Browse Source

feat(bluetooth): 重构蓝牙设备页面并新增设备状态组件

- 移除旧的 device.vue 页面及其相关逻辑
- 新增 DeviceStatusInfo.vue 组件用于展示设备运行模式和故障状态
- 重构 index.vue 页面,引入 BluetoothHeader 和 DeviceStatusInfo 组件
- 优化蓝牙连接和数据读取逻辑,增加异步处理和超时机制
- 移除旧的头部样式,使用组件化方式管理页面元素
- 新增批量连接处理功能,支持多个设备自动配网
- 完善蓝牙状态监听和地址读取流程
- 移除旧的 indexOne.vue 页面及相关配网逻辑
- 添加设备列表排序功能,按信号强度排列
- 优化蓝牙连接状态管理和错误处理机制
mws 1 month ago
parent
commit
8e7592334e

+ 0 - 282
pages/bluetooth/device/device.vue

@@ -1,282 +0,0 @@
-<template>
-	<view class="device-container">
-		<text class="title-rev">数据接收 : </text>
-		<button class="bt-clear" type="primary" @click="btClearTap" hover-start-time="0">清空</button>
-		<checkbox-group @change="checkScroll" class="checkbox-scroll">
-			<checkbox checked="true"></checkbox>
-			<text>滚动</text>
-		</checkbox-group>
-
-
-
-		<view class="view-bt-send">
-			<button class="bt-send" type="primary" @click="btSendTap" hover-start-time="0">发送</button>
-		</view>
-	</view>
-</template>
-
-<script>
-	// #ifdef APP
-	import ecUI from '@/utils/ecUI.js'
-	import ecBLE from '@/utils/ecBLE/ecBLE.js'
-	// #endif   
-	// #ifdef MP
-	const ecUI = require('@/utils/ecUI.js')
-	const ecBLE = require('@/utils/ecBLE/ecBLE.js')
-	// #endif
-	let ctx
-	let isCheckScroll = true
-	let isCheckRevHex = false
-	let isCheckSendHex = false
-	let sendData = ''
-	export default {
-		data() {
-			return {
-				textRevData: '',
-				scrollIntoView: 'scroll-view-bottom',
-			}
-		},
-		onLoad() {
-			ctx = this
-			isCheckScroll = true
-			isCheckRevHex = false
-			isCheckSendHex = false
-			sendData = ''
-
-			//on disconnect
-			ecBLE.onBLEConnectionStateChange(() => {
-				ecUI.showModal('提示', '设备断开连接')
-			})
-			//receive data
-			ecBLE.onBLECharacteristicValueChange((str, strHex) => {
-				let data =
-					ctx.textRevData +
-					'[' +
-					ctx.dateFormat('hh:mm:ss,S', new Date()) +
-					']: ' +
-					(isCheckRevHex ? strHex.replace(/[0-9a-fA-F]{2}/g, ' $&') : str) +
-					'\r\n'
-				// console.log(data)
-				ctx.textRevData = data
-				if (isCheckScroll) {
-					if (ctx.scrollIntoView === "scroll-view-bottom") {
-						ctx.scrollIntoView = "scroll-view-bottom2"
-					} else {
-						ctx.scrollIntoView = "scroll-view-bottom"
-					}
-				}
-			})
-		},
-		onUnload() {
-			ecBLE.onBLEConnectionStateChange(() => {})
-			ecBLE.onBLECharacteristicValueChange(() => {})
-			ecBLE.closeBLEConnection()
-		},
-		methods: {
-			checkScroll(e) {
-				if (e.detail.value.length) isCheckScroll = true
-				else isCheckScroll = false
-			},
-			checkRevHex(e) {
-				if (e.detail.value.length) isCheckRevHex = true
-				else isCheckRevHex = false
-			},
-			checkSendHex(e) {
-				if (e.detail.value.length) isCheckSendHex = true
-				else isCheckSendHex = false
-			},
-			inputSendData(e) {
-				sendData = e.detail.value
-			},
-			btClearTap() {
-				ctx.textRevData = ''
-			},
-			btSendTap() {
-				if (isCheckSendHex) {
-					let data = sendData
-						.replace(/\s*/g, '')
-						.replace(/\n/g, '')
-						.replace(/\r/g, '')
-					if (data.length === 0) {
-						ecUI.showModal('提示', '请输入要发送的数据')
-						return
-					}
-					if (data.length % 2 != 0) {
-						ecUI.showModal('提示', '数据长度只能是双数')
-						return
-					}
-					if (data.length > 488) {
-						ecUI.showModal('提示', '最多只能发送244字节')
-						return
-					}
-					if (!new RegExp('^[0-9a-fA-F]*$').test(data)) {
-						ecUI.showModal('提示', '数据格式错误,只能是0-9,a-f,A-F')
-						return
-					}
-					ecBLE.writeBLECharacteristicValue(data, true)
-				} else {
-					if (sendData.length === 0) {
-						ecUI.showModal('提示', '请输入要发送的数据')
-						return
-					}
-					let tempSendData = sendData.replace(/\n/g, '\r\n')
-					if (tempSendData.length > 244) {
-						ecUI.showModal('提示', '最多只能发送244字节')
-						return
-					}
-					ecBLE.writeBLECharacteristicValue(tempSendData, false)
-				}
-			},
-			dateFormat(fmt, date) {
-				var o = {
-					'M+': date.getMonth() + 1, //月份
-					'd+': date.getDate(), //日
-					'h+': date.getHours(), //小时
-					'm+': date.getMinutes(), //分
-					's+': date.getSeconds(), //秒
-					'q+': Math.floor((date.getMonth() + 3) / 3), //季度
-					S: date.getMilliseconds(), //毫秒
-				}
-				if (/(y+)/.test(fmt))
-					fmt = fmt.replace(
-						RegExp.$1,
-						(date.getFullYear() + '').substr(4 - RegExp.$1.length)
-					)
-				for (var k in o)
-					if (new RegExp('(' + k + ')').test(fmt)) {
-						// console.log(RegExp.$1.length)
-						// console.log(o[k])
-						fmt = fmt.replace(
-							RegExp.$1,
-							RegExp.$1.length == 1 ?
-							(o[k] + '').padStart(3, '0') :
-							('00' + o[k]).substr(('' + o[k]).length)
-						)
-					}
-				return fmt
-			},
-		}
-	}
-</script>
-
-<style>
-	.device-container {
-		height: 100vh;
-		position: relative;
-	}
-
-	.title-rev {
-		position: absolute;
-		top: 0px;
-		left: 20px;
-		line-height: 45px;
-		font-size: 17px;
-	}
-
-	.bt-clear {
-		position: absolute;
-		top: 8px;
-		right: 165px;
-		width: 55px !important;
-		height: 29px;
-		font-size: 14px;
-		display: flex;
-		justify-content: center;
-		align-items: center;
-		padding: 0;
-	}
-
-	.checkbox-scroll {
-		position: absolute;
-		top: 0;
-		right: 90px;
-		height: 45px;
-		font-size: 15px;
-		display: flex;
-		align-items: center;
-	}
-
-	.checkbox-rev-hex {
-		position: absolute;
-		top: 0px;
-		right: 20px;
-		height: 45px;
-		font-size: 15px;
-		display: flex;
-		align-items: center;
-	}
-
-	.scroll-view-container {
-		position: absolute;
-		top: 45px;
-		left: 20px;
-		right: 20px;
-		padding: 0 3px 0 5px;
-		background-color: #E5E5E5;
-	}
-
-	.scroll-view-rev {
-		height: 150px;
-		background-color: #E5E5E5;
-	}
-
-	.view-rev-gap {
-		height: 5px;
-	}
-
-	.text-rev {
-		font-size: 14px;
-		word-break: break-all;
-		font-family: Monospace;
-	}
-
-	.title-send {
-		position: absolute;
-		top: 200px;
-		left: 20px;
-		font-size: 17px;
-		line-height: 45px;
-	}
-
-	.checkbox-send-hex {
-		position: absolute;
-		top: 200px;
-		right: 20px;
-		height: 45px;
-		font-size: 15px;
-		display: flex;
-		align-items: center;
-	}
-
-	.view-input-send {
-		position: absolute;
-		top: 245px;
-		left: 20px;
-		right: 20px;
-		padding: 2px 3px;
-		background-color: #E5E5E5;
-		overflow-x: hidden;
-	}
-
-	.input-send {
-		height: 84px;
-		width: 100%;
-		background-color: #E5E5E5;
-	}
-
-	.view-bt-send {
-		position: absolute;
-		top: 370px;
-		left: 20px;
-		right: 20px;
-		display: flex;
-	}
-
-	.bt-send {
-		flex: 1;
-		height: 45px;
-		display: flex;
-		justify-content: center;
-		align-items: center;
-	}
-</style>

+ 166 - 88
pages/bluetooth/index/index.vue

@@ -2,22 +2,9 @@
   <view class="container">
 
     <!-- 头部区域 -->
-    <view class="header">
-      <u-row>
-        <u-col span="2">
-          <view class="status-btn" :class="{ active_btn: communicationLink_one }">Link</view>
-        </u-col>
-        <u-col span="2">
-          <view class="status-btn" :class="{ active_btn: bleConnected }">blue</view>
-        </u-col>
-        <u-col span="6" textAlign="left">
-          <text class="title">长沙亿旭智能</text>
-        </u-col>
-        <u-col span="2">
-
-        </u-col>
-      </u-row>
-    </view>
+    <BluetoothHeader
+        @ble-data-received="handleBleDataReceived"
+    />
 
     <!-- 主要内容区域 -->
     <view class="main-content">
@@ -84,19 +71,27 @@
         </u-row>
 
       </view>
+      <DeviceStatusInfo/>
     </view>
 
   </view>
 </template>
 
 <script>
-import {ecBLE,ecUI,initBLE,writeRegister,startHeartbeat,stopHeartbeat,setGlobalSlaveAddress,getGlobalSlaveAddress} from '@/utils/modbus.js';
+import BluetoothHeader from '@/pages/components/header.vue';
+import DeviceStatusInfo from '@/pages/components/DeviceStatusInfo.vue';
+import {ecBLE,ecUI,initBLE,writeRegister,startHeartbeat,stopHeartbeat,setGlobalSlaveAddress,getGlobalSlaveAddress,setAgreement,getConnected} from '@/utils/modbus.js';
 import i18 from '@/utils/i18.js';
 let deviceListData = [];
 let ctx;
 export default {
+  components: {
+    BluetoothHeader,
+    DeviceStatusInfo
+  },
   data() {
     return {
+      step:"",
       editStatus: false,
       selectedDeviceId: null, //选中的设备
       timer: "",  //设备列表数据定时刷新
@@ -122,35 +117,6 @@ export default {
     }
 
   },
-  computed: {
-    bleConnected() {
-      return this.$store.getters['ble/connected']
-    },
-    bleData() {
-      return this.$store.getters['ble/data']
-    }
-  },
-  watch: {
-    bleData: {
-      handler(newData, oldData) {
-        if (newData) {
-          console.log('接收到蓝牙数据:------------------')
-          // 清除之前的定时器
-          if (this.communicationTimer) {
-            console.log('清除之前的定时器');
-            clearTimeout(this.communicationTimer)
-            this.communicationTimer = null
-          }
-          // 设置通信链接状态为 true
-          this.communicationLink_one = true
-          this.updateSensorData(newData)
-
-        }
-      },
-      deep: true, // 深度监听,确保嵌套对象变化时也能触发
-      immediate: true // 立即执行一次
-    }
-  },
   onLoad() {
     uni.setNavigationBarTitle({
       title: "蓝牙配网"
@@ -159,6 +125,8 @@ export default {
     ctx = this;
     clearInterval(this.timer);
     this.timer = setInterval(() => {
+      // 在添加或更新设备后对数组进行排序
+      deviceListData.sort((a, b) => b.rssi - a.rssi);
       ctx.deviceListDataShow = JSON.parse(JSON.stringify(deviceListData))
     }, 800)
     initBLE();
@@ -177,8 +145,36 @@ export default {
     }, 100)
   },
   methods: {
-    readAddress(){
-      writeRegister("GET_ADDRESS", null);
+    // 处理从子组件传递过来的蓝牙数据
+    handleBleDataReceived(data) {
+      console.log('在父组件中接收到蓝牙数据:', data);
+      this.updateSensorData(data);
+    },
+    agreementTypeSelect(e){
+      this.agreementTypeName =  e.name;
+      setAgreement(this.agreementTypeName);
+    },
+    async readAddress(){
+      try {
+        // 发送读取地址指令
+        writeRegister("GET_ADDRESS", null);
+
+        // 等待地址响应,最多3秒
+        const data = await this.waitForAddressResponse(3000);
+        console.log('接收到的数据地址:', data.Addres_23);
+        this.deviceAddress = data.Addres_23;
+
+        // 如果有地址则更新通讯地址
+        if (this.deviceAddress != null && this.deviceAddress != '') {
+          this.updataAddress();
+        }
+
+        return data;
+      } catch (error) {
+        console.error('读取地址失败:', error);
+        this.$modal.showToast("读取地址超时");
+        throw error;
+      }
     },
     closeBlue(){
       ecUI.showLoading("正在断开并重新扫描");
@@ -193,14 +189,9 @@ export default {
         ecUI.hideLoading();
       }, 2000);
     },
-    updateSensorData(data) {
+    updateSensorData(data){
       console.log('接收到的数据地址:', data.Addres_23);
       this.deviceAddress = data.Addres_23;
-      this.communicationTimer = setTimeout(() => {
-        console.log('通信链接已结束')
-        this.communicationLink_one = false
-        this.communicationTimer = null
-      }, 5000)
     },
     updataAddress(){
       if (this.deviceAddress == null || this.deviceAddress == '') {
@@ -223,16 +214,16 @@ export default {
       }, 2000);
 
     },
-    i18(text) {
+    i18(text){
       return text;
     },
     $t(title) {
       return title;
     },
-    selectblue(id) {  //选中需要连接的蓝牙
+    selectblue(id){  //选中需要连接的蓝牙
       this.selectedDeviceId = id;
     },
-    listViewTap() {   //连接蓝牙
+    listViewTap(){   //连接蓝牙
       const id = this.selectedDeviceId;
       // 校验设备ID
       if (!id) {
@@ -252,7 +243,7 @@ export default {
     },
     // 超时处理函数
     handleConnectionTimeout() {
-      this.connected = this.bleConnected;
+      this.connected = getConnected();
       ecUI.hideLoading();
       if (!this.connected) {
         this.$modal.showToast(i18('连接失败'));
@@ -309,6 +300,123 @@ export default {
       })
       ecBLE.startBluetoothDevicesDiscovery()
     },
+    async autoLinkList() {
+      // 获取前五个设备进行配网通讯
+      for (let i = 0; i < Math.min(5, this.deviceListDataShow.length); i++) {
+        const device = this.deviceListDataShow[i];
+
+        try {
+          this.step = `正在处理设备 ${i+1}/${Math.min(5, this.deviceListDataShow.length)}: 断开当前连接`;
+          if (getConnected()){
+            // 断开蓝牙
+            ecBLE.closeBLEConnection();
+            // 等待断开连接(等待connected为false)
+            const isDisconnected = await this.waitForBluetoothState(false, 2000);
+            if (!isDisconnected) {
+              this.step = `设备 ${device.name} 断开连接失败,跳过该设备`;
+              continue;
+            }
+          }
+
+          // 连接蓝牙
+          this.step = `正在连接设备: ${device.name}`;
+          ecUI.showLoading(`正在连接 ${device.name}`);
+
+          // 建立连接
+          ecBLE.createBLEConnection(device.id);
+
+          // 等待连接建立(等待connected为true)
+          const isConnected = await this.waitForBluetoothState(true, 5000);
+
+          if (isConnected) {
+            this.step = `连接成功,正在读取设备地址信息`;
+            // 获取设备地址并等待响应
+            try {
+              const addressData = await this.readAddress();
+              this.step = `设备地址读取成功: ${this.deviceAddress}`;
+
+              // 进行其他通讯操作
+              // ...
+
+              this.step = `设备 ${device.name} 处理完成`;
+            } catch (error) {
+              console.error('读取设备地址失败:', error);
+              this.step = `读取设备 ${device.name} 地址失败,跳过该设备`;
+            }
+          } else {
+            this.step = `连接 ${device.name} 失败,跳过该设备`;
+          }
+
+          ecUI.hideLoading();
+
+          // 设备间间隔1秒
+          await this.sleep(1000);
+
+        } catch (error) {
+          console.error(`处理设备 ${device.name} 时出错:`, error);
+          this.step = `处理设备 ${device.name} 出错,跳过`;
+          await this.sleep(1000);
+        }
+      }
+
+      this.step = "批量连接处理已完成";
+    },
+   // 通用的等待状态方法
+    waitForBluetoothState(targetState, timeout = 2000, interval = 200) {
+      return new Promise((resolve) => {
+        const startTime = Date.now();
+
+        const checkState = () => {
+          const currentState = getConnected();
+          const isTargetState = currentState === targetState;
+
+          // 如果达到目标状态或者超时,则resolve
+          if (isTargetState || (Date.now() - startTime) >= timeout) {
+            resolve(isTargetState);
+          } else {
+            // 继续检查
+            setTimeout(checkState, interval);
+          }
+        };
+
+        checkState();
+      });
+    },
+    // 延时方法
+    sleep(ms) {
+      return new Promise(resolve => setTimeout(resolve, ms));
+    },
+    waitForAddressResponse(timeout = 3000) {
+      return new Promise((resolve, reject) => {
+        // 保存原始的 handleBleDataReceived 方法
+        const originalHandler = this.handleBleDataReceived;
+        let timeoutId;
+
+        // 创建新的处理函数
+        const newHandler = (data) => {
+          // 检查是否包含地址数据
+          if (data && data.Addres_23 !== undefined) {
+            clearTimeout(timeoutId);
+            // 恢复原始处理函数
+            this.handleBleDataReceived = originalHandler;
+            resolve(data);
+          } else {
+            // 如果不是地址数据,调用原始处理函数
+            originalHandler.call(this, data);
+          }
+        };
+
+        // 替换处理函数
+        this.handleBleDataReceived = newHandler;
+
+        // 设置超时
+        timeoutId = setTimeout(() => {
+          this.handleBleDataReceived = originalHandler;
+          reject(new Error('等待地址响应超时'));
+        }, timeout);
+      });
+    },
+
 
   }
 }
@@ -323,36 +431,6 @@ export default {
 }
 
 
-// 头部样式
-.header {
-  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-  padding: 20rpx;
-
-  .status-btn {
-    background-color: #ff4757;
-    border: none;
-    margin-left: 0px;
-    padding: 0px;
-    width: 40px;
-    text-align: center;
-    color: white;
-    border-radius: 4px;
-    height: 20px;
-    line-height: 20px;
-  }
-  .active_btn {
-    background-color: yellowgreen !important;
-  }
-
-
-
-  .title {
-    color: #fff;
-    font-size: 36rpx;
-    font-weight: bold;
-  }
-}
-
 // 主要内容区域
 .main-content {
   flex: 1;

+ 0 - 780
pages/bluetooth/indexOne/index.vue

@@ -1,780 +0,0 @@
-<template>
-  <view style="height: 100vh">
-	<view v-if="!connected">
-    <scroll-view class="main-container" scroll-y="true"
-                 :refresher-enabled="false">
-      <view v-for="(item, index) in deviceListDataShow" :key="item.id" class="list-item" hover-class="list-item-hover"
-            hover-start-time="0" hover-stay-time="100" @click="listViewTap(item.id)">
-        <image v-if="item.manufacturer==='eciot'" src="/static/img/ecble.png" class="list-item-img"></image>
-        <image v-else src="/static/img/ble.png" class="list-item-img"></image>
-        <text class="list-item-name">{{item.name}}</text>
-        <image v-if="item.rssi >= -41" src="/static/img/s5.png" mode="aspectFit" class="list-item-rssi-img"></image>
-        <image v-else-if="item.rssi >= -55" src="/static/img/s4.png" mode="aspectFit" class="list-item-rssi-img"></image>
-        <image v-else-if="item.rssi >= -65" src="/static/img/s3.png" mode="aspectFit" class="list-item-rssi-img"></image>
-        <image v-else-if="item.rssi >= -75" src="/static/img/s2.png" mode="aspectFit" class="list-item-rssi-img"></image>
-        <image v-else="item.rssi < -75" src="/static/img/s1.png" mode="aspectFit" class="list-item-rssi-img"></image>
-        <text class="list-item-rssi">{{item.rssi}}</text>
-        <view class="list-item-line"></view>
-      </view>
-      <u-popup :show="showSendData"  >
-        <view class="slot-content">
-          <view>
-            <u--input
-                :placeholder="i18('请输入值')"
-                border="surround"
-                v-model="sendData"
-            ></u--input>
-          </view>
-          <view style="margin:10px;text-decoration: underline;margin-bottom: 0px" @click="sendLanyaData">
-            <u-button>发送</u-button>
-          </view>
-        </view>
-      </u-popup>
-      <view v-if="deviceListDataShow.length==0" class="notice"> - {{ $t('buletooth.nodevice') }} -</view>
-      <view class="gap"></view>
-    </scroll-view>
-  </view>
-
-  <view v-if="connected">
-    <view class="text-area">
-      <u--form  v-if="isCompanyUser()" style="width: 100%;"
-               labelPosition="left"
-               ref="uForm"
-      >
-        <u-form-item
-            label="WIFI名称:"
-            borderBottom
-            labelWidth="auto"
-            @click="openChooseWifi"
-            ref="item1"
-        >
-          <u--input
-              v-model="SSID"
-              disabled
-              disabledColor="#ffffff"
-              placeholder="请选择wifi:"
-              border="none"
-          ></u--input>
-          <u-icon
-              slot="right"
-              name="arrow-right"
-          ></u-icon>
-        </u-form-item>
-        <u-form-item
-            label="密码:"
-            borderBottom
-            ref="item1"
-        >
-          <u--input
-              v-model="password"
-              border="none"
-          ></u--input>
-        </u-form-item>
-
-      </u--form>
-      <u--form  v-else style="width: 100%;"
-                labelPosition="left"
-                ref="uForm"
-      >
-        <u-form-item
-            label="WIFI名称:"
-            borderBottom
-            labelWidth="auto"
-            @click="openChooseWifi"
-            ref="item1"
-        >
-          <u--input
-              v-model="SSID"
-              disabled
-              disabledColor="#ffffff"
-              placeholder="请选择wifi:"
-              border="none"
-          ></u--input>
-          <u-icon
-              slot="right"
-              name="arrow-right"
-          ></u-icon>
-        </u-form-item>
-        <u-form-item
-            label="密码:"
-            borderBottom
-            ref="item1"
-        >
-          <u--input
-              v-model="password"
-              border="none"
-          ></u--input>
-        </u-form-item>
-
-
-        <u-form-item
-            label="二维码ID:"
-            borderBottom
-            ref="item1"
-            labelWidth="auto"
-        >
-          <u--input
-              v-model="qrcodeid"
-              border="none"
-          ></u--input>
-        </u-form-item>
-
-        <u-form-item
-            @click="showProductList = true"
-            label="产品类型:"
-            borderBottom
-            ref="item1"
-            labelWidth="auto"
-        >
-          <u--input disabled
-                    v-model="productName"
-                    border="none"
-          ></u--input>
-        </u-form-item>
-
-      </u--form>
-    </view>
-    <view style="margin:10px">
-      <u-button text="开始配网" v-if="isCompanyUser()" @click="doConnectUser(1)" size="small" type="primary"></u-button>
-
-      <u-button text="开始配网" v-else @click="doConnect(2)" size="small" type="primary"></u-button>
-
-    </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>
-
-<script>
-import authObj from '@/plugins/auth.js';
-// #ifdef APP
-import ecUI from '@/utils/ecUI.js'
-import ecBLE from '@/utils/ecBLE/ecBLE.js'
-// #endif
-// #ifdef MP
-const ecUI = require('@/utils/ecUI.js')
-const ecBLE = require('@/utils/ecBLE/ecBLE.js')
-// #endif
-import i18 from '@/utils/i18.js'
-import {getDevcieByQrcodeID} from "@/api/device/device";
-	let ctx
-	let deviceListData = []
-	export default {
-    data() {
-			return {
-        showProductList:false,
-        showPwd:false,
-        rightPwd:"",
-        pwd:"",
-        timer:"",
-        buleid:"",
-				deviceListDataShow: [],
-        showTimer:null,
-        connected:false,
-        uuid:"",
-        showDeviceNo:false,
-        inputDeviceNo:"",
-        commonCode:"",
-        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: [
-          []
-        ],
-
-			}
-		},
-		onLoad() {
-      uni.setNavigationBarTitle({
-        title: "蓝牙配网"
-      })
-      this.deviceno  = this.generateTimestamp();
-      ecUI.showLoading("正在初始化蓝牙模块")
-			ctx = this
-      clearInterval(this.timer);
-      this.timer = setInterval(() => {
-        ctx.deviceListDataShow = JSON.parse(JSON.stringify(deviceListData))
-      }, 800)
-      console.log(this.commonCode)
-      this.productName = this.chooseProductList[0][0].text;
-		},
-    onUnload(){
-      ecBLE.stopBluetoothDevicesDiscovery();
-      ecBLE.closeBLEConnection()
-    },
-		onShow() {
-      if(this.showTimer!= null){
-        clearTimeout(this.showTimer);
-      }
-			this.showTimer = setTimeout(() => {
-				ctx.openBluetoothAdapter()
-			}, 100)
-		},
-		methods: {
-      isCompanyUser(){
-        return authObj.authRoleAdmin(["companymgr"]) || authObj.authRoleAdmin(["companyuser"]);
-      },
-      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) {
-            if (!res.authSetting['scope.userLocation']) {
-              wx.authorize({
-                scope: 'scope.userLocation',
-                success () {
-                  // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
-
-                }
-              })
-            }
-          }
-        })
-      },
-      chooseWifi(e){
-        this.SSID = e.value[0];
-        this.showWiftList= false;
-      },
-      openChooseWifi(){
-        if(this.wifiList[0].length == 0){
-          this.getWifiList();
-        }else{
-          this.showWiftList = true;
-        }
-      },
-      openWifi(){
-        let self = this;
-        // #ifdef MP-WEIXIN
-        wx.startWifi({
-          success(res) {
-            console.log(res);
-            // self.getWifiList();
-          },
-          fail(res) {
-            console.log(res)
-            uni.showToast({
-              title: '请打开WIFI',
-              icon: 'none',
-              duration: 3000
-            });
-
-          },
-        })
-        // #endif
-
-      },
-      getWifi(){
-        // #ifdef MP-WEIXIN
-        var that = this
-        wx.getConnectedWifi({
-          success(res) {
-            console.log(res)
-            that.BSSID = res.wifi.BSSID
-            that.WIFIName = res.wifi.SSID
-          },
-          fail(res) {
-            console.log(res)
-            //报错的相关处理
-          },
-        })
-        // #endif
-
-      },
-      getWifiList(){
-        // #ifdef MP-WEIXIN
-        var that = this
-        uni.showLoading();
-        wx.getWifiList({
-          success(res) {
-            console.log(res)
-            wx.onGetWifiList(function(res) {
-              that.showWiftList = true;
-              uni.hideLoading();
-              console.log("获取wifi列表");
-              that.wifiList = [[]];
-              console.log(res.wifiList); //在这里提取列表数据
-              //通过遍历将WIFI名字存入集合,以便下卡框等组件使用
-              for (var i = 0; i < res.wifiList.length; i++) {
-                that.wifiList[0].push(res.wifiList[i].SSID)
-              }
-            })
-          },
-          fail(res) {
-            console.log(res)
-            uni.showToast({
-              title: '获取wifi失败,请检查wifi',
-              icon: 'none',
-              duration: 2000
-            });
-          },
-        })
-        // #endif
-
-      },
-      doConnectUser(){
-        if(this.SSID == ""){
-          uni.showToast({
-            title: '请选择WIFI',
-            icon: 'none',
-            duration: 3000
-          });
-          return;
-        }
-        if(this.password == ""){
-          uni.showToast({
-            title: '请输入wifi密码',
-            icon: 'none',
-            duration: 3000
-          });
-          return;
-        }
-
-        /**
-         * ID:XXX+回车换行(设备编号)
-         * QR:XXXX+回车换行(二维码ID)
-         * ssid:WiFi名字+回车换行
-         * psd:wifi密码+回车换行
-         * 最后+OK
-         */
-        let self = this;
-        let endStr = "$$";
-        ecUI.showLoading("正在配置网络信息")
-
-        setTimeout(function(){
-          self.sendBlueData("ssid:"+self.SSID+endStr);
-        },400);
-
-        setTimeout(function(){
-          self.sendBlueData("psd:"+self.password+endStr);
-        },600);
-
-
-        setTimeout(function(){
-          self.sendBlueData("OK");
-        },800);
-
-
-
-      },
-      doConnect(){
-        if(this.SSID == ""){
-          uni.showToast({
-            title: '请选择WIFI',
-            icon: 'none',
-            duration: 3000
-          });
-          return;
-        }
-        if(this.password == ""){
-          uni.showToast({
-            title: '请输入wifi密码',
-            icon: 'none',
-            duration: 3000
-          });
-          return;
-        }
-
-        if(this.qrcodeid == ""){
-          uni.showToast({
-            title: '请输入二维码ID',
-            icon: 'none',
-            duration: 3000
-          });
-          return;
-        }
-
-
-        if(this.deviceno == ""){
-          uni.showToast({
-            title: '请输入设备编号',
-            icon: 'none',
-            duration: 3000
-          });
-          return;
-        }
-
-
-        /**
-         * ID:XXX+回车换行(设备编号)
-         * QR:XXXX+回车换行(二维码ID)
-         * ssid:WiFi名字+回车换行
-         * psd:wifi密码+回车换行
-         * 最后+OK
-         */
-        let self = this;
-        getDevcieByQrcodeID(this.qrcodeid).then(res=>{
-          if(res.data != null){
-            self.$modal.showToast("当前二维码已经配置设备");
-          }else{
-            let endStr = "$$";
-            ecUI.showLoading("正在配置网络信息")
-            setTimeout(function(){
-              self.sendBlueData("ID:"+self.deviceno+endStr);
-            },200);
-            setTimeout(function(){
-              self.sendBlueData("QR:"+self.qrcodeid+endStr);
-            },400);
-
-            setTimeout(function(){
-              self.sendBlueData("ssid:"+self.SSID+endStr);
-            },600);
-
-            setTimeout(function(){
-              self.sendBlueData("psd:"+self.password+endStr);
-            },800);
-
-            setTimeout(function(){
-              self.sendBlueData("pid:"+self.productId+endStr);
-            },1000);
-
-            setTimeout(function(){
-              self.sendBlueData("OK");
-            },1200);
-          }
-        })
-
-
-
-
-      },
-      stringToHex(str) {
-          let hex = '';
-          for (let i = 0; i < str.length; i++) {
-            const char = str.charCodeAt(i);
-            const hexChar = char.toString(16).padStart(2, '0');
-            hex += hexChar;
-          }
-          return hex;
-      },
-      doByTime(func,time){
-        setTimeout(function (){
-          func();
-        },time);
-      },
-      sendLanyaData(){
-        this.$modal.showToast("正在发送");
-       this.sendBlueData(this.sendData);
-      },
-      i18(text){
-        return text;
-      },
-      cancel(){
-        this.showPwd = false;
-        uni.navigateBack({
-        });
-      },
-      resetPwd(){
-        let self = this;
-        if(!this.inputDeviceNo){
-          self.$modal.showToast("请输入序列号");
-          return;
-        }
-        let uuidRight = false;
-        if(this.inputDeviceNo == this.commonCode || this.uuid == this.inputDeviceNo){
-          uuidRight = true;
-        }
-        if(!uuidRight){
-          self.$modal.showToast("序列号有误");
-          return;
-        }
-        if(uuidRight){
-          this.$modal.confirm("密码将被重置为123456").then(res=>{
-            setPwd("123456")
-            self.$modal.showToast("密码修改成功");
-            this.rightPwd = "123456";
-            self.loginSuccess();
-          });
-        }
-      },
-       getBeijingTime() {
-         const date = new Date();
-         const utcTime = date.getTime() + (date.getTimezoneOffset() * 60 * 1000);
-         const beijingTime = new Date(utcTime + (8 * 60 * 60 * 1000));
-         return beijingTime;
-      },
-       generateUniqueNumber(date) {
-         let dateString = date.toISOString().slice(0, 10).replace(/-/g, '');
-         console.log(dateString)
-         let hash = w_md5.hex_md5_32(dateString);
-         console.log(hash);//32位小写
-         let str = "";
-         for (let i = 0; i < 6; i++) {
-           const c = hash.charCodeAt(i);
-           str  = str+""+c+""
-         }
-         return str.substr(0,6);
-},
-      goBack(){
-        uni.navigateBack({
-        });
-      },
-      $t(title){
-        return title;
-      },
-      inputPwd(){
-        if(!this.pwd ){
-          this.$modal.showToast(this.$t('buletooth.errpwd'));
-        }else{
-          if(this.rightPwd && this.rightPwd === this.pwd){
-           this.loginSuccess();
-          }else{
-            this.$modal.showToast(this.$t('buletooth.errpwd'));
-          }
-
-        }
-      },
-      loginSuccess(){
-        this.showPwd = false;
-        this.showDeviceNo = false;
-        uni.setStorageSync("pwd",this.rightPwd);
-        uni.setStorageSync('blueid', this.buleid);
-        this.pwd = "";
-        ecBLE.stopBluetoothDevicesDiscovery();
-        uni.navigateTo({
-          url: '/pages/weitiandi/bluetooth/status'
-        });
-      },
-      getLocalPwd(){
-        let pwd = uni.getStorageSync("pwd");
-        return pwd;
-      },
-     sendBlueData(tempSendData){
-       tempSendData = this.stringToHex(tempSendData);
-        let data = tempSendData
-            .replace(/\s*/g, '')
-            .replace(/\n/g, '')
-            .replace(/\r/g, '')
-        console.log("写入数据:"+data);
-        ecBLE.writeBLECharacteristicValue(data, true)
-      },
-			listViewTap(id){
-        let self = this;
-				ecUI.showLoading("正在连接蓝牙")
-				ecBLE.onBLEConnectionStateChange(res => {
-          console.log(res);
-					if (res.ok) {
-            self.connected = true;
-            self.openWifi();
-            ecUI.hideLoading()
-            self.showSendData = true;
-						ecBLE.stopBluetoothDevicesDiscovery();
-            //
-					} else {
-            ecUI.hideLoading()
-            this.$modal.showToast("请检查是否配置成功");
-					}
-				});
-        //receive data
-        ecBLE.onBLECharacteristicValueChange((str, strHex) => {
-			   console.log("数据来了")
-          let isCheckRevHex = true;
-          let data =
-              (isCheckRevHex ? strHex.replace(/[0-9a-fA-F]{2}/g, ' $&') : str)
-          console.log(data)
-          self.$modal.closeLoading();
-          data = parseDataObj(data);
-
-        })
-        self.connected = false;
-				ecBLE.createBLEConnection(id);
-        setTimeout(function (){
-          if(!self.connected){
-            self.$modal.showToast(i18('连接失败'));
-            self.startBluetoothDevicesDiscovery()
-          }
-        },10000);
-			},
-      showInputPwd(){
-        this.showPwd = true;
-      },
-      messageCallback(data){
-        let self = this;
-        console.log(data);
-        let type = data.type;
-        let real_data = data.real_data;
-        if(type == 253){
-          self.$modal.closeLoading();
-          self.uuid = real_data.substr(0,6);
-        }
-        self.$forceUpdate();
-        console.log('收到服务器内容:' + JSON.stringify(data));
-      },
-      forgetPwd(){
-        this.$modal.loading("正在读取设备ID");
-        getUUID()
-        this.showDeviceNo = true;
-      },
-			openBluetoothAdapter() {
-        let self = this;
-				ecBLE.onBluetoothAdapterStateChange(res => {
-          ecUI.hideLoading()
-					if (res.ok) {
-              ctx.startBluetoothDevicesDiscovery()
-					} else {
-						ecUI.showModal(
-                this.$t('buletooth.tip'),
-							`Bluetooth adapter error | ${res.errCode} | ${res.errMsg}`,
-							() => {
-
-							}
-						)
-					}
-				})
-				ecBLE.openBluetoothAdapter()
-			},
-			startBluetoothDevicesDiscovery() {
-        ecBLE.stopBluetoothDevicesDiscovery();
-				console.log('start search')
-				ecBLE.onBluetoothDeviceFound(res => {
-          let isRight = true;
-          // if(res.name.startsWith('BT_') || res.name.startsWith('FC41D')){
-          //   isRight = true;
-          // }
-          if(!isRight){
-            return;
-          }
-					for (const item of deviceListData) {
-						if (item.id === res.id) {
-							item.name = res.name
-							item.rssi = res.rssi
-							return
-						}
-					}
-					let manufacturer = ''
-					if (res.name.length === 11 && res.name.startsWith('@')) {
-						manufacturer = 'eciot'
-					}
-					if (res.name.length === 15 && res.name.startsWith('BT_')) {
-						manufacturer = 'eciot'
-					}
-          manufacturer = 'eciot'
-					deviceListData.push({
-						id: res.id,
-						name: res.name,
-						rssi: res.rssi,
-						manufacturer,
-					})
-				})
-				ecBLE.startBluetoothDevicesDiscovery()
-			},
-		}
-	}
-</script>
-
-<style>
-	.main-container {
-		height: 100vh;
-	}
-
-	.list-item {
-		height: 57px;
-		position: relative;
-	}
-
-	.list-item-hover {
-		background-color: #e5e4e9;
-	}
-
-	.list-item-img {
-		position: absolute;
-		width: 36px;
-		height: 36px;
-		left: 20px;
-		top: 10px;
-	}
-
-	.list-item-name {
-		position: absolute;
-		font-size: 22px;
-		left: 76px;
-		top: 0px;
-		line-height: 56px;
-	}
-
-	.list-item-rssi-img {
-		position: absolute;
-		width: 20px;
-		height: 20px;
-		right: 20px;
-		top: 13px;
-	}
-
-	.list-item-rssi {
-		position: absolute;
-		width: 40px;
-		height: 20px;
-		right: 10px;
-		top: 33px;
-		font-size: 12px;
-		font-weight: bold;
-		display: flex;
-		justify-content: center;
-	}
-
-	.list-item-line {
-		position: absolute;
-		height: 1px;
-		width: 100vw;
-		left: 20px;
-		top: 56px;
-		background-color: #c6c6c8;
-	}
-
-	.notice {
-		display: flex;
-		justify-content: center;
-		align-items: center;
-		margin-top: 10px;
-		font-size: 13px;
-		color: #909399;
-	}
-
-	.gap {
-		height: 57px;
-	}
-  .text-area {
-    display: flex;
-    justify-content: center;
-    background: white;
-    width: 100%;
-    height: 100%;
-  }
-</style>

+ 28 - 84
pages/bluetooth/set/one.vue

@@ -1,24 +1,10 @@
 <template>
   <view class="container">
 
-
     <!-- 头部区域 -->
-    <view class="header">
-      <u-row>
-        <u-col span="2">
-          <view class="status-btn" :class="{ active_btn: communicationLink_1 }">Link</view>
-        </u-col>
-        <u-col span="2">
-          <view class="status-btn" :class="{ active_btn: bleConnected }">blue</view>
-        </u-col>
-        <u-col span="6" textAlign="left">
-          <text class="title">长沙亿旭智能</text>
-        </u-col>
-        <u-col span="2">
-
-        </u-col>
-      </u-row>
-    </view>
+    <BluetoothHeader
+        @ble-data-received="handleBleDataReceived"
+    />
 
     <!-- 主要内容区域 -->
     <scroll-view class="content" scroll-y>
@@ -236,14 +222,21 @@
         </view>
       </view>
     </scroll-view>
+    <DeviceStatusInfo/>
     <u-modal :show="confirmShow" title="提示" :content='confirmContent' :showCancelButton=true  @cancel="cancel"  @confirm="confirm" ></u-modal>
 
   </view>
 </template>
 
 <script>
-import {writeRegister} from '@/utils/modbus.js';
+import BluetoothHeader from '@/pages/components/header.vue';
+import DeviceStatusInfo from '@/pages/components/DeviceStatusInfo.vue';
+import {writeRegister,getAgreement} from '@/utils/modbus.js';
 export default {
+  components: {
+    BluetoothHeader,
+    DeviceStatusInfo
+  },
   data() {
     return {
       editStatus: false,
@@ -272,41 +265,21 @@ export default {
         uphillSlope: '',
         uphillMode: 'read',
         downhillSlope: '',
-        downhillMode: 'read'
+        downhillMode: 'read',
+        agreementTypeName: '',
       }
     }
   },
-  computed: {
-    bleConnected() {
-      return this.$store.getters['ble/connected']
-    },
-    bleData() {
-      return this.$store.getters['ble/data']
-    }
-  },
-  watch: {
-    bleData: {
-      handler(newData, oldData) {
-        if (newData) {
-          console.log('接收到蓝牙数据:', newData)
-          // 清除之前的定时器
-          if (this.communicationTimer_1) {
-            clearTimeout(this.communicationTimer_1)
-            this.communicationTimer_1 = null
-          }
-          // 设置通信链接状态为 true
-          this.communicationLink_1 = true
-          if (!this.editStatus){
-            this.updateSensorData(newData)
-          }
-
-        }
-      },
-      deep: true, // 深度监听,确保嵌套对象变化时也能触发
-      immediate: true // 立即执行一次
-    }
+
+  onShow() {
+    this.agreementTypeName = getAgreement();
   },
   methods: {
+    // 处理从子组件传递过来的蓝牙数据
+    handleBleDataReceived(data) {
+      console.log('在父组件中接收到蓝牙数据:', JSON.stringify( data));
+      this.updateSensorData(data);
+    },
     limit(value){
       console.log('限制选择:', value)
       this.params.wLim = !value;
@@ -498,45 +471,10 @@ export default {
   }
 }
 
-.header {
-  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-  padding: 20rpx;
-
-  .link-btn {
-    background-color: #ff4757;
-    border: none;
-    width: 60px;
-    margin-left: 0px;
-  }
-
-  .title {
-    color: #fff;
-    font-size: 36rpx;
-    font-weight: bold;
-  }
-
-  .status-btn {
-    background-color: #ff4757;
-    border: none;
-    margin-left: 0px;
-    padding: 0px;
-    width: 40px;
-    text-align: center;
-    color: white;
-    border-radius: 4px;
-    height: 20px;
-    line-height: 20px;
-  }
-  .active_btn {
-    background-color: yellowgreen !important;
-  }
-
-}
-
 .content {
   flex: 1;
   padding: $custom-spacing-md;
-  height: calc(100vh - 60px);
+  height: calc(100vh - 190px);
 }
 
 .param-section {
@@ -610,4 +548,10 @@ export default {
 ::v-deep .content text{
   font-size: 12px !important;
 }
+.typeSelect{
+  font-size: 16px;
+  color: #fff;
+  font-weight: 600;
+  display: flex;
+}
 </style>

+ 25 - 87
pages/bluetooth/set/record.vue

@@ -2,22 +2,9 @@
 	<view class="container">
 
     <!-- 头部区域 -->
-    <view class="header">
-      <u-row>
-        <u-col span="2">
-          <view class="status-btn" :class="{ active_btn: communicationLink }">Link</view>
-        </u-col>
-        <u-col span="2">
-          <view class="status-btn" :class="{ active_btn: bleConnected }">blue</view>
-        </u-col>
-        <u-col span="6" textAlign="left">
-          <text class="title">长沙亿旭智能</text>
-        </u-col>
-        <u-col span="2">
-
-        </u-col>
-      </u-row>
-    </view>
+    <BluetoothHeader
+        @ble-data-received="handleBleDataReceived"
+    />
 	
 	
 		<view class="main-content">
@@ -75,19 +62,21 @@
 
 			</view>
 		</view>
-
+    <DeviceStatusInfo/>
 	</view>
 </template>
 
 <script>
-  import ecBLEApp from '@/utils/ecBLE/ecBLEApp.js'
-	import UniDataPickerView
-    from "../../../uni_modules/uni-data-picker/components/uni-data-pickerview/uni-data-pickerview.vue";
+  import ecBLEApp from '@/utils/ecBLE/ecBLEApp.js';
+  import {getAgreement} from '@/utils/modbus.js';
+  import BluetoothHeader from '@/pages/components/header.vue';
+  import DeviceStatusInfo from '@/pages/components/DeviceStatusInfo.vue';
 
   export default {
-    components: {UniDataPickerView},
+    components: {BluetoothHeader,DeviceStatusInfo},
 		data() {
 			return {
+        agreementTypeName:'',
         communicationLink: false,
         communicationTimer_3: null, // 添加这一行用于保存定时器 ID
         writeLogs: [],
@@ -111,7 +100,8 @@
       // 从全局变量加载日志
       this.writeLogs = ecBLEApp.getGlobalWriteLogs()
       // 添加监听器以实时更新
-      ecBLEApp.addLogListener(this.onLogUpdate)
+      ecBLEApp.addLogListener(this.onLogUpdate);
+      this.agreementTypeName = getAgreement();
     },
 
     onHide() {
@@ -119,12 +109,6 @@
       ecBLEApp.removeLogListener(this.onLogUpdate)
     },
     computed: {
-      bleConnected() {
-        return this.$store.getters['ble/connected']
-      },
-      bleData() {
-        return this.$store.getters['ble/data']
-      },
       // 修改排序计算属性
       sortedWriteLogs() {
         return this.writeLogs.slice().sort((a, b) => {
@@ -132,32 +116,13 @@
         });
       }
     },
-    watch: {
-      bleData: {
-        handler(newData, oldData) {
-          if (newData) {
-            console.log('接收到蓝牙数据:', newData)
-            // 清除之前的定时器
-            if (this.communicationTimer_3) {
-              clearTimeout(this.communicationTimer_3)
-              this.communicationTimer_3 = null
-            }
-            // 设置通信链接状态为 true
-            this.communicationLink = true
-            this.updateSensorData(newData)
-
-            // 设置6秒后将 communicationLink 设置为 false 的定时器
-            this.communicationTimer_3 = setTimeout(() => {
-              this.communicationLink = false
-              this.communicationTimer_3 = null
-            }, 5000)
-          }
-        },
-        deep: true, // 深度监听,确保嵌套对象变化时也能触发
-        immediate: true // 立即执行一次
-      }
-    },
+
 		methods: {
+      // 处理从子组件传递过来的蓝牙数据
+      handleBleDataReceived(data) {
+        console.log('在父组件中接收到蓝牙数据:', data);
+        this.updateSensorData(data);
+      },
       updateSensorData(data) {
 
       },
@@ -250,39 +215,6 @@
 	background-color: #f5f5f5;
 }
 
-.header {
-  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-  padding: 20rpx;
-
-  .link-btn {
-    background-color: #ff4757;
-    border: none;
-    width: 60px;
-    margin-left: 0px;
-  }
-
-  .title {
-    color: #fff;
-    font-size: 36rpx;
-    font-weight: bold;
-  }
-
-  .status-btn {
-    background-color: #ff4757;
-    border: none;
-    margin-left: 0px;
-    padding: 0px;
-    width: 40px;
-    text-align: center;
-    color: white;
-    border-radius: 4px;
-    height: 20px;
-    line-height: 20px;
-  }
-  .active_btn {
-    background-color: yellowgreen !important;
-  }
-}
 
 .status-bar {
 	height: 60rpx;
@@ -345,6 +277,7 @@
 	flex: 1;
 	padding: 20rpx;
 	background-color: #f5f5f5;
+  height: calc(100% - 140rpx);
 }
 
 .receive-section {
@@ -465,5 +398,10 @@
   width: 100px !important;
   height: 30px !important;
 }
-
+.typeSelect{
+  font-size: 16px;
+  color: #fff;
+  font-weight: 600;
+  display: flex;
+}
 </style>

+ 229 - 110
pages/bluetooth/set/set.vue

@@ -1,21 +1,9 @@
 <template>
   <view class="container">
     <!-- 头部区域 -->
-    <view class="header">
-      <u-row>
-        <u-col span="2">
-          <view class="status-btn" :class="{ active_btn: communicationLink_set }">Link</view>
-        </u-col>
-        <u-col span="2">
-          <view class="status-btn" :class="{ active_btn: bleConnected }">blue</view>
-        </u-col>
-        <u-col span="6" textAlign="left">
-          <text class="title">长沙亿旭智能</text>
-        </u-col>
-        <u-col span="2">
-        </u-col>
-      </u-row>
-    </view>
+    <BluetoothHeader
+        @ble-data-received="handleBleDataReceived"
+    />
 
     <!-- 主要内容区域 -->
     <view class="main-content">
@@ -63,17 +51,84 @@
             </u-button>
           </view>
         </view>
+        <!-- 单电机控制器按键组 -->
+        <view class="motor-control-section">
+          <view class="section-title">单电机控制</view>
+          <view class="motor-control-buttons">
+            <!-- 第一行 -->
+            <view class="button-row">
+              <u-button
+                  :plain="true" :hairline="true"
+                  class="motor-control-btn"
+                  type="primary"
+                  size="medium"
+                  @click="handleMotorControl('stop')"
+              >
+                停止
+              </u-button>
+              <u-button
+                  :plain="true" :hairline="true"
+                  class="motor-control-btn"
+                  type="primary"
+                  size="medium"
+                  @click="handleMotorControl('motor1East')"
+              >
+                电机1向东
+              </u-button>
+              <u-button
+                  :plain="true" :hairline="true"
+                  class="motor-control-btn"
+                  type="primary"
+                  size="medium"
+                  @click="handleMotorControl('motor1West')"
+              >
+                电机1向西
+              </u-button>
+            </view>
+
+            <!-- 第二行 -->
+            <view class="button-row">
+              <u-button
+                  :plain="true" :hairline="true"
+                  class="motor-control-btn"
+                  type="primary"
+                  size="medium"
+                  @click="handleMotorControl('motor2East')"
+              >
+                电机2向东
+              </u-button>
+              <u-button
+                  :plain="true" :hairline="true"
+                  class="motor-control-btn"
+                  type="primary"
+                  size="medium"
+                  @click="handleMotorControl('motor2West')"
+              >
+                电机2向西
+              </u-button>
+              <view class="empty-button-space"></view> <!-- 空白占位 -->
+            </view>
+          </view>
+        </view>
       </view>
+      <DeviceStatusInfo/>
     </view>
     <u-modal :show="confirmShow" title="提示" :content='confirmContent' :showCancelButton=true  @cancel="cancel"  @confirm="confirm" ></u-modal>
   </view>
 </template>
 
 <script>
-import {writeRegister,heartbeat} from '@/utils/modbus.js';
+import BluetoothHeader from '@/pages/components/header.vue';
+import DeviceStatusInfo from '@/pages/components/DeviceStatusInfo.vue';
+import {writeRegister,heartbeat,getAgreement} from '@/utils/modbus.js';
 export default {
+  components: {
+    BluetoothHeader,
+    DeviceStatusInfo
+  },
   data() {
     return {
+      agreementTypeName: '',
       communicationLink_set: false,
       communicationTimer_set: null,
       selectAction: '',
@@ -168,74 +223,114 @@ export default {
       ]
     }
   },
-  computed: {
-    bleConnected() {
-      return this.$store.getters['ble/connected']
-    },
-    bleData() {
-      return this.$store.getters['ble/data']
-    }
-  },
-  watch: {
-    bleData: {
-      handler(newData, oldData) {
-        if (newData) {
-          console.log('newData:', newData)
-          // 清除之前的定时器
-          if (this.communicationTimer_set) {
-            clearTimeout(this.communicationTimer_set)
-            this.communicationTimer_set = null
-          }
-          // 设置通信链接状态为 true
-          this.communicationLink_set = true
-          this.updateSensorData(newData)
-
 
-        }
-      },
-      deep: true,
-      immediate: true
-    }
+  onShow() {
+    this.agreementTypeName = getAgreement();
   },
   methods: {
+    // 处理电机控制按钮点击
+    handleMotorControl(action) {
+      // 检查是否处于手动模式
+      if (this.workMode !== '手动') {
+        uni.showToast({
+          title: '请先切换到手动模式',
+          icon: 'none',
+          duration: 2000
+        });
+        return;
+      }
+
+      this.motorControlAction = action;
+
+      // 设置确认对话框内容
+      let actionText = '';
+      switch(action) {
+        case 'stop':
+          actionText = '停止';
+          break;
+        case 'motor1East':
+          actionText = '电机1向东';
+          break;
+        case 'motor1West':
+          actionText = '电机1向西';
+          break;
+        case 'motor2East':
+          actionText = '电机2向东';
+          break;
+        case 'motor2West':
+          actionText = '电机2向西';
+          break;
+      }
+
+      this.confirmContent = `是否确定执行${actionText}操作?`;
+      this.confirmShow = true;
+    },
+    // 处理从子组件传递过来的蓝牙数据
+    handleBleDataReceived(data) {
+      console.log('在父组件中接收到蓝牙数据:', data);
+      this.updateSensorData(data);
+    },
     cancel(){
       this.confirmShow = false
+      this.motorControlAction = ''; // 重置电机控制动作
     },
     confirm() {
-      switch (this.selectAction) {
-        case 'auto': // 自动
-          writeRegister("READ_AUTO",null);
-          break
-        case 'manual': // 手动
-          writeRegister("READ_MANUAL",null)
-          break
-        case 'calibrate':  // 标定
-          // writeRegister("WRITE_REGISTER",null)
-          break
-        case 'east': // 向东
-          writeRegister("READ_DOWN",null)
-          break
-        case 'level': // 放平
-          writeRegister("FLATTEN",null)
-          break
-        case 'west': // 向西
-          writeRegister("READ_UP",null)
-          break
-        case 'snow': // 雪
-          writeRegister("SNOW",null)
-          break
-        case 'rain': // 雨
-          writeRegister("RAIN",null)
-          break
-        case 'wind': // 风
-          writeRegister("WIND",null)
-          break
-        case 'calibrateTime':  // 校正时间
-          writeRegister("READ_TIME",this.getCurrentTimeValues())
-          break
-        case 'cancel': //取消
-          writeRegister("READ_CANCEL",null)
+      if (this.motorControlAction === ''){
+        switch (this.selectAction) {
+          case 'auto': // 自动
+            writeRegister("READ_AUTO",null);
+            break
+          case 'manual': // 手动
+            writeRegister("READ_MANUAL",null)
+            break
+          case 'calibrate':  // 标定
+            // writeRegister("WRITE_REGISTER",null)
+            break
+          case 'east': // 向东
+            writeRegister("READ_DOWN",null)
+            break
+          case 'level': // 放平
+            writeRegister("FLATTEN",null)
+            break
+          case 'west': // 向西
+            writeRegister("READ_UP",null)
+            break
+          case 'snow': // 雪
+            writeRegister("SNOW",null)
+            break
+          case 'rain': // 雨
+            writeRegister("RAIN",null)
+            break
+          case 'wind': // 风
+            writeRegister("WIND",null)
+            break
+          case 'calibrateTime':  // 校正时间
+            writeRegister("READ_TIME",this.getCurrentTimeValues())
+            break
+          case 'cancel': //取消
+            writeRegister("READ_CANCEL",null)
+        }
       }
+      // 添加电机控制处理
+      switch(this.motorControlAction) {
+        case 'stop':
+          writeRegister("READ_MOTOR_STOP", null);
+          break;
+        case 'motor1East':
+          writeRegister("READ_MOTOR1_EAST", null);
+          break;
+        case 'motor1West':
+          writeRegister("READ_MOTOR1_WEST", null);
+          break;
+        case 'motor2East':
+          writeRegister("READ_MOTOR2_EAST", null);
+          break;
+        case 'motor2West':
+          writeRegister("READ_MOTOR2_WEST", null);
+          break;
+      }
+      // 重置电机控制动作
+      this.motorControlAction = '';
       this.confirmShow = false;
       uni.showToast({
         title: '操作执行成功!',
@@ -441,43 +536,11 @@ export default {
   flex-direction: column;
 }
 
-.header {
-  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-  padding: 20rpx;
-
-  .link-btn {
-    background-color: #ff4757;
-    border: none;
-    width: 60px;
-    margin-left: 0px;
-  }
-
-  .title {
-    color: #fff;
-    font-size: 36rpx;
-    font-weight: bold;
-  }
-
-  .status-btn {
-    background-color: #ff4757;
-    border: none;
-    margin-left: 0px;
-    padding: 0px;
-    width: 40px;
-    text-align: center;
-    color: white;
-    border-radius: 4px;
-    height: 20px;
-    line-height: 20px;
-  }
-  .active_btn {
-    background-color: yellowgreen !important;
-  }
-}
 
 .main-content {
   flex: 1;
   padding: 20rpx;
+  height: 100%;
 }
 
 .work-mode-display {
@@ -544,7 +607,7 @@ export default {
   background-color: #fff;
   border-radius: 16rpx;
   overflow: auto;
-  height: calc(100% - 220rpx);
+  height: calc(100% - 390rpx);
 
   .control-item {
     display: flex;
@@ -617,4 +680,60 @@ export default {
     background-color: red;
   }
 }
+.typeSelect{
+  font-size: 16px;
+  color: #fff;
+  font-weight: 600;
+  display: flex;
+}
+
+.text-lable{
+  color: #fff;
+  font-size: 12px;
+}
+
+.motor-control-section {
+  background-color: #fff;
+  border-radius: 16rpx;
+  padding: 20rpx;
+  margin-top: 20rpx;
+}
+
+.section-title {
+  font-size: 28rpx;
+  font-weight: bold;
+  color: #333;
+  margin-bottom: 20rpx;
+  text-align: center;
+}
+
+.motor-control-buttons {
+  .button-row {
+    display: flex;
+    justify-content: space-between;
+    margin-bottom: 20rpx;
+
+    &:last-child {
+      margin-bottom: 0;
+    }
+  }
+
+  .motor-control-btn {
+    flex: 1;
+    margin: 0 10rpx;
+
+    &:first-child {
+      margin-left: 0;
+    }
+
+    &:last-child {
+      margin-right: 0;
+    }
+  }
+
+  .empty-button-space {
+    flex: 1;
+    margin: 0 10rpx;
+  }
+}
 </style>

+ 31 - 83
pages/bluetooth/set/two.vue

@@ -3,26 +3,13 @@
 
 
     <!-- 头部区域 -->
-    <view class="header">
-      <u-row>
-        <u-col span="2">
-          <view class="status-btn" :class="{ active_btn: communicationLink_2 }">Link</view>
-        </u-col>
-        <u-col span="2">
-          <view class="status-btn" :class="{ active_btn: bleConnected }">blue</view>
-        </u-col>
-        <u-col span="6" textAlign="left">
-          <text class="title">长沙亿旭智能</text>
-        </u-col>
-        <u-col span="2">
-
-        </u-col>
-      </u-row>
-    </view>
+    <BluetoothHeader
+        @ble-data-received="handleBleDataReceived"
+    />
 
 
     <!-- 主要内容区域 -->
-    <scroll-view class="content" scroll-y>
+    <scroll-view class="content" >
       <view class="param-section">
         <!-- 电机方向 -->
         <view class="param-row">
@@ -260,6 +247,7 @@
         </view>
       </view>
     </scroll-view>
+    <DeviceStatusInfo/>
     <u-action-sheet
         :show="showMotorDirection"
         :actions="directionOptions"
@@ -273,10 +261,17 @@
 </template>
 
 <script>
-import {writeRegister,setTime,stopHeartbeat,setTimeStatus} from '@/utils/modbus.js';
+import BluetoothHeader from '@/pages/components/header.vue';
+import DeviceStatusInfo from '@/pages/components/DeviceStatusInfo.vue';
+import {writeRegister,setTime,stopHeartbeat,setTimeStatus,getAgreement} from '@/utils/modbus.js';
 export default {
+  components: {
+    BluetoothHeader,
+    DeviceStatusInfo
+  },
   data() {
     return {
+      agreementTypeName :'',
       checkboxValue_timedSend: ['timedSend'],
       editStatus: false,
       showMotorDirection: false,
@@ -310,37 +305,15 @@ export default {
       communicationTimer_2: null, // 添加这一行用于保存定时器 ID
     }
   },
-  computed: {
-    bleConnected() {
-      return this.$store.getters['ble/connected']
-    },
-    bleData() {
-      return this.$store.getters['ble/data']
-    }
-  },
-  watch: {
-    bleData: {
-      handler(newData, oldData) {
-        if (newData) {
-          console.log('接收到蓝牙数据:', newData)
-          // 清除之前的定时器
-          if (this.communicationTimer_2) {
-            clearTimeout(this.communicationTimer_2)
-            this.communicationTimer_2 = null
-          }
-          // 设置通信链接状态为 true
-          this.communicationLink_2 = true
-          if (!this.editStatus){
-             this.updateSensorData(newData)
-          }
-
-        }
-      },
-      deep: true, // 深度监听,确保嵌套对象变化时也能触发
-      immediate: true // 立即执行一次
-    }
+  onShow() {
+    this.agreementTypeName = getAgreement();
   },
   methods: {
+    // 处理从子组件传递过来的蓝牙数据
+    handleBleDataReceived(data) {
+      console.log('在父组件中接收到蓝牙数据:', data);
+      this.updateSensorData(data);
+    },
     handleBlurWithDelay() {
       setTimeout(() => {
         this.editStatus = false;
@@ -588,7 +561,7 @@ export default {
 @import '@/static/scss/custom-theme.scss';
 
 .container {
-  height: calc(100% - 140px);
+  height: calc(100vh - 100px);
   display: flex;
   flex-direction: column;
   background-color: $custom-bg-tertiary;
@@ -620,48 +593,18 @@ export default {
   }
 }
 
-.header {
-  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-  padding: 20rpx;
-
-  .link-btn {
-    background-color: #ff4757;
-    border: none;
-    width: 60px;
-    margin-left: 0px;
-  }
-
-  .title {
-    color: #fff;
-    font-size: 36rpx;
-    font-weight: bold;
-  }
-
-  .status-btn {
-    background-color: #ff4757;
-    border: none;
-    margin-left: 0px;
-    padding: 0px;
-    width: 40px;
-    text-align: center;
-    color: white;
-    border-radius: 4px;
-    height: 20px;
-    line-height: 20px;
-  }
-  .active_btn {
-    background-color: yellowgreen !important;
-  }
-
-}
 
 .content {
   flex: 1;
   padding: $custom-spacing-md;
+  height: calc(100% - 90px) ;
 }
 
 .param-section {
+  height: 100%;
+  overflow: auto;
   @include card-style;
+
 }
 
 .param-row {
@@ -781,5 +724,10 @@ export default {
 ::v-deep .content text{
     font-size: 12px !important;
 }
-
+.typeSelect{
+  font-size: 16px;
+  color: #fff;
+  font-weight: 600;
+  display: flex;
+}
 </style>

+ 0 - 43
pages/common/textview/index.vue

@@ -1,43 +0,0 @@
-<template>
-  <view>
-    <uni-card class="view-title" :title="title">
-      <text class="uni-body view-content">{{ content }}</text>
-    </uni-card>
-  </view>
-</template>
-
-<script>
-  export default {
-    data() {
-      return {
-        title: '',
-        content: ''
-      }
-    },
-    onLoad(options) {
-      this.title = options.title
-      this.content = options.content
-      uni.setNavigationBarTitle({
-        title: options.title
-      })
-    }
-  }
-</script>
-
-<style scoped>
-  page {
-    background-color: #ffffff;
-  }
-
-  .view-title {
-    font-weight: bold;
-  }
-
-  .view-content {
-    font-size: 26rpx;
-    padding: 12px 5px 0;
-    color: #333;
-    line-height: 24px;
-    font-weight: normal;
-  }
-</style>

+ 0 - 34
pages/common/webview/index.vue

@@ -1,34 +0,0 @@
-<template>
-  <view v-if="params.url">
-    <web-view :webview-styles="webviewStyles" :src="`${params.url}`"></web-view>
-  </view>
-</template>
-
-<script>
-  export default {
-    data() {
-      return {
-        params: {},
-        webviewStyles: {
-          progress: {
-            color: "#FF3333"
-          }
-        }
-      }
-    },
-    props: {
-      src: {
-        type: [String],
-        default: null
-      }
-    },
-    onLoad(event) {
-      this.params = event
-      if (event.title) {
-        uni.setNavigationBarTitle({
-          title: event.title
-        })
-      }
-    }
-  }
-</script>

+ 164 - 0
pages/components/DeviceStatusInfo.vue

@@ -0,0 +1,164 @@
+<!-- components/DeviceStatusInfo.vue -->
+<template>
+  <view class="device-status-info" >
+    <!-- 运行模式信息 -->
+    <view class="info-section">
+      <view class="info-title">运行模式:</view>
+      <view class="info-content">
+        <text class="mode-text" :class="modeClass">{{ currentMode }}</text>
+      </view>
+    </view>
+
+    <!-- 故障信息 -->
+    <view class="info-section">
+      <view class="info-title">故障状态:</view>
+      <view class="info-content">
+        <text class="fault-text" :class="faultClass">{{ faultInfo }}</text>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script>
+export default {
+  name: "DeviceStatusInfo",
+  computed: {
+    bleConnected() {
+      return this.$store.getters['ble/connected']
+    },
+    bleData() {
+      return this.$store.getters['ble/data']
+    },
+    // 当前运行模式
+    currentMode() {
+      if (!this.bleData) return '未知';
+
+      // 根据 WorkModle_41 二进制值判断模式(与set.vue中逻辑一致)
+      const workMode = this.bleData.WorkModle_41;
+      if (workMode !== undefined) {
+        const workModeBits = workMode.toString();
+        switch (workModeBits) {
+          case "100000": // 自动
+            return '自动';
+          case "10000": // 手动
+            return '手动';
+          case "1000000": // 放平
+            return '放平';
+          case "1000000000": // 雨
+            return '雨';
+          case "100000000": // 雪
+            return '雪';
+          case "10000000000": // 风
+            return '风';
+          case "10000000": // 指定
+            return '指定';
+          case "11000": // 向东
+            return '向东';
+          case "10100": // 向西
+            return '向西';
+          default:
+            return '未知模式';
+        }
+      }
+      return '未知模式';
+    },
+    // 故障信息 (按照modbus.js中的逻辑)
+    faultInfo() {
+      if (!this.bleData) return '无数据';
+
+      // 使用已解析的故障码信息(与modbus.js中逻辑一致)
+      if (this.bleData.FaultCode_10 !== undefined) {
+        if (this.bleData.FaultCode_10 === '0') {
+          return '无故障';
+        } else {
+          return this.bleData.FaultCodeDescription || '未知故障';
+        }
+      }
+      return '未知状态';
+    },
+    // 获取模式显示样式类
+    modeClass() {
+      const mode = this.currentMode;
+      if (mode === '手动') {
+        return 'manual-mode';
+      } else if (mode === '自动') {
+        return 'auto-mode';
+      } else if (['放平', '雨', '雪', '风', '指定', '向东', '向西'].includes(mode)) {
+        return 'other-mode';
+      }
+      return 'unknown-mode';
+    },
+    // 获取故障显示样式类
+    faultClass() {
+      if (this.faultInfo === '无故障') {
+        return 'no-fault';
+      } else {
+        return 'has-fault';
+      }
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.device-status-info {
+  background-color: #fff;
+  border-top: 1px solid #ddd;
+  padding: 10px 15px;
+  margin-top: auto;
+  display: flex;
+  height: 40px;
+  justify-content: space-around;
+}
+
+.info-section {
+  display: flex;
+  margin-bottom: 8px;
+
+  &:last-child {
+    margin-bottom: 0;
+  }
+}
+
+.info-title {
+  font-size: 14px;
+  font-weight: bold;
+  color: #333;
+  width: 65px;
+  flex-shrink: 0;
+}
+
+.info-content {
+  flex: 1;
+}
+
+.mode-text {
+  font-size: 14px;
+  padding: 0px 10px 0px 2px;
+  border-radius: 4px;
+  &.manual-mode {
+    color: #e17055;
+  }
+  &.auto-mode {
+    color: #666;
+  }
+  &.other-mode {
+    color: #666;
+  }
+  &.unknown-mode {
+    color: #666;
+  }
+}
+
+.fault-text {
+  font-size: 14px;
+  padding: 0px 10px 0px 2px;
+  border-radius: 4px;
+  &.no-fault {
+    color: #666;
+  }
+  &.has-fault {
+    color: #666;
+  }
+}
+</style>

+ 144 - 0
pages/components/header.vue

@@ -0,0 +1,144 @@
+<!-- BluetoothHeader.vue -->
+<template>
+  <view class="header">
+    <u-row>
+      <u-col span="2">
+        <view class="status-btn" :class="{ active_btn: linkStatus }">Link</view>
+      </u-col>
+      <u-col span="2">
+        <view class="status-btn" :class="{ active_btn: bleConnected }">blue</view>
+      </u-col>
+      <u-col span="4" textAlign="left">
+        <text class="title">长沙亿旭智能</text>
+      </u-col>
+      <u-col span="4">
+        <view class="text-lable">2025.12.02 V1.0</view>
+        <view class="typeSelect" @click="toggleAgreementType">
+          {{ agreementTypeName }}
+          <u-icon name="arrow-down-fill" color="#fff" size="16"></u-icon>
+        </view>
+      </u-col>
+    </u-row>
+
+    <u-action-sheet
+        :show="showAgreementType"
+        :actions="typeOptions"
+        title="请选择协议类型"
+        @close="closeAgreementType"
+        @select="selectAgreementType"
+    >
+    </u-action-sheet>
+  </view>
+</template>
+
+<script>
+import {setAgreement,getAgreement} from '@/utils/modbus.js';
+export default {
+  data() {
+    return {
+      communicationTimer: null,
+      linkStatus:false,
+      showAgreementType: false,
+      agreementTypeName: "",
+      typeOptions: [
+        {name: 'Lora', value: 'Lora'},
+        {name: 'zigbee', value: 'zigbee'}
+      ],
+    }
+  },
+  computed: {
+    bleConnected() {
+      return this.$store.getters['ble/connected']
+    },
+    bleData() {
+      return this.$store.getters['ble/data']
+    }
+  },
+  watch: {
+    bleData: {
+      handler(newData, oldData) {
+        if (newData) {
+          console.log('接收到蓝牙数据:------------------')
+          // 清除之前的定时器
+          if (this.communicationTimer) {
+            clearTimeout(this.communicationTimer)
+            this.communicationTimer = null
+          }
+          if (newData.device !== '255'){
+              // 设置通信链接状态为 true
+              this.linkStatus = true
+          }
+          // 将数据传递给父组件
+          this.$emit('ble-data-received', newData);
+
+          this.communicationTimer = setTimeout(() => {
+            this.linkStatus = false
+            this.communicationTimer = null
+          }, 5000)
+        }
+      },
+      deep: true, // 深度监听,确保嵌套对象变化时也能触发
+      immediate: true // 立即执行一次
+    }
+  },
+  mounted() {
+    this.agreementTypeName = getAgreement()
+  },
+  methods: {
+    toggleAgreementType() {
+      this.showAgreementType = true;
+    },
+    closeAgreementType() {
+      this.showAgreementType = false;
+    },
+    selectAgreementType(e) {
+      setAgreement(e.name);
+      this.agreementTypeName = getAgreement()
+    }
+  }
+}
+</script>
+
+<style lang="scss">
+// 头部样式
+.header {
+  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
+  padding: 20rpx;
+
+  .status-btn {
+    background-color: #ff4757;
+    border: none;
+    margin-left: 0px;
+    padding: 0px;
+    width: 40px;
+    text-align: center;
+    color: white;
+    border-radius: 4px;
+    height: 20px;
+    line-height: 20px;
+  }
+  .active_btn {
+    background-color: yellowgreen !important;
+  }
+
+
+
+  .title {
+    color: #fff;
+    font-size: 36rpx;
+    font-weight: bold;
+  }
+}
+.typeSelect{
+  font-size: 16px;
+  color: #fff;
+  font-weight: 600;
+  display: flex;
+  justify-content: flex-end;
+}
+.text-lable{
+  color: #fff;
+  font-size: 12px;
+  text-align: right;
+}
+</style>

+ 0 - 52
pages/index.vue

@@ -1,52 +0,0 @@
-<template>
-  <view class="content">
-    <view class="text-area">
-      <text class="title">跳转中。。</text>
-    </view>
-  </view>
-</template>
-
-<script>
-import { getToken, setToken, removeToken } from '@/utils/auth'
-  export default {
-    onLoad: function(opt) {
-      let token = opt.token;
-
-      if(token){
-        let deptNum = opt.deptId;
-        setToken(token)
-        uni.reLaunch({
-          url: '/subpkg/device/index?deptId='+deptNum
-        });
-      }
-    }
-  }
-</script>
-
-<style>
-  .content {
-    display: flex;
-    flex-direction: column;
-    align-items: center;
-    justify-content: center;
-  }
-
-  .logo {
-    height: 200rpx;
-    width: 200rpx;
-    margin-top: 200rpx;
-    margin-left: auto;
-    margin-right: auto;
-    margin-bottom: 50rpx;
-  }
-
-  .text-area {
-    display: flex;
-    justify-content: center;
-  }
-
-  .title {
-    font-size: 36rpx;
-    color: #8f8f94;
-  }
-</style>

+ 0 - 442
pages/login.vue

@@ -1,442 +0,0 @@
-<template>
-	<view class="normal-login-container"
-		style="background-image: url('https://jianyaoji.oss-cn-hangzhou.aliyuncs.com/jianyaoji/images/login/bg.png');background-size: 100% 100%;">
-		<view class="logo-content align-center justify-center flex">
-			<!--      <image style="width: 100rpx;height: 100rpx;" :src="globalConfig.appInfo.logo" mode="widthFix">-->
-			<!--      </image>-->
-			<text class="title">老药师云平台移动端登录</text>
-		</view>
-		<view style="position: fixed;top:1vw;left:1vh;font-size: 12px;color: white;">
-			版本号:{{version}}
-		</view>
-		<view class="login-form-content">
-			<view class="input-item flex align-center">
-				<view class="iconfont icon-user icon"></view>
-				<input v-model="loginForm.username" class="input" type="text" placeholder="请输入账号" maxlength="30" />
-			</view>
-			<view class="input-item flex align-center">
-				<view class="iconfont icon-password icon"></view>
-				<input v-model="loginForm.password" type="password" class="input" placeholder="请输入密码" maxlength="20" />
-			</view>
-			<view class="input-item flex align-center" style="width: 60%;margin: 0px;" v-if="captchaEnabled">
-				<view class="iconfont icon-code icon"></view>
-				<input v-model="loginForm.code" type="number" class="input" placeholder="请输入验证码" maxlength="4" />
-				<view class="login-code">
-					<image :src="codeUrl" @click="getCode" class="login-code-img"></image>
-				</view>
-			</view>
-			<view class="action-btn">
-				<button @click="handleLogin" class="login-btn cu-btn block bg-blue lg round">登 录</button>
-			</view>
-			<view class="action-btn">
-				<button class="login-btn cu-btn block bg-blue lg round" open-type="getPhoneNumber"
-					@getphonenumber="getPhoneNumber">注 册</button>
-			</view>
-		</view>
-
-		<view class="xieyi text-center">
-			<!--      <text class="text-grey1">登录即代表同意</text>-->
-			<!--      <text @click="handleUserAgrement" class="text-blue">《用户协议》</text>-->
-			<!--      <text @click="handlePrivacy" class="text-blue">《隐私协议》</text>-->
-		</view>
-		<u-modal title="客户注册信息" @cancel="closeDlg" confirmText="提交审核" :showCancelButton="true" @confirm="submitReg"
-			:show="show">
-			<view class="slot-content">
-				<u--form labelPosition="left" :model="model1" ref="s">
-					<u-form-item label="*客户名称:" prop="chooseUser.deptName" borderBottom ref="item1" labelWidth="auto">
-						<u--input v-model="chooseUser.deptName" border="none"></u--input>
-					</u-form-item>
-					<u-form-item label="*联系人:" prop="chooseUser.leader" borderBottom ref="item1" labelWidth="auto">
-						<u--input v-model="chooseUser.leader" border="none"></u--input>
-					</u-form-item>
-
-					<u-form-item label="手机号:" prop="chooseUser.phone" borderBottom ref="item1" labelWidth="auto">
-						<u--input v-model="chooseUser.phone" border="none"></u--input>
-					</u-form-item>
-
-					<u-form-item label="*密码:" prop="chooseUser.password" borderBottom ref="item1" labelWidth="auto">
-						<u--input v-if="show" v-model="chooseUser.password" border="none"></u--input>
-					</u-form-item>
-					<u-form-item label="登录账号:" borderBottom ref="item1" labelWidth="auto">
-						<u--input v-model="chooseUser.phone" border="none" disabled></u--input>
-					</u-form-item>
-					<u-form-item label="*订单图片:" borderBottom ref="item1" labelWidth="auto">
-						<u-upload :fileList="fileList" name="1" multiple :maxCount="1" :previewFullImage="true"
-							:width="auto" :height="auto" @delete="deletePic" @afterRead="afterRead"></u-upload>
-					</u-form-item>
-				</u--form>
-			</view>
-		</u-modal>
-		<u-modal title="注册记录" @cancel="closereg" confirmText="重新注册" :showCancelButton="true" @confirm="submitRegTo"
-			:show="registersshow">
-			<view class="slot-content">
-				<u--form labelPosition="left" :model="model1" ref="s">
-					<u-form-item label="客户名称:" prop="registers.deptName" borderBottom ref="item1" labelWidth="auto">
-						<u--input v-model="registers.deptName" border="none" :disabled="true"></u--input>
-					</u-form-item>
-					<u-form-item label="联系人:" prop="registers.leader" borderBottom ref="item1" labelWidth="auto">
-						<u--input v-model="registers.leader" border="none" :disabled="true"></u--input>
-					</u-form-item>
-
-					<u-form-item label="手机号:" prop="registers.phone" borderBottom ref="item1" labelWidth="auto">
-						<u--input v-model="registers.phone" border="none" :disabled="true"></u--input>
-					</u-form-item>
-
-					<u-form-item label="密码:" prop="registers.password" borderBottom ref="item1" labelWidth="auto">
-						<u--input v-if="registersshow" v-model="registers.password" border="none"
-							:disabled="true"></u--input>
-					</u-form-item>
-					<u-form-item label="登录账号:" borderBottom ref="item1" labelWidth="auto">
-						<u--input v-model="registers.phone" border="none" disabled :disabled="true"></u--input>
-					</u-form-item>
-					<u-form-item label="注册状态:" borderBottom ref="item1" labelWidth="auto">
-						<!-- this.registers.status==1&&this.registers.delFlag==0 -->
-						<view v-if="registers.status==0" style="color:#1a62ff;">审核中</view>
-						<view v-if="registers.status==1&&registers.delFlag==0">审核完成,<text
-								style="color: crimson;">未通过原因:</text><text>{{registers.remark}}</text></view>
-					</u-form-item>
-				</u--form>
-			</view>
-		</u-modal>
-	</view>
-</template>
-
-<script>
-	import {
-		getCodeImg,
-		uploadRegister,
-		getPhone,
-		checkReg
-	} from '@/api/login'
-	import {
-		getToken
-	} from "@/utils/auth";
-	import {
-		checkStr
-	} from "@/utils/validate";
-	export default {
-		data() {
-			return {
-				version: "",
-				codeUrl: "",
-				captchaEnabled: true,
-				globalConfig: getApp().globalData.config,
-				loginForm: {
-					username: "",
-					password: "",
-					code: "",
-					uuid: '',
-				},
-				show: false,
-				chooseUser: {},
-				fileList: [],
-				registers: {},
-				registersshow: false
-			}
-		},
-		created() {
-			this.show = false,
-				this.getVersion();
-			this.checkLogin();
-		},
-		methods: {
-			getPhoneNumber(e) {
-				console.log(e.detail.code) // 动态令牌
-				// console.log(e.detail.code)  // 动态令牌
-				//     console.log(e.detail.errMsg) // 回调信息(成功失败都会返回)
-				//     console.log(e.detail.errno)  // 错误码(失败时返回)
-				this.newUser(e.detail.code);
-			},
-			toRegister() {
-
-			},
-			submitReg() {
-				//注册数据提交
-				if (this.chooseUser.deptName === ""||this.chooseUser.deptName ==null) {
-					this.$modal.msgError("请输入客户名")
-				} else if (this.chooseUser.phone === ""||this.chooseUser.phone ==null) {
-					this.$modal.msgError("请输入手机号")
-				} else if (this.chooseUser.leader === ""||this.chooseUser.leader ==null) {
-					this.$modal.msgError("请输入负责人")
-				} else if(this.chooseUser.password === ""||this.chooseUser.password ==null) {
-					this.$modal.msgError("请输入登录密码")
-				}else if(this.fileList[0]===''||this.fileList[0]==null){
-					this.$modal.msgError("请输上传订单图片")
-				}else{
-				uploadRegister({
-					formdata: this.chooseUser,
-					name: 'register',
-					file: this.fileList[0].url
-				}).then(res => {
-					uni.showToast({
-						title: '注册信息已提交',
-						duration: 2000
-					});
-					this.show = false
-				})
-				}
-			},
-			deletePic(event) {
-				this.fileList = []
-			},
-			async afterRead(file, lists, name) {
-				//{"file":[{"size":542091,"type":"image","url":"http://tmp/MPgJgECRVMUFe49f23795545b0cd35400a9b70a9f918.jpg",
-				//"thumb":"http://tmp/MPgJgECRVMUFe49f23795545b0cd35400a9b70a9f918.jpg"}],"name":"1","index":0}
-				if (file.file[0].size > 2048 * 1000) {
-					this.$modal.errMsg("图片大于2M")
-				} else {
-					this.fileList = file.file
-				}
-			},
-			newUser(code) {
-				let self = this
-				uni.showLoading({
-					title: '获取手机号...'
-				});
-				wx.login({
-					success(res) {
-						if (res.code) {
-							let data = {
-								loginCode: res.code,
-								phoneCode: code
-							}
-							//获取到手机号
-							getPhone(data).then(res => {
-								//console.log("获取到手机号信息结果<>>" + JSON.stringify(res))
-								if (checkStr(res.data.phone, 'mobile')) {
-									//console.log("................" + res.data.phone)
-									self.chooseUser.phone = res.data.phone
-									self.chooseUser.openId = res.data.openId
-									//通过手机号校验注册信息
-									checkReg(res.data.phone).then(res => {
-										//console.log("校验注册信息结果<>>" + JSON.stringify(res))
-										if (res.data.code == 0) {
-											//已注册待审核
-											self.registers = res.data.res
-											self.registersshow = true
-										} else if (res.data.code == 1) {
-											//已注册且通过审核,但是用户可能已被删除
-											self.show = true;
-										} else if (res.data.code == 2) {
-											//未注册,进入注册页
-											self.show = true;
-										} else if(res.data.code==3){
-											uni.showToast({
-												title: '已存在客户信息',
-												duration: 2000,
-												icon:'none'
-											});
-										}else{
-											//已注册未通过审核
-											self.registers = res.data.res
-											self.registersshow = true
-										}
-										uni.hideLoading();
-									}).catch(res => {
-										uni.showToast({
-											title: '校验信息失败',
-											duration: 2000,
-											icon:'none'
-										});
-									})
-								} else {
-									uni.showToast({
-										title: '手机号获取异常',
-										duration: 2000,
-										icon:'none'
-									});
-								}
-								//self.show = true;
-							}).catch(res => {
-								uni.showToast({
-									title: '获取手机号异常',
-									duration: 2000,
-									icon:'none'
-								});
-							})
-						} else {
-							console.log('获取code失败!' + res.errMsg)
-						}
-					}
-				})
-			},
-			closereg() {
-				this.registersshow = false
-				this.registers = {}
-			},
-			submitRegTo() {
-				//审核中
-				if (this.registers.status == 0) {
-					uni.showToast({
-						title: '已在审核中...',
-						duration: 1500,
-						icon: 'loading'
-					});
-					this.registersshow = false
-					this.show = false
-					this.registers = {}
-				} else if (this.registers.status == 1 && this.registers.delFlag == 0) {
-					//审核完成且失败允许重新注册
-					this.registersshow = false
-					this.show = true
-				}
-			},
-			closeDlg() {
-				this.show = false;
-				this.chooseUser = {};
-			},
-			checkLogin() {
-				let token = getToken()
-				if (token) {
-					this.loginSuccess()
-				} else {
-					this.getCode()
-				}
-			},
-			// 隐私协议
-			handlePrivacy() {
-				let site = this.globalConfig.appInfo.agreements[0]
-				this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`)
-			},
-			// 用户协议
-			handleUserAgrement() {
-				let site = this.globalConfig.appInfo.agreements[1]
-				this.$tab.navigateTo(`/pages/common/webview/index?title=${site.title}&url=${site.url}`)
-			},
-			// 获取图形验证码
-			getCode() {
-				getCodeImg().then(res => {
-					this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled
-					if (this.captchaEnabled) {
-						this.codeUrl = 'data:image/gif;base64,' + res.img
-						this.loginForm.uuid = res.uuid
-					}
-				})
-			},
-			getVersion() {
-				let appBaseInfo = uni.getAppBaseInfo();
-				let appVersionCode = appBaseInfo.appVersionCode;
-				this.version = appVersionCode;
-			},
-			// 登录方法
-			async handleLogin() {
-				if (this.loginForm.username === "") {
-					this.$modal.msgError("请输入您的账号")
-				} else if (this.loginForm.password === "") {
-					this.$modal.msgError("请输入您的密码")
-				} else if (this.loginForm.code === "" && this.captchaEnabled) {
-					this.$modal.msgError("请输入验证码")
-				} else {
-					this.$modal.loading("登录中,请耐心等待...")
-					this.pwdLogin()
-				}
-			},
-			// 密码登录
-			async pwdLogin() {
-				this.$store.dispatch('Login', this.loginForm).then(() => {
-					this.$modal.closeLoading()
-					this.loginSuccess()
-				}).catch(() => {
-					if (this.captchaEnabled) {
-						this.getCode()
-					}
-				})
-			},
-			// 登录成功后,处理函数
-			loginSuccess(result) {
-				// 设置用户信息
-				this.$store.dispatch('GetInfo').then(res => {
-					this.$tab.reLaunch('/pages/work/index')
-				})
-			}
-		}
-	}
-</script>
-
-<style lang="scss">
-	page {
-		background-color: #ffffff;
-	}
-
-	.normal-login-container {
-		width: 100%;
-		position: absolute;
-		top: 0px;
-		bottom: 0;
-		left: 0;
-		right: 0;
-
-		.logo-content {
-			width: 100%;
-			font-size: 21px;
-			text-align: center;
-			padding-top: 15%;
-
-			image {
-				border-radius: 4px;
-			}
-
-			.title {
-				margin-left: 10px;
-				color: #FFFFFF;
-				font-size: 56rpx;
-			}
-		}
-
-		.login-form-content {
-			text-align: center;
-			margin: 20px auto;
-			margin-top: 15%;
-			width: 90%;
-			background: white;
-			border-radius: 30rpx;
-			box-shadow: 0rpx 5rpx 27rpx 0rpx rgba(195, 195, 195, 2.4);
-			padding: 10%;
-
-			.input-item {
-				margin: 20px auto;
-				background-color: #f5f6f7;
-				height: 45px;
-				border-radius: 20px;
-
-				.icon {
-					font-size: 38rpx;
-					margin-left: 10px;
-					color: #999;
-				}
-
-				.input {
-					width: 100%;
-					font-size: 14px;
-					line-height: 20px;
-					text-align: left;
-					padding-left: 15px;
-					//background: rgb(224,236,255);
-				}
-
-			}
-
-			.login-btn {
-				margin-top: 40px;
-				height: 45px;
-			}
-
-			.xieyi {
-				color: #333;
-				margin-top: 20px;
-			}
-
-			.login-code {
-				height: 38px;
-				float: right;
-
-				.login-code-img {
-					height: 38px;
-					position: absolute;
-					margin-left: 10px;
-					width: 200rpx;
-				}
-			}
-		}
-	}
-</style>

+ 0 - 75
pages/mine/about/index.vue

@@ -1,75 +0,0 @@
-<template>
-  <view class="about-container">
-    <view class="header-section text-center">
-      <image style="width: 150rpx;height: 150rpx;" src="/static/logo200.png" mode="widthFix">
-      </image>
-      <uni-title type="h2" title="云平台移动端"></uni-title>
-    </view>
-
-    <view class="content-section">
-      <view class="menu-list">
-        <view class="list-cell list-cell-arrow">
-          <view class="menu-item-box">
-            <view>版本信息</view>
-            <view class="text-right">v{{version}}</view>
-          </view>
-        </view>
-        <view class="list-cell list-cell-arrow">
-          <view class="menu-item-box">
-            <view>官方邮箱</view>
-            <view class="text-right">ruoyi@xx.com</view>
-          </view>
-        </view>
-        <view class="list-cell list-cell-arrow">
-          <view class="menu-item-box">
-            <view>服务热线</view>
-            <view class="text-right">400-999-9999</view>
-          </view>
-        </view>
-        <view class="list-cell list-cell-arrow">
-          <view class="menu-item-box">
-            <view>公司网站</view>
-            <view class="text-right">
-              <uni-link :href="url" :text="url" showUnderLine="false"></uni-link>
-            </view>
-          </view>
-        </view>
-      </view>
-    </view>
-
-    <view class="copyright">
-      <view>Copyright &copy; 2022 ruoyi.vip All Rights Reserved.</view>
-    </view>
-  </view>
-</template>
-
-<script>
-  export default {
-    data() {
-      return {
-        url: getApp().globalData.config.appInfo.site_url,
-        version: getApp().globalData.config.appInfo.version
-      }
-    }
-  }
-</script>
-
-<style lang="scss">
-  page {
-    background-color: #f8f8f8;
-  }
-
-  .copyright {
-    margin-top: 50rpx;
-    text-align: center;
-    line-height: 60rpx;
-    color: #999;
-  }
-
-  .header-section {
-    display: flex;
-    padding: 30rpx 0 0;
-    flex-direction: column;
-    align-items: center;
-  }
-</style>

+ 0 - 631
pages/mine/avatar/index.vue

@@ -1,631 +0,0 @@
-<template>
-	<view class="container">
-		<view class="page-body uni-content-info">
-			<view class='cropper-content'>
-				<view v-if="isShowImg" class="uni-corpper" :style="'width:'+cropperInitW+'px;height:'+cropperInitH+'px;background:#000'">
-					<view class="uni-corpper-content" :style="'width:'+cropperW+'px;height:'+cropperH+'px;left:'+cropperL+'px;top:'+cropperT+'px'">
-						<image :src="imageSrc" :style="'width:'+cropperW+'px;height:'+cropperH+'px'"></image>
-						<view class="uni-corpper-crop-box" @touchstart.stop="contentStartMove" @touchmove.stop="contentMoveing" @touchend.stop="contentTouchEnd"
-						    :style="'left:'+cutL+'px;top:'+cutT+'px;right:'+cutR+'px;bottom:'+cutB+'px'">
-							<view class="uni-cropper-view-box">
-								<view class="uni-cropper-dashed-h"></view>
-								<view class="uni-cropper-dashed-v"></view>
-								<view class="uni-cropper-line-t" data-drag="top" @touchstart.stop="dragStart" @touchmove.stop="dragMove"></view>
-								<view class="uni-cropper-line-r" data-drag="right" @touchstart.stop="dragStart" @touchmove.stop="dragMove"></view>
-								<view class="uni-cropper-line-b" data-drag="bottom" @touchstart.stop="dragStart" @touchmove.stop="dragMove"></view>
-								<view class="uni-cropper-line-l" data-drag="left" @touchstart.stop="dragStart" @touchmove.stop="dragMove"></view>
-								<view class="uni-cropper-point point-t" data-drag="top" @touchstart.stop="dragStart" @touchmove.stop="dragMove"></view>
-								<view class="uni-cropper-point point-tr" data-drag="topTight"></view>
-								<view class="uni-cropper-point point-r" data-drag="right" @touchstart.stop="dragStart" @touchmove.stop="dragMove"></view>
-								<view class="uni-cropper-point point-rb" data-drag="rightBottom" @touchstart.stop="dragStart" @touchmove.stop="dragMove"></view>
-								<view class="uni-cropper-point point-b" data-drag="bottom" @touchstart.stop="dragStart" @touchmove.stop="dragMove" @touchend.stop="dragEnd"></view>
-								<view class="uni-cropper-point point-bl" data-drag="bottomLeft"></view>
-								<view class="uni-cropper-point point-l" data-drag="left" @touchstart.stop="dragStart" @touchmove.stop="dragMove"></view>
-								<view class="uni-cropper-point point-lt" data-drag="leftTop"></view>
-							</view>
-						</view>
-					</view>
-				</view>
-			</view>
-			<view class='cropper-config'>
-				<button type="primary reverse" @click="getImage" style='margin-top: 30rpx;'> 选择头像 </button>
-				<button type="warn" @click="getImageInfo" style='margin-top: 30rpx;'> 提交 </button>
-			</view>
-			<canvas canvas-id="myCanvas" :style="'position:absolute;border: 1px solid red; width:'+imageW+'px;height:'+imageH+'px;top:-9999px;left:-9999px;'"></canvas>
-		</view>
-	</view>
-</template>
-
-<script>
-  import config from '@/config'
-  import store from "@/store"
-  import { uploadAvatar } from "@/api/system/user"
-  
-  const baseUrl = config.baseUrl
-	let sysInfo = uni.getSystemInfoSync()
-	let SCREEN_WIDTH = sysInfo.screenWidth
-	let PAGE_X, // 手按下的x位置
-		PAGE_Y, // 手按下y的位置 
-		PR = sysInfo.pixelRatio, // dpi
-		T_PAGE_X, // 手移动的时候x的位置
-		T_PAGE_Y, // 手移动的时候Y的位置
-		CUT_L, // 初始化拖拽元素的left值
-		CUT_T, // 初始化拖拽元素的top值
-		CUT_R, // 初始化拖拽元素的
-		CUT_B, // 初始化拖拽元素的
-		CUT_W, // 初始化拖拽元素的宽度
-		CUT_H, //  初始化拖拽元素的高度
-		IMG_RATIO, // 图片比例
-		IMG_REAL_W, // 图片实际的宽度
-		IMG_REAL_H, // 图片实际的高度
-		DRAFG_MOVE_RATIO = 1, //移动时候的比例,
-		INIT_DRAG_POSITION = 100, // 初始化屏幕宽度和裁剪区域的宽度之差,用于设置初始化裁剪的宽度
-		DRAW_IMAGE_W = sysInfo.screenWidth // 设置生成的图片宽度
-
-	export default {
-		/**
-		 * 页面的初始数据
-		 */
-		data() {
-			return {
-				imageSrc: store.getters.avatar,
-				isShowImg: false,
-				// 初始化的宽高
-				cropperInitW: SCREEN_WIDTH,
-				cropperInitH: SCREEN_WIDTH,
-				// 动态的宽高
-				cropperW: SCREEN_WIDTH,
-				cropperH: SCREEN_WIDTH,
-				// 动态的left top值
-				cropperL: 0,
-				cropperT: 0,
-
-				transL: 0,
-				transT: 0,
-
-				// 图片缩放值
-				scaleP: 0,
-				imageW: 0,
-				imageH: 0,
-
-				// 裁剪框 宽高
-				cutL: 0,
-				cutT: 0,
-				cutB: SCREEN_WIDTH,
-				cutR: '100%',
-				qualityWidth: DRAW_IMAGE_W,
-				innerAspectRadio: DRAFG_MOVE_RATIO
-			}
-		},
-		/**
-		 * 生命周期函数--监听页面初次渲染完成
-		 */
-		onReady: function () {
-			this.loadImage()
-		},
-		methods: {
-			setData: function (obj) {
-				let that = this
-				Object.keys(obj).forEach(function (key) {
-					that.$set(that.$data, key, obj[key])
-				})
-			},
-			getImage: function () {
-				var _this = this
-				uni.chooseImage({
-					success: function (res) {
-						_this.setData({
-							imageSrc: res.tempFilePaths[0],
-						})
-						_this.loadImage()
-					},
-				})
-			},
-			loadImage: function () {
-				var _this = this
-
-				uni.getImageInfo({
-					src: _this.imageSrc,
-					success: function success(res) {
-						IMG_RATIO = 1 / 1
-						if (IMG_RATIO >= 1) {
-							IMG_REAL_W = SCREEN_WIDTH
-							IMG_REAL_H = SCREEN_WIDTH / IMG_RATIO
-						} else {
-							IMG_REAL_W = SCREEN_WIDTH * IMG_RATIO
-							IMG_REAL_H = SCREEN_WIDTH
-						}
-						let minRange = IMG_REAL_W > IMG_REAL_H ? IMG_REAL_W : IMG_REAL_H
-						INIT_DRAG_POSITION = minRange > INIT_DRAG_POSITION ? INIT_DRAG_POSITION : minRange
-						// 根据图片的宽高显示不同的效果   保证图片可以正常显示
-						if (IMG_RATIO >= 1) {
-							let cutT = Math.ceil((SCREEN_WIDTH / IMG_RATIO - (SCREEN_WIDTH / IMG_RATIO - INIT_DRAG_POSITION)) / 2)
-							let cutB = cutT
-							let cutL = Math.ceil((SCREEN_WIDTH - SCREEN_WIDTH + INIT_DRAG_POSITION) / 2)
-							let cutR = cutL
-							_this.setData({
-								cropperW: SCREEN_WIDTH,
-								cropperH: SCREEN_WIDTH / IMG_RATIO,
-								// 初始化left right
-								cropperL: Math.ceil((SCREEN_WIDTH - SCREEN_WIDTH) / 2),
-								cropperT: Math.ceil((SCREEN_WIDTH - SCREEN_WIDTH / IMG_RATIO) / 2),
-								cutL: cutL,
-								cutT: cutT,
-								cutR: cutR,
-								cutB: cutB,
-								// 图片缩放值
-								imageW: IMG_REAL_W,
-								imageH: IMG_REAL_H,
-								scaleP: IMG_REAL_W / SCREEN_WIDTH,
-								qualityWidth: DRAW_IMAGE_W,
-								innerAspectRadio: IMG_RATIO
-							})
-						} else {
-							let cutL = Math.ceil((SCREEN_WIDTH * IMG_RATIO - (SCREEN_WIDTH * IMG_RATIO)) / 2)
-							let cutR = cutL
-							let cutT = Math.ceil((SCREEN_WIDTH - INIT_DRAG_POSITION) / 2)
-							let cutB = cutT
-							_this.setData({
-								cropperW: SCREEN_WIDTH * IMG_RATIO,
-								cropperH: SCREEN_WIDTH,
-								// 初始化left right
-								cropperL: Math.ceil((SCREEN_WIDTH - SCREEN_WIDTH * IMG_RATIO) / 2),
-								cropperT: Math.ceil((SCREEN_WIDTH - SCREEN_WIDTH) / 2),
-
-								cutL: cutL,
-								cutT: cutT,
-								cutR: cutR,
-								cutB: cutB,
-								// 图片缩放值
-								imageW: IMG_REAL_W,
-								imageH: IMG_REAL_H,
-								scaleP: IMG_REAL_W / SCREEN_WIDTH,
-								qualityWidth: DRAW_IMAGE_W,
-								innerAspectRadio: IMG_RATIO
-							})
-						}
-						_this.setData({
-							isShowImg: true
-						})
-						uni.hideLoading()
-					}
-				})
-			},
-			// 拖动时候触发的touchStart事件
-			contentStartMove(e) {
-				PAGE_X = e.touches[0].pageX
-				PAGE_Y = e.touches[0].pageY
-			},
-
-			// 拖动时候触发的touchMove事件
-			contentMoveing(e) {
-				var _this = this
-				var dragLengthX = (PAGE_X - e.touches[0].pageX) * DRAFG_MOVE_RATIO
-				var dragLengthY = (PAGE_Y - e.touches[0].pageY) * DRAFG_MOVE_RATIO
-				// 左移
-				if (dragLengthX > 0) {
-					if (this.cutL - dragLengthX < 0) dragLengthX = this.cutL
-				} else {
-					if (this.cutR + dragLengthX < 0) dragLengthX = -this.cutR
-				}
-
-				if (dragLengthY > 0) {
-					if (this.cutT - dragLengthY < 0) dragLengthY = this.cutT
-				} else {
-					if (this.cutB + dragLengthY < 0) dragLengthY = -this.cutB
-				}
-				this.setData({
-					cutL: this.cutL - dragLengthX,
-					cutT: this.cutT - dragLengthY,
-					cutR: this.cutR + dragLengthX,
-					cutB: this.cutB + dragLengthY
-				})
-
-				PAGE_X = e.touches[0].pageX
-				PAGE_Y = e.touches[0].pageY
-			},
-
-			contentTouchEnd() {
-
-			},
-
-			// 获取图片
-			getImageInfo() {
-				var _this = this
-				uni.showLoading({
-					title: '图片生成中...',
-				})
-				// 将图片写入画布
-				const ctx = uni.createCanvasContext('myCanvas')
-				ctx.drawImage(_this.imageSrc, 0, 0, IMG_REAL_W, IMG_REAL_H)
-				ctx.draw(true, () => {
-					// 获取画布要裁剪的位置和宽度   均为百分比 * 画布中图片的宽度    保证了在微信小程序中裁剪的图片模糊  位置不对的问题 canvasT = (_this.cutT / _this.cropperH) * (_this.imageH / pixelRatio)
-					var canvasW = ((_this.cropperW - _this.cutL - _this.cutR) / _this.cropperW) * IMG_REAL_W
-					var canvasH = ((_this.cropperH - _this.cutT - _this.cutB) / _this.cropperH) * IMG_REAL_H
-					var canvasL = (_this.cutL / _this.cropperW) * IMG_REAL_W
-					var canvasT = (_this.cutT / _this.cropperH) * IMG_REAL_H
-					uni.canvasToTempFilePath({
-						x: canvasL,
-						y: canvasT,
-						width: canvasW,
-						height: canvasH,
-						destWidth: canvasW,
-						destHeight: canvasH,
-						quality: 0.5,
-						canvasId: 'myCanvas',
-						success: function (res) {
-							uni.hideLoading()
-							let data = {name: 'avatarfile', filePath: res.tempFilePath}
-							uploadAvatar(data).then(response => {
-								store.commit('SET_AVATAR', baseUrl + response.imgUrl)
-								uni.showToast({ title: "修改成功", icon: 'success' })
-								uni.navigateBack()
-							})
-						}
-					})
-				})
-			},
-			// 设置大小的时候触发的touchStart事件
-			dragStart(e) {
-				T_PAGE_X = e.touches[0].pageX
-				T_PAGE_Y = e.touches[0].pageY
-				CUT_L = this.cutL
-				CUT_R = this.cutR
-				CUT_B = this.cutB
-				CUT_T = this.cutT
-			},
-
-			// 设置大小的时候触发的touchMove事件
-			dragMove(e) {
-				var _this = this
-				var dragType = e.target.dataset.drag
-				switch (dragType) {
-					case 'right':
-						var dragLength = (T_PAGE_X - e.touches[0].pageX) * DRAFG_MOVE_RATIO
-						if (CUT_R + dragLength < 0) dragLength = -CUT_R
-						this.setData({
-							cutR: CUT_R + dragLength
-						})
-						break
-					case 'left':
-						var dragLength = (T_PAGE_X - e.touches[0].pageX) * DRAFG_MOVE_RATIO
-						if (CUT_L - dragLength < 0) dragLength = CUT_L
-						if ((CUT_L - dragLength) > (this.cropperW - this.cutR)) dragLength = CUT_L - (this.cropperW - this.cutR)
-						this.setData({
-							cutL: CUT_L - dragLength
-						})
-						break
-					case 'top':
-						var dragLength = (T_PAGE_Y - e.touches[0].pageY) * DRAFG_MOVE_RATIO
-						if (CUT_T - dragLength < 0) dragLength = CUT_T
-						if ((CUT_T - dragLength) > (this.cropperH - this.cutB)) dragLength = CUT_T - (this.cropperH - this.cutB)
-						this.setData({
-							cutT: CUT_T - dragLength
-						})
-						break
-					case 'bottom':
-						var dragLength = (T_PAGE_Y - e.touches[0].pageY) * DRAFG_MOVE_RATIO
-						if (CUT_B + dragLength < 0) dragLength = -CUT_B
-						this.setData({
-							cutB: CUT_B + dragLength
-						})
-						break
-					case 'rightBottom':
-						var dragLengthX = (T_PAGE_X - e.touches[0].pageX) * DRAFG_MOVE_RATIO
-						var dragLengthY = (T_PAGE_Y - e.touches[0].pageY) * DRAFG_MOVE_RATIO
-
-						if (CUT_B + dragLengthY < 0) dragLengthY = -CUT_B
-						if (CUT_R + dragLengthX < 0) dragLengthX = -CUT_R
-						let cutB = CUT_B + dragLengthY
-						let cutR = CUT_R + dragLengthX
-
-						this.setData({
-							cutB: cutB,
-							cutR: cutR
-						})
-						break
-					default:
-						break
-				}
-			}
-		}
-	}
-</script>
-
-<style>
-	/* pages/uni-cropper/index.wxss */
-
-	.uni-content-info {
-		/* position: fixed;
-		top: 0;
-		left: 0;
-		right: 0;
-		bottom: 0;
-		display: block;
-		align-items: center;
-		flex-direction: column; */
-	}
-
-	.cropper-config {
-		padding: 20rpx 40rpx;
-	}
-
-	.cropper-content {
-		min-height: 750rpx;
-		width: 100%;
-	}
-
-	.uni-corpper {
-		position: relative;
-		overflow: hidden;
-		-webkit-user-select: none;
-		-moz-user-select: none;
-		-ms-user-select: none;
-		user-select: none;
-		-webkit-tap-highlight-color: transparent;
-		-webkit-touch-callout: none;
-		box-sizing: border-box;
-	}
-
-	.uni-corpper-content {
-		position: relative;
-	}
-
-	.uni-corpper-content image {
-		display: block;
-		width: 100%;
-		min-width: 0 !important;
-		max-width: none !important;
-		height: 100%;
-		min-height: 0 !important;
-		max-height: none !important;
-		image-orientation: 0deg !important;
-		margin: 0 auto;
-	}
-	/* 移动图片效果 */
-
-	.uni-cropper-drag-box {
-		position: absolute;
-		top: 0;
-		right: 0;
-		bottom: 0;
-		left: 0;
-		cursor: move;
-		background: rgba(0, 0, 0, 0.6);
-		z-index: 1;
-	}
-	/* 内部的信息 */
-
-	.uni-corpper-crop-box {
-		position: absolute;
-		background: rgba(255, 255, 255, 0.3);
-		z-index: 2;
-	}
-
-	.uni-corpper-crop-box .uni-cropper-view-box {
-		position: relative;
-		display: block;
-		width: 100%;
-		height: 100%;
-		overflow: visible;
-		outline: 1rpx solid #69f;
-		outline-color: rgba(102, 153, 255, .75)
-	}
-	/* 横向虚线 */
-
-	.uni-cropper-dashed-h {
-		position: absolute;
-		top: 33.33333333%;
-		left: 0;
-		width: 100%;
-		height: 33.33333333%;
-		border-top: 1rpx dashed rgba(255, 255, 255, 0.5);
-		border-bottom: 1rpx dashed rgba(255, 255, 255, 0.5);
-	}
-	/* 纵向虚线 */
-
-	.uni-cropper-dashed-v {
-		position: absolute;
-		left: 33.33333333%;
-		top: 0;
-		width: 33.33333333%;
-		height: 100%;
-		border-left: 1rpx dashed rgba(255, 255, 255, 0.5);
-		border-right: 1rpx dashed rgba(255, 255, 255, 0.5);
-	}
-	/* 四个方向的线  为了之后的拖动事件*/
-
-	.uni-cropper-line-t {
-		position: absolute;
-		display: block;
-		width: 100%;
-		background-color: #69f;
-		top: 0;
-		left: 0;
-		height: 1rpx;
-		opacity: 0.1;
-		cursor: n-resize;
-	}
-
-	.uni-cropper-line-t::before {
-		content: '';
-		position: absolute;
-		top: 50%;
-		right: 0rpx;
-		width: 100%;
-		-webkit-transform: translate3d(0, -50%, 0);
-		transform: translate3d(0, -50%, 0);
-		bottom: 0;
-		height: 41rpx;
-		background: transparent;
-		z-index: 11;
-	}
-
-	.uni-cropper-line-r {
-		position: absolute;
-		display: block;
-		background-color: #69f;
-		top: 0;
-		right: 0rpx;
-		width: 1rpx;
-		opacity: 0.1;
-		height: 100%;
-		cursor: e-resize;
-	}
-
-	.uni-cropper-line-r::before {
-		content: '';
-		position: absolute;
-		top: 0;
-		left: 50%;
-		width: 41rpx;
-		-webkit-transform: translate3d(-50%, 0, 0);
-		transform: translate3d(-50%, 0, 0);
-		bottom: 0;
-		height: 100%;
-		background: transparent;
-		z-index: 11;
-	}
-
-	.uni-cropper-line-b {
-		position: absolute;
-		display: block;
-		width: 100%;
-		background-color: #69f;
-		bottom: 0;
-		left: 0;
-		height: 1rpx;
-		opacity: 0.1;
-		cursor: s-resize;
-	}
-
-	.uni-cropper-line-b::before {
-		content: '';
-		position: absolute;
-		top: 50%;
-		right: 0rpx;
-		width: 100%;
-		-webkit-transform: translate3d(0, -50%, 0);
-		transform: translate3d(0, -50%, 0);
-		bottom: 0;
-		height: 41rpx;
-		background: transparent;
-		z-index: 11;
-	}
-
-	.uni-cropper-line-l {
-		position: absolute;
-		display: block;
-		background-color: #69f;
-		top: 0;
-		left: 0;
-		width: 1rpx;
-		opacity: 0.1;
-		height: 100%;
-		cursor: w-resize;
-	}
-
-	.uni-cropper-line-l::before {
-		content: '';
-		position: absolute;
-		top: 0;
-		left: 50%;
-		width: 41rpx;
-		-webkit-transform: translate3d(-50%, 0, 0);
-		transform: translate3d(-50%, 0, 0);
-		bottom: 0;
-		height: 100%;
-		background: transparent;
-		z-index: 11;
-	}
-
-	.uni-cropper-point {
-		width: 5rpx;
-		height: 5rpx;
-		background-color: #69f;
-		opacity: .75;
-		position: absolute;
-		z-index: 3;
-	}
-
-	.point-t {
-		top: -3rpx;
-		left: 50%;
-		margin-left: -3rpx;
-		cursor: n-resize;
-	}
-
-	.point-tr {
-		top: -3rpx;
-		left: 100%;
-		margin-left: -3rpx;
-		cursor: n-resize;
-	}
-
-	.point-r {
-		top: 50%;
-		left: 100%;
-		margin-left: -3rpx;
-		margin-top: -3rpx;
-		cursor: n-resize;
-	}
-
-	.point-rb {
-		left: 100%;
-		top: 100%;
-		-webkit-transform: translate3d(-50%, -50%, 0);
-		transform: translate3d(-50%, -50%, 0);
-		cursor: n-resize;
-		width: 36rpx;
-		height: 36rpx;
-		background-color: #69f;
-		position: absolute;
-		z-index: 1112;
-		opacity: 1;
-	}
-
-	.point-b {
-		left: 50%;
-		top: 100%;
-		margin-left: -3rpx;
-		margin-top: -3rpx;
-		cursor: n-resize;
-	}
-
-	.point-bl {
-		left: 0%;
-		top: 100%;
-		margin-left: -3rpx;
-		margin-top: -3rpx;
-		cursor: n-resize;
-	}
-
-	.point-l {
-		left: 0%;
-		top: 50%;
-		margin-left: -3rpx;
-		margin-top: -3rpx;
-		cursor: n-resize;
-	}
-
-	.point-lt {
-		left: 0%;
-		top: 0%;
-		margin-left: -3rpx;
-		margin-top: -3rpx;
-		cursor: n-resize;
-	}
-	/* 裁剪框预览内容 */
-
-	.uni-cropper-viewer {
-		position: relative;
-		width: 100%;
-		height: 100%;
-		overflow: hidden;
-	}
-
-	.uni-cropper-viewer image {
-		position: absolute;
-		z-index: 2;
-	}
-</style>

+ 0 - 113
pages/mine/help/index.vue

@@ -1,113 +0,0 @@
-<template>
-  <view class="help-container">
-    <view v-for="(item, findex) in list" :key="findex" :title="item.title" class="list-title">
-      <view class="text-title">
-        <view :class="item.icon"></view>{{ item.title }}
-      </view>
-      <view class="childList">
-        <view v-for="(child, zindex) in item.childList" :key="zindex" class="question" hover-class="hover"
-          @click="handleText(child)">
-          <view class="text-item">{{ child.title }}</view>
-          <view class="line" v-if="zindex !== item.childList.length - 1"></view>
-        </view>
-      </view>
-    </view>
-  </view>
-</template>
-
-<script>
-  export default {
-    data() {
-      return {
-        list: [{
-            icon: 'iconfont icon-github',
-            title: '若依问题',
-            childList: [{
-              title: '若依开源吗?',
-              content: '开源'
-            }, {
-              title: '若依可以商用吗?',
-              content: '可以'
-            }, {
-              title: '若依官网地址多少?',
-              content: 'http://ruoyi.vip'
-            }, {
-              title: '若依文档地址多少?',
-              content: 'http://doc.ruoyi.vip'
-            }]
-          },
-          {
-            icon: 'iconfont icon-help',
-            title: '其他问题',
-            childList: [{
-              title: '如何退出登录?',
-              content: '请点击[我的] - [应用设置] - [退出登录]即可退出登录',
-            }, {
-              title: '如何修改用户头像?',
-              content: '请点击[我的] - [选择头像] - [点击提交]即可更换用户头像',
-            }, {
-              title: '如何修改登录密码?',
-              content: '请点击[我的] - [应用设置] - [修改密码]即可修改登录密码',
-            }]
-          }
-        ]
-      }
-    },
-    methods: {
-      handleText(item) {
-        this.$tab.navigateTo(`/pages/common/textview/index?title=${item.title}&content=${item.content}`)
-      }
-    }
-  }
-</script>
-
-<style lang="scss" scoped>
-  page {
-    background-color: #f8f8f8;
-  }
-
-  .help-container {
-    margin-bottom: 100rpx;
-    padding: 30rpx;
-    background: white;
-  }
-
-  .list-title {
-    margin-bottom: 30rpx;
-  }
-
-  .childList {
-    background: #ffffff;
-    box-shadow: 0px 0px 10rpx rgba(193, 193, 193, 0.2);
-    border-radius: 16rpx;
-    margin-top: 10rpx;
-  }
-
-  .line {
-    width: 100%;
-    height: 1rpx;
-    background-color: #F5F5F5;
-  }
-
-  .text-title {
-    color: #303133;
-    font-size: 32rpx;
-    font-weight: bold;
-    margin-left: 10rpx;
-
-    .iconfont {
-      font-size: 16px;
-      margin-right: 10rpx;
-    }
-  }
-
-  .text-item {
-    font-size: 28rpx;
-    padding: 24rpx;
-  }
-
-  .question {
-    color: #606266;
-    font-size: 28rpx;
-  }
-</style>

+ 0 - 205
pages/mine/index.vue

@@ -1,205 +0,0 @@
-<template>
-  <view class="mine-container" :style="{height: `${windowHeight}px`}">
-    <!--顶部个人信息栏-->
-    <view class="header-section" style="position: relative">
-      <view class="flex padding justify-between">
-        <view class="flex align-center">
-          <view v-if="!avatar" class="cu-avatar xl round bg-white">
-            <view class="iconfont icon-people text-gray icon"></view>
-          </view>
-          <image style="position: relative;top:24rpx;" v-if="avatar" @click="handleToAvatar" :src="avatar" class="cu-avatar xl round" mode="widthFix">
-          </image>
-
-          <view v-if="!name" @click="handleToLogin" class="login-tip">
-            点击登录
-          </view>
-          <view v-if="name" @click="handleToInfo" class="user-info">
-            <view class="u_title" style="font-size: 32rpx">
-              用户名:{{ name }}
-            </view>
-          </view>
-        </view>
-        <view @click="handleToInfo" class="flex align-center" style="width: 180rpx;position: absolute;right:-6rpx;top:130rpx;">
-          <text sytle="font-size:24rpx">个人信息</text>
-          <view class="iconfont icon-right"></view>
-        </view>
-
-      </view>
-      <view v-if="user != null"  style="position: absolute;bottom: 80rpx;text-align: left;padding-left:184rpx;font-size: 32rpx">
-        单&nbsp;&nbsp;&nbsp;&nbsp;位:{{ user.dept.deptName }}
-      </view>
-    </view>
-
-    <view class="content-section" style="margin-top:122rpx">
-      <view class="mine-actions grid col-4 text-center" style="display: none">
-        <view class="action-item" @click="handleJiaoLiuQun">
-          <view class="iconfont icon-friendfill text-pink icon"></view>
-          <text class="text">交流群</text>
-        </view>
-        <view class="action-item" @click="handleBuilding">
-          <view class="iconfont icon-service text-blue icon"></view>
-          <text class="text">在线客服</text>
-        </view>
-        <view class="action-item" @click="handleBuilding">
-          <view class="iconfont icon-community text-mauve icon"></view>
-          <text class="text">反馈社区</text>
-        </view>
-        <view class="action-item" @click="handleBuilding">
-          <view class="iconfont icon-dianzan text-green icon"></view>
-          <text class="text">点赞我们</text>
-        </view>
-      </view>
-
-      <view class="menu-list" >
-        <view class="list-cell list-cell-arrow" @click="handleToEditInfo">
-          <view class="menu-item-box">
-            <view class="iconfont icon-user menu-icon"></view>
-            <view>编辑资料</view>
-          </view>
-        </view>
-<!--        <view class="list-cell list-cell-arrow" @click="handleHelp">-->
-<!--          <view class="menu-item-box">-->
-<!--            <view class="iconfont icon-help menu-icon"></view>-->
-<!--            <view>常见问题</view>-->
-<!--          </view>-->
-<!--        </view>-->
-<!--        <view class="list-cell list-cell-arrow" @click="handleAbout">-->
-<!--          <view class="menu-item-box">-->
-<!--            <view class="iconfont icon-aixin menu-icon"></view>-->
-<!--            <view>关于我们</view>-->
-<!--          </view>-->
-<!--        </view>-->
-        <view class="list-cell list-cell-arrow" @click="handleToSetting">
-          <view class="menu-item-box">
-            <view class="iconfont icon-setting menu-icon"></view>
-            <view>应用设置</view>
-          </view>
-        </view>
-      </view>
-
-    </view>
-  </view>
-</template>
-
-<script>
-  import storage from '@/utils/storage'
-
-  export default {
-    data() {
-      return {
-        user:this.$store.state.user.user,
-        name: this.$store.state.user.name,
-        version: getApp().globalData.config.appInfo.version
-      }
-    },
-    computed: {
-      avatar() {
-		  console.log('avatar>>>'+JSON.stringify(this.$store.state.user))
-        return this.$store.state.user.avatar
-      },
-      windowHeight() {
-        return uni.getSystemInfoSync().windowHeight - 50
-      }
-    },
-    methods: {
-      handleToInfo() {
-        this.$tab.navigateTo('/pages/mine/info/index')
-      },
-      handleToEditInfo() {
-        this.$tab.navigateTo('/pages/mine/info/edit')
-      },
-      handleToSetting() {
-        this.$tab.navigateTo('/pages/mine/setting/index')
-      },
-      handleToLogin() {
-        this.$tab.reLaunch('/pages/login')
-      },
-      handleToAvatar() {
-        this.$tab.navigateTo('/pages/mine/avatar/index')
-      },
-      handleLogout() {
-        this.$modal.confirm('确定注销并退出系统吗?').then(() => {
-          this.$store.dispatch('LogOut').then(() => {
-            this.$tab.reLaunch('/pages/index')
-          })
-        })
-      },
-      handleHelp() {
-        this.$tab.navigateTo('/pages/mine/help/index')
-      },
-      handleAbout() {
-        this.$tab.navigateTo('/pages/mine/about/index')
-      },
-      handleJiaoLiuQun() {
-        this.$modal.showToast('QQ群:133713780')
-      },
-      handleBuilding() {
-        this.$modal.showToast('模块建设中~')
-      }
-    }
-  }
-</script>
-
-<style lang="scss">
-  page {
-    background-color: #f5f6f7;
-  }
-
-  .mine-container {
-    width: 100%;
-    height: 100%;
-
-
-    .header-section {
-      padding: 15px 15px 45px 15px;
-      background-color: #3c96f3;
-      color: white;
-
-      .login-tip {
-        font-size: 18px;
-        margin-left: 10px;
-      }
-
-      .cu-avatar {
-        border: 2px solid #eaeaea;
-
-        .icon {
-          font-size: 40px;
-        }
-      }
-
-      .user-info {
-        margin-left: 15px;
-
-        .u_title {
-          font-size: 18px;
-          line-height: 30px;
-        }
-      }
-    }
-
-    .content-section {
-      position: relative;
-      top: -50px;
-
-      .mine-actions {
-        margin: 15px 15px;
-        padding: 20px 0px;
-        border-radius: 8px;
-        background-color: white;
-
-        .action-item {
-          .icon {
-            font-size: 28px;
-          }
-
-          .text {
-            display: block;
-            font-size: 13px;
-            margin: 8px 0px;
-          }
-        }
-      }
-    }
-  }
-</style>

+ 0 - 127
pages/mine/info/edit.vue

@@ -1,127 +0,0 @@
-<template>
-  <view class="container">
-    <view class="example">
-      <uni-forms ref="form" :model="user" labelWidth="80px">
-        <uni-forms-item label="用户昵称" name="nickName">
-          <uni-easyinput v-model="user.nickName" placeholder="请输入昵称" />
-        </uni-forms-item>
-        <uni-forms-item label="手机号码" name="phonenumber">
-          <uni-easyinput v-model="user.phonenumber" placeholder="请输入手机号码" />
-        </uni-forms-item>
-        <uni-forms-item label="邮箱" name="email">
-          <uni-easyinput v-model="user.email" placeholder="请输入邮箱" />
-        </uni-forms-item>
-        <uni-forms-item label="性别" name="sex" required>
-          <uni-data-checkbox v-model="user.sex" :localdata="sexs" />
-        </uni-forms-item>
-      </uni-forms>
-      <button class="login-btn cu-btn block bg-blue lg round"  @click="submit">提交</button>
-    </view>
-  </view>
-</template>
-
-<script>
-  import { getUserProfile } from "@/api/system/user"
-  import { updateUserProfile } from "@/api/system/user"
-
-  export default {
-    data() {
-      return {
-        user: {
-          nickName: "",
-          phonenumber: "",
-          email: "",
-          sex: ""
-        },
-        sexs: [{
-          text: '男',
-          value: "0"
-        }, {
-          text: '女',
-          value: "1"
-        }],
-        rules: {
-          nickName: {
-            rules: [{
-              required: true,
-              errorMessage: '用户昵称不能为空'
-            }]
-          },
-          phonenumber: {
-            rules: [{
-              required: true,
-              errorMessage: '手机号码不能为空'
-            }, {
-              pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
-              errorMessage: '请输入正确的手机号码'
-            }]
-          },
-          email: {
-            rules: [{
-              required: true,
-              errorMessage: '邮箱地址不能为空'
-            }, {
-              format: 'email',
-              errorMessage: '请输入正确的邮箱地址'
-            }]
-          }
-        }
-      }
-    },
-    onLoad() {
-      this.getUser()
-    },
-    onReady() {
-      this.$refs.form.setRules(this.rules)
-    },
-    methods: {
-      getUser() {
-        getUserProfile().then(response => {
-          this.user = response.data
-        })
-      },
-      submit(ref) {
-        this.$refs.form.validate().then(res => {
-          updateUserProfile(this.user).then(response => {
-            this.$modal.msgSuccess("修改成功")
-          })
-        })
-      }
-    }
-  }
-</script>
-
-<style lang="scss">
-  page {
-    background-color: #ffffff;
-  }
-
-  .example {
-    padding: 15px;
-    background-color: #fff;
-  }
-
-  .segmented-control {
-    margin-bottom: 15px;
-  }
-
-  .button-group {
-    margin-top: 15px;
-    display: flex;
-    justify-content: space-around;
-  }
-
-  .form-item {
-    display: flex;
-    align-items: center;
-    flex: 1;
-  }
-
-  .button {
-    display: flex;
-    align-items: center;
-    height: 35px;
-    line-height: 35px;
-    margin-left: 10px;
-  }
-</style>

+ 0 - 44
pages/mine/info/index.vue

@@ -1,44 +0,0 @@
-<template>
-  <view class="container">
-    <uni-list>
-      <uni-list-item showExtraIcon="true" :extraIcon="{type: 'person-filled'}" title="昵称" :rightText="user.nickName" />
-      <uni-list-item showExtraIcon="true" :extraIcon="{type: 'phone-filled'}" title="手机号码" :rightText="user.phonenumber" />
-      <uni-list-item showExtraIcon="true" :extraIcon="{type: 'email-filled'}" title="邮箱" :rightText="user.email" />
-      <uni-list-item showExtraIcon="true" :extraIcon="{type: 'auth-filled'}" title="岗位" :rightText="postGroup" />
-      <uni-list-item showExtraIcon="true" :extraIcon="{type: 'staff-filled'}" title="角色" :rightText="roleGroup" />
-      <uni-list-item showExtraIcon="true" :extraIcon="{type: 'calendar-filled'}" title="创建日期" :rightText="user.createTime" />
-    </uni-list>
-  </view>
-</template>
-
-<script>
-  import { getUserProfile } from "@/api/system/user"
-
-  export default {
-    data() {
-      return {
-        user: {},
-        roleGroup: "",
-        postGroup: ""
-      }
-    },
-    onLoad() {
-      this.getUser()
-    },
-    methods: {
-      getUser() {
-        getUserProfile().then(response => {
-          this.user = response.data
-          this.roleGroup = response.roleGroup
-          this.postGroup = response.postGroup
-        })
-      }
-    }
-  }
-</script>
-
-<style lang="scss">
-  page {
-    background-color: #ffffff;
-  }
-</style>

+ 0 - 85
pages/mine/pwd/index.vue

@@ -1,85 +0,0 @@
-<template>
-  <view class="pwd-retrieve-container">
-    <uni-forms ref="form" :value="user" labelWidth="80px">
-      <uni-forms-item name="oldPassword" label="旧密码">
-        <uni-easyinput type="password" v-model="user.oldPassword" placeholder="请输入旧密码" />
-      </uni-forms-item>
-      <uni-forms-item name="newPassword" label="新密码">
-        <uni-easyinput type="password" v-model="user.newPassword" placeholder="请输入新密码" />
-      </uni-forms-item>
-      <uni-forms-item name="confirmPassword" label="确认密码">
-        <uni-easyinput type="password" v-model="user.confirmPassword" placeholder="请确认新密码" />
-      </uni-forms-item>
-      <button type="info"  class="login-btn cu-btn block bg-blue lg round" @click="submit">提交</button>
-    </uni-forms>
-  </view>
-</template>
-
-<script>
-  import { updateUserPwd } from "@/api/system/user"
-
-  export default {
-    data() {
-      return {
-        user: {
-          oldPassword: undefined,
-          newPassword: undefined,
-          confirmPassword: undefined
-        },
-        rules: {
-          oldPassword: {
-            rules: [{
-              required: true,
-              errorMessage: '旧密码不能为空'
-            }]
-          },
-          newPassword: {
-            rules: [{
-                required: true,
-                errorMessage: '新密码不能为空',
-              },
-              {
-                minLength: 6,
-                maxLength: 20,
-                errorMessage: '长度在 6 到 20 个字符'
-              }
-            ]
-          },
-          confirmPassword: {
-            rules: [{
-                required: true,
-                errorMessage: '确认密码不能为空'
-              }, {
-                validateFunction: (rule, value, data) => data.newPassword === value,
-                errorMessage: '两次输入的密码不一致'
-              }
-            ]
-          }
-        }
-      }
-    },
-    onReady() {
-      this.$refs.form.setRules(this.rules)
-    },
-    methods: {
-      submit() {
-        this.$refs.form.validate().then(res => {
-          updateUserPwd(this.user.oldPassword, this.user.newPassword).then(response => {
-            this.$modal.msgSuccess("修改成功")
-          })
-        })
-      }
-    }
-  }
-</script>
-
-<style lang="scss">
-  page {
-    background-color: #ffffff;
-  }
-
-  .pwd-retrieve-container {
-    padding-top: 36rpx;
-    padding: 15px;
-  }
-</style>

+ 0 - 78
pages/mine/setting/index.vue

@@ -1,78 +0,0 @@
-<template>
-  <view class="setting-container" :style="{height: `${windowHeight}px`}">
-    <view class="menu-list">
-      <view class="list-cell list-cell-arrow" @click="handleToPwd">
-        <view class="menu-item-box">
-          <view class="iconfont icon-password menu-icon"></view>
-          <view>修改密码</view>
-        </view>
-      </view>
-      <view class="list-cell list-cell-arrow" @click="handleToUpgrade">
-        <view class="menu-item-box">
-          <view class="iconfont icon-refresh menu-icon"></view>
-          <view>检查更新</view>
-        </view>
-      </view>
-      <view class="list-cell list-cell-arrow" @click="handleCleanTmp">
-        <view class="menu-item-box">
-          <view class="iconfont icon-clean menu-icon"></view>
-          <view>清理缓存</view>
-        </view>
-      </view>
-    </view>
-    <view class="cu-list menu">
-      <view class="cu-item item-box">
-        <view class="content text-center" @click="handleLogout">
-          <text class="text-black">退出登录</text>
-        </view>
-      </view>
-    </view>
-  </view>
-</template>
-
-<script>
-  export default {
-    data() {
-      return {
-        windowHeight: uni.getSystemInfoSync().windowHeight
-      }
-    },
-    methods: {
-      handleToPwd() {
-        this.$tab.navigateTo('/pages/mine/pwd/index')
-      },
-      handleToUpgrade() {
-        this.$modal.showToast('模块建设中~')
-      },
-      handleCleanTmp() {
-        this.$modal.showToast('模块建设中~')
-      },
-      handleLogout() {
-        this.$modal.confirm('确定注销并退出系统吗?').then(() => {
-          this.$store.dispatch('LogOut').then(() => {
-            this.$tab.reLaunch('/pages/index')
-          })
-        })
-      }
-    }
-  }
-</script>
-
-<style lang="scss" scoped>
-  .page {
-    background-color: #f8f8f8;
-  }
-
-  .item-box {
-    background-color: #FFFFFF;
-    margin: 30rpx;
-    display: flex;
-    flex-direction: row;
-    justify-content: center;
-    align-items: center;
-    padding: 10rpx;
-    border-radius: 8rpx;
-    color: #303133;
-    font-size: 32rpx;
-  }
-</style>

+ 0 - 51
pages/regist/index.vue

@@ -1,51 +0,0 @@
-<template>
-
-	<view class="login-form-content">
-		<view class="input-item flex align-center">
-			<view class="iconfont icon-user icon"></view>
-			<input v-model="loginForm.username" class="input" type="text" placeholder="客户名称" maxlength="30" />
-		</view>
-		<view class="input-item flex align-center">
-			<view class="iconfont icon-password icon"></view>
-			<input v-model="loginForm.password" type="password" class="input" placeholder="联系人" maxlength="20" />
-		</view>
-		<view class="input-item flex align-center">
-			<view class="iconfont icon-password icon"></view>
-			<input v-model="loginForm.password" type="password" class="input" placeholder="电话" maxlength="20" />
-		</view>
-		<view class="input-item flex align-center">
-			<view class="iconfont icon-password icon"></view>
-			<input v-model="loginForm.password" type="password" class="input" placeholder="联系人" maxlength="20" />
-		</view>
-	</view>
-
-</template>
-
-<script>
-	export default {
-	  onLoad: function() {
-	  }
-	}
-</script>
-
-<style  lang="scss">
-	.input-item {
-	  margin: 20px auto;
-	  background-color: #f5f6f7;
-	  height: 45px;
-	  border-radius: 20px;
-	  .icon {
-	    font-size: 38rpx;
-	    margin-left: 10px;
-	    color: #999;
-	  }
-	  .input {
-	    width: 100%;
-	    font-size: 14px;
-	    line-height: 20px;
-	    text-align: left;
-	    padding-left: 15px;
-	    //background: rgb(224,236,255);
-	  }
-	}
-</style>

+ 0 - 180
pages/reviews/reviews.vue

@@ -1,180 +0,0 @@
-<template>
-	<view>
-		<view v-for="item in list">
-			<uni-card :title=" '客户:'+(item.deptName==null?' ':item.deptName)"
-				:extra="'负责人:'+(item.leader==null?' ':item.leader)">
-				<view style="position: relative;line-height: 6vw;">
-					<u-row>
-						<u-col span="8">
-							<view>联系电话:{{item.phone}}</view>
-							<view>创建时间:{{item.createTime}}</view>
-							<view>审核时间:{{item.reviewTime==null?'':item.reviewTime}}</view>
-							<uni-tag title="?????"></uni-tag>
-							<view>审核状态:<uni-tag size="small" :text="item.status==0?'待审核':'审核完成'"
-									:type="item.status==0?'primary':'success'" /></view>
-							<view>是否通过:<uni-tag size="small" :text="item.status==0?'待审核':item.delFlag==1?'审核通过':'审核失败'"
-									:type="item.status==0?'primary':item.delFlag==1?'success':'error'" /></view>
-							<view v-if="item.delFlag==0&&item.delFlag!=''">
-								原因:{{item.remark}}
-							</view>
-						</u-col>
-						<u-col span="4">
-							<image @click="previewImg(orders(item))" aspectFit style="width: 120px;height: 80px;" :src="orders(item)"></image>
-							<u-button :disabled="item.status==1?true:false" icon="eye-fill" type="primary"
-								@click="openDetailDialog(item.id)" :plain="true" size="mini" text="审核"></u-button>
-						</u-col>
-
-					</u-row>
-
-				</view>
-			</uni-card>
-		</view>
-		<u-modal title="审核是否通过:" @cancel="closeDlg" confirmText="提交" :showCancelButton="true" @confirm="submitReg"
-			:show="show">
-			<view class="slot-content">
-				<view>
-					<radio-group @change="change">
-						通过:
-						<radio value="1"></radio>
-						不通过:
-						<radio value="0"></radio>
-					</radio-group>
-				</view>
-				<view v-if="chooseUser.delFlag==0&&chooseUser.delFlag!=''">
-					<u-input v-model="chooseUser.remark" placeholder="请输入不通过原因..."></u-input>
-				</view>
-			</view>
-		</u-modal>
-	</view>
-
-</template>
-
-<script>
-	import config from '@/config'
-	import {
-		listReviews,
-		reviewsAdopt,
-		reviews
-	} from '@/api/user/user';
-	export default {
-		data() {
-			return {
-				total:0, //数据总长
-				// 查询参数
-				queryParams: {
-					pageNum: 1,
-					pageSize: 10,
-					deptName: undefined,
-					leader: undefined,
-					phone: undefined,
-					status: undefined,
-					delFlag: undefined,
-				},
-				list: [],
-				show: false,
-				chooseUser: [],
-				switchdis: false, //已经审核完禁用
-			}
-		},
-		created() {
-			this.queryParams= {
-				pageNum: 1,
-				pageSize: 10,
-				deptName: undefined,
-				leader: undefined,
-				phone: undefined,
-				status: undefined,
-				delFlag: undefined,
-			},
-			this.listReviews()
-		},
-		onReachBottom() {
-			if(this.total>this.list.length){
-				this.queryParams.pageNum++
-				this.listReviews()
-			}
-		},
-		methods: {
-			previewImg(imgurl) {
-			    uni.previewImage({
-			      current: imgurl,
-			      urls: [imgurl]
-			    });
-			  },
-			submitReg() {
-				if((this.chooseUser.remark==null||this.chooseUser.remark=='')&&this.chooseUser.delFlag==0){
-					uni.showToast({
-						title: '请输入原因',
-						duration: 1500,
-						icon: 'none'
-					});
-					return;
-				}
-				
-				reviewsAdopt(this.chooseUser).then((response) => {
-					this.show = false;
-					this.queryParams= {
-						pageNum: 1,
-						pageSize: 10,
-						deptName: undefined,
-						leader: undefined,
-						phone: undefined,
-						status: undefined,
-						delFlag: undefined,
-					},
-					this.listReviews();
-				});
-			},
-			change(event) {
-				this.chooseUser.delFlag = event.detail.value
-				console.log('this.chooseUser>>>' + JSON.stringify(this.chooseUser))
-			},
-			closeDlg() {
-				console.log('closeDlg>>>>>>>')
-				this.show = false
-			},
-			listReviews() {
-				listReviews(this.queryParams).then(res => {
-					
-					let lists = res.rows
-					
-					this.total=res.total 
-					if(this.total>this.list.length){
-					for (let l in lists) {
-						this.list.push(lists[l])
-					}	
-					}
-					console.log('list>>' + JSON.stringify(this.list))
-				})
-			},
-			orders(item) {
-				let baseUrl = config.baseUrl
-				return baseUrl + item.orders
-			},
-			// 打开信息详情
-			openDetailDialog(id) {
-				this.show = true;
-				reviews(id).then((response) => {
-					this.chooseUser = response.data;
-					console.log("this.form>>>>>???>>>" + JSON.stringify(this.chooseUser));
-				});
-			},
-
-
-		}
-	}
-</script>
-
-<style>
-	.mb-10 {
-		margin-bottom: 10px;
-	}
-
-	.decoration {
-		width: 6px;
-		height: 6px;
-		margin-right: 4px;
-		border-radius: 50%;
-		background-color: #18bc37 !default;
-	}
-</style>

+ 0 - 316
pages/user/index.vue

@@ -1,316 +0,0 @@
-<template>
-	<view class="work-container">
-		<view class="header">
-			<u-search placeholder="请输入客户名称" :clearabled="true" @clear="searchDept" @custom="searchDept"
-				v-model="search.deptName" @search="searchDept"></u-search>
-		</view>
-		<scroll-view
-      scroll-y
-      style="height: 100vh"
-      @scrolltolower="loadMore">
-			<uni-card v-if="item.parentId !==0" v-for="item in displayList" :title="item.deptName"
-				:extra="item.createTime">
-
-				<view style="position: relative">
-					<view>联系人:{{item.leader}}</view>
-					<view>联系电话:{{item.phone}}</view>
-					<view style="width: 50px;position: absolute;right:-10px;bottom:0px"><u-button @click="toUser(item)"
-							type="primary" :plain="true" size="mini" text="查看人员"></u-button>
-					</view>
-
-					<view style="width: 50px;position: absolute;right:90rpx;bottom:0rpx"><u-button type="success"
-							@click="toDeviceList(item)" :plain="true" size="mini" text="查看设备"></u-button>
-					</view>
-					<view style="width: 50px;position: absolute;right:200rpx;bottom:0rpx"><u-button type="warning "
-							@click="toDel(item)" :plain="true" size="mini" text="删除客户"></u-button>
-					</view>
-				</view>
-
-			</uni-card>
-      <view v-if="loading" class="loading">加载中...</view>
-      <view v-if="allLoaded" class="no-more">没有更多了</view>
-    </scroll-view>
-		<view style="position: fixed;bottom: 0px;text-align: center;width: 100%">
-			<u-button type="primary" text="新增客户" @click="newUser"></u-button>
-		</view>
-		<u-modal :show="showAdd " title="客户信息" @cancel="closeDlg" :showCancelButton="true" @confirm="doAddUser">
-			<view class="slot-content">
-				<u--form labelPosition="left" :model="model1" ref="s">
-					<u-form-item label="客户名称:" prop="chooseUser.deptName" borderBottom ref="item1" labelWidth="auto">
-						<u--input v-model="chooseUser.deptName" border="none"></u--input>
-					</u-form-item>
-					<u-form-item label="联系人:" prop="chooseUser.nickName" borderBottom ref="item1" labelWidth="auto">
-						<u--input v-model="chooseUser.nickName" border="none"></u--input>
-					</u-form-item>
-
-					<u-form-item label="手机号:" prop="chooseUser.phonenumber" borderBottom ref="item1" labelWidth="auto">
-						<u--input v-model="chooseUser.phonenumber" border="none"></u--input>
-					</u-form-item>
-
-					<u-form-item label="密码:" prop="chooseUser.password" borderBottom ref="item1" labelWidth="auto">
-						<u--input v-if="showAdd" v-model="chooseUser.password" border="none"></u--input>
-					</u-form-item>
-					<u-form-item label="登录账号:" borderBottom ref="item1" labelWidth="auto">
-						<u--input v-model="chooseUser.phonenumber" border="none" disabled></u--input>
-					</u-form-item>
-					<u-form-item label="状态:" prop="chooseUser.password" borderBottom ref="item1" labelWidth="auto">
-						<u-radio-group v-model="statusValue" placement="row">
-							<u-radio v-for="(item, index) in statusList" :key="index" :label="item.name"
-								:name="item.name" @change="statusChange">
-							</u-radio>
-						</u-radio-group>
-					</u-form-item>
-					<u-form-item label="显示排序:" prop="chooseUser.orderNum" borderBottom ref="item1" labelWidth="auto">
-						<uni-number-box v-model="chooseUser.orderNum" />
-					</u-form-item>
-				</u--form>
-
-			</view>
-		</u-modal>
-	</view>
-</template>
-
-<script>
-	import authObj from '@/plugins/auth.js';
-	import {
-		getDeptList,
-		getUserListByDept
-	} from '@/api/user/user';
-	import {
-		addDeptAndUser,
-		delDept
-	} from '@/api/dept/dept'
-	import {
-		unbind
-	} from '@/api/device/device.js'
-	import UText from "../../uni_modules/uview-ui/components/u-text/u-text";
-	import {
-		checkStr
-	} from "@/utils/validate.js"
-	export default {
-		components: {
-			UText
-		},
-		data() {
-			return {
-				deptList: [],
-        displayList:[],
-        loading:false,
-        allLoaded :false,
-        pageSize:50,
-        currentPage:1,
-        search: {
-					deptName: ""
-				},
-				statusList: [{
-						name: '启用',
-						disabled: false
-					},
-					{
-						name: '禁用',
-						disabled: false
-					}
-				],
-				statusValue: '启用',
-				//showEdit: false,
-				showAdd: false,
-				chooseUser: {},
-			}
-		},
-		onLoad() {
-			this.getDeptList();
-		},
-		methods: {
-			newUser() {
-				this.showAdd = true;
-				this.chooseUser.orderNum = 1
-			},
-			closeDlg() {
-				console.log('closeDlg>>>>>>>')
-				this.showAdd = false;
-				this.chooseUser = {};
-			},
-			statusChange(e) {
-				console.log(e);
-			},
-			searchDept() {
-				this.getDeptList();
-			},
-			toUser(item) {
-				uni.navigateTo({
-					url: '/pages/user/list?deptId=' + item.deptId
-				});
-			},
-			toDeviceList(item) {
-				uni.navigateTo({
-					url: '/subpkg/device/index?deptId=' + item.deptId
-				});
-			},
-			//删除客户,并删除客户下的用户信息和解绑设备
-			toDel(item){
-				let self=this
-				uni.showModal({
-				  title: '提示',
-				  content: "删除客户信息并解绑设备?",
-				  confirmText:'取消',
-				  confirmColor:'#2979ff',
-				  cancelText:'确定',
-				  cancelColor:'#ed1c24',
-				  success: function (res) {
-				    if (res.confirm) {
-				     console.log('取消'+JSON.stringify(item));
-				    } else if (res.cancel) {
-				      console.log('用户点击确定'+JSON.stringify(item));
-					  unbind(item.deptId).then(res=>{
-						  uni.showToast({
-						  	title: '操作成功',
-						  	icon: 'none',
-						  	duration: 1500
-						  })
-						  location.reload()
-					  })
-				    }
-				  }
-				});
-			},
-      loadMore() {
-        if (this.loading || this.allLoaded) return
-
-        this.loading = true
-        setTimeout(() => {
-          const start = this.currentPage * this.pageSize
-          const end = start + this.pageSize
-          const nextPageData = this.deptList.slice(start, end)
-
-          if (nextPageData.length === 0) {
-            this.allLoaded = true
-          } else {
-            this.displayList = this.displayList.concat(nextPageData)
-            this.currentPage++
-          }
-
-          this.loading = false
-        }, 300) // 模拟加载时间,实际可以去掉
-      },
-			getDeptList() {
-				getDeptList(this.search.deptName).then(res => {
-					this.deptList = res.data;
-          this.displayList = this.deptList.slice(0, 50)
-
-        });
-			},
-			doAddUser() {
-				let self = this;
-				this.chooseUser.postIds = [];
-				if (this.statusValue == '启用') {
-					this.chooseUser.status = 0;
-				} else {
-					this.chooseUser.status = 1;
-				}
-				if (!checkStr(this.chooseUser.phonenumber, 'mobile')) {
-					uni.showToast({
-						title: '手机号码格式有误',
-						icon: 'none',
-						duration: 1000
-					})
-				} else {
-					this.chooseUser.userName = this.chooseUser.phonenumber
-					if (this.showAdd) {
-						addDeptAndUser(this.chooseUser).then(res => {
-							uni.showToast({
-								title: '操作成功',
-								icon: 'none',
-								duration: 1500
-							})
-							self.closeDlg();
-							location.reload()
-						}).catch(res => {
-							console.log('close>>>>>>erro')
-						})
-					}
-				}
-			},
-		}
-	}
-</script>
-
-<style lang="scss">
-	/* #ifndef APP-NVUE */
-	.u-collapse-content {
-		display: flex;
-		flex-direction: column;
-	}
-
-	page {
-		display: flex;
-		flex-direction: column;
-		box-sizing: border-box;
-		background-color: #fff;
-		min-height: 100%;
-		height: auto;
-	}
-
-	view {
-		font-size: 14px;
-		line-height: inherit;
-	}
-
-	/* #endif */
-
-	.text {
-		text-align: center;
-		font-size: 26rpx;
-		margin-top: 10rpx;
-	}
-
-	.grid-item-box {
-		flex: 1;
-		/* #ifndef APP-NVUE */
-		display: flex;
-		/* #endif */
-		flex-direction: column;
-		align-items: center;
-		justify-content: center;
-		padding: 15px 0;
-	}
-
-	.uni-margin-wrap {
-		width: 690rpx;
-		width: 100%;
-		;
-	}
-
-	.swiper {
-		height: 300rpx;
-	}
-
-	.swiper-box {
-		height: 150px;
-	}
-
-	.swiper-item {
-		/* #ifndef APP-NVUE */
-		display: flex;
-		/* #endif */
-		flex-direction: column;
-		justify-content: center;
-		align-items: center;
-		color: #fff;
-		height: 300rpx;
-		line-height: 300rpx;
-	}
-
-	@media screen and (min-width: 500px) {
-		.uni-swiper-dot-box {
-			width: 400px;
-			/* #ifndef APP-NVUE */
-			margin: 0 auto;
-			/* #endif */
-			margin-top: 8px;
-		}
-
-		.image {
-			width: 100%;
-		}
-	}
-</style>

+ 0 - 367
pages/user/list.vue

@@ -1,367 +0,0 @@
-<template>
-  <view class="work-container">
-    <view class="header" style="padding:0 20rpx">
-      <u-search placeholder="请输入用户手机号" :showAction="false" :clearabled="true" @clear="searchDept" @custom="searchDept" v-model="search.userName" @search="searchDept"></u-search>
-    </view>
-    <view style="margin-top: 20rpx;padding-bottom: 100rpx;">
-
-      <uni-card title="管理员"  extra="额外信息" padding="0" thumbnail="/static/images/user/user.png" v-for="item in userList">
-        <template v-slot:cover>
-         <view style="position: relative;display: flex;flex-direction: row;margin:20rpx;border-bottom: 1px solid lightgray;height: 60rpx">
-            <view style="width: 60rpx;height: 40rpx;position: absolute;top: 2rpx;">
-              <u-image :showLoading="true" src="/static/images/user/user.png" width="60rpx" height="40rpx" ></u-image>
-            </view>
-           <view style="font-size: 24rpx;margin-left:10rpx;position: absolute;top: 8rpx;left: 64rpx;font-weight: bold">
-             {{ item.nickName }}
-           </view>
-           <view style="position: absolute;right:-14rpx;top:-2rpx">
-             <u-tag v-if="item.status == 0" text="启用"   type="warning" bgColor="rgb(222,242,228)" color="#48C373" borderColor="rgb(222,242,228)"></u-tag>
-             <u-tag v-if="item.status == 1" text="禁用"  bgColor="rgb(239,239,239)" color="rgb(180,180,180)" borderColor="rgb(239,239,239)"  ></u-tag>
-
-           </view>
-         </view>
-        </template>
-        <template v-slot:title>
-          <view style="position: relative;display: flex;flex-direction: column;margin:20rpx;height: 200rpx;    line-height: 66rpx;
-color: #545454; ">
-            <view>
-
-              联系电话:{{ item.phonenumber }}
-            </view>
-            <view v-if="item.dept!= null">
-
-              所属客户:{{ item.dept.deptName}}
-            </view>
-            <view>
-
-              创建时间:{{ item.createTime }}
-            </view>
-          </view>
-        </template>
-        <template v-slot:actions>
-          <view style="position: relative;display: flex;flex-direction: row;margin:20rpx;line-height: 60rpx;
-color: #545454; ">
-            <view v-if="isCanEdit()" @click="modifyUser(item)" style="display:flex;flex-direction: row;margin-left: 100rpx;">
-                <u-image src="/static/images/user/edit.png" width="50rpx" height="50rpx"></u-image>
-                <view style="margin-left: 10rpx">修改</view>
-            </view>
-            <view v-if="isCanEdit()" @click="delUser(item)" style="display:flex;flex-direction: row;margin-left: 180rpx;">
-              <u-image src="/static/images/user/del.png" width="50rpx" height="50rpx"></u-image>
-              <view style="margin-left: 10rpx"> 删除</view>
-            </view>
-          </view>
-        </template>
-      </uni-card>
-    </view>
-      <view v-if="isCanEdit()" style="position: fixed;bottom: 0px;text-align: center;width: 100%">
-        <u-button type="primary" text="新增用户" @click="newUser"></u-button>
-      </view>
-
-      <u-modal  :show="showAdd || showEdit" title="编辑用户" @cancel="closeDlg" :showCancelButton="true"  @confirm="doAddUser" >
-        <view class="slot-content">
-          <u--form
-              labelPosition="left"
-              :model="model1"
-              ref="uForm"
-          >
-            <u-form-item
-                label="昵称:"
-                prop="chooseUser.nickName"
-                borderBottom
-                ref="item1"
-                labelWidth="auto"
-            >
-              <u--input
-                  v-model="chooseUser.nickName"
-                  border="none"
-              ></u--input>
-            </u-form-item>
-
-            <u-form-item
-                label="手机号:"
-                prop="chooseUser.phonenumber"
-                borderBottom
-                ref="item1"
-                labelWidth="auto"
-            >
-              <u--input
-                  v-model="chooseUser.phonenumber"
-                  border="none"
-              ></u--input>
-            </u-form-item>
-
-            <u-form-item
-                label="密码:"
-                prop="chooseUser.password"
-                borderBottom
-                ref="item1"
-                labelWidth="auto"
-            >
-              <u--input v-if="showAdd"
-                        v-model="chooseUser.password"
-                        border="none"
-              ></u--input>
-
-             <view style="width:100rpx"  v-if="showEdit">
-               <u-button width="100rpx" type="warning" size="mini" @click="resetPwd()" text="重置密码"></u-button>
-             </view>
-            </u-form-item>
-
-            <u-form-item
-                label="登录账号:"
-                borderBottom
-                ref="item1"
-                labelWidth="auto"
-            >
-              <u--input
-                  v-model="chooseUser.phonenumber"
-                  border="none"
-                  disabled
-              ></u--input>
-            </u-form-item>
-            <u-form-item
-                label="状态:"
-                prop="chooseUser.password"
-                borderBottom
-                ref="item1"
-                labelWidth="auto"
-            >
-              <u-radio-group
-                  v-model="statusValue"
-                  placement="row"
-              >
-                <u-radio
-                    v-for="(item, index) in statusList"
-                    :key="index"
-                    :label="item.name"
-                    :name="item.name"
-                    @change="statusChange"
-                >
-                </u-radio>
-              </u-radio-group>
-            </u-form-item>
-          </u--form>
-
-        </view>
-      </u-modal>
-
-  </view>
-</template>
-
-<script>
-import authObj from '@/plugins/auth.js';
-import {getDeptList,getUserListByDept,addUser,editUser,resetPwd,deleteUser,getUserById} from '@/api/user/user';
-import UText from "../../uni_modules/uview-ui/components/u-text/u-text";
-import UButton from "../../uni_modules/uview-ui/components/u-button/u-button";
-import UImage from "../../uni_modules/uview-ui/components/u--image/u--image";
-export default {
-  components: {UImage, UButton, UText},
-  data() {
-      return {
-        statusList:[{  name: '启用',
-          disabled: false
-        },
-          {
-            name: '禁用',
-            disabled: false
-          }],
-        statusValue: '启用',
-        userList:[],
-        search:{
-          userName:""
-        },
-        deptId:0,
-        showEdit:false,
-        showAdd:false,
-        chooseUser:{},
-      }
-    },
-  onLoad(opt){
-    this.deptId = opt.deptId;
-    if(this.deptId == 'undefined'){
-      this.deptId = 0;
-    }
-    this.getUser();
-  },
-    methods: {
-      isCanEdit(){
-        return authObj.authRoleAdmin(["companymgr",'admin'])
-      },
-      delUser(user){
-        let self = this;
-        uni.showModal({
-          title: '提示',
-          content: '确认要删除该用户么?',
-          success: function (res) {
-            if (res.confirm) {
-              deleteUser(user.userId).then(res=>{
-                self.$modal.showToast("操作成功");
-                self.getUser();
-              });
-            } else if (res.cancel) {
-              console.log('用户点击取消');
-            }
-          }
-        });
-
-      },
-      modifyUser(user){
-        let self = this;
-        getUserById(user.userId).then(res=>{
-          self.chooseUser = res.data;
-          self.chooseUser.roleIds = res.roleIds;
-          self.showEdit = true;
-        })
-
-      },
-      statusChange(e){
-        console.log(e);
-      },
-      closeDlg(){
-        this.showEdit = false;
-        this.showAdd = false;
-        this.chooseUser = {};
-      },
-     newUser(){
-       this.showAdd = true;
-     },
-      doAddUser(){
-        let self = this;
-        this.chooseUser.postIds=[];
-        if(this.statusValue == '启用'){
-          this.chooseUser.status = 0;
-        }else{
-          this.chooseUser.status = 1;
-        }
-        this.chooseUser.userName = this.chooseUser.phonenumber;
-        if(this.showAdd){
-          addUser(this.chooseUser).then(res=>{
-            self.getUser()
-            self.closeDlg();
-          });
-        }
-        if(this.showEdit){
-          editUser(this.chooseUser).then(res=>{
-            self.getUser()
-            self.closeDlg();
-          });
-        }
-
-      },
-      resetPwd(){
-        this.showEdit = false;
-        let self = this;
-        let userId = this.chooseUser.userId;
-        uni.showModal({
-          title: '提示',
-          editable:true,
-          placeholderText: '请输入新密码',
-          success: function (res) {
-            if (res.confirm) {
-              resetPwd({userId:userId,password:res.content}).then(res=>{
-               self.$modal.showToast("操作成功");
-             })
-            } else if (res.cancel) {
-              console.log('用户点击取消');
-            }
-          }
-        });
-
-      },
-      searchDept(){
-        this.getUser();
-      },
-      change(item){
-        console.log(item)
-      },
-      getUser(){
-        let id = this.deptId;
-        getUserListByDept(id,this.search.userName).then(res=>{
-          this.userList = res.rows;
-          for(const user of this.userList){
-          }
-        });
-      },
-    }
-  }
-</script>
-
-<style lang="scss">
-  /* #ifndef APP-NVUE */
-  .u-collapse-content{
-    display: flex;
-    flex-direction: column;
-  }
-  page {
-    display: flex;
-    flex-direction: column;
-    box-sizing: border-box;
-    background-color: #fff;
-    min-height: 100%;
-    height: auto;
-  }
-
-  view {
-    font-size: 14px;
-    line-height: inherit;
-  }
-
-  /* #endif */
-
-  .text {
-    text-align: center;
-    font-size: 26rpx;
-    margin-top: 10rpx;
-  }
-
-  .grid-item-box {
-    flex: 1;
-    /* #ifndef APP-NVUE */
-    display: flex;
-    /* #endif */
-    flex-direction: column;
-    align-items: center;
-    justify-content: center;
-    padding: 15px 0;
-  }
-
-  .uni-margin-wrap {
-    width: 690rpx;
-    width: 100%;
-    ;
-  }
-
-  .swiper {
-    height: 300rpx;
-  }
-
-  .swiper-box {
-    height: 150px;
-  }
-
-  .swiper-item {
-    /* #ifndef APP-NVUE */
-    display: flex;
-    /* #endif */
-    flex-direction: column;
-    justify-content: center;
-    align-items: center;
-    color: #fff;
-    height: 300rpx;
-    line-height: 300rpx;
-  }
-
-  @media screen and (min-width: 500px) {
-    .uni-swiper-dot-box {
-      width: 400px;
-      /* #ifndef APP-NVUE */
-      margin: 0 auto;
-      /* #endif */
-      margin-top: 8px;
-    }
-
-    .image {
-      width: 100%;
-    }
-  }
-</style>

+ 0 - 241
pages/wifi/index.vue

@@ -1,241 +0,0 @@
-<template>
-  <view class="content"style="background: white">
-    <view class="text-area">
-      <u--form style="width: 100%;"
-               labelPosition="left"
-               ref="uForm"
-      >
-        <u-form-item
-            label="WIFI名称"
-            borderBottom
-            labelWidth="auto"
-            @click="openChooseWifi"
-            ref="item1"
-        >
-          <u--input
-              v-model="SSID"
-              disabled
-              disabledColor="#ffffff"
-              placeholder="请选择wifi"
-              border="none"
-          ></u--input>
-          <u-icon
-              slot="right"
-              name="arrow-right"
-          ></u-icon>
-        </u-form-item>
-        <u-form-item
-            label="密码"
-            borderBottom
-            ref="item1"
-        >
-          <u--input
-              v-model="password"
-              border="none"
-          ></u--input>
-        </u-form-item>
-
-      </u--form>
-
-    </view>
-    <view style="margin:10px">
-      <u-button text="开始配网" @click="doConnect" size="small" type="primary"></u-button>
-
-    </view>
-    <u-picker @cancel="showWiftList=false" @confirm="chooseWifi"  :show="showWiftList" :columns="wifiList"></u-picker>
-  </view>
-</template>
-
-<script>
-  export default {
-    data(){
-
-      return{
-        showWiftList:false,
-        wifiList: [
-          []
-        ],
-        SSID:"",
-        password:""
-      }
-    },
-    onLoad: function() {
-      this.openWifi();
-    },
-    methods:{
-		getAuth(){
-			wx.getSetting({
-			  success(res) {
-			    if (!res.authSetting['scope.userLocation']) {
-			      wx.authorize({
-			        scope: 'scope.userLocation',
-			        success () {
-			          // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
-
-			        }
-			      })
-			    }
-			  }
-			})
-		},
-      chooseWifi(e){
-        this.SSID = e.value[0];
-        this.showWiftList= false;
-      },
-      openChooseWifi(){
-        if(this.wifiList[0].length == 0){
-            this.getWifiList();
-        }else{
-          this.showWiftList = true;
-        }
-      },
-      openWifi(){
-        let self = this;
-        // #ifdef MP-WEIXIN
-        wx.startWifi({
-          success(res) {
-            console.log(res);
-            // self.getWifiList();
-          },
-          fail(res) {
-            console.log(res)
-            uni.showToast({
-              title: '请打开WIFI',
-              icon: 'none',
-              duration: 3000
-            });
-
-          },
-        })
-        // #endif
-
-      },
-      getWifi(){
-        // #ifdef MP-WEIXIN
-        var that = this
-        wx.getConnectedWifi({
-          success(res) {
-            console.log(res)
-            that.BSSID = res.wifi.BSSID
-            that.WIFIName = res.wifi.SSID
-          },
-          fail(res) {
-            console.log(res)
-            //报错的相关处理
-          },
-        })
-        // #endif
-
-      },
-      getWifiList(){
-        // #ifdef MP-WEIXIN
-        var that = this
-        uni.showLoading();
-        wx.getWifiList({
-          success(res) {
-            console.log(res)
-            wx.onGetWifiList(function(res) {
-              that.showWiftList = true;
-              uni.hideLoading();
-              console.log("获取wifi列表");
-              that.wifiList = [[]];
-              console.log(res.wifiList); //在这里提取列表数据
-              //通过遍历将WIFI名字存入集合,以便下卡框等组件使用
-              for (var i = 0; i < res.wifiList.length; i++) {
-                that.wifiList[0].push(res.wifiList[i].SSID)
-              }
-            })
-          },
-          fail(res) {
-            console.log(res)
-            uni.showToast({
-              title: '获取wifi失败,请检查wifi',
-              icon: 'none',
-              duration: 2000
-            });
-          },
-        })
-        // #endif
-
-      },
-      doConnect(){
-        // #ifdef MP-WEIXIN
-        const airkiss = requirePlugin('airkiss');
-        if (this.SSID != '' && this.password != '') {
-          console.log(airkiss)
-          uni.showLoading({
-            title: '配网中请稍后..'
-          });
-          airkiss.startAirkiss(this.SSID, this.password, function(res) {
-            console.log(res)
-            switch (res.code) {
-              case 0:
-                uni.hideLoading();
-                uni.showModal({
-                  title: '初始化失败',
-                  content: res.result,
-                  showCancel: false,
-                  confirmText: '收到',
-                })
-                break;
-              case 1:
-                uni.hideLoading();
-                uni.showModal({
-                  title: '配网成功',
-                  content: '设备IP:' + res.ip + '\r\n 设备Mac:' + res.bssid,
-                  showCancel: false,
-                  confirmText: '好的',
-                })
-                break;
-              case 2:
-                uni.hideLoading();
-                uni.showModal({
-                  title: '配网失败',
-                  content: '请检查密码是否正确',
-                  showCancel: false,
-                  confirmText: '收到',
-                })
-                break;
-
-              default:
-                uni.hideLoading();
-                break;
-            }
-
-          })
-        } else {
-          uni.showToast({
-            title: '请选择WIFI并输入密码',
-            icon: 'none',
-            duration: 3000
-          });
-        }
-        // #endif
-
-      }
-    }
-  }
-</script>
-
-<style>
-  .content {
-    display: flex;
-    flex-direction: column;
-    align-items: center;
-    justify-content: center;
-  }
-
-
-  .text-area {
-    display: flex;
-    justify-content: center;
-    background: white;
-    width: 100%;
-    height: 100%;
-  }
-
-  .title {
-    font-size: 36rpx;
-    color: #8f8f94;
-  }
-</style>

+ 0 - 446
pages/work/index.vue

@@ -1,446 +0,0 @@
-<template>
-  <view class="work-container">
-    <!-- 轮播图 -->
-  <view style="padding:0 26rpx;">
-    <uni-swiper-dot class="uni-swiper-dot-box" :info="data" :current="current" field="content">
-      <swiper class="swiper-box" :current="swiperDotIndex" @change="changeSwiper">
-        <swiper-item v-for="(item, index) in data" :key="index">
-          <view class="swiper-item" @click="clickBannerItem(item)">
-            <image :src="item.image" mode="aspectFill" :draggable="false" style="border-radius: 12rpx;margin:20rpx" />
-          </view>
-        </swiper-item>
-      </swiper>
-    </uni-swiper-dot>
-  </view>
-    <view style="box-sizing: border-box;margin-top:20rpx;padding:0 20rpx">
-      <view class="grid-item-box" @click="watchDevice"  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/scan.png" width="80rpx" height="80rpx" ></u-image>
-        </view>
-        <view class="grid-text">
-          <view class="top">查看设备</view>
-          <view class="bottom">View Device</view>
-        </view>
-      </view>
-
-      <view class="grid-item-box" v-if="hasRole(['admin'])" @click="goPage('user')" 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/user.png" width="80rpx" height="80rpx" ></u-image>
-        </view>
-        <view class="grid-text">
-          <view class="top">客户列表</view>
-          <view class="bottom">Customer List</view>
-        </view>
-      </view>
-	  <view class="grid-item-box" v-if="hasRole(['admin'])" @click="goPage('reviews')" 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/user.png" width="80rpx" height="80rpx" ></u-image>
-	    </view>
-	    <view class="grid-text">
-	      <view class="top">注册审核</view>
-	      <view class="bottom">Registration Review</view>
-	    </view>
-	  </view>
-
-      <view class="grid-item-box" v-if="hasRole(['admin']) || hasRole(['companymgr'])" @click="goPage('deptuser')" 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/user.png" width="80rpx" height="80rpx" ></u-image>
-          </view>
-          <view class="grid-text">
-            <view class="top">用户管理</view>
-            <view class="bottom">User Management</view>
-          </view>
-      </view>
-      <view class="grid-item-box" v-if="isCompanyUser()" @click="goPage('device')"  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/device.png" width="80rpx" height="80rpx" ></u-image>
-        </view>
-        <view class="grid-text">
-          <view class="top">设备列表</view>
-          <view class="bottom">Device List</view>
-        </view>
-      </view>
-
-      <view class="grid-item-box" @click="goPage('wifi')"  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/wifi.png" width="80rpx" height="80rpx" ></u-image>
-        </view>
-        <view class="grid-text">
-          <view class="top">设备配网</view>
-          <view class="bottom">Wifi Setting</view>
-        </view>
-      </view>
-
-      <view class="grid-item-box" v-if="isCompanyUser()" @click="scanCode()"  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">Device Binding</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>-->
-
-
-
-
-
-      <view class="grid-item-box" @click="goPage('alert')" v-if="hasRole(['admin']) || isCompanyUser()"  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/alert.png" width="80rpx" height="80rpx" ></u-image>
-        </view>
-        <view class="grid-text">
-          <view class="top">设备告警</view>
-          <view class="bottom">Device Alert</view>
-        </view>
-      </view>
-
-
-<!--      <view class="grid-item-box" v-if="isCompanyUser()" @click="goPage('alert')"  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/error.png" width="80rpx" height="80rpx" ></u-image>-->
-<!--        </view>-->
-<!--        <view class="grid-text">-->
-<!--          <view class="top">异常列表</view>-->
-<!--          <view class="bottom">Exception List</view>-->
-<!--        </view>-->
-<!--      </view>-->
-
-      <view class="grid-item-box" @click="goPage('reset')" v-if="hasRole(['admin']) || hasRole(['companymgr'])"  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/reset.png" width="80rpx" height="80rpx" ></u-image>
-        </view>
-        <view class="grid-text">
-          <view class="top">注销设备</view>
-          <view class="bottom">Unregister Device</view>
-        </view>
-      </view>
-
-
-      <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>
-        <view class="grid-text">
-          <view class="top">时长排名</view>
-          <view class="bottom">Duration Ranking</view>
-        </view>
-      </view>
-    </view>
-    <!-- 宫格组件 -->
-
-
-      <u-modal :show="show" :title="dlgTitle" @cancel="cancel" :showCancelButton="true" @confirm="bingDevice" >
-        <view class="slot-content">
-
-          <view>设备名称:{{ scanDevice.deviceName }}</view>
-          <view>产品名称:{{ scanDevice.productName }}</view>
-          <view>设备编号:{{ scanDevice.serialNumber }}</view>
-          <view>激活日期:{{ scanDevice.activeTime }}</view>
-
-        </view>
-      </u-modal>
-  </view>
-</template>
-
-<script>
-import authObj from '@/plugins/auth.js';
-import {getDevcieByQrcode,bindDevice} from '@/api/device/device';
-import UImage from "../../uni_modules/uview-ui/components/u--image/u--image";
-import config from '@/config'
-export default {
-  components: {UImage},
-  data() {
-      return {
-        deptId:0,
-        dlgTitle:"",
-        current: 0,
-        swiperDotIndex: 0,
-        show:false,
-        imgUrl:"",
-        scanDevice:{},
-        data: [
-        ]
-      }
-    },
-  onLoad(){
-    this.imgUrl = config.imgUrl
-    this.data.push({
-      image:this.imgUrl+"/mini/banner/banner01.png"
-    });
-    if(this.isCompanyUser()){
-      this.deptId = this.$store.state.user.user.deptId;
-      console.log( this.deptId );
-    }
-
-  },
-    methods: {
-      bingDevice(){
-          this.show = false;
-        bindDevice(this.scanDevice).then(res=>{
-          if(res.code == 200){
-            this.$modal.showToast('操作成功')
-          }else{
-            this.$modal.showToast(res.msg);
-          }
-
-        })
-      },
-      cancel(){
-        this.show = false;
-        this.scanDevice = {};
-      },
-      clickBannerItem(item) {
-        console.log();
-      },
-      hasRole(role){
-        return authObj.authRoleAdmin(role);
-      },
-      isTestRole(){
-        return authObj.authRoleAdmin("testdevice");
-      },
-      isCompanyUser(){
-        return authObj.authRoleAdmin(["companymgr"]) || authObj.authRoleAdmin(["companyuser"]);
-      },
-      changeSwiper(e) {
-        this.current = e.detail.current
-      },
-      changeGrid(e) {
-        this.$modal.showToast('模块建设中~')
-      },
-      watchDevice(){
-        let self = this;
-        uni.scanCode({
-          success: function (res) {
-            console.log('条码内容:' + res.result);
-            getDevcieByQrcode(res.result).then(res=>{
-              let device = res.data;
-              if(self.isCompanyUser()){
-                if(device.deptId == null || device.deptId == 0){
-                  self.$modal.showToast('设备不存在或无权限')
-                  return;
-                }
-              }
-
-              if(device != null){
-                let type =device.type;
-                if(type == 24){
-                  uni.navigateTo({
-                    url: '/subpkg/device/detail_new_20250528?id='+device.deviceId
-                  });
-                  return;
-                }
-                if(type == 16 || type == 17 || type == 18 || type == 19){
-                  uni.navigateTo({
-                    url: '/subpkg/device/detail_6?id='+device.deviceId
-                  });
-                }else if(type == 20 || type == 21 || type == 22){
-                  uni.navigateTo({
-                    url: '/subpkg/device/detail_new_5?id='+device.deviceId
-                  });
-                }else{
-                  uni.navigateTo({
-                    url: '/subpkg/device/detail?id='+device.deviceId
-                  });
-                }
-
-              }else{
-                self.$modal.showToast('设备不存在或无权限')
-              }
-
-            });
-          }
-        });
-      },
-      scanCode(){
-        let self = this;
-        uni.scanCode({
-          success: function (res) {
-            console.log('条码内容:' + res.result);
-            getDevcieByQrcode(res.result).then(res=>{
-              let device = res.data;
-              if(!device){
-                self.$modal.showToast('设备不存在或该已经绑定用户')
-              }else{
-                if(device.deptId != null && device.deptId>0){
-                  self.$modal.showToast('该设备已经绑定了用户')
-                }else{
-                  self.dlgTitle = "绑定设备";
-                  self.scanDevice = device;
-                  self.show = true;
-                }
-              }
-            });
-          }
-        });
-      },
-
-      goPage(path){
-        if('deptuser' == path){
-          uni.navigateTo({
-            url: '/pages/user/list?deptId='+this.deptId
-          });
-        }
-        if('device' == path){
-          uni.navigateTo({
-            url: '/subpkg/device/index'
-          });
-        }
-        if('wifi' == path){
-          uni.navigateTo({
-            url: '/pages/bluetooth/index/index'
-          });
-        }
-        if('scan' == path){
-          uni.navigateTo({
-            url: '/subpkg/device/scan'
-          });
-        }
-        if('user' == path){
-          uni.navigateTo({
-            url: '/pages/user/index'
-          });
-        }
-        if('alert' == path){
-          uni.navigateTo({
-            url: '/subpkg/device/alert'
-          });
-        }
-        if('error' == path){
-          uni.navigateTo({
-            url: '/subpkg/device/error'
-          });
-        }
-        if('reset' == path){
-          uni.navigateTo({
-            url: '/subpkg/device/reset/reset'
-          });
-        }
-
-        if('time' == path){
-          uni.navigateTo({
-            url: '/subpkg/device/rank'
-          });
-        }
-		if('reviews'==path){
-			uni.navigateTo({
-				url:'/pages/reviews/reviews'
-			})
-		}
-
-
-      }
-    }
-  }
-</script>
-
-<style lang="scss">
-  /* #ifndef APP-NVUE */
-  page {
-    display: flex;
-    flex-direction: column;
-    box-sizing: border-box;
-    background-color: #fff;
-    min-height: 100%;
-    height: auto;
-  }
-
-  view {
-    font-size: 14px;
-    line-height: inherit;
-  }
-
-  /* #endif */
-
-  .text {
-    text-align: center;
-    font-size: 26rpx;
-    margin-top: 10rpx;
-  }
-
-  .grid-item-box {
-    flex: 1;
-    /* #ifndef APP-NVUE */
-    display: inline-block;
-    position: relative;
-    /* #endif */
-    flex-direction: column;
-    align-items: center;
-    justify-content: center;
-    padding: 15px 0;
-    height: 250rpx;
-    width:50%;
-  }
-
-  .uni-margin-wrap {
-    width: 690rpx;
-    width: 100%;
-    ;
-  }
-
-  .swiper {
-    height: 300rpx;
-  }
-
-  .swiper-box {
-    height: 150px;
-  }
-
-  .swiper-item {
-    /* #ifndef APP-NVUE */
-    display: flex;
-    /* #endif */
-    flex-direction: column;
-    justify-content: center;
-    align-items: center;
-    color: #fff;
-    height: 300rpx;
-    line-height: 300rpx;
-  }
-
-  @media screen and (min-width: 500px) {
-    .uni-swiper-dot-box {
-      width: 400px;
-      /* #ifndef APP-NVUE */
-      margin: 0 auto;
-      /* #endif */
-      margin-top: 8px;
-    }
-
-    .image {
-      width: 100%;
-    }
-  }
-  .grid-image{
-    position: absolute;
-    left: 61rpx;
-    top: 49rpx;
-  }
-  .grid-text{
-    position: absolute;
-    left:184rpx;
-    top:62rpx;
-    color: #545454;
-    .top{
-      font-weight: bold;
-      font-size: 32rpx;
-      margin-bottom: 30rpx;
-    }
-    .bottom{
-      font-size: 18rpx;
-      font-weight: 400;
-    }
-  }
-
-</style>

+ 241 - 280
utils/modbus.js

@@ -2,10 +2,11 @@
 let _globalSlaveAddress = 0x01; //全局初始从机地址
 let connected = false;  // 连接状态
 let sharedHeartbeatInterval = null; // 心跳定时器变量
-let agreement = 'DEVICE_A'; //协议类型 默认为 DEVICE_A
+let agreement = 'Lora'; //协议类型 默认为 Lora
 let taskInterval  = 500; // 定时任务频率
 let timeStatus = true;
 import store from '@/store';
+import { MODBUS_FRAME_CONFIG,MODBUS_TYPES } from '@/utils/modbusConfig.js';
 // 先声明变量
 let ecUI, ecBLE;
 
@@ -35,6 +36,11 @@ export function getConnected() {
 export function setAgreement(type) {
     agreement = type;
 }
+
+export function getAgreement() {
+    return agreement;
+}
+
 export function setTime(value) {
     if (value === taskInterval && isHeartbeatRunning()){
         return;
@@ -72,6 +78,16 @@ export function initBLE() {
             console.log("数据来了");
             let data = strHex.replace(/[0-9a-fA-F]{2}/g, ' $&') ;
             const parsedData = readRegister(data)
+            if (parsedData.device === '255' || parsedData.device === 'FF' || parsedData.device === 255){
+                let b = isHeartbeatRunning();
+                if (!b){
+                    if (parsedData.Addres_23 !== _globalSlaveAddress){
+                        _globalSlaveAddress = parsedData.Addres_23;
+                    }
+                    startHeartbeat();
+                }
+
+            }
             store.dispatch('ble/updateData', parsedData)
         } catch (error) {
             store.dispatch('ble/updateError', error)
@@ -90,225 +106,9 @@ export function setGlobalSlaveAddress(addr) {
 }
 
 export function getGlobalSlaveAddress() {
-    console.log(_globalSlaveAddress);
     return _globalSlaveAddress;
 }
 
-/**
- * 支持的 Modbus 类型
- */
-export const MODBUS_TYPES = {
-    WRITE_ADDRESS: 'WRITE_ADDRESS',
-    READ_REGISTER: 'READ_REGISTER',
-};
-
-
-
-/**
- * Modbus 协议帧配置
- */
-export const MODBUS_FRAME_CONFIG = {
-    DEVICE_A: {
-        WRITE_ADDRESS: { //写地址
-            type: MODBUS_TYPES.WRITE_ADDRESS,
-            slaveAddress: 0x00,
-            functionCode: 0x06,
-            startAddress: 0x0017,
-            value: null,
-        },
-        GET_ADDRESS: { //读取地址
-            type: MODBUS_TYPES.WRITE_ADDRESS,
-            slaveAddress: 0xFF,     // 从协议数据看是FF
-            functionCode: 0x03,     // 功能码03
-            startAddress: 0x0001,   // 起始地址0001
-            value: "0x0046",          // 读取0个寄存器(根据实际需求可调整)
-        },
-        TIMED_TASKS:{ //定时任务
-            type: MODBUS_TYPES.WRITE_ADDRESS,
-            slaveAddress:  _globalSlaveAddress,
-            functionCode: 0x03,
-            startAddress: 0x0001,
-            value: "0x0046",
-        },
-         RAIN:{ //雨
-            type: MODBUS_TYPES.WRITE_ADDRESS,
-            slaveAddress: _globalSlaveAddress,
-            functionCode: 0x06,
-            startAddress: 0x0029,
-            value: "0x0200",
-        },
-         SNOW:{ //雪
-            type: MODBUS_TYPES.WRITE_ADDRESS,
-            slaveAddress: _globalSlaveAddress,
-            functionCode: 0x06,
-            startAddress: 0x0029,
-            value: "0x0100",
-        },
-        WIND:{ //风
-            type: MODBUS_TYPES.WRITE_ADDRESS,
-            slaveAddress: _globalSlaveAddress,
-            functionCode: 0x06,
-            startAddress: 0x0029,
-            value: "0x0400",
-        },
-        FLATTEN:{ //放平
-            type: MODBUS_TYPES.WRITE_ADDRESS,
-            slaveAddress: _globalSlaveAddress,
-            functionCode: 0x06,
-            startAddress: 0x0029,
-            value: "0x0040",
-        },
-        STOP:{ //停止
-            type: MODBUS_TYPES.WRITE_ADDRESS,
-            slaveAddress: _globalSlaveAddress,
-            functionCode: 0x06,
-            startAddress: 0x0029,
-            value: "0x0080",
-        },
-        READ_MANUAL:{ //手动
-            type: MODBUS_TYPES.WRITE_ADDRESS,
-            slaveAddress: _globalSlaveAddress,
-            functionCode: 0x06,
-            startAddress: 0x0029,
-            value: "0x0010",
-        },
-         READ_AUTO:{ //自动
-            type: MODBUS_TYPES.WRITE_ADDRESS,
-            slaveAddress: _globalSlaveAddress,
-            functionCode: 0x06,
-            startAddress: 0x0029,
-            value: "0x0020",
-        },
-        READ_DOWN:{ //向东
-            type: MODBUS_TYPES.WRITE_ADDRESS,
-            slaveAddress: _globalSlaveAddress,
-            functionCode: 0x06,
-            startAddress: 0x0029,
-            value: "0x0018",
-        },
-        READ_UP:{ //向西
-            type: MODBUS_TYPES.WRITE_ADDRESS,
-            slaveAddress: _globalSlaveAddress,
-            functionCode: 0x06,
-            startAddress: 0x0029,
-            value: "0x0014",
-        },
-        READ_CANCEL:{ //取消
-            type: MODBUS_TYPES.WRITE_ADDRESS,
-            slaveAddress: _globalSlaveAddress,
-            functionCode: 0x06,
-            startAddress: 0x0029,
-            value: "0x0000",
-        },
-        READ_TIME:{ //校正时间
-            type: MODBUS_TYPES.READ_REGISTER,
-            slaveAddress: _globalSlaveAddress,
-            functionCode: 0x10,
-            startAddress: 0x002C,
-            value: null,
-        },
-
-        READ_TEMPERATURE:{ //天文写入
-            type: MODBUS_TYPES.READ_REGISTER,
-            slaveAddress: _globalSlaveAddress,
-            functionCode: 0x10,
-            startAddress: 0x0032,
-            value: null,
-        },
-        READ_LIMIT:{ //限位写入
-            type: MODBUS_TYPES.READ_REGISTER,
-            slaveAddress: _globalSlaveAddress,
-            functionCode: 0x10,
-            startAddress: 0x0040,
-            value: null,
-        },
-        READ_INCLINATION:{ //坡度写入
-            type: MODBUS_TYPES.READ_REGISTER,
-            slaveAddress: _globalSlaveAddress,
-            functionCode: 0x10,
-            startAddress: 0x003C,
-            value: null,
-        },
-        READ_FREQUENCY:{ //频点写入
-            type: MODBUS_TYPES.READ_REGISTER,
-            slaveAddress: _globalSlaveAddress,
-            functionCode: 0x10,
-            startAddress: 0x0019,
-            value: null,
-        },
-         READ_DIRECTION:{ //电机方向 正转动
-            type: MODBUS_TYPES.WRITE_ADDRESS,
-            slaveAddress: _globalSlaveAddress,
-            functionCode: 0x06,
-            startAddress: 0x0025,
-            value: "0x0000",
-        },
-         READ_REVERSE:{ //电机方向 反转
-            type: MODBUS_TYPES.WRITE_ADDRESS,
-            slaveAddress: _globalSlaveAddress,
-            functionCode: 0x06,
-            startAddress: 0x0025,
-            value: "0x0001",
-        },
-         READ_RETURN:{ //夜返角度
-            type: MODBUS_TYPES.WRITE_ADDRESS,
-            slaveAddress: _globalSlaveAddress,
-            functionCode: 0x06,
-            startAddress: 0x0042,
-            value: null,
-        },
-        READ_FLAT:{ //放平角度
-            type: MODBUS_TYPES.WRITE_ADDRESS,
-            slaveAddress: _globalSlaveAddress,
-            functionCode: 0x06,
-            startAddress: 0x0043,
-            value: null,
-        },
-        READ_SPECIFY:{ //指定角度
-            type: MODBUS_TYPES.WRITE_ADDRESS,
-            slaveAddress: _globalSlaveAddress,
-            functionCode: 0x06,
-            startAddress: 0x0045,
-            value: null,
-        },
-        READ_SNOW:{ //雪天角度
-            type: MODBUS_TYPES.WRITE_ADDRESS,
-            slaveAddress: _globalSlaveAddress,
-            functionCode: 0x06,
-            startAddress: 0x0044,
-            value: null,
-        },
-        READ_WIND:{ //大风角度
-            type: MODBUS_TYPES.WRITE_ADDRESS,
-            slaveAddress: _globalSlaveAddress,
-            functionCode: 0x06,
-            startAddress: 0x0046,
-            value: null,
-        },
-        READ_OVERCURRENT:{ //过流写入
-            type: MODBUS_TYPES.WRITE_ADDRESS,
-            slaveAddress: _globalSlaveAddress,
-            functionCode: 0x06,
-            startAddress: 0x0026,
-            value: null,
-        },
-        READ_TRACKING:{ //跟踪精度
-            type: MODBUS_TYPES.WRITE_ADDRESS,
-            slaveAddress: _globalSlaveAddress,
-            functionCode: 0x06,
-            startAddress: 0x0027,
-            value: null,
-        },
-
-    },
-    DEVICE_B: {
-
-    },
-    DEVICE_C: {
-
-    },
-};
-
 
 /**
  * 写入操作
@@ -343,7 +143,7 @@ export function writeRegister(action, valueToWrite) {
                 if (getConnected() && timeStatus) {
                     startHeartbeat();
                 }
-            }, 50);
+            }, 100);
         }
     }
 
@@ -430,8 +230,6 @@ function generateModbusFrame(protocol, action, valueToWrite) {
         slaveAddress = _globalSlaveAddress;
     }
 
-    // validateParams({ slaveAddress, functionCode, startAddress, valueToWrite });
-
     let buffer;
     if (type === MODBUS_TYPES.READ_REGISTER) {
 
@@ -523,6 +321,15 @@ export function arrayBufferToHex(buffer, withSpaces = false) {
 }
 
 
+const FAULT_CODE_MAP = {
+    '0': '无故障',
+    '1': '角度保护',
+    '2': '角度矫正失败',
+    '3': '过流保护',
+    '4': '通讯保护',
+    '5': '限位保护'
+};
+
 /**
  * 解析蓝牙数据
  */
@@ -538,7 +345,18 @@ export function parseBluetoothData(hexString) {
     if (cleanHexString.length < 6) {
         throw new Error('蓝牙数据不完整');
     }
+    // 根据协议类型选择不同的解析方式
+    if (agreement === 'Lora') {
+        return parseLoraData(cleanHexString);
+    } else if (agreement === 'zigbee') {
+        console.log("zigbee协议")
+        return parseZigbeeData(cleanHexString);
+    }
+
+}
+ function parseLoraData(cleanHexString) {
     // 将连续的十六进制字符串转换为带空格的格式
+    const register = createEmptyRegister();
     const formattedHexString = cleanHexString.match(/.{1,2}/g)?.join(' ') || cleanHexString;
 
     const byteStrings = formattedHexString.split(' ').filter(s => s.length > 0);
@@ -553,65 +371,6 @@ export function parseBluetoothData(hexString) {
         throw new Error('蓝牙数据不完整');
     }
 
-    const register = {
-        device: '',
-        function: '',
-        registerNumber: '',
-        Addres_23: '',
-        Frequence_25: '',
-        NetworkId_26: '',
-        modAddre_27: '',
-        MotorCurrent_30: '',
-        MotorCurrent_35: '',
-        Battery_32: '',
-        Temperature_33: '',
-        MotDrection_37: '',
-        OverProtection_38: '',
-        TrackingAccuracy_39: '',
-        Message_40: '',
-        WorkModle_41: '',
-        TargetAngle_42: '',
-        RealAngle_43: '',
-        RealAngle_31: '',
-        Year_44: '',
-        Month_45: '',
-        Day_46: '',
-        Hour_47: '',
-        Minute_48: '',
-        Second_49: '',
-        nowtime: '',
-        Longitude_50: '',
-        Latitude_51: '',
-        TimeZone_52: '',
-        EleAngle_53: '',
-        Azimuth_54: '',
-        width_60: '',
-        inter_61: '',
-        UpGrade_62: '',
-        DownGrade_63: '',
-        EasternLimit_64: '',
-        WesternLimit_65: '',
-        NightAngle_66: '',
-        FlatAngle_67: '',
-        SnowAngle_68: '',
-        SpecifiedAngle_69: '',
-        WindAngle_70: '',
-        qAzimuth_54: '',
-        qwidth_60: '',
-        Interval_61: '',
-        qEasternLimit_64: '',
-        qWesternLimit_65: '',
-        qNightAngle_66: '',
-        qFlatAngle_67: '',
-        qSnowAngle_68: '',
-        qSpecifiedAngle_69: '',
-        qWindAngle_70: '',
-        qEleAngle_53: '',
-        qTargetAngle_42: '',
-        qRealAngle_43: '',
-        qRealAngle_31: ''
-    };
-
     register.device = parseInt(byteStrings[0], 16);
     register.function = parseInt(byteStrings[1], 16);
     register.registerNumber = parseInt(byteStrings[2], 16);
@@ -624,11 +383,14 @@ export function parseBluetoothData(hexString) {
         formattedOutput.push(combined.toUpperCase());
     }
 
-    // 参照mainwindow.cpp的解析逻辑补全
     for (let i = 1; i < formattedOutput.length; i++) {
         const value = parseInt(formattedOutput[i], 16);
         const valueInt16 = (value > 0x7FFF) ? value - 0x10000 : value; // 转换为有符号16位整数
 
+        if (i === 8) { // 故障码
+            register.FaultCode_10 = valueInt16.toString();
+            register.FaultCodeDescription = FAULT_CODE_MAP[register.FaultCode_10] || '未知故障';
+        }
         if (i === 22) { // 地址写入
             register.Addres_23 = valueInt16.toString();
         } else if (i === 24) { // 频点[0-83]
@@ -735,6 +497,205 @@ export function parseBluetoothData(hexString) {
     console.log(JSON.stringify( register));
     return register;
 }
+function parseZigbeeData(hexString) {
+
+    const register = createEmptyRegister();
+
+    // 将连续的十六进制字符串转换为带空格的格式
+    const formattedHexString = hexString.match(/.{1,2}/g)?.join(' ') || hexString;
+    const byteStrings = formattedHexString.split(' ').filter(s => s.length > 0);
+
+    if (byteStrings.length < 10 ){  //其他操作执行成功
+        return;
+    }
+
+    if (!byteStrings || byteStrings.length < 3) {
+        throw new Error('蓝牙数据不完整');
+    }
+
+    register.device = parseInt(byteStrings[0], 16);
+    register.function = parseInt(byteStrings[1], 16);
+    register.registerNumber = parseInt(byteStrings[2], 16);
+
+    const formattedOutput = [];
+    for (let i = 3; i < byteStrings.length; i += 2) {
+        const byte1 = parseInt(byteStrings[i], 16);
+        const byte2 = i + 1 < byteStrings.length ? parseInt(byteStrings[i + 1], 16) : 0;
+        const combined = ((byte1 << 8) | byte2).toString(16).padStart(4, '0');
+        formattedOutput.push(combined.toUpperCase());
+    }
+
+
+    for (let i = 1; i < formattedOutput.length; i++) {
+        const value = parseInt(formattedOutput[i], 16);
+        const valueInt16 = (value > 0x7FFF) ? value - 0x10000 : value; // 转换为有符号16位整数
+
+
+        if (i === 30) { // 地址写入zigbee 31-30
+            register.Addres_23 = valueInt16.toString();
+        } else if (i === 46) { // 模块地址
+            register.modAddre_27 = valueInt16;
+
+            // 从模块地址中提取频点和网络ID
+            const hexStr = valueInt16.toString(16).padStart(4, '0').toUpperCase();
+            const highPartHex = hexStr.substring(0, 2);
+            const lowPartHex = hexStr.substring(2, 4);
+
+            register.NetworkId_26 = parseInt(highPartHex, 16).toString();
+            register.Frequence_25 = parseInt(lowPartHex, 16).toString();
+        } else if (i === 23) { // 电机电流1位小数(A)24-23
+            register.MotorCurrent_30 = valueInt16.toString();
+            register.MotorCurrent_30 = insertDecimal(register.MotorCurrent_30, 1);
+        } else if (i === 47) { // 电池1位小数(V)48-47
+            register.Battery_32 = valueInt16.toString();
+            register.Battery_32 = insertDecimal(register.Battery_32, 1);
+        } else if (i === 48) { // 温度(度)49-48
+            register.Temperature_33 = valueInt16.toString();
+        } else if (i === 45) { // 电机方向46-45
+            register.MotDrection_37 = valueInt16.toString();
+        } else if (i === 29) { // 过流保护(A)30-29
+            register.OverProtection_38 = valueInt16.toString();
+        } else if (i === 22) { // 跟踪精度 23-22
+            register.TrackingAccuracy_39 = valueInt16.toString();
+        } else if (i === 3) { // 十进制转二进制0111倾角+过流+限位  4-3
+            register.Message_40 = valueInt16.toString(2); // 转二进制
+        } else if (i === 1) { // 工作模式2-1
+            register.WorkModle_41 = valueInt16.toString(2); // 转二进制
+        } else if (i === 9) { // 目标角度_两位小数10-9
+            register.TargetAngle_42 = valueInt16;
+            register.qTargetAngle_42 = insertDecimal(register.TargetAngle_42.toString(), 2);
+        } else if (i === 10) { // 实际角度_两位小数11-10
+            register.RealAngle_43 = valueInt16;
+            register.qRealAngle_43 = insertDecimal(register.RealAngle_43.toString(), 2);
+        } else if (i === 13) { // 年 14-13
+            register.Year_44 = valueInt16.toString();
+        } else if (i === 14) { // 月
+            register.Month_45 = valueInt16.toString();
+        } else if (i === 15) { // 日
+            register.Day_46 = valueInt16.toString();
+        } else if (i === 16) { // 时
+            register.Hour_47 = valueInt16.toString();
+        } else if (i === 17) { // 分
+            register.Minute_48 = valueInt16.toString();
+        } else if (i === 18) { // 秒
+            register.Second_49 = valueInt16.toString();
+            register.nowtime = `${register.Year_44}-${register.Month_45}-${register.Day_46} ${register.Hour_47.padStart(2, '0')}:${register.Minute_48.padStart(2, '0')}:${register.Second_49.padStart(2, '0')}`;
+        } else if (i === 19) { // 太阳经度_两位小数20-19
+            register.Longitude_50 = valueInt16.toString();
+            register.Longitude_50 = insertDecimal(register.Longitude_50, 2);
+        } else if (i === 20) { // 太阳纬度_两位小数21-20
+            register.Latitude_51 = valueInt16.toString();
+            register.Latitude_51 = insertDecimal(register.Latitude_51, 2);
+        } else if (i === 21) { // 时区_两位小数800   22-21
+            register.TimeZone_52 = valueInt16.toString();
+            register.TimeZone_52 = insertDecimal(register.TimeZone_52, 2);
+        } else if (i === 5) { // 太阳高度角_两位小数6-5
+            register.EleAngle_53 = valueInt16;
+            register.qEleAngle_53 = insertDecimal(register.EleAngle_53.toString(), 2);
+        } else if (i === 6) { // 太阳方位角_两位小数180调零7-6
+            register.Azimuth_54 = valueInt16;
+            register.qAzimuth_54 = insertDecimal(register.Azimuth_54.toString(), 2);
+        } else if (i === 31) { // 宽度_两位小数32-31
+            register.width_60 = valueInt16;
+            register.qwidth_60 = insertDecimal(register.width_60.toString(), 2);
+        } else if (i === 32) { // 间距_两位小数33-32
+            register.inter_61 = valueInt16;
+            register.Interval_61 = insertDecimal(register.inter_61.toString(), 2);
+        } else if (i === 33) { // 上坡度_两位小数34-33
+            register.UpGrade_62 = valueInt16.toString();
+            register.UpGrade_62 = insertDecimal(register.UpGrade_62, 2);
+        } else if (i === 34) { // 下坡度_两位小数35-34
+            register.DownGrade_63 = valueInt16.toString();
+            register.DownGrade_63 = insertDecimal(register.DownGrade_63, 2);
+        } else if (i === 39) { // 东限位40-39
+            register.EasternLimit_64 = valueInt16;
+            register.qEasternLimit_64 = register.EasternLimit_64.toString();
+        } else if (i === 40) { // 西限位
+            register.WesternLimit_65 = valueInt16;
+            register.qWesternLimit_65 = register.WesternLimit_65.toString();
+        } else if (i === 89) { // 夜返角
+            register.NightAngle_66 = valueInt16;
+            register.qNightAngle_66 = register.NightAngle_66.toString();
+        } else if (i === 42) { // 放平角度
+            register.FlatAngle_67 = valueInt16;
+            register.qFlatAngle_67 = register.FlatAngle_67.toString();
+        } else if (i === 41) { // 雪天角度
+            register.SnowAngle_68 = valueInt16;
+            register.qSnowAngle_68 = register.SnowAngle_68.toString();
+        } else if (i === 43) { // 指定角度
+            register.SpecifiedAngle_69 = valueInt16;
+            register.qSpecifiedAngle_69 = register.SpecifiedAngle_69.toString();
+        } else if (i === 44) { // 大风角度
+            register.WindAngle_70 = valueInt16;
+            register.qWindAngle_70 = register.WindAngle_70.toString();
+        }
+    }
+    return register;
+}
+
+ function createEmptyRegister() {
+     const register = {
+        device: '',
+        function: '',
+        registerNumber: '',
+        Addres_23: '',
+        Frequence_25: '',
+        NetworkId_26: '',
+        modAddre_27: '',
+        MotorCurrent_30: '',
+        MotorCurrent_35: '',
+        Battery_32: '',
+        Temperature_33: '',
+        MotDrection_37: '',
+        OverProtection_38: '',
+        TrackingAccuracy_39: '',
+        Message_40: '',
+        WorkModle_41: '',
+        TargetAngle_42: '',
+        RealAngle_43: '',
+        RealAngle_31: '',
+        Year_44: '',
+        Month_45: '',
+        Day_46: '',
+        Hour_47: '',
+        Minute_48: '',
+        Second_49: '',
+        nowtime: '',
+        Longitude_50: '',
+        Latitude_51: '',
+        TimeZone_52: '',
+        EleAngle_53: '',
+        Azimuth_54: '',
+        width_60: '',
+        inter_61: '',
+        UpGrade_62: '',
+        DownGrade_63: '',
+        EasternLimit_64: '',
+        WesternLimit_65: '',
+        NightAngle_66: '',
+        FlatAngle_67: '',
+        SnowAngle_68: '',
+        SpecifiedAngle_69: '',
+        WindAngle_70: '',
+        qAzimuth_54: '',
+        qwidth_60: '',
+        Interval_61: '',
+        qEasternLimit_64: '',
+        qWesternLimit_65: '',
+        qNightAngle_66: '',
+        qFlatAngle_67: '',
+        qSnowAngle_68: '',
+        qSpecifiedAngle_69: '',
+        qWindAngle_70: '',
+        qEleAngle_53: '',
+        qTargetAngle_42: '',
+        qRealAngle_43: '',
+         qRealAngle_31: '',
+         FaultCode_10:'',
+         FaultCodeDescription: ''
+    };
+     return register;
+}
 
 /**
  * 在数字中插入小数点

+ 437 - 0
utils/modbusConfig.js

@@ -0,0 +1,437 @@
+/**
+ * 支持的 Modbus 类型
+ */
+export const MODBUS_TYPES = {
+    WRITE_ADDRESS: 'WRITE_ADDRESS',
+    READ_REGISTER: 'READ_REGISTER',
+};
+
+/**
+ * Modbus 协议帧配置
+ */
+export const MODBUS_FRAME_CONFIG = {
+    Lora: {
+        WRITE_ADDRESS: { //写地址
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: 0x00,
+            functionCode: 0x06,
+            startAddress: 0x0017,
+            value: null,
+        },
+        GET_ADDRESS: { //读取地址
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: 0xFF,     // 从协议数据看是FF
+            functionCode: 0x03,     // 功能码03
+            startAddress: 0x0001,   // 起始地址0001
+            value: "0x0046",          // 读取0个寄存器(根据实际需求可调整)
+        },
+        TIMED_TASKS:{ //定时任务
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress:  null,
+            functionCode: 0x03,
+            startAddress: 0x0001,
+            value: "0x0046",
+        },
+        RAIN:{ //雨
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0029,
+            value: "0x0200",
+        },
+        SNOW:{ //雪
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0029,
+            value: "0x0100",
+        },
+        WIND:{ //风
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0029,
+            value: "0x0400",
+        },
+        FLATTEN:{ //放平
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0029,
+            value: "0x0040",
+        },
+        STOP:{ //停止
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0029,
+            value: "0x0080",
+        },
+        READ_MANUAL:{ //手动
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0029,
+            value: "0x0010",
+        },
+        READ_AUTO:{ //自动
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0029,
+            value: "0x0020",
+        },
+        READ_DOWN:{ //向东
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0029,
+            value: "0x0018",
+        },
+        READ_UP:{ //向西
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0029,
+            value: "0x0014",
+        },
+        READ_CANCEL:{ //取消
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0029,
+            value: "0x0000",
+        },
+        READ_TIME:{ //校正时间
+            type: MODBUS_TYPES.READ_REGISTER,
+            slaveAddress: null,
+            functionCode: 0x10,
+            startAddress: 0x002C,
+            value: null,
+        },
+
+        READ_TEMPERATURE:{ //天文写入
+            type: MODBUS_TYPES.READ_REGISTER,
+            slaveAddress: null,
+            functionCode: 0x10,
+            startAddress: 0x0032,
+            value: null,
+        },
+        READ_LIMIT:{ //限位写入
+            type: MODBUS_TYPES.READ_REGISTER,
+            slaveAddress: null,
+            functionCode: 0x10,
+            startAddress: 0x0040,
+            value: null,
+        },
+        READ_INCLINATION:{ //坡度写入
+            type: MODBUS_TYPES.READ_REGISTER,
+            slaveAddress: null,
+            functionCode: 0x10,
+            startAddress: 0x003C,
+            value: null,
+        },
+        READ_FREQUENCY:{ //频点写入
+            type: MODBUS_TYPES.READ_REGISTER,
+            slaveAddress: null,
+            functionCode: 0x10,
+            startAddress: 0x0019,
+            value: null,
+        },
+        READ_DIRECTION:{ //电机方向 正转动
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0025,
+            value: "0x0000",
+        },
+        READ_REVERSE:{ //电机方向 反转
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0025,
+            value: "0x0001",
+        },
+        READ_RETURN:{ //夜返角度
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0042,
+            value: null,
+        },
+        READ_FLAT:{ //放平角度
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0043,
+            value: null,
+        },
+        READ_SPECIFY:{ //指定角度
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0045,
+            value: null,
+        },
+        READ_SNOW:{ //雪天角度
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0044,
+            value: null,
+        },
+        READ_WIND:{ //大风角度
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0046,
+            value: null,
+        },
+        READ_OVERCURRENT:{ //过流写入
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0026,
+            value: null,
+        },
+        READ_TRACKING:{ //跟踪精度
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0027,
+            value: null,
+        },
+        READ_MOTOR_STOP: { // 停止
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0013, // 19号寄存器 (十进制)
+            value: "0x0000",
+        },
+        READ_MOTOR1_EAST: { // 电机1向东
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0013, // 19号寄存器 (十进制)
+            value: "0x0001",
+        },
+        READ_MOTOR1_WEST: { // 电机1向西
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0013, // 19号寄存器 (十进制)
+            value: "0x0002",
+        },
+        READ_MOTOR2_EAST: { // 电机2向东
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0013, // 19号寄存器 (十进制)
+            value: "0x0003",
+        },
+        READ_MOTOR2_WEST: { // 电机2向西
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0013, // 19号寄存器 (十进制)
+            value: "0x0004",
+        },
+
+    },
+
+    zigbee: {
+        WRITE_ADDRESS: { //写地址
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: 0x00,
+            functionCode: 0x06,
+            startAddress: 0x001F,
+            value: null,
+        },
+        GET_ADDRESS: { //读取地址
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: 0xFF,     
+            functionCode: 0x03,     
+            startAddress: 0x0001,   
+            value: "0x0046",         
+        },
+        TIMED_TASKS:{ //定时任务
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress:  null,
+            functionCode: 0x03,
+            startAddress: 0x0001,
+            value: "0x003C",
+        },
+        RAIN:{ //雨
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0002,
+            value: "0x0200",
+        },
+        SNOW:{ //雪
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0002,
+            value: "0x0100",
+        },
+        WIND:{ //风
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0002,
+            value: "0x0400",
+        },
+        FLATTEN:{ //放平
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0002,
+            value: "0x0040",
+        },
+        STOP:{ //停止
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0002,
+            value: "0x0080",
+        },
+        READ_MANUAL:{ //手动
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0002,
+            value: "0x0010",
+        },
+        READ_AUTO:{ //自动
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0002,
+            value: "0x0020",
+        },
+        READ_DOWN:{ //向东
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0002,
+            value: "0x0018",
+        },
+        READ_UP:{ //向西
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0002,
+            value: "0x0014",
+        },
+        READ_CANCEL:{ //取消
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0002,
+            value: "0x0000",
+        },
+        READ_TIME:{ //校正时间
+            type: MODBUS_TYPES.READ_REGISTER,
+            slaveAddress: null,
+            functionCode: 0x10,
+            startAddress: 0x000E,
+            value: null,
+        },
+
+        READ_TEMPERATURE:{ //天文写入
+            type: MODBUS_TYPES.READ_REGISTER,
+            slaveAddress: null,
+            functionCode: 0x10,
+            startAddress: 0x0014,
+            value: null,
+        },
+        READ_LIMIT:{ //限位写入
+            type: MODBUS_TYPES.READ_REGISTER,
+            slaveAddress: null,
+            functionCode: 0x10,
+            startAddress: 0x0028,
+            value: null,
+        },
+        READ_INCLINATION:{ //坡度写入
+            type: MODBUS_TYPES.READ_REGISTER,
+            slaveAddress: null,
+            functionCode: 0x10,
+            startAddress: 0x0020,
+            value: null,
+        },
+        READ_FREQUENCY:{ //频点写入
+            type: MODBUS_TYPES.READ_REGISTER,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x002F,
+            value: null,
+        },
+        READ_DIRECTION:{ //电机方向 正转动
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x002E,
+            value: "0x0000",
+        },
+        READ_REVERSE:{ //电机方向 反转
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x002E,
+            value: "0x0001",
+        },
+        READ_RETURN:{ //夜返角度
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0042,
+            value: null,
+        },
+        READ_FLAT:{ //放平角度
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x002B,
+            value: null,
+        },
+        READ_SPECIFY:{ //指定角度
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x002C,
+            value: null,
+        },
+        READ_SNOW:{ //雪天角度
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x002A,
+            value: null,
+        },
+        READ_WIND:{ //大风角度
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x002D,
+            value: null,
+        },
+        READ_OVERCURRENT:{ //过流写入
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x001E,
+            value: null,
+        },
+        READ_TRACKING:{ //跟踪精度
+            type: MODBUS_TYPES.WRITE_ADDRESS,
+            slaveAddress: null,
+            functionCode: 0x06,
+            startAddress: 0x0017,
+            value: null,
+        },
+    },
+    DEVICE_C: {
+
+    },
+};