From 247b2582ab497335d1c232a35cf03f9b73b7e67a Mon Sep 17 00:00:00 2001 From: "3321822538@qq.com" <3321822538@qq.com> Date: Mon, 22 Jul 2024 18:03:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=A3=E5=9C=A8=E5=AE=8C=E5=96=84=20wifi?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/http.interceptor.js | 4 +- page_components/bindsz.vue | 126 ++++++-- page_components/fuwu/index.vue | 10 +- page_components/newtaocan.vue | 3 + page_components/wifilist/index.vue | 236 ++++++++++++++- page_fenbao/statulist/myshop/shopxx/index.vue | 6 + page_fenbao/statulist/taocanlist/index.vue | 113 ++++---- page_fenbao/zhuce.vue | 130 +++++---- page_user/HM-dragSorts/HM-dragSorts.vue | 12 +- page_user/fenzu.vue | 15 +- page_user/sbdetail.vue | 62 ++-- page_user/setting.vue | 2 +- pages/index/index.vue | 16 +- pages/my.vue | 4 +- pages/shouye/index.vue | 271 ++++++++++-------- 15 files changed, 691 insertions(+), 319 deletions(-) diff --git a/common/http.interceptor.js b/common/http.interceptor.js index 7b25644..52fb418 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -20,8 +20,8 @@ const install = (Vue, vm) => { // }, // }); Vue.prototype.$u.http.setConfig({ - // baseUrl: 'http://192.168.2.143:10002', - baseUrl: 'https://kg.chuangtewl.com/prod-api', + baseUrl: 'http://192.168.2.143:10002', + // baseUrl: 'https://kg.chuangtewl.com/prod-api', loadingText: '努力加载中~', loadingTime: 1000, // 设置自定义头部content-type diff --git a/page_components/bindsz.vue b/page_components/bindsz.vue index 55ddac2..7036974 100644 --- a/page_components/bindsz.vue +++ b/page_components/bindsz.vue @@ -3,6 +3,20 @@ <u-navbar title="设备设置" :border-bottom="false" :background="bgc" back-icon-color="#fff" title-color='#fff' title-size='36' height='50'></u-navbar> <view class="card"> + + <view class="icon"> + <view class="imgbox" v-if="userImgs"> + <button style="border: 0;outline: none;width: 143rpx;padding-left: 0rpx;height: 143rpx;border-radius: 16rpx;" @click="getImage"> + <image style="border-radius: 10rpx;" :src="userImgs" mode="aspectFit"></image> + </button> + </view> + <view class="imgbox" v-else> + <button style="border: 0;outline: none;width: 143rpx;padding-left: 0rpx;height: 143rpx;border-radius: 16rpx;" @click="getImage"> + <image src="https://api.ccttiot.com/smartmeter/img/static/uY8CPw9YE6JxPzcHUaqf" mode="aspectFit"></image> + </button> + </view> + </view> + <view class="li" @click.stop="sremakemc()"> <view class="tit"> 设备名称 @@ -48,7 +62,7 @@ </view> <view class="li" @click="btnwifi"> <view class="tit"> - Wifi配网 + WiFi配网 </view> <view class="info"> <view class="txt"> @@ -224,7 +238,9 @@ name:'', deviceId:'', isMch:false, - taocan:'' + taocan:'', + token:'', + userImgs:'' } }, onLoad(option) { @@ -236,6 +252,7 @@ }, onShow() { this.taocan = '' + this.getQiniuToken() this.getgroup() this.getuserinfo() this.getao() @@ -257,10 +274,64 @@ } }, methods: { + // 修改图片 + getImage(e) { + let _this = this + let math = 'static/' + _this.$u.guid(20) + uni.chooseImage({ + count: 9, + type: 'all', + success(res) { + // console.log(res); + const tempFilePaths = res.tempFilePaths[0] + wx.uploadFile({ + url: 'https://up-z2.qiniup.com', + name: 'file', + filePath: tempFilePaths, + formData: { + token: _this.token, //后端返回的token + key: 'smartmeter/img/' + math + }, + success: function(res) { + console.log(res, 'resres'); + let str = JSON.parse(res.data) + _this.userImgs = 'https://api.ccttiot.com/' + str.key + let data = { + deviceId:_this.id, + customPicture:_this.userImgs + } + _this.$u.put('/app/device', data).then((res) => { + if (res.code == 200) { + this.getDevice() + uni.showToast({ + title: '操作成功', + icon: 'none', + duration: 2000 + }) + } + }) + } + }) + } + }) + }, + // 获取上传七牛云token + getQiniuToken() { + this.$u.get("/common/qiniu/uploadInfo").then((res) => { + if (res.code == 200) { + this.token = res.token + } + }) + }, + getao(){ this.$u.get(`/app/suit/listByDeviceId/${this.id}`).then(res => { if(res.code == 200){ - if(res.data.length > 0){ + if(res.data.length <= 1){ + res.data.forEach(item => { + this.taocan += item.name + }) + }else{ res.data.forEach(item => { this.taocan += item.name + ',' }) @@ -271,7 +342,7 @@ // 点击设置套餐 btntc(){ uni.navigateTo({ - url:'/page_components/newtaocan?id=' + this.id + url:'/page_fenbao/statulist/taocanlist/index?id=' + this.id }) }, // 获取当前用户信息 @@ -284,6 +355,9 @@ }, // 点击wifi进行配网 btnwifi(){ + uni.showLoading({ + title: '蓝牙连接中...' + }) if(this.deviceId == ''){ xBlufi.initXBlufi(1); xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent); @@ -325,23 +399,27 @@ uni.removeStorageSync('mac'); let systemInfo = uni.getSystemInfoSync(); if (systemInfo.platform == 'android') { + uni.hideLoading() // 当前设备是 Android uni.navigateTo({ url: '/page_components/wifilist/index?deviceId=' +this.deviceId + '&name=' +this.name }) } else if (systemInfo.platform == 'ios') { + uni.hideLoading() // 当前设备是 iOS uni.navigateTo({ url: '/page_fenbao/device/wifivideo?deviceId=' +this.deviceId + '&name=' +this.name }) } }else if(res.msg == '设备编号和mac不能同时为空'){ + uni.hideLoading() uni.showToast({ - title: '未找到设备', + title: '未连接到设备,请查看蓝牙是否打开以及在设备范围内', icon: 'none', duration: 2000 }); } else { + uni.hideLoading() uni.showToast({ title: res.msg, icon: 'none', @@ -384,7 +462,7 @@ } }else if(res.msg == '设备编号和mac不能同时为空'){ uni.showToast({ - title: '未找到设备', + title: '未连接到设备,请查看蓝牙是否打开以及在设备范围内', icon: 'none', duration: 2000 }); @@ -629,6 +707,9 @@ this.$u.get("/app/device/" + id).then((res) => { if (res.code == 200) { this.listobj = res.data + if(res.data.customPicture){ + this.userImgs = res.data.customPicture + } } }) }, @@ -689,11 +770,11 @@ case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START: if (!options.result) { console.log("蓝牙未开启", options); - uni.showToast({ - title: '蓝牙未开启', - icon: 'none', - duration: 3000 - }); + // uni.showToast({ + // title: '蓝牙未开启', + // icon: 'none', + // duration: 3000 + // }); return } else { // this.searching = true @@ -819,8 +900,8 @@ font-size: 32rpx; font-family: HarmonyOS Sans SC, HarmonyOS Sans SC; font-weight: 400; - color: #FFFFFF; - background-color: #2A82E4; + color: #000; + background-color:#fff; } .btn1 { @@ -831,8 +912,8 @@ font-size: 32rpx; font-family: HarmonyOS Sans SC, HarmonyOS Sans SC; font-weight: 400; - color: #000; - background-color: #fff; + color: #fff; + background-color: #8883F0; border: 1rpx solid #ccc; } } @@ -933,7 +1014,7 @@ font-size: 36rpx; font-family: Source Han Sans, Source Han Sans; font-weight: 400; - color: #2A82E4; + color: #8883F0; } } @@ -978,4 +1059,17 @@ } } } + .icon { + // display: flex; + // flex-wrap: wrap; + // align-items: center; + margin-top: 40rpx; + .imgbox { + // width: 33%; + image { + width: 142rpx; + height: 142rpx; + } + } + } </style> \ No newline at end of file diff --git a/page_components/fuwu/index.vue b/page_components/fuwu/index.vue index 149d626..340c316 100644 --- a/page_components/fuwu/index.vue +++ b/page_components/fuwu/index.vue @@ -4,14 +4,14 @@ title-size='36' height='50'></u-navbar> --> <view class="title"> <image src="https://api.ccttiot.com/smartmeter/img/static/uyr6T0Vfkefty2blkDmU" mode="" style="width: 52rpx;height: 52rpx;margin-right: 10rpx;vertical-align: bottom;vertical-align: bottom;" @click="btnshouye"></image> - {{deviceobj.deviceName == undefined ? '--' : deviceobj.deviceName}} + <text style="width: 80%;text-align: center;display: inline-block;">{{deviceobj.deviceName == undefined ? '--' : deviceobj.deviceName}}</text> <view class="wz"> <!-- 该设备还剩余时长:{{expireTimeStr}}分钟 --> </view> - <view class="wz" v-if="deviceobj.storeContactMobile == null"> + <view class="wz" style="text-align: right;padding-right: 20rpx;" v-if="deviceobj.storeContactMobile == null"> 联系客服:<text @click="call">{{deviceobj.userMobile == undefined ? '--' : deviceobj.userMobile}}</text> </view> - <view class="wz" v-else> + <view class="wz" style="text-align: right;padding-right: 20rpx;" v-else> 联系客服:<text @click="call">{{deviceobj.storeContactMobile == undefined ? '--' : deviceobj.storeContactMobile}}</text> </view> </view> @@ -57,7 +57,7 @@ v-for="(item,index) in deviceobj.suitList" :key="index" @click="btnactive(item)"> <view class="lt"> <view class="tc"> - {{item.name.length > 5 ? item.name.substring(0,5) + '...' : item.name}} + {{item.name.length > 4 ? item.name.substring(0,4) + '...' : item.name}} </view> <view class="date"> {{item.value}} <text v-if="item.timeUnit == 1">日</text> <text v-if="item.timeUnit == 2">时</text> <text v-if="item.timeUnit == 3">分钟</text> <text v-if="item.timeUnit == 4">秒</text> @@ -821,7 +821,7 @@ color: #fff; margin-bottom: 30rpx; margin-top: 110rpx; - height: 200rpx; + height: 126rpx; .wz { font-weight: 400; diff --git a/page_components/newtaocan.vue b/page_components/newtaocan.vue index 8a84cde..db028da 100644 --- a/page_components/newtaocan.vue +++ b/page_components/newtaocan.vue @@ -4,6 +4,9 @@ height='50'></u-navbar> <view class="box" v-if="loading"> + <view class="" style="color: #ccc;font-size: 28rpx;font-weight: 600;"> + 左滑可删除指定套餐 + </view> <u-swipe-action :show="item.show" :index="index" v-for="(item, index) in list" :key="item.suitId" @click="click(item)" @open="open" :options="options"> <view class="boxlist" @click="btnedit(item)"> <view class="toptime"> diff --git a/page_components/wifilist/index.vue b/page_components/wifilist/index.vue index 780e85c..a18cec4 100644 --- a/page_components/wifilist/index.vue +++ b/page_components/wifilist/index.vue @@ -7,8 +7,10 @@ <view class="device"> <span class="device-list-title">WIFI选择</span> </view> - <view class="flex-row items-center flex-1 group"> - <text class="text_3 ml-3">请选择您需要连接的2.4Gwifi名称</text> + <view class="flex-row items-center flex-1 group" style="display: flex;justify-content: space-between;align-items: center;"> + <view class="text_3 ml-3">请选择您需要连接的2.4GwiFi名称</view> + <view class="text_3 ml-3" style="color: #8883F0;display: flex;justify-content: space-between;align-items: center;" @click="btnwifi"> + <image style="width: 34rpx;height: 34rpx;vertical-align: middle; margin-right: 10rpx;" src="https://api.ccttiot.com/smartmeter/img/static/uhhg02VV44LLPaDJDJO2" mode=""></image> <text>刷新</text> </view> </view> <!-- wifi列表 --> @@ -61,6 +63,7 @@ </view> </template> <script> + var xBlufi = require("@/page_components/blufi/xBlufi.js") // import jpSelect from '@/components/jp-select/jp-select.vue'; // var xBlufi = require("@/page_components/blufi/xBlufi.js"); export default { @@ -124,16 +127,13 @@ that.wifiList = res.wifiList // 升序排序 that.wifiList.sort(function(a, b) { - return b.signalStrength - a - .signalStrength; + return b.signalStrength - a.signalStrength; }); // 去重 for (var i = 0; i < that.wifiList.length; i++) { for (var j = i + 1; j < that.wifiList .length; j++) { - if (that.wifiList[i].SSID == that.wifiList[ - j] - .SSID) { + if (that.wifiList[i].SSID == that.wifiList[j].SSID) { that.wifiList.splice(j, 1); j-- } @@ -162,7 +162,13 @@ onLoad: function(option) { // 传过来的蓝牙信息 this.objlist = option - console.log(this.objlist, 'listlist') + + // 接受蓝牙信息 + xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent); + xBlufi.notifyInitBleEsp32({ + deviceId: this.objlist.deviceId + }) + var that = this wx.startWifi({ success: function() { @@ -231,10 +237,59 @@ let that = this; }, methods: { + // 点击重新获取wifi + btnwifi(){ + var that = this + wx.startWifi({ + success: function() { + // Wi-Fi 模块初始化成功 + console.log('Wi-Fi 模块已初始化'); + // 在这里可以调用 wx.getWifiList + wx.getWifiList({ + success: function(res) { + // 获取 Wi-Fi 列表成功 + console.log('获取 Wi-Fi 列表成功:', res); + // 在这里可以处理 Wi-Fi 列表数据 + wx.onGetWifiList(function(res) { + // 这里是监听获取到 Wi-Fi 列表后的回调函数 + console.log('ios监听到获取到 Wi-Fi 列表:', res.wifiList); + that.wifiList = res.wifiList + // 降序排序 + that.wifiList.sort(function(a, b) { + return b.signalStrength - a.signalStrength; + }); + // 去重 + for (var i = 0; i < that.wifiList.length; i++) { + for (var j = i + 1; j < that.wifiList + .length; j++) { + if (that.wifiList[i].SSID == that.wifiList[j] + .SSID) { + that.wifiList.splice(j, 1); + j-- + } + } + } + that.signalStrengthflag = true + that.list = that.wifiList + console.log(that.list, '1010'); //在这里提取列表数据 + }); + }, + fail: function(err) { + // 获取 Wi-Fi 列表失败 + console.error('获取 Wi-Fi 列表失败:', err); + } + }); + }, + fail: function(err) { + // 初始化失败 + console.error('Wi-Fi 初始化失败:', err); + } + }); + }, + // 点击判断索引是否相同显示图片 btnqhwifi(index, item) { this.indexs = index - // console.log(item.SSID) this.ssid = item.SSID }, // 点击进行下一步 @@ -242,25 +297,178 @@ console.log('panduan1', this.indexs); if (this.indexs == -1) { uni.showToast({ - title: '请选择需要连接的wifi', + title: '请选择需要连接的WiFi', icon: 'none', duration: 3000 }); } else { console.log('panduan2'); uni.navigateTo({ - url: '/page_user/wifijoint/index?ssid=' + JSON.stringify(this.ssid) + '&objlist=' + JSON - .stringify(this.objlist) + url: '/page_user/wifijoint/index?ssid=' + JSON.stringify(this.ssid) + '&objlist=' + JSON.stringify(this.objlist) }) } }, btnsd() { this.ssid = '' uni.navigateTo({ - url: '/page_user/wifijoint/index?objlist=' + JSON.stringify(this.objlist) + '&ssid=' + JSON - .stringify(this.ssid) + url: '/page_user/wifijoint/index?objlist=' + JSON.stringify(this.objlist) + '&ssid=' + JSON.stringify(this.ssid) }) }, + + + // 点击连接操作 + content_wf() { + if (!this.name) { + uni.showToast({ + title: 'SSID不能为空', + icon: 'none' + }); + return; + } + if (!this.password) { + uni.showToast({ + title: '密码不能为空', + icon: 'none' + }); + return; + } + uni.showLoading({ + title: '正在配网', + mask: true + }) + xBlufi.notifySendCustomData({ + customData: "ssid@" + this.name + "pass@" + this.password + }) + // xBlufi.notifySendCustomData({ + // customData: "ssid@" + this.name + // }) + + // xBlufi.notifySendCustomData({ + // customData: "pass@" + this.password + // }) + }, + + + + + // 蓝牙回调 + funListenDeviceMsgEvent: function(options) { + let that = this; + switch (options.type) { + case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED: { + console.log('状态', options.result) + uni.showModal({ + title: '很抱歉提醒你!', + content: '蓝牙异常断开,请重新连接…', + showCancel: false, + success: function(res) { + uni.navigateTo({ + url:'/pages/index/index' + }) + } + }); + this.statusflag = false + uni.hideLoading(); + } + break; + + case xBlufi.XBLUFI_TYPE.TYPE_CONNECT_ROUTER_RESULT: + uni.hideLoading(); + if (!options.result) + this.statusflag = false, + uni.hideLoading(), + uni.showModal({ + title: '温馨提示', + content: '配网失败,请重试', + showCancel: false //是否显示取消按钮 + }); + else { + if (options.data.progress == 100) { + let ssid = options.data.ssid; + this.statusflag = false + uni.hideLoading(); + uni.showModal({ + title: '温馨提示', + content: `连接成功`, + showCancel: false, + success: function(res) { + uni.switchTab({ + url: '/pages/index/index' + }) + // let ids = that.$store.state.user.deviceId + wx.closeBLEConnection({ + deviceId: this.objlist.deviceId, + }) + + // getwifi(ids).then(res => { + // console.log(res); + // uni.switchTab({ + // url:'/pages/index/index' + // }) + // }) + } + }) + } + } + break; + case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_MY_DATA: + this.loadPercent = options.data; + this.loadText = '文件读取中' + console.log("文件读取中", options.data); + break; + case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA: + + this.ver_data = this.parseCustomData(options.data) + console.log("1收到设备发来的自定义数据结果:", this.ver_data); + break; + + case xBlufi.XBLUFI_TYPE.TYPE_INIT_ESP32_RESULT: + uni.hideLoading(); + if (options.result) { + console.log('初始化成功'); + } else { + console.log('初始化失败'); + uni.showModal({ + title: '温馨提示', + content: `设备初始化失败`, + showCancel: false, + //是否显示取消按钮 + success: function(res) { + // uni.redirectTo({ + // url: '../search/search' + // }); + } + }); + } + break; + } + }, + // 解析自定义数据 + parseCustomData(data) { + // 将字符串按照 "@" 分割成数组 + const dataArray = data.split('@'); + + // 根据约定,解析各个字段的值 + const voltage = parseFloat(dataArray[0].substring(1)); // 去除前缀 "V",并将字符串转换为浮点数 + const switchState = dataArray[1].substring(1); // 去除前缀 "S" + const current = parseFloat(dataArray[2].substring(1)); // 去除前缀 "A",并将字符串转换为浮点数 + const power = parseFloat(dataArray[4].substring(1)); // 去除前缀 "P",并将字符串转换为浮点数 + const remainingPower = parseFloat(dataArray[5].substring(1)); // 去除前缀 "M",并将字符串转换为浮点数 + const setMode = dataArray[6].substring(3); // 去除前缀 "SET" + + // 返回解析后的数据对象 + return { + voltage, + switchState, + current, + power, + remainingPower, + setMode + }; + } + + + }, diff --git a/page_fenbao/statulist/myshop/shopxx/index.vue b/page_fenbao/statulist/myshop/shopxx/index.vue index 0d33184..e0fa781 100644 --- a/page_fenbao/statulist/myshop/shopxx/index.vue +++ b/page_fenbao/statulist/myshop/shopxx/index.vue @@ -197,6 +197,12 @@ icon: 'none', duration: 1000 }); + }else if(this.shopname.length > 5) { + uni.showToast({ + title: '店铺名称过长,不能超过五个字', + icon: 'none', + duration: 1000 + }); } else if (this.selectortext == '请选择商铺类型') { uni.showToast({ title: '请选择商铺类型', diff --git a/page_fenbao/statulist/taocanlist/index.vue b/page_fenbao/statulist/taocanlist/index.vue index 67cd40b..80bd5bc 100644 --- a/page_fenbao/statulist/taocanlist/index.vue +++ b/page_fenbao/statulist/taocanlist/index.vue @@ -25,10 +25,12 @@ </view> </view> </view> --> - - <HM-dragSorts v-if="tcidlist.length > 0" ref="dragSorts" :list="newobj" :tcidlist="tcidlist" @update:tcidlist="handleTcidlistUpdate" :autoScroll="true" :feedbackGenerator="false" @newList="handleNewList" rowHeight='50' - @change="change" @confirm="confirm" @onclick="onclick" :listBackgroundColor='F7FAFE'></HM-dragSorts> - + + <HM-dragSorts ref="dragSorts" :list="newobj" :tcidlist="tcidlist" + @update:tcidlist="handleTcidlistUpdate" :autoScroll="true" :feedbackGenerator="false" + @newList="handleNewList" rowHeight='50' @change="change" @confirm="confirm" @onclick="onclick" + :listBackgroundColor='F7FAFE'></HM-dragSorts> + <view class="" v-if="list == ''" style="color: #ccc;font-size: 36rpx;margin-top: 200rpx;text-align: center;"> 该设备暂无套餐 @@ -42,8 +44,8 @@ </view> </view> </view> - - + + </view> </template> @@ -74,7 +76,7 @@ checkboxes: [], tcidlist: [], titaoc: [], - newobj:[] + newobj: [] }; }, onLoad(option) { @@ -88,7 +90,7 @@ onShow() { this.tcidlist = [] this.getlist() - + }, // 分享到好友(会话) onShareAppMessage: function() { @@ -107,67 +109,68 @@ } }, methods: { - handleTcidlistUpdate(newTcidlist) { - // 这里是处理接收到的新 tcidlist 的地方 - console.log('接收到的 tcidlist:', newTcidlist); - this.tcidlist = newTcidlist - }, - - - handleNewList(newList) { - let list = [this.list, ...newList]; - const newSortedList = list.map((item, index) => { - return { - storeId: item.suitId, - groupSort: index + 1 // 使用索引值加 1 作为 groupSort - }; - }); - console.log("新的排列数据:", newSortedList); - setTimeout(()=> { - this.$u.put("/app/store/changeSort",newSortedList).then((res) => { - // this.$forceUpdate() - if (res.code == 200) { - // this.getgroup() - } - }); - }, 200); - - // 在这里处理新的排列数据,可以将其存储到父组件的数据中,或者进行其他操作 + handleTcidlistUpdate(newTcidlist) { + // 这里是处理接收到的新 tcidlist 的地方 + console.log('接收到的 tcidlist:', newTcidlist); + this.tcidlist = newTcidlist }, - change(){ - + + + handleNewList(newList) { + let list = [this.list, ...newList] + const newSortedList = list.map((item, index) => { + return { + suitId: item.suitId, + sort: index + 1 // 使用索引值加 1 作为 groupSort + } + }) + let filteredArr = newSortedList.filter(item => item.suitId !== undefined) + console.log("新的排列数据:", filteredArr) + setTimeout(() => { + this.$u.put("/app/suit/sort", filteredArr).then((res) => { + if (res.code == 200) { + // this.getgroup() + } + }); + }, 200) + }, + change() { + }, confirm(e) { - + }, onclick(e) { - + }, - - - + + + // 查询本人套餐 getao() { this.$u.get(`/app/suit/listByDeviceId/${this.deviceId}`).then(res => { if (res.code == 200) { if (res.data.length > 0) { this.titaoc = res.data - let uniqueSuitIds = new Set(); - this.list.forEach(item => { - if (this.titaoc.some(titaocItem => titaocItem.sourceId === item.suitId || titaocItem.suitId === item.suitId)) { - uniqueSuitIds.add(item.suitId); - } - }) - this.tcidlist = Array.from(uniqueSuitIds); - let matchedItems = this.list.filter(item => uniqueSuitIds.has(item.suitId)) - let unmatchedItems = this.list.filter(item => !uniqueSuitIds.has(item.suitId)) - this.list = matchedItems.concat(unmatchedItems) + let uniqueSuitIds = new Set(); + this.list.forEach(item => { + if (this.titaoc.some(titaocItem => titaocItem.sourceId === item.suitId || titaocItem.suitId === item.suitId)) { + uniqueSuitIds.add(item.suitId); + } + }) + this.tcidlist = Array.from(uniqueSuitIds); + let matchedItems = this.list.filter(item => uniqueSuitIds.has(item.suitId)) + let unmatchedItems = this.list.filter(item => !uniqueSuitIds.has(item.suitId)) + this.list = matchedItems.concat(unmatchedItems) + this.newobj = this.list + }else{ this.newobj = this.list + this.tcidlist = [] } } }) }, - + btnactive(id, index) { const indexInTcidList = this.tcidlist.indexOf(id); @@ -181,7 +184,7 @@ // 点击确定 btnqd() { - this.$u.delete(`/app/suit/delByDevice/${this.deviceId}`).then(res=>{}) + this.$u.delete(`/app/suit/delByDevice/${this.deviceId}`).then(res => {}) let numArr = this.tcidlist.map(item => parseInt(item, 10)) let data = { deviceId: this.deviceId, @@ -213,9 +216,7 @@ this.list = res.rows this.list = this.list.map(item => ({ ...item, - checked: false, - isActive: false, - tcidlist:this.tcidlist + tcidlist: this.tcidlist })) // console.log(this.list); this.loading = true diff --git a/page_fenbao/zhuce.vue b/page_fenbao/zhuce.vue index b29d1ed..c5240ed 100644 --- a/page_fenbao/zhuce.vue +++ b/page_fenbao/zhuce.vue @@ -8,9 +8,10 @@ <text class="sm"> {{texts}} </text --> </view> - <view class="dblist" v-for="(item, index) in devicesLists" :key="index"> + <view class="dblist" v-for="(item, index) in devicesLists" :key="index"> + <!-- <view class="dblist"> --> <view class="lt"> - <image src="https://api.ccttiot.com/smartmeter/img/static/uoQO0pUZ1UHcW5uVKkuR" mode=""></image> + <image src="https://api.ccttiot.com/smartmeter/img/static/uGVs6cbSjcuQNXuHhoWi" mode="aspectFit"></image> </view> <view class="cen"> <view class="name"> @@ -19,6 +20,12 @@ <view class="mac"> MAC:{{item.localName.substring(5)}} </view> + <view class="" style="color: #8883F0;margin-top: 10rpx;margin-bottom: 10rpx;text-align: left;"> + 蓝牙强度:{{item.RSSI}} + </view> + <view @click="btnshows(item,index)" style="color: #8883F0;margin-top: 10rpx;margin-bottom: 10rpx;text-align: left;"> + 型号选择:{{item.xuanz == undefined ? '--' : item.xuanz}} + </view> </view> <view class="rt"> <!-- <text style="margin-bottom: 10rpx;" :id="item.deviceId" @tap="createBLEConnections(item)">响铃</text> --> @@ -37,12 +44,14 @@ <text>未扫描到附近未绑定设备:</text> <text>1.确保待连接设备在附近且蓝牙处于打开状态。</text> <text>2.确保设备未与其他设备进行蓝牙连接。</text> - <text>确保设备未被添加过。</text> - <text>...</text> + <text>3.确保设备未被添加过。</text> <button @click="btnyc">好的</button> </view> <view v-if="mengcflag" class="mengc" style="width: 100%;height: 100vh;background-color: #000;opacity: .5;position: fixed;top: 0;left: 0;"></view> + + <!-- 选择蓝牙型号 --> + <u-select v-model="shows" :list="arr" @confirm="confirm"></u-select> <!-- <view class="containers" v-show="statusflag"> <uni-section> <uni-load-more :status="status" /> @@ -85,12 +94,16 @@ backgroundColor: "#8883f0", }, lurulist: [], - + arr:[], + shows:false, + arrname:'', + valuexh:'' } }, onLoad(option) { // console.log(option); this.getluru() + this.getxingh() this.storeId = option.sn xBlufi.initXBlufi(1); console.log("xBlufi", xBlufi.XMQTT_SYSTEM); @@ -152,6 +165,37 @@ this.videoContext = uni.createVideoContext('myVideo', this) }, methods: { + getxingh(){ + this.$u.get(`/app/model/all`).then(res => { + if(res.code == 200){ + this.arr = res.data + this.arr.forEach(item => { + if (item.hasOwnProperty('modelId')) { + item.value = item.modelId; + } + if (item.hasOwnProperty('modelName')) { + item.label = item.modelName; + } + }) + // console.log(this.arr,'2121212') + } + }) + }, + btnshows(item,index){ + this.arrname = item.name + this.shows = true + }, + // 选择型号 + confirm(e){ + this.devicesLists.forEach(item => { + if(item.name == this.arrname){ + item.xuanz = e[0].label + this.valuexh = e[0].value + } + }) + console.log(this.devicesLists,'021515615'); + }, + btnyc() { this.titleflag = false @@ -161,7 +205,7 @@ case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS: if (options.result) { let devicesarr = options.data - console.log(devicesarr,100100); + // console.log(devicesarr,100100); devicesarr.forEach(device => { const mac = device.name.substring(5); if (device.name.substring(0, 4) == "CTKG") { @@ -171,6 +215,7 @@ const deviceId = device.name.substring(5); return !this.lurulist.includes(deviceId); }) + // console.log(this.devicesLists); // 将去重后的数组重新赋值给 this.devicesList // this.devicesList = uniqueDevicesList; } @@ -189,46 +234,6 @@ { console.log("连接回调options.data.deviceId:" + options.data.deviceId, "连接回调options.data.name:" + options.data.name); - - // let data = { - // sn:this.storeId, - // mac:this.mac - // } - // this.$u.post('/app/device', data).then((res) => { - // if (res.code == 200) { - // uni.showToast({ - // title: '录入成功', - // icon: 'none', - // duration: 2000 - // }) - // uni.hideLoading() - // uni.removeStorageSync('mac'); - - // let vm = this - // uni.showModal({ - // title: '提示', - // content: '你已录入成功,是否返回首页?', - // success: function (res) { - // if (res.confirm) { - // setTimeout(()=>{ - // uni.navigateTo({ - // url:'/pages/shouye/index' - // }) - // },1000) - // } else if (res.cancel) { - // console.log('用户点击了取消'); - // } - // } - // }) - // } else { - // uni.hideLoading() - // uni.showToast({ - // title: res.msg, - // icon: 'none', - // duration: 2000 - // }); - // } - // }) } } @@ -257,9 +262,14 @@ let uniqueDevicesList = Array.from(new Set(this.devicesList)); // console.log(uniqueDevicesList,'uniqueDevicesListuniqueDevicesList'); // 将去重后的数组重新赋值给 this.devicesList - this.devicesLists = uniqueDevicesList.filter(device => { - const deviceId = device.name.substring(5); - return !this.lurulist.includes(deviceId); + // this.devicesLists = uniqueDevicesList.filter(device => { + // const deviceId = device.name.substring(5); + // return !this.lurulist.includes(deviceId); + // }) + this.devicesLists = uniqueDevicesList.map(device => { + const deviceId = device.name.substring(5); + const newDevice = { ...device, xuanz: "请选择" }; // 直接在复制时添加 xuanz 字段 + return newDevice; }) console.log('蓝牙停止搜索ok') if (this.devicesLists.length == 0) { @@ -327,12 +337,13 @@ // 录入设备 let data = { sn: this.storeId, - mac: this.mac + mac: this.mac, + modelId:this.valuexh } this.$u.post('/app/device', data).then((res) => { if (res.code == 200) { uni.showToast({ - title: '设备录入成功', + title: '设备:'+ this.mac +'已录入成功', icon: 'success', duration: 2000 }) @@ -340,7 +351,7 @@ uni.hideLoading() setTimeout(()=>{ uni.navigateBack() - },2000) + },1000) uni.removeStorageSync('mac'); // uni.showModal({ // title: '提示', @@ -434,7 +445,7 @@ .pages { // padding-top: 136rpx !important; - padding: 0 66rpx; + padding: 0 32rpx; box-sizing: border-box; } @@ -488,16 +499,16 @@ .lt { padding-left: 10rpx; box-sizing: border-box; - margin-right: 38rpx; + margin-right: 18rpx; image { - width: 42rpx; - // height: 112rpx; + width: 120rpx; + height: 200rpx; } } .cen { - width: 370rpx; + width: 365rpx; padding-left: 10rpx; box-sizing: border-box; @@ -527,8 +538,9 @@ } .rt { - margin-top: 22rpx; - + margin-top: 32rpx; + padding-top: 50rpx; + box-sizing: border-box; text { display: inline-block; width: 108rpx; diff --git a/page_user/HM-dragSorts/HM-dragSorts.vue b/page_user/HM-dragSorts/HM-dragSorts.vue index c7b97df..f0546f0 100644 --- a/page_user/HM-dragSorts/HM-dragSorts.vue +++ b/page_user/HM-dragSorts/HM-dragSorts.vue @@ -3,8 +3,8 @@ <!-- 拖拽中显示的行 --> <view class="rowBox-shadow" id="shadowRowBox"> <view class="hm-row-shadow move" id="shadowRow"> - <view class="modules" v-if="false"> - <!-- 内容 --> + <view class="modules" > + <!-- 内容 v-if="false"--> <view class="row-content"> <view class="row" :style="{'height': rowHeight+'px'}"> <image v-if="shadowRow.icon" class="icon" :src="shadowRow.icon"></image> @@ -46,7 +46,7 @@ </view> </view> - <view class="card" > + <view class="card"> <view class="card_left"> <view class="img"> @@ -58,7 +58,7 @@ </view> </view> <view class="card_right"> - <image src="https://api.ccttiot.com/smartmeter/img/static/uzgOF6t4abt95qDf111j" mode="" @click.stop="xiugai(row.storeId)" + <image src="https://api.ccttiot.com/smartmeter/img/static/uzgOF6t4abt95qDf111j" mode="" @click.stop="xiugai(row.storeId,row.name)" style="width: 34rpx;height: 34rpx;margin-right: 30rpx;"></image> <image src="https://api.ccttiot.com/smartmeter/img/static/u5rf4EUUv9e5KBef4efW" mode="" :data-id="row.HMDrag_id" @touchstart="drag.touchstart" @touchmove="drag.touchmove" @touchend="drag.touchend"></image> @@ -279,8 +279,8 @@ this.pushWxsData('longTouch', this.longTouch); }, methods: { - xiugai(id){ - this.$parent.putgroupname(id) + xiugai(id,name){ + this.$parent.putgroupname(id,name) }, del(id){ this.$parent.delgroup(id) diff --git a/page_user/fenzu.vue b/page_user/fenzu.vue index 8e273f7..4afd0c1 100644 --- a/page_user/fenzu.vue +++ b/page_user/fenzu.vue @@ -136,6 +136,7 @@ }); }else if(num==2){ + let data ={ name:this.price, groupSort:1 @@ -195,8 +196,9 @@ } }) }, - putgroupname(id){ + putgroupname(id,name){ this.groupid=id + this.remake = name this.sremake() }, handleNewList(newList) { @@ -209,8 +211,9 @@ }; }); console.log("新的排列数据:", newSortedList); + let filteredArr = newSortedList.filter(item => item.storeId !== null) setTimeout(()=> { - this.$u.put("/app/store/changeSort",newSortedList).then((res) => { + this.$u.put("/app/store/changeSort",filteredArr).then((res) => { // this.$forceUpdate() if (res.code == 200) { // this.getgroup() @@ -376,8 +379,8 @@ font-size: 32rpx; font-family: HarmonyOS Sans SC, HarmonyOS Sans SC; font-weight: 400; - color: #FFFFFF; - background-color: #2A82E4; + color: #000; + background-color: #fff; } .btn1{ display: flex; @@ -392,8 +395,8 @@ font-size: 32rpx; font-family: HarmonyOS Sans SC, HarmonyOS Sans SC; font-weight: 400; - color: #000; - background-color: #fff; + color: #fff; + background-color: #8883F0; border: 1rpx solid #ccc; } } diff --git a/page_user/sbdetail.vue b/page_user/sbdetail.vue index 73ccaca..ee7d912 100644 --- a/page_user/sbdetail.vue +++ b/page_user/sbdetail.vue @@ -18,10 +18,10 @@ <view class="mid_left"> <button v-if="opflag" style="border: 0;outline: none;width: 143rpx;padding-left: 0rpx;height: 143rpx;border-radius: 16rpx;border: 1rpx solid #ccc;" type="primary reverse" open-type="chooseAvatar" @chooseavatar="btnpic"> - <image :src="imglist" mode="" + <image :src="imglist" mode="aspectFit" style="width: 142rpx;height: 142rpx;border-radius: 20rpx;"></image> </button> - <image v-else :src="imglist" mode="" + <image v-else :src="imglist" mode="aspectFit" style="width: 142rpx;height: 142rpx;border-radius: 20rpx;"></image> <!-- <image :src="imglist" mode=""></image> --> </view> @@ -35,10 +35,10 @@ <view class="txt" v-if="deviceInfo"> S/N码:{{ deviceInfo.deviceNo == null ? '' : deviceInfo.deviceNo }}</view> <div class="tip" v-if="deviceInfo.onlineStatus==1">在线</div> - <div class="tip" v-if="deviceInfo.onlineStatus==0">离线</div> + <div class="tip" v-if="deviceInfo.onlineStatus==0" style="color: #ccc;">离线</div> <div class="tip" v-if="deviceInfo.status==1">空闲</div> <div class="tip" v-if="deviceInfo.status==2">使用中</div> - <div class="tip" v-if="deviceInfo.status==3">维修中</div> + <div class="tip" v-if="deviceInfo.status==3" style="color: red;">维修中</div> </view> </view> </view> @@ -297,33 +297,33 @@ }, 100) this.getQiniuToken() }, - onUnload: function() { - xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent); - xBlufi.notifyStartDiscoverBle({ - 'isStart': false - }); - wx.closeBLEConnection({ - deviceId: this.deviceId, - }) - }, - onHide() { - xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent); - xBlufi.notifyStartDiscoverBle({ - 'isStart': false - }); - wx.closeBLEConnection({ - deviceId: this.deviceId, - }) - }, - onBeforeUnmount() { - xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent); - xBlufi.notifyStartDiscoverBle({ - 'isStart': false - }); - wx.closeBLEConnection({ - deviceId: this.deviceId, - }) - }, + // onUnload: function() { + // xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent); + // xBlufi.notifyStartDiscoverBle({ + // 'isStart': false + // }); + // wx.closeBLEConnection({ + // deviceId: this.deviceId, + // }) + // }, + // onHide() { + // xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent); + // xBlufi.notifyStartDiscoverBle({ + // 'isStart': false + // }); + // wx.closeBLEConnection({ + // deviceId: this.deviceId, + // }) + // }, + // onBeforeUnmount() { + // xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent); + // xBlufi.notifyStartDiscoverBle({ + // 'isStart': false + // }); + // wx.closeBLEConnection({ + // deviceId: this.deviceId, + // }) + // }, methods: { // 开启和关闭 btnkq(){ diff --git a/page_user/setting.vue b/page_user/setting.vue index a0366ca..593cfcf 100644 --- a/page_user/setting.vue +++ b/page_user/setting.vue @@ -59,7 +59,7 @@ </view> <view class="li"> <view class="tit"> - Wifi名称 + WiFi名称 </view> <view class="info"> <view class="txt"> diff --git a/pages/index/index.vue b/pages/index/index.vue index a4b0508..7e74de6 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -107,21 +107,18 @@ </view> </view> - <view class="card_left_no" @click="todetail(item.deviceId)"> + <view class="card_left_no" :class="item.onlineStatus == 0 ? 'activewzgl' : ''" @click="todetail(item.deviceId)"> S/N码:{{item.deviceNo}} </view> <view @click="sremakes(item)" v-if="item.storeId == null" class="dianpu" style="border: 1px solid #8883F0;padding: 5rpx;box-sizing: border-box;width: 180rpx;border-radius: 20rpx;color: #8883F0;text-align: center;margin-top: 20rpx;"> 未分配店铺 </view> - <view v-else style="color: #ccc;margin-top: 20rpx;" @click="todetail(item.deviceId)"> - 归属店铺: {{item.storeName == null ? '--' : item.storeName}} + <view v-else :class="item.onlineStatus == 0 ? 'activewzgl' : ''" style="color: #95989D;margin-top: 20rpx;" @click="todetail(item.deviceId)"> + 归属店铺: {{item.storeName == null ? '--' : item.storeName}} | <text v-if="item.onlineStatus == 1" style="margin-left: 10rpx;">在线</text> <text v-else>离线</text> </view> - <!-- <view @click="sremakes(item)" v-else class="dianpu" style="border: 1px solid #8883F0;padding: 5rpx;box-sizing: border-box;width: 200rpx;border-radius: 20rpx;color: #8883F0;text-align: center;margin-top: 20rpx;"> - 已分配店铺 - </view> --> </view> <view class="card_right" @click="todetail(item.deviceId)"> - <image v-if="item.customPicture" :src="item.customPicture" mode="" + <image v-if="item.customPicture" :src="item.customPicture" mode="aspectFit" style="border-radius: 20rpx;"></image> <image v-else :src="item.picture" mode=""></image> </view> @@ -884,6 +881,9 @@ background-color: #F7FAFE; height: 100%; } + .activewzgl{ + color: #ccc !important; + } .page { height: 100%; @@ -1436,7 +1436,7 @@ border-radius: 24rpx 24rpx 24rpx 24rpx; .card_left { - width: 310rpx; + width: 100%; margin-top: 20rpx; margin-left: 50rpx; diff --git a/pages/my.vue b/pages/my.vue index 83a49a1..bf598ea 100644 --- a/pages/my.vue +++ b/pages/my.vue @@ -75,10 +75,10 @@ <image src="https://api.ccttiot.com/smartmeter/img/static/uGlrjkSOTDXMFuuRb03l" mode=""></image> <view class="txt">意见反馈</view> </view> - <view class="botcard" @click="btnmy"> + <!-- <view class="botcard" @click="btnmy"> <image src="https://api.ccttiot.com/smartmeter/img/static/uCtxeWyTyH2DHQZaRv5Q" mode=""></image> <view class="txt">秘钥管理</view> - </view> + </view> --> <view class="botcard" @click="btnguanli"> <image src="https://api.ccttiot.com/smartmeter/img/static/umjPUc8nDKf1JwVqRAeb" mode=""></image> <view class="txt">套餐管理</view> diff --git a/pages/shouye/index.vue b/pages/shouye/index.vue index 97335b7..ae2e2f6 100644 --- a/pages/shouye/index.vue +++ b/pages/shouye/index.vue @@ -2,7 +2,7 @@ <view class="page"> <!-- 用户首页显示 --> <view class="useryonghu"> - <u-navbar :is-back="false" title="创想物联" :border-bottom="false" :background="bgc" title-color='#fff' + <u-navbar :is-back="false" title="创想物联" :border-bottom="false" :background="bgc" title-color='#fff' title-size='44' height='50'></u-navbar> <view class="ditu"> <view class="dtxs"> @@ -13,14 +13,19 @@ <view class="ongoing_order" v-if="sylist.length > 0"> <view class="order_top"> <view class="order_lt"> - <image src="https://api.ccttiot.com/smartmeter/img/static/uFNuOet0fB5Bwe1c26sk" mode=""></image> + <image src="https://api.ccttiot.com/smartmeter/img/static/uFNuOet0fB5Bwe1c26sk" mode=""> + </image> <text>您有正在使用中的设备...</text> </view> - <image @click="btnorder" v-if="!listflag" src="https://api.ccttiot.com/smartmeter/img/static/ublEB3HEjyfZbnKS2Ai9" mode=""></image> - <image @click="btnorders" v-if="listflag" style="transform: rotate(180deg);margin-top: 20rpx;" src="https://api.ccttiot.com/smartmeter/img/static/ublEB3HEjyfZbnKS2Ai9" mode=""></image> + <image @click="btnorder" v-if="!listflag" + src="https://api.ccttiot.com/smartmeter/img/static/ublEB3HEjyfZbnKS2Ai9" mode=""></image> + <image @click="btnorders" v-if="listflag" style="transform: rotate(180deg);margin-top: 20rpx;" + src="https://api.ccttiot.com/smartmeter/img/static/ublEB3HEjyfZbnKS2Ai9" mode=""></image> </view> - <view class="order_list" v-for="(item,index) in sylist" :key="index" v-if="listflag" @click="btnitem(item.deviceId)"> - <text>{{item.deviceName}}</text> <image src="https://api.ccttiot.com/smartmeter/img/static/uZoBXJ0MLrGUSBFk5lGp" mode=""></image> + <view class="order_list" v-for="(item,index) in sylist" :key="index" v-if="listflag" + @click="btnitem(item.deviceId)"> + <text>{{item.deviceName}}</text> + <image src="https://api.ccttiot.com/smartmeter/img/static/uZoBXJ0MLrGUSBFk5lGp" mode=""></image> </view> </view> <!-- 正在进行中的订单结束 --><!-- 正在进行中的订单结束 --> @@ -53,7 +58,8 @@ style="width: 96rpx;height:94rpx;"></image> </view> <view class="gr" @click="btnindex(6)" v-else> - <image src="https://api.ccttiot.com/smartmeter/img/static/u3NDAI21OIGQH0Exdmdd" mode="" style="width: 96rpx;height:94rpx;"></image> + <image src="https://api.ccttiot.com/smartmeter/img/static/u3NDAI21OIGQH0Exdmdd" mode="" + style="width: 96rpx;height:94rpx;"></image> </view> </view> <view class="guangg" @click="btnad"> @@ -90,7 +96,7 @@ export default { data() { return { - listflag:false, + listflag: false, params: { year: true, month: true, @@ -119,91 +125,79 @@ }, deviceobj: {}, deviceCount: 0, - sylist:[] + sylist: [] }; }, onLoad(option) { - if (option.flag) { - let id = option.id - this.$u.get(`/app/device/${id}/withSuitList`).then((res) => { - if (res.code == 200) { - this.deviceobj = res.data - } - }) + // if (option.flag) { + // let id = option.id + // this.$u.get(`/app/device/${id}/withSuitList`).then((res) => { + // if (res.code == 200) { + // this.deviceobj = res.data + // } + // }) - let that = this - // uni.showModal({ - // title: '提示', - // content: '该设备未被绑定,你需进行绑定吗?', - // success: function(res) { - // if (res.confirm) { - let data = { - deviceNo: id - } - that.$u.put("/app/device/bind", data).then(res => { - if (res.code == 200) { - uni.showModal({ - title: '提示', - content: '该设备未绑定,你需进行绑定吗?', - success: function(res) { - if (res.confirm) { - uni.navigateTo({ - url: '/page_components/bindsz?id=' + that.deviceobj.deviceId - }) - } else if (res.cancel) { - - } - } - }) - } else { - if (res.msg == '设备未录入') { - uni.showModal({ - title: '提示', - content: '该设备未录入,你需进行录入吗?', - success: function(res) { - if (res.confirm) { - uni.navigateTo({ - url: '/page_fenbao/zhuce?sn=' + id - }) - } else if (res.cancel) { - - } - } - }) - } else { - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 1000 - }) - } - } - }) - // } else if (res.cancel) { - // uni.navigateTo({ - // url: '/pages/shouye/index' - // }) - // } - // } - // }) - } + // let that = this + // let data = { + // deviceNo: id + // } + // that.$u.put("/app/device/bind", data).then(res => { + // if (res.code == 200) { + // uni.showModal({ + // title: '提示', + // content: '该设备未绑定,你需进行绑定吗?', + // success: function(res) { + // if (res.confirm) { + // uni.navigateTo({ + // url: '/page_components/bindsz?id=' + that.deviceobj.deviceId + // }) + // } else if (res.cancel) { + + // } + // } + // }) + // } else { + // if (res.msg == '设备未录入') { + // uni.showModal({ + // title: '提示', + // content: '该设备未录入,你需进行录入吗?', + // success: function(res) { + // if (res.confirm) { + // uni.navigateTo({ + // url: '/page_fenbao/zhuce?sn=' + id + // }) + // } else if (res.cancel) { + + // } + // } + // }) + // } else { + // uni.showToast({ + // title: res.msg, + // icon: 'none', + // duration: 1000 + // }) + // } + // } + // }) + // } }, // 分享到好友(会话) - onShareAppMessage: function () { - return { - title: '创想物联', - path: '/pages/shouye/index' - } - }, - - // 分享到朋友圈 - onShareTimeline: function () { - return { - title: '创想物联', - query: '', - path: '/pages/shouye/index' - } - }, + onShareAppMessage: function() { + return { + title: '创想物联', + path: '/pages/shouye/index' + } + }, + + // 分享到朋友圈 + onShareTimeline: function() { + return { + title: '创想物联', + query: '', + path: '/pages/shouye/index' + } + }, onShow() { this.logins() this.getad() @@ -223,27 +217,27 @@ }, methods: { // 请求正在使用的设备列表 - getshiy(){ + getshiy() { this.$u.get("/app/device/usingDevice").then((res) => { if (res.code == 200) { this.sylist = res.data } }) }, - - btnitem(deviceId){ + + btnitem(deviceId) { uni.navigateTo({ - url:'/page_components/eletj?id=' + deviceId + url: '/page_components/eletj?id=' + deviceId }) }, // 点击显示使用中设备 - btnorder(){ - this.listflag = true + btnorder() { + this.listflag = true }, - btnorders(){ - this.listflag = false + btnorders() { + this.listflag = false }, - + btnad() { this.$u.get("/app/ad").then((res) => { if (res.code == 200) { @@ -288,10 +282,54 @@ let decodedValue = decodeURIComponent(sceneValue) let id = getQueryParam(decodedValue, 's') // console.log(res, id) - this.$u.get(`/app/device/${id}/withSuitList`).then((res) => { - if (res.code == 200) { - uni.navigateTo({ - url: '/page_components/fuwu/index?id=' + id + let that = this + let data = { + deviceNo: id + } + that.$u.get(`/app/device/isBind?deviceNo=${id}`).then(res => { + if (res.data == 2) { + that.$u.get(`/app/device/${id}/withSuitList`).then((res) => { + if (res.code == 200) { + uni.navigateTo({ + url: '/page_components/fuwu/index?id=' + id + }) + } + }) + } else if (res.data == 1) { + uni.showModal({ + title: '提示', + content: '该设备未绑定,你需进行绑定吗?', + success: function(res) { + if (res.confirm) { + that.$u.put("/app/device/bind", data).then(res => { + if(res.code == 200){ + that.$u.get(`/app/device/${id}/bySn`).then((res) => { + if (res.code == 200) { + uni.navigateTo({ + url: '/page_components/bindsz?id=' + res.data.deviceId + }) + } + }) + } + }) + } else if (res.cancel) { + + } + } + }) + } else if (res.data == 0) { + uni.showModal({ + title: '提示', + content: '该设备未录入,你需进行录入吗?', + success: function(res) { + if (res.confirm) { + uni.navigateTo({ + url: '/page_fenbao/zhuce?sn=' + id + }) + } else if (res.cancel) { + + } + } }) } }) @@ -926,7 +964,8 @@ position: absolute; top: 48rpx; left: 34rpx; - .order_list{ + + .order_list { width: 100%; height: 110rpx; // background-color: rgba(0, 0, 0, 0.6); @@ -941,16 +980,18 @@ box-sizing: border-box; line-height: 110rpx; animation: fadeInDown .5s ease-out forwards; - image{ + + image { width: 17rpx; height: 34rpx; } } + .order_top { width: 622rpx; height: 94rpx; background: rgba(0, 0, 0, 0.4); - box-shadow: 0rpx 4rpx 10rpx 0rpx rgba(0,0,0,0.3); + box-shadow: 0rpx 4rpx 10rpx 0rpx rgba(0, 0, 0, 0.3); border-radius: 40rpx 40rpx 40rpx 40rpx; display: flex; align-items: center; @@ -964,13 +1005,15 @@ .order_lt { display: flex; align-items: center; + image { width: 44rpx; height: 62rpx; margin-right: 20rpx; } } - image{ + + image { width: 47rpx; height: 47rpx; padding-bottom: 10rpx; @@ -1021,14 +1064,16 @@ } } } - @keyframes fadeInDown { - from { - opacity: 0; - transform: translateY(-20px); - } - to { - opacity: 1; - transform: translateY(0); - } + + @keyframes fadeInDown { + from { + opacity: 0; + transform: translateY(-20px); + } + + to { + opacity: 1; + transform: translateY(0); + } } </style> \ No newline at end of file