Browse Source

优化功能细节

wzh 2 years atrás
parent
commit
32cf882c09
3 changed files with 68 additions and 32 deletions
  1. 41 15
      pages/bluetooth/index/index.vue
  2. 17 7
      pages/device/detail.vue
  3. 10 10
      pages/work/index.vue

+ 41 - 15
pages/bluetooth/index/index.vue

@@ -71,18 +71,6 @@
           ></u--input>
         </u-form-item>
 
-        <u-form-item
-            label="设备编号:"
-            borderBottom
-            ref="item1"
-            labelWidth="auto"
-        >
-          <u--input
-              v-model="deviceno"
-              border="none"
-          ></u--input>
-        </u-form-item>
-
 
         <u-form-item
             label="二维码ID:"
@@ -96,15 +84,15 @@
           ></u--input>
         </u-form-item>
 
-
         <u-form-item
-            label="产品ID:"
+            @click="showProductList = true"
+            label="产品类型:"
             borderBottom
             ref="item1"
             labelWidth="auto"
         >
           <u--input
-              v-model="productId"
+              v-model="productName"
               border="none"
           ></u--input>
         </u-form-item>
@@ -117,6 +105,9 @@
 
     </view>
     <u-picker @cancel="showWiftList=false" @confirm="chooseWifi"  :show="showWiftList" :columns="wifiList"></u-picker>
+
+    <u-picker @cancel="showProductList=false" keyName="text" @confirm="chooseProduct"  :show="showProductList" :columns="chooseProductList"></u-picker>
+
   </view>
   </view>
 </template>
@@ -137,6 +128,7 @@ import i18 from '@/utils/i18.js'
 	export default {
     data() {
 			return {
+        showProductList:false,
         showPwd:false,
         rightPwd:"",
         pwd:"",
@@ -152,11 +144,22 @@ import i18 from '@/utils/i18.js'
         showSendData:false,
         sendData:"",
         qrcodeid:"",
+        productName:"",
         deviceno:"",
         SSID:"",
         password:"",
         showWiftList:false,
         productId:56,
+        chooseProductList:[[      {
+          id:56,text:"3"
+        },
+          {
+            id:56,text:"4"
+          },
+          {
+            id:57,text:"5"
+          }
+          ]],
         wifiList: [
           []
         ],
@@ -167,6 +170,7 @@ import i18 from '@/utils/i18.js'
       uni.setNavigationBarTitle({
         title: "蓝牙配网"
       })
+      this.deviceno  = this.generateTimestamp();
       ecUI.showLoading("正在初始化蓝牙模块")
 			ctx = this
       clearInterval(this.timer);
@@ -174,6 +178,7 @@ import i18 from '@/utils/i18.js'
         ctx.deviceListDataShow = JSON.parse(JSON.stringify(deviceListData))
       }, 800)
       console.log(this.commonCode)
+      this.productName = this.chooseProductList[0][0].text;
 		},
     onUnload(){
       ecBLE.stopBluetoothDevicesDiscovery();
@@ -188,6 +193,27 @@ import i18 from '@/utils/i18.js'
 			}, 100)
 		},
 		methods: {
+      chooseProduct(e){
+        this.productId = e.value[0].id;
+        this.productName = e.value[0].text;
+        this.showProductList= false;
+      },
+      generateTimestamp() {
+  const date = new Date();
+  const year = date.getFullYear().toString().substr(2);
+  const month = date.getMonth() + 1;
+  const day = date.getDate();
+  const hours = date.getHours();
+  const minutes = date.getMinutes();
+
+  // 生成6位随机数字
+  const randomNum = Math.floor(Math.random() * 900000) + 100000;
+
+  // 将数字拼接成字符串
+  const timestamp = `${year}${month < 10 ? '0' + month : month}${day < 10 ? '0' + day : day}${hours}${minutes < 10 ? '0' + minutes : minutes}${randomNum}`;
+
+  return timestamp;
+},
       getAuth(){
         wx.getSetting({
           success(res) {

+ 17 - 7
pages/device/detail.vue

@@ -351,14 +351,14 @@
       </view>
     </u-popup>
 
-    <u-popup :show="deviceInfo.status != 3"  mode="center"  >
-        <view style="
-        margin:2%;padding:10%; /* 背景色 */color: #000; padding: 10px; /* 内边距 */border-radius: 5px; /* 圆角 */font-size: 16px; /* 文字大小 */text-align: center; /* 文字居中 */  ">
-         <view style="width: 100px;margin-top:40rpx;">设备未在线</view>
-          <view>无法操作</view>
-        </view>
+<!--    <u-popup :show="!onlineStatus"  mode="center" :closeOnClickOverlay="true" :closeable="true" @close="onlineStatus=false">-->
+<!--        <view style="-->
+<!--        margin:2%;padding:10%; /* 背景色 */color: #000; padding: 10px; /* 内边距 */border-radius: 5px; /* 圆角 */font-size: 16px; /* 文字大小 */text-align: center; /* 文字居中 */  ">-->
+<!--         <view style="width: 100px;margin-top:40rpx;">设备未在线</view>-->
+<!--          <view>无法操作</view>-->
+<!--        </view>-->
 
-    </u-popup>
+<!--    </u-popup>-->
 
     <u-popup :show="planPopDlg" @close="closePlanPop" mode="center"  :closeable="true">
       <view style="position: relative;width: 400rpx;background: none;padding:40rpx;">
@@ -627,6 +627,7 @@ import config from '@/config'
 export default {
   data(){
     return {
+      onlineStatus:false,
       modeList:[[
         {id:1,text:"微压循环"},
         {id:2,text:"常温二煎的一煎"},
@@ -1910,6 +1911,15 @@ export default {
 
         self.deviceInfo = res.data;
         self.deviceType = res.data.type;
+        self.onlineStatus = self.deviceInfo == 3?true:false;
+        if(!self.onlineStatus){
+          uni.showModal({
+            title: '系统提示',
+            content: "设备未在线,无法操作",
+            confirmText: '确定',
+            showCancel:false,
+          })
+        }
         console.log("当前设备类型:"+JSON.stringify(self.deviceInfo.type))
         self.location = {
           latitude: self.deviceInfo.latitude,

+ 10 - 10
pages/work/index.vue

@@ -73,15 +73,15 @@
       </view>
 
 
-      <view class="grid-item-box" v-if="hasRole(['admin'])" @click="goPage('scan')"  style="background-image: url('https://jianyaoji.oss-cn-hangzhou.aliyuncs.com/jianyaoji/images/icons/bg.png');background-size: 100% 100%">
-        <view class="grid-image">
-          <u-image :showLoading="true" src="/static/images/icons/bind.png" width="80rpx" height="80rpx" ></u-image>
-        </view>
-        <view class="grid-text">
-          <view class="top">绑码激活</view>
-          <view class="bottom">Bind Code Activation</view>
-        </view>
-      </view>
+<!--      <view class="grid-item-box" v-if="hasRole(['admin'])" @click="goPage('scan')"  style="background-image: url('https://jianyaoji.oss-cn-hangzhou.aliyuncs.com/jianyaoji/images/icons/bg.png');background-size: 100% 100%">-->
+<!--        <view class="grid-image">-->
+<!--          <u-image :showLoading="true" src="/static/images/icons/bind.png" width="80rpx" height="80rpx" ></u-image>-->
+<!--        </view>-->
+<!--        <view class="grid-text">-->
+<!--          <view class="top">绑码激活</view>-->
+<!--          <view class="bottom">Bind Code Activation</view>-->
+<!--        </view>-->
+<!--      </view>-->
 
 
 
@@ -119,7 +119,7 @@
       </view>
 
 
-      <view class="grid-item-box" @click="goPage('time')"  style="background-image: url('https://jianyaoji.oss-cn-hangzhou.aliyuncs.com/jianyaoji/images/icons/bg.png');background-size: 100% 100%">
+      <view class="grid-item-box" v-if="hasRole(['admin']) || isCompanyUser()" @click="goPage('time')"  style="background-image: url('https://jianyaoji.oss-cn-hangzhou.aliyuncs.com/jianyaoji/images/icons/bg.png');background-size: 100% 100%">
         <view class="grid-image">
           <u-image :showLoading="true" src="/static/images/icons/rank.png" width="80rpx" height="80rpx" ></u-image>
         </view>