index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <template>
  2. <view class="content">
  3. <!-- <view class="banner">
  4. <uni-swiper-dot class="uni-swiper-dot-box" :info="data" :current="current" field="content">
  5. <swiper class="swiper-box" :current="swiperDotIndex" @change="changeSwiper">
  6. <swiper-item v-for="(item, index) in data" :key="index">
  7. <view class="swiper-item" @click="clickBannerItem(item)">
  8. <image :src="imgUrl+item.image" mode="aspectFill" :draggable="false" />
  9. </view>
  10. </swiper-item>
  11. </swiper>
  12. </uni-swiper-dot>
  13. </view> -->
  14. <view style="height: 10vh;text-align: center;">
  15. <image style="height: 3vh;width: 15vh;margin-top: 5vh;"
  16. src="../static/images/new/starts/login/backImg2.png"></image>
  17. </view>
  18. <view style="text-align: center;top:12vh;position: relative;color: aliceblue;">
  19. <view style="font-size: 30rpx;">Please choose from the below options:</view>
  20. <view style="font-size: 20rpx;">Charge up quickly & easily to enjoy a smarter life!</view>
  21. </view>
  22. <view
  23. style="margin:0 5vw;left:0px;right:0px;text-align: center;top:45vh;position: absolute;display: flex;flex-direction: rows;justify-content: space-evenly;">
  24. <!-- <view style="color:white;width:80px;">
  25. 设备编号
  26. </view> -->
  27. <view style="text-align: center;">
  28. <view class="blue" @click="buleTeeth()">
  29. <image src="../static/images/new/starts/index/blue.png" style="width: 60px;height: 60px;margin-top: 2vh;"></image>
  30. </view>
  31. <view class="" @click="scan">
  32. <image src="../static/images/new/starts/index/scan.png" style="width: 60px;height: 60px;margin-top: 2vh;"
  33. ></image>
  34. </view>
  35. <!-- <view class="" @click="scan">
  36. <image src="../static/images/new/starts/index/bind.png" style="width: 60px;height: 60px;margin-top: 2vh;"
  37. ></image>
  38. </view> -->
  39. <!-- <u--input v-model="sn" placeholder="请输入设备编号" color="white"
  40. style="width: 10vw;padding-left:10px;background: rgb(90, 88, 115);text-align: left;font-size: 20px;width:90vw;border-radius: 100vh;height: 40px;">
  41. <u-button slot="suffix" @click="binddevice"
  42. style="background: #505086;color:white;border-radius: 100vh;width: 120px;margin-right: -10px;">绑 定</u-button>
  43. </u--input> -->
  44. </view>
  45. <view style="position:fixed;bottom:10px;display: flex;align-items: center;justify-content: center;">
  46. <view @click="skip(0)" style="margin:0px 10px;">
  47. <image src="@/static/images/new/starts/tabbar/one_on.png"
  48. style="width: 60px;height: 60px;margin: 2vh 0.2vh;"></image>
  49. </view>
  50. <view @click="skip(1)" style="margin:0px 10px;">
  51. <image src="@/static/images/new/starts/tabbar/two_off.png"
  52. style="width: 60px;height: 60px;margin: 2vh 0.2vh;"></image>
  53. </view>
  54. <view @click="skip(2)" style="margin:0px 10px;">
  55. <image src="@/static/images/new/starts/tabbar/three_off.png"
  56. style="width: 60px;height: 60px;margin: 2vh 0.2vh;"></image>
  57. </view>
  58. </view>
  59. </view>
  60. <!-- <view class="container">
  61. <view class="item" @click="buleTeeth">
  62. <image :src = "imgUrl+'/index/bluetooth.png'"/>
  63. <view class="item-text">{{i18('蓝牙连接')}}</view>
  64. </view>
  65. <view class="item" @click="scan">
  66. <image :src = "imgUrl+'/index/scan.png'"/>
  67. <view class="item-text">{{i18('扫码绑定')}}</view>
  68. </view>
  69. <view class="item" @click="devicelist">
  70. <image :src = "imgUrl+'/index/device-2.png'"/>
  71. <view class="item-text">{{i18('设备列表')}}</view>
  72. </view>
  73. <view class="item" @click="wifi">
  74. <image :src = "imgUrl+'/index/bluetooth.png'"/>
  75. <view class="item-text">{{i18('WIFI配网')}}</view>
  76. </view>
  77. </view> -->
  78. </view>
  79. </template>
  80. <script>
  81. import {
  82. getDeviceInfoFromQrcode,
  83. bindDevice
  84. } from '@/api/device/device.js'
  85. import i18 from '@/utils/i18.js'
  86. export default {
  87. data: function() {
  88. return {
  89. current: 0,
  90. swiperDotIndex: 0,
  91. data: [{
  92. image: '/index/banner-index.png'
  93. }]
  94. }
  95. },
  96. computed: {
  97. imgUrl() {
  98. return getApp().globalData.config.imgUrl;
  99. }
  100. },
  101. onLoad: function() {},
  102. onShow() {
  103. uni.setNavigationBarTitle({
  104. title: this.$t('page.worktai')
  105. })
  106. },
  107. methods: {
  108. skip(type){
  109. if(type==0){
  110. uni.reLaunch({
  111. url:'/pages/index'
  112. })
  113. }else if(type==1){
  114. uni.reLaunch({
  115. url:'/pages/weitiandi/deviceList'
  116. })
  117. }else if(type==2){
  118. uni.reLaunch({
  119. url:'/pages/mine/index'
  120. })
  121. }
  122. },
  123. devicelist() {
  124. uni.navigateTo({
  125. url: '/pages/weitiandi/deviceList'
  126. });
  127. },
  128. i18(text) {
  129. return i18(text)
  130. },
  131. buleTeeth() {
  132. uni.navigateTo({
  133. url: '/pages/bluetooth/index/index'
  134. });
  135. },
  136. wifi() {
  137. uni.navigateTo({
  138. url: '/pages/bluetooth/index/wifi'
  139. });
  140. },
  141. toBind(qrcode) {
  142. bindDevice(qrcode).then(res => {
  143. let data = res.data;
  144. if (data != null) {
  145. let imei = res.data.imei;
  146. let ccid = res.data.ccid;
  147. let qrcode = res.data.qrcode;
  148. let uuid = res.data.uuid;
  149. this.$modal.showToast("绑定成功");
  150. } else {
  151. this.$modal.showToast("绑定失败");
  152. }
  153. })
  154. },
  155. scan() {
  156. let self = this;
  157. uni.scanCode({
  158. success: function(res) {
  159. console.log('条码类型:' + res.scanType);
  160. console.log('条码内容:' + res.result);
  161. getDeviceInfoFromQrcode(res.result).then(res => {
  162. if (res.data != null) {
  163. let imei = res.data.imei;
  164. let ccid = res.data.ccid;
  165. let qrcode = res.data.qrcode;
  166. let uuid = res.data.userId;
  167. if (uuid) {
  168. self.$modal.showToast("该设备已被绑定");
  169. } else {
  170. self.$modal.confirm("确认绑定该设备?").then(res => {
  171. self.toBind(qrcode)
  172. })
  173. }
  174. // uni.navigateTo({
  175. // url: '/pages/weitiandi/device/status?qrcode='+qrcode+'&id='+imei+'&ccid='+ccid
  176. // });
  177. } else {
  178. self.$modal.showToast("找不到设备,请联系管理员");
  179. }
  180. });
  181. }
  182. });
  183. },
  184. scan2() {
  185. let self = this;
  186. getDeviceInfoFromQrcode("http://wetiandi.com/index.php?do=wepay&sn=GD1B388803").then(res => {
  187. if (res.data != null) {
  188. let imei = res.data.imei;
  189. let ccid = res.data.ccid;
  190. let qrcode = res.data.qrcode;
  191. let uuid = res.data.userId;
  192. if (uuid) {
  193. self.$modal.showToast("该设备已被绑定");
  194. } else {
  195. self.$modal.confirm("确认绑定该设备?").then(res => {
  196. self.toBind(qrcode)
  197. })
  198. }
  199. // uni.navigateTo({
  200. // url: '/pages/weitiandi/device/status?qrcode='+qrcode+'&id='+imei+'&ccid='+ccid
  201. // });
  202. } else {
  203. self.$modal.showToast("找不到设备,请联系管理员");
  204. }
  205. });
  206. }
  207. }
  208. }
  209. </script>
  210. <style>
  211. .content {
  212. background-image: url('../static/images/new/starts/bg1.jpg');
  213. background-size: cover;
  214. background-repeat: no-repeat;
  215. inset: 0;
  216. position: absolute;
  217. }
  218. .swiper {
  219. height: 22vh;
  220. }
  221. .banner {
  222. height: 22vh;
  223. width: 100%;
  224. margin-top: 1vh
  225. }
  226. .swiper-box {
  227. height: 22vh;
  228. }
  229. .swiper-item {
  230. /* #ifndef APP-NVUE */
  231. display: flex;
  232. /* #endif */
  233. flex-direction: column;
  234. justify-content: center;
  235. align-items: center;
  236. color: #fff;
  237. height: 300rpx;
  238. line-height: 300rpx;
  239. }
  240. @media screen and (min-width: 500px) {
  241. .uni-swiper-dot-box {
  242. width: 400px;
  243. /* #ifndef APP-NVUE */
  244. margin: 0 auto;
  245. /* #endif */
  246. margin-top: 8px;
  247. }
  248. .image {
  249. width: 100%;
  250. }
  251. }
  252. .item {
  253. display: inline-block;
  254. width: 50%;
  255. position: relative;
  256. }
  257. .item image {
  258. height: 12vh;
  259. }
  260. .item-text {
  261. position: absolute;
  262. top: 30px;
  263. left: 50%;
  264. }
  265. </style>