浇花器
This commit is contained in:
parent
0c19bc56db
commit
42d9dbc722
2
App.vue
2
App.vue
|
@ -170,7 +170,7 @@
|
||||||
@import "uview-ui/index.scss";
|
@import "uview-ui/index.scss";
|
||||||
@import "./common/css/iconfont.css";
|
@import "./common/css/iconfont.css";
|
||||||
// 自定义tabar样式修改
|
// 自定义tabar样式修改
|
||||||
/deep/.u-tabbar__content__item__text{
|
::v-deep.u-tabbar__content__item__text{
|
||||||
font-size: 20rpx !important;
|
font-size: 20rpx !important;
|
||||||
bottom: 10rpx !important;
|
bottom: 10rpx !important;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,13 +21,12 @@ const install = (Vue, vm) => {
|
||||||
// });
|
// });
|
||||||
Vue.prototype.$u.http.setConfig({
|
Vue.prototype.$u.http.setConfig({
|
||||||
baseUrl: 'https://yxd.ccttiot.com/prod-api',
|
baseUrl: 'https://yxd.ccttiot.com/prod-api',
|
||||||
// baseUrl: 'http://192.168.0.100:8081',
|
// baseUrl: 'http://192.168.1.3:8081',
|
||||||
loadingText: '努力加载中~',
|
loadingText: '努力加载中~',
|
||||||
loadingTime: 800,
|
loadingTime: 800,
|
||||||
// 设置自定义头部content-type
|
// 设置自定义头部content-type
|
||||||
header: {
|
header: {
|
||||||
'content-type': 'application/json;charset=UTF-8',
|
'content-type': 'application/json;charset=UTF-8',
|
||||||
|
|
||||||
},
|
},
|
||||||
// ......
|
// ......
|
||||||
});
|
});
|
||||||
|
|
|
@ -84,11 +84,11 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
/deep/.u-tabbar__content__item__button {
|
::v-deep.u-tabbar__content__item__button {
|
||||||
top: 20rpx !important;
|
top: 20rpx !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/deep/.u-tabbar {
|
::v-deep.u-tabbar {
|
||||||
.u-tabbar__content__item:nth-child(2) {
|
.u-tabbar__content__item:nth-child(2) {
|
||||||
.u-tabbar__content__item__button {
|
.u-tabbar__content__item__button {
|
||||||
width: 32rpx !important;
|
width: 32rpx !important;
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
<view class="name">
|
<view class="name">
|
||||||
<text>工作时长:</text>
|
<text>工作时长:</text>
|
||||||
<view class="">
|
<view class="">
|
||||||
<input type="number" v-model="miao"/>
|
<input type="number" v-model="miao" @input="handleMiaoInput" @blur="handleMiaoBlur"/>
|
||||||
秒
|
秒
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -165,7 +165,9 @@
|
||||||
// 添加默认时间设置
|
// 添加默认时间设置
|
||||||
defaultTime:'',
|
defaultTime:'',
|
||||||
defaultTimeLength: '',
|
defaultTimeLength: '',
|
||||||
jgtian: ''
|
jgtian: '',
|
||||||
|
shebid:'',
|
||||||
|
zaixianobj:{}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 分享到好友(会话)
|
// 分享到好友(会话)
|
||||||
|
@ -184,12 +186,16 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
|
this.pre = option.pre
|
||||||
|
if(option.shebid){
|
||||||
|
this.shebid = option.shebid
|
||||||
|
this.getxq()
|
||||||
|
}else{
|
||||||
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
|
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
|
||||||
xBlufi.notifySendCustomData({
|
xBlufi.notifySendCustomData({
|
||||||
customData: "11get"
|
customData: "11get"
|
||||||
})
|
})
|
||||||
if (option.list.length > 0) { //判断有无数据 有数据直接拿 无数据则发送命令获取数据
|
if (option.list.length > 0) { //判断有无数据 有数据直接拿 无数据则发送命令获取数据
|
||||||
this.pre = option.pre
|
|
||||||
if (option.pre == 'WATER') {
|
if (option.pre == 'WATER') {
|
||||||
this.list = JSON.parse(option.list)
|
this.list = JSON.parse(option.list)
|
||||||
for (let key in this.list) {
|
for (let key in this.list) {
|
||||||
|
@ -214,11 +220,49 @@
|
||||||
customData: "11get"
|
customData: "11get"
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 请求浇花器数据
|
||||||
|
getxq(){
|
||||||
|
this.$u.get(`/app/getDeviceInfo/${this.shebid}`).then(res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
if(this.pre != 'WATER'){
|
||||||
|
this.shi = res.data.gatewayReturnParams.h.value
|
||||||
|
this.fen = res.data.gatewayReturnParams.m.value < 10 ? '0' + res.data.gatewayReturnParams.m.value : res.data.gatewayReturnParams.m.value
|
||||||
|
this.miao = res.data.gatewayReturnParams.t.value
|
||||||
|
this.tian = res.data.gatewayReturnParams.d.value
|
||||||
|
} else {
|
||||||
|
// 单阀 WATER,从后台字段 h1/m1/s1/o1...(以及可选 d1..d6) 组装展示结构
|
||||||
|
const params = res.data.gatewayReturnParams
|
||||||
|
const mapped = this.buildListFromBackend(params)
|
||||||
|
// u-switch 需要布尔值,已在构建阶段转换
|
||||||
|
this.list = mapped
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 后台 -> 定时列表结构(与蓝牙解析一致)
|
||||||
|
buildListFromBackend(params){
|
||||||
|
const result = {}
|
||||||
|
for(let i = 1; i <= 6; i++){
|
||||||
|
const h = Number(params?.[`h${i}`]?.value)
|
||||||
|
const m = Number(params?.[`m${i}`]?.value)
|
||||||
|
const s = Number(params?.[`s${i}`]?.value)
|
||||||
|
const o = Number(params?.[`o${i}`]?.value)
|
||||||
|
const d = Number(params?.[`d${i}`]?.value)
|
||||||
|
const hour = isNaN(h) ? 0 : h
|
||||||
|
const minute = isNaN(m) ? 0 : m
|
||||||
|
const second = isNaN(s) ? 0 : s
|
||||||
|
const onoff = !isNaN(o) && o === 1
|
||||||
|
const interval = isNaN(d) || d <= 0 ? 1 : d
|
||||||
|
result[`p_set${i}`] = [hour, minute, second, onoff, interval]
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
},
|
||||||
// 选择启动时间
|
// 选择启动时间
|
||||||
confirmtime(e){
|
confirmtime(e){
|
||||||
console.log(e);
|
console.log(e);
|
||||||
|
@ -285,23 +329,17 @@
|
||||||
})
|
})
|
||||||
try {
|
try {
|
||||||
this.showLoading()
|
this.showLoading()
|
||||||
// this.kgflag = true
|
// 保持 UI 不变,等待请求成功后再更新
|
||||||
this.btnitem(key, index, values)
|
|
||||||
this.btnqx()
|
|
||||||
this.deviceindex = index
|
this.deviceindex = index
|
||||||
this.devicehour = values[0] || 0 // 添加默认值
|
this.devicehour = values[0] || 0
|
||||||
this.deviceminute = values[1] || 0
|
this.deviceminute = values[1] || 0
|
||||||
this.devicemiao = values[2] || 0
|
this.devicemiao = values[2] || 0
|
||||||
|
const prevSwitch = !!values[3]
|
||||||
if (this.list.hasOwnProperty(key)) {
|
const nextSwitch = !prevSwitch
|
||||||
const array = this.list[key]
|
const intervalDays = parseInt(this.jgtian) || 1
|
||||||
const lastIndex = array.length - 1
|
const flag = nextSwitch ? 1 : 0
|
||||||
const lastElement = array[lastIndex]
|
const cucun = '11p_set' + (Number(this.deviceindex) + 1)+ ':' + this.devicehour + ',' + this.deviceminute + ',' + this.devicemiao + ',' + flag + ',' + intervalDays + ';'
|
||||||
array[lastIndex] = !lastElement
|
if(this.shebid == ''){
|
||||||
this.deviceflag = lastElement ? 0 : 1
|
|
||||||
}
|
|
||||||
let flag = values[3] == 0 ? 1 : 0
|
|
||||||
let cucun = '11p_set' + (Number(this.deviceindex) + 1)+ ':' + this.devicehour + ',' + this.deviceminute + ',' + this.devicemiao + ',' + flag + ',' + this.jgtian + ';'
|
|
||||||
this.lastOperation = () => {
|
this.lastOperation = () => {
|
||||||
xBlufi.notifySendCustomData({
|
xBlufi.notifySendCustomData({
|
||||||
customData: cucun
|
customData: cucun
|
||||||
|
@ -312,12 +350,45 @@
|
||||||
xBlufi.notifySendCustomData({
|
xBlufi.notifySendCustomData({
|
||||||
customData: "11get"
|
customData: "11get"
|
||||||
})
|
})
|
||||||
|
// BLE 下不立即改 UI,等待设备返回数据刷新
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
// this.kgflag = false
|
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
this.hideLoading()
|
this.hideLoading()
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
}else{
|
||||||
|
let parameters = {
|
||||||
|
date:cucun
|
||||||
|
}
|
||||||
|
let data = {
|
||||||
|
deviceId:this.shebid,
|
||||||
|
instructionKey:'date',
|
||||||
|
parameters:parameters
|
||||||
|
}
|
||||||
|
this.$u.post(`/app/sendCommandByGateway`,data).then(res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
// 网关成功:仅本地更新开关状态
|
||||||
|
const keyName = `p_set${Number(this.deviceindex) + 1}`
|
||||||
|
if (this.list[keyName]) {
|
||||||
|
this.$set(this.list[keyName], 3, nextSwitch)
|
||||||
|
}
|
||||||
|
uni.showToast({
|
||||||
|
title: '设置成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration:2000
|
||||||
|
})
|
||||||
|
// 不再请求新数据
|
||||||
|
}else{
|
||||||
|
// 失败则保持原状态
|
||||||
|
values[3] = prevSwitch
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'none',
|
||||||
|
duration:2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('btnchange error:', error)
|
console.error('btnchange error:', error)
|
||||||
this.retryOperation()
|
this.retryOperation()
|
||||||
|
@ -388,6 +459,7 @@
|
||||||
const intervalDays = parseInt(this.jgtian) || 0;
|
const intervalDays = parseInt(this.jgtian) || 0;
|
||||||
|
|
||||||
let cucun = '11p_set' + this.deviceindex + ':' + this.devicehour + ',' + this.deviceminute + ',' + this.devicemiao + ',' + 1 + ',' + intervalDays + ';'
|
let cucun = '11p_set' + this.deviceindex + ':' + this.devicehour + ',' + this.deviceminute + ',' + this.devicemiao + ',' + 1 + ',' + intervalDays + ';'
|
||||||
|
if(this.shebid == ''){
|
||||||
this.lastOperation = () => {
|
this.lastOperation = () => {
|
||||||
xBlufi.notifySendCustomData({
|
xBlufi.notifySendCustomData({
|
||||||
customData: cucun
|
customData: cucun
|
||||||
|
@ -398,11 +470,45 @@
|
||||||
await this.delay(1000)
|
await this.delay(1000)
|
||||||
xBlufi.notifySendCustomData({
|
xBlufi.notifySendCustomData({
|
||||||
customData: "11get"
|
customData: "11get"
|
||||||
});
|
})
|
||||||
|
// BLE 下设置后计时刷新由设备推送完成
|
||||||
// setTimeout(() => {
|
|
||||||
this.hideLoading()
|
this.hideLoading()
|
||||||
// }, 2000)
|
}else{
|
||||||
|
let parameters = {
|
||||||
|
date:cucun
|
||||||
|
}
|
||||||
|
let data = {
|
||||||
|
deviceId:this.shebid,
|
||||||
|
instructionKey:'date',
|
||||||
|
parameters:parameters
|
||||||
|
}
|
||||||
|
this.$u.post(`/app/sendCommandByGateway`,data).then(res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '设置成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration:2000
|
||||||
|
})
|
||||||
|
// 网关成功:本地立即更新列表,避免再次请求
|
||||||
|
const key = `p_set${this.deviceindex}`
|
||||||
|
if (!this.list[key]) {
|
||||||
|
this.$set(this.list, key, [0,0,0,false,1])
|
||||||
|
}
|
||||||
|
// 更新为本次设置的值(使用 $set 保证响应式)
|
||||||
|
this.$set(this.list[key], 0, Number(this.devicehour) || 0)
|
||||||
|
this.$set(this.list[key], 1, Number(this.deviceminute) || 0)
|
||||||
|
this.$set(this.list[key], 2, Number(this.devicemiao) || 0)
|
||||||
|
this.$set(this.list[key], 3, true)
|
||||||
|
this.$set(this.list[key], 4, Number(intervalDays) || 1)
|
||||||
|
}else{
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'none',
|
||||||
|
duration:2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('btnqd error:', error)
|
console.error('btnqd error:', error)
|
||||||
this.retryOperation()
|
this.retryOperation()
|
||||||
|
@ -427,6 +533,16 @@
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 限制工作时长不能超过9999秒
|
||||||
|
if(this.miao > 9999){
|
||||||
|
uni.showToast({
|
||||||
|
title: '工作时长最大值为9999秒',
|
||||||
|
icon: 'none',
|
||||||
|
duration:2000
|
||||||
|
})
|
||||||
|
this.miao = 9999
|
||||||
|
}
|
||||||
|
|
||||||
this.showLoading();
|
this.showLoading();
|
||||||
this.timeflag = false;
|
this.timeflag = false;
|
||||||
if(this.tian > 99){
|
if(this.tian > 99){
|
||||||
|
@ -438,27 +554,48 @@
|
||||||
}
|
}
|
||||||
let tian = this.tian > 99 ? 99 : this.tian
|
let tian = this.tian > 99 ? 99 : this.tian
|
||||||
let cucun = '11pset' + ',' + this.shi + ',' + this.fen + ',' + this.miao + ',' + tian + '@'
|
let cucun = '11pset' + ',' + this.shi + ',' + this.fen + ',' + this.miao + ',' + tian + '@'
|
||||||
|
if(this.shebid == ''){
|
||||||
this.lastOperation = () => {
|
this.lastOperation = () => {
|
||||||
xBlufi.notifySendCustomData({
|
xBlufi.notifySendCustomData({
|
||||||
customData: cucun
|
customData: cucun
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
this.lastOperation()
|
this.lastOperation()
|
||||||
|
|
||||||
await this.delay(1000)
|
await this.delay(1000)
|
||||||
xBlufi.notifySendCustomData({
|
xBlufi.notifySendCustomData({
|
||||||
customData: "11get"
|
customData: "11get"
|
||||||
})
|
})
|
||||||
|
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '保存成功',
|
title: '保存成功',
|
||||||
icon: 'success',
|
icon: 'success',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
})
|
})
|
||||||
|
|
||||||
// setTimeout(() => {
|
|
||||||
this.hideLoading()
|
this.hideLoading()
|
||||||
// }, 2000)
|
}else{
|
||||||
|
let parameters = {
|
||||||
|
date:cucun
|
||||||
|
}
|
||||||
|
let data = {
|
||||||
|
deviceId:this.shebid,
|
||||||
|
instructionKey:'date',
|
||||||
|
parameters:parameters
|
||||||
|
}
|
||||||
|
this.$u.post(`/app/sendCommandByGateway`,data).then(res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '保存成功',
|
||||||
|
icon: 'success',
|
||||||
|
duration:2000
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: 'none',
|
||||||
|
duration:2000
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('btnbc error:', error)
|
console.error('btnbc error:', error)
|
||||||
this.retryOperation()
|
this.retryOperation()
|
||||||
|
@ -493,11 +630,9 @@
|
||||||
try {
|
try {
|
||||||
console.log("收到设备发来的自定义数据结果:", options.data);
|
console.log("收到设备发来的自定义数据结果:", options.data);
|
||||||
const inputString = options.data.slice(0, -1) + ";";
|
const inputString = options.data.slice(0, -1) + ";";
|
||||||
|
|
||||||
if (this.pre == 'WATER') {
|
if (this.pre == 'WATER') {
|
||||||
const pairs = inputString.split(';');
|
const pairs = inputString.split(';');
|
||||||
const pSetObjects = {};
|
const pSetObjects = {};
|
||||||
|
|
||||||
pairs.forEach(pair => {
|
pairs.forEach(pair => {
|
||||||
if (!pair) return;
|
if (!pair) return;
|
||||||
const [key, value] = pair.split(':');
|
const [key, value] = pair.split(':');
|
||||||
|
@ -548,6 +683,43 @@
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// 处理工作时长输入
|
||||||
|
handleMiaoInput(e) {
|
||||||
|
// 在uni-app中,直接使用e.detail.value获取输入值
|
||||||
|
let value = e.detail.value || e.target.value || '';
|
||||||
|
console.log('输入值:', value); // 调试用
|
||||||
|
|
||||||
|
// 转换为数字
|
||||||
|
let numValue = parseInt(value) || 0;
|
||||||
|
console.log('转换后数值:', numValue); // 调试用
|
||||||
|
|
||||||
|
// 限制最大值为9999
|
||||||
|
if (numValue > 9999) {
|
||||||
|
numValue = 9999;
|
||||||
|
uni.showToast({
|
||||||
|
title: '工作时长最大值为9999秒',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新数据
|
||||||
|
this.miao = numValue;
|
||||||
|
console.log('最终miao值:', this.miao); // 调试用
|
||||||
|
},
|
||||||
|
|
||||||
|
// 处理工作时长失去焦点时的验证
|
||||||
|
handleMiaoBlur(e) {
|
||||||
|
// 再次验证并限制
|
||||||
|
if (this.miao > 9999) {
|
||||||
|
this.miao = 9999;
|
||||||
|
uni.showToast({
|
||||||
|
title: '工作时长最大值为9999秒',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
// 改变天数
|
// 改变天数
|
||||||
changeDays(change) {
|
changeDays(change) {
|
||||||
let newValue = (parseInt(this.jgtian) || 1) + change;
|
let newValue = (parseInt(this.jgtian) || 1) + change;
|
||||||
|
@ -559,11 +731,11 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
/deep/ .u-title {
|
::v-deep .u-title {
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/deep/ .uicon-nav-back {
|
::v-deep .uicon-nav-back {
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
}
|
}
|
||||||
.baocun{
|
.baocun{
|
||||||
|
|
|
@ -75,10 +75,10 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
/deep/ .u-title{
|
::v-deep .u-title{
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
}
|
}
|
||||||
/deep/ .uicon-nav-back{
|
::v-deep .uicon-nav-back{
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
}
|
}
|
||||||
.list{
|
.list{
|
||||||
|
|
|
@ -154,10 +154,10 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
/deep/ .u-title{
|
::v-deep .u-title{
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
}
|
}
|
||||||
/deep/ .uicon-nav-back{
|
::v-deep .uicon-nav-back{
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
}
|
}
|
||||||
.kfimg{
|
.kfimg{
|
||||||
|
|
|
@ -53,10 +53,10 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
/deep/ .u-title{
|
::v-deep .u-title{
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
}
|
}
|
||||||
/deep/ .uicon-nav-back{
|
::v-deep .uicon-nav-back{
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
}
|
}
|
||||||
page{
|
page{
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
<u-navbar :is-back="true" title='添加设备' title-color="#000" :border-bottom="false" :background="bgc" id="navbar">
|
<u-navbar :is-back="true" title=' ' title-color="#000" :border-bottom="false" :background="bgc"
|
||||||
|
id="navbar">
|
||||||
</u-navbar>
|
</u-navbar>
|
||||||
<view class="page">
|
<view class="page">
|
||||||
<!-- 有搜索到设备 -->
|
<!-- 有搜索到设备 -->
|
||||||
|
@ -13,7 +14,7 @@
|
||||||
如未找到想添加的设备,点击重新搜索
|
如未找到想添加的设备,点击重新搜索
|
||||||
</view>
|
</view>
|
||||||
<view class="list">
|
<view class="list">
|
||||||
<view class="list_item" v-for="(item,index) in jiaohuaqi" :key="index" :class="{ show: item.show }">
|
<view class="list_item" v-for="(item,index) in sortedJiaohuaqi" :key="index" :class="{ show: item.show }">
|
||||||
<image :src="item.modelPicture" mode=""></image>
|
<image :src="item.modelPicture" mode=""></image>
|
||||||
<view class="cen">
|
<view class="cen">
|
||||||
<view class="name" style="color: #ccc;" v-if="item.userId && item.userId != userid">
|
<view class="name" style="color: #ccc;" v-if="item.userId && item.userId != userid">
|
||||||
|
@ -104,6 +105,15 @@
|
||||||
processingQueue: false, // 是否正在处理队列
|
processingQueue: false, // 是否正在处理队列
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
sortedJiaohuaqi() {
|
||||||
|
return this.jiaohuaqi.slice().sort((a, b) => {
|
||||||
|
if (a.ssid === undefined) return 1;
|
||||||
|
if (b.ssid === undefined) return -1;
|
||||||
|
return Math.abs(a.ssid) - Math.abs(b.ssid);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
// 分享到好友(会话)
|
// 分享到好友(会话)
|
||||||
onShareAppMessage: function() {
|
onShareAppMessage: function() {
|
||||||
return {
|
return {
|
||||||
|
@ -380,17 +390,17 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
/deep/ .u-input__input{
|
::v-deep .u-input__input{
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
border-radius: 10rpx;
|
border-radius: 10rpx;
|
||||||
padding-left: 10rpx;
|
padding-left: 10rpx;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
/deep/ .u-title {
|
::v-deep .u-title {
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/deep/ .uicon-nav-back {
|
::v-deep .uicon-nav-back {
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -216,11 +216,11 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
/deep/ .u-title {
|
::v-deep .u-title {
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/deep/ .uicon-nav-back {
|
::v-deep .uicon-nav-back {
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,10 +76,10 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
/deep/ .u-title{
|
::v-deep .u-title{
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
}
|
}
|
||||||
/deep/ .uicon-nav-back{
|
::v-deep .uicon-nav-back{
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
}
|
}
|
||||||
page{
|
page{
|
||||||
|
|
|
@ -138,10 +138,10 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
/deep/ .u-title{
|
::v-deep .u-title{
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
}
|
}
|
||||||
/deep/ .uicon-nav-back{
|
::v-deep .uicon-nav-back{
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
}
|
}
|
||||||
.about{
|
.about{
|
||||||
|
|
|
@ -134,11 +134,15 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
|
console.log(option,'0000');
|
||||||
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
|
xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
|
||||||
|
xBlufi.notifySendCustomData({
|
||||||
|
customData: "11get"
|
||||||
|
})
|
||||||
this.deviceid = option.deviceid
|
this.deviceid = option.deviceid
|
||||||
this.imgpic = option.img
|
this.imgpic = option.img
|
||||||
if(option.xctime != '--'){
|
if(option.xctime != '--'){
|
||||||
this.xinpin = option.xipin
|
// this.xinpin = option.xipin
|
||||||
if(option.xctime != '--' && option.ver){
|
if(option.xctime != '--' && option.ver){
|
||||||
this.ver = 'V' + option.ver.slice(3)
|
this.ver = 'V' + option.ver.slice(3)
|
||||||
this.xctime = option.xctime
|
this.xctime = option.xctime
|
||||||
|
@ -156,9 +160,11 @@
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
this.ver = ''
|
this.ver = ''
|
||||||
|
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent)
|
||||||
},
|
},
|
||||||
onHide() {
|
onHide() {
|
||||||
this.ver = ''
|
this.ver = ''
|
||||||
|
xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
btnxip(){
|
btnxip(){
|
||||||
|
@ -178,6 +184,9 @@
|
||||||
xBlufi.notifySendCustomData({
|
xBlufi.notifySendCustomData({
|
||||||
customData: '11sleep' + this.xinpin + '@'
|
customData: '11sleep' + this.xinpin + '@'
|
||||||
})
|
})
|
||||||
|
xBlufi.notifySendCustomData({
|
||||||
|
customData: '11get'
|
||||||
|
})
|
||||||
},
|
},
|
||||||
// 解绑设备按钮
|
// 解绑设备按钮
|
||||||
btnjiebang() {
|
btnjiebang() {
|
||||||
|
@ -223,6 +232,8 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
// 点击显示修改名称弹框
|
// 点击显示修改名称弹框
|
||||||
btnxianshi() {
|
btnxianshi() {
|
||||||
this.nameflag = true
|
this.nameflag = true
|
||||||
|
@ -343,7 +354,7 @@
|
||||||
break
|
break
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
|
case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
|
||||||
// console.log("选择固件升级收信息:", options.data, options.data.length);
|
// console.log("选择固件升级收信息:", options.data, options.data.length);
|
||||||
if (typeof options.data === 'string') {
|
console.log(options,'020202020202');
|
||||||
if (options.data.indexOf("prom:") !== -1) {
|
if (options.data.indexOf("prom:") !== -1) {
|
||||||
console.log('固件升级中')
|
console.log('固件升级中')
|
||||||
var indexOld = options.data.substring(options.data.indexOf('prom:'))
|
var indexOld = options.data.substring(options.data.indexOf('prom:'))
|
||||||
|
@ -386,9 +397,37 @@
|
||||||
})
|
})
|
||||||
},1000)
|
},1000)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}else{
|
}else{
|
||||||
console.error("options.data 不是字符串:", options.data);
|
console.log('jiexijiexi',options);
|
||||||
|
const inputString = options.data.slice(0, -1) + ";"
|
||||||
|
const hasAtSymbol = inputString.includes(',');
|
||||||
|
let processedString = inputString;
|
||||||
|
let currentDay = 0;
|
||||||
|
const pairs = processedString.split(';').filter(Boolean);
|
||||||
|
const showObject = {};
|
||||||
|
const pSetObjects = {};
|
||||||
|
// 初始化所有p_set为默认值
|
||||||
|
for (let i = 1; i <= 6; i++) {
|
||||||
|
pSetObjects[`p_set${i}`] = [0, 0, 0, 0, 0];
|
||||||
|
}
|
||||||
|
// 解析字符串
|
||||||
|
pairs.forEach(pair => {
|
||||||
|
const [key, value] = pair.split(':');
|
||||||
|
// 处理可能带有前缀的show键,如 "ver270@show"
|
||||||
|
const cleanKey = key.includes('@') ? key.split('@')[1] : key;
|
||||||
|
if (cleanKey == 'show') {
|
||||||
|
showObject.showArray = value.split(',').map(Number);
|
||||||
|
} else if (key.startsWith('p_set')) {
|
||||||
|
const values = value.split(',').map(Number);
|
||||||
|
// 确保数组长度为5
|
||||||
|
while (values.length < 5) {
|
||||||
|
values.push(0);
|
||||||
|
}
|
||||||
|
pSetObjects[key] = values;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
console.log(showObject,'showObjectshowObject');
|
||||||
|
this.xinpin = showObject.showArray[showObject.showArray.length - 2]
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
|
case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
|
||||||
|
@ -465,11 +504,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/deep/ .u-title {
|
::v-deep .u-title {
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/deep/ .uicon-nav-back {
|
::v-deep .uicon-nav-back {
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,10 +53,10 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
/deep/ .u-title{
|
::v-deep .u-title{
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
}
|
}
|
||||||
/deep/ .uicon-nav-back{
|
::v-deep .uicon-nav-back{
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
}
|
}
|
||||||
page{
|
page{
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6,7 +6,7 @@
|
||||||
<text></text>
|
<text></text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="telsele">
|
<!-- <view class="telsele">
|
||||||
<view class="tel">
|
<view class="tel">
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/ucosihVOuRDfyaNn5VzX" mode=""></image> 手机号
|
<image src="https://api.ccttiot.com/smartmeter/img/static/ucosihVOuRDfyaNn5VzX" mode=""></image> 手机号
|
||||||
</view>
|
</view>
|
||||||
|
@ -14,9 +14,9 @@
|
||||||
<input type="text" v-model="tel" placeholder="请输入您的手机号"/>
|
<input type="text" v-model="tel" placeholder="请输入您的手机号"/>
|
||||||
<image v-if="tel" @click="btnqk" style="width: 32rpx;height: 32rpx;" src="https://api.ccttiot.com/smartmeter/img/static/uE9WtCydr2ISGWek6EkS" mode=""></image>
|
<image v-if="tel" @click="btnqk" style="width: 32rpx;height: 32rpx;" src="https://api.ccttiot.com/smartmeter/img/static/uE9WtCydr2ISGWek6EkS" mode=""></image>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view> -->
|
||||||
|
|
||||||
<view class="telsele" style="margin-top: 36rpx;margin-bottom: 26rpx;">
|
<!-- <view class="telsele" style="margin-top: 36rpx;margin-bottom: 26rpx;">
|
||||||
<view class="tel">
|
<view class="tel">
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uFiLt1SC4cHdZrIDRxeO" mode=""></image> 密码
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uFiLt1SC4cHdZrIDRxeO" mode=""></image> 密码
|
||||||
</view>
|
</view>
|
||||||
|
@ -35,9 +35,9 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="you">
|
<view class="you">
|
||||||
没有账户? <text @click="btnljdl">立即注册</text>
|
没有账户? <text @click="btnljdl">立即注册</text>
|
||||||
</view>
|
</view> -->
|
||||||
<view class="wxlogo">
|
<view class="wxlogo">
|
||||||
—————— 其他登录方式 ——————
|
—————— 登录方式 ——————
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<button style="color: #ccc;margin-top: 30rpx;" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
|
<button style="color: #ccc;margin-top: 30rpx;" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
|
||||||
|
@ -186,7 +186,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
/deep/ .u-checkbox__icon-wrap{
|
::v-deep .u-checkbox__icon-wrap{
|
||||||
border: 1px solid #666666;
|
border: 1px solid #666666;
|
||||||
}
|
}
|
||||||
page{
|
page{
|
||||||
|
|
|
@ -2,12 +2,16 @@
|
||||||
<view>
|
<view>
|
||||||
<image src="https://api.ccttiot.com/smartmeter/img/static/uZUV03nVfyr3MvcLKUfs" class="bj" mode=""></image>
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uZUV03nVfyr3MvcLKUfs" class="bj" mode=""></image>
|
||||||
<view class="anniu">
|
<view class="anniu">
|
||||||
<view class="zhuce" @click="btnzc">
|
<!-- <view class="zhuce" @click="btnzc">
|
||||||
注册
|
注册
|
||||||
</view>
|
</view> -->
|
||||||
<view class="denglu" @click="denglu">
|
<!-- <view class="denglu" @click="denglu">
|
||||||
登录
|
登录
|
||||||
</view>
|
</view> -->
|
||||||
|
<button class="denglu" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
|
||||||
|
<!-- <image src="https://api.ccttiot.com/smartmeter/img/static/uxWMldLMb888YHm0qOgN" mode=""></image> -->
|
||||||
|
快捷登录
|
||||||
|
</button>
|
||||||
<view class="zhuce" style="margin-top: 30rpx;" @click="denglus">
|
<view class="zhuce" style="margin-top: 30rpx;" @click="denglus">
|
||||||
暂不登录
|
暂不登录
|
||||||
</view>
|
</view>
|
||||||
|
@ -56,6 +60,44 @@
|
||||||
xBlufi.initXBlufi(1)
|
xBlufi.initXBlufi(1)
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
|
// 点击微信一键登录
|
||||||
|
getPhoneNumber(e) {
|
||||||
|
this.jsCode = e.detail.code
|
||||||
|
let that = this;
|
||||||
|
const wxLoginAsync = () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
wx.login({
|
||||||
|
success(res) {
|
||||||
|
if (res.code) {
|
||||||
|
that.mobileCode = res.code
|
||||||
|
let data = {
|
||||||
|
jsCode: e.detail.code,
|
||||||
|
mobileCode: res.code,
|
||||||
|
}
|
||||||
|
resolve(data);
|
||||||
|
} else {
|
||||||
|
reject(res.errMsg)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail(err) {
|
||||||
|
reject(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
wxLoginAsync().then(async (data) => {
|
||||||
|
this.$u.post(`/wxlogin?mobileCode=${this.jsCode}&jsCode=${this.mobileCode}`, data).then((res) => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
wx.setStorageSync('token', res.token)
|
||||||
|
uni.switchTab({
|
||||||
|
url:'/pages/index/index'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}).catch((err) => {
|
||||||
|
console.error(err)
|
||||||
|
})
|
||||||
|
},
|
||||||
// 跳转到注册页
|
// 跳转到注册页
|
||||||
btnzc(){
|
btnzc(){
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
|
|
|
@ -226,10 +226,10 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
/deep/ .u-title{
|
::v-deep .u-title{
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
}
|
}
|
||||||
/deep/ .uicon-nav-back{
|
::v-deep .uicon-nav-back{
|
||||||
margin-bottom: 22rpx;
|
margin-bottom: 22rpx;
|
||||||
}
|
}
|
||||||
page{
|
page{
|
||||||
|
|
|
@ -132,13 +132,28 @@
|
||||||
duration: 2000
|
duration: 2000
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
let data = {
|
let that = this
|
||||||
phone:this.tel,
|
wx.login({
|
||||||
phoneCode:this.yzm,
|
success(res) {
|
||||||
uuid:this.uuid,
|
if (res.code) {
|
||||||
password:this.password
|
that.mobileCode = res.code
|
||||||
|
resolve(data);
|
||||||
|
} else {
|
||||||
|
reject(res.errMsg)
|
||||||
}
|
}
|
||||||
this.$u.post(`/appCodeLogin`,data).then((res) => {
|
},
|
||||||
|
fail(err) {
|
||||||
|
reject(err)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
let data = {
|
||||||
|
phone:that.tel,
|
||||||
|
phoneCode:that.yzm,
|
||||||
|
uuid:that.uuid,
|
||||||
|
password:that.password,
|
||||||
|
jsCode:that.mobileCode
|
||||||
|
}
|
||||||
|
that.$u.post(`/appCodeLogin`,data).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
wx.setStorageSync('token', res.token)
|
wx.setStorageSync('token', res.token)
|
||||||
uni.switchTab({
|
uni.switchTab({
|
||||||
|
@ -269,7 +284,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
/deep/ .u-checkbox__icon-wrap{
|
::v-deep .u-checkbox__icon-wrap{
|
||||||
border: 1px solid #666666;
|
border: 1px solid #666666;
|
||||||
}
|
}
|
||||||
page{
|
page{
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
/deep/ .map{
|
::v-deep .map{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user