更新用户校验状态,及用户隐私,token不过期直接跳到设备控制器页
parent
1f90a950dc
commit
4134eef47e
2
App.vue
2
App.vue
|
|
@ -60,7 +60,7 @@ export default {
|
||||||
console.log('小程序切前台/首次显示')
|
console.log('小程序切前台/首次显示')
|
||||||
const token = getToken() || this.globalData.mqtt.token
|
const token = getToken() || this.globalData.mqtt.token
|
||||||
if (token) {
|
if (token) {
|
||||||
|
this.$tab.reLaunch('/pages/control/index')
|
||||||
// 兜底检查:如果globalData里没有列表,但缓存里有,补充恢复
|
// 兜底检查:如果globalData里没有列表,但缓存里有,补充恢复
|
||||||
if (this.globalData.mqtt.subscribeList.length === 0) {
|
if (this.globalData.mqtt.subscribeList.length === 0) {
|
||||||
const savedSubscribeList = uni.getStorageSync('mqtt_subscribe_list')
|
const savedSubscribeList = uni.getStorageSync('mqtt_subscribe_list')
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,11 @@ module.exports = {
|
||||||
// 政策协议
|
// 政策协议
|
||||||
agreements: [{
|
agreements: [{
|
||||||
title: "隐私政策",
|
title: "隐私政策",
|
||||||
url: "https://ruoyi.vip/protocol.html"
|
url: "https://privacy.xiaoces.com/privacy.html"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "用户服务协议",
|
title: "用户服务协议",
|
||||||
url: "https://ruoyi.vip/protocol.html"
|
url: "https://privacy.xiaoces.com/privacy.html"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="card-icon" :class="{ active: status[card.type] === 1 }" @click.stop="handleCardClick(1 - status[card.type], card.type)">
|
<view v-if="showFlag" class="card-icon" :class="{ active: status[card.type] === 1 }" @click.stop="handleCardClick(1 - status[card.type], card.type)">
|
||||||
<!-- 加@click.stop防止冒泡触发卡片点击的弹窗事件 -->
|
<!-- 加@click.stop防止冒泡触发卡片点击的弹窗事件 -->
|
||||||
<uni-icons
|
<uni-icons
|
||||||
:type="status[card.type] === 1 ? 'circle' : 'circle-filled'"
|
:type="status[card.type] === 1 ? 'circle' : 'circle-filled'"
|
||||||
|
|
@ -173,6 +173,7 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
showFlag:true,
|
||||||
temp: "",
|
temp: "",
|
||||||
mqttConfig: {
|
mqttConfig: {
|
||||||
subscribeTopic:'/listener',
|
subscribeTopic:'/listener',
|
||||||
|
|
@ -291,6 +292,7 @@ export default {
|
||||||
mqttUtil.setOnMessageCallback(this.ackMessage);
|
mqttUtil.setOnMessageCallback(this.ackMessage);
|
||||||
// 更新连接状态
|
// 更新连接状态
|
||||||
this.connected = mqttUtil.getMqttState().isConnected;
|
this.connected = mqttUtil.getMqttState().isConnected;
|
||||||
|
this.showFlag = !((store.getters && store.getters.name !== 'admin') && this.$auth.hasRole("test"))
|
||||||
},
|
},
|
||||||
onUnload() {
|
onUnload() {
|
||||||
// 移除MQTT消息回调(避免内存泄漏)
|
// 移除MQTT消息回调(避免内存泄漏)
|
||||||
|
|
@ -478,7 +480,7 @@ export default {
|
||||||
const funcMsg = "该功能用来开启或暂停设备,按钮亮为开启,按钮暗为暂停设备"
|
const funcMsg = "该功能用来开启或暂停设备,按钮亮为开启,按钮暗为暂停设备"
|
||||||
if ((store.getters && store.getters.name !== 'admin')
|
if ((store.getters && store.getters.name !== 'admin')
|
||||||
&& this.$auth.hasRole("test")) {
|
&& this.$auth.hasRole("test")) {
|
||||||
this.testFunction(`${this.testMsg}\n${funcMsg}`)
|
// this.testFunction(`${this.testMsg}\n${funcMsg}`)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 校验
|
// 校验
|
||||||
|
|
@ -673,6 +675,10 @@ export default {
|
||||||
|
|
||||||
// 新增:打开修改运行时间的弹窗
|
// 新增:打开修改运行时间的弹窗
|
||||||
openTimeModal(card) {
|
openTimeModal(card) {
|
||||||
|
if ((store.getters && store.getters.name !== 'admin')
|
||||||
|
&& this.$auth.hasRole("test")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.currentCard = card; // 记录当前卡片信息
|
this.currentCard = card; // 记录当前卡片信息
|
||||||
this.currentCardTime = this.limitTimes[`${card.type}Limit`]; // 记录当前时间
|
this.currentCardTime = this.limitTimes[`${card.type}Limit`]; // 记录当前时间
|
||||||
this.newLimitTime = this.currentCardTime; // 默认填充当前时间
|
this.newLimitTime = this.currentCardTime; // 默认填充当前时间
|
||||||
|
|
@ -680,6 +686,10 @@ export default {
|
||||||
this.$refs.inputDialog.open()
|
this.$refs.inputDialog.open()
|
||||||
},
|
},
|
||||||
openDataModal(sensorCard) {
|
openDataModal(sensorCard) {
|
||||||
|
if ((store.getters && store.getters.name !== 'admin')
|
||||||
|
&& this.$auth.hasRole("test")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.sensorCard = sensorCard;
|
this.sensorCard = sensorCard;
|
||||||
this.remark=this.dtu_remark[sensorCard.key] || sensorCard.label;
|
this.remark=this.dtu_remark[sensorCard.key] || sensorCard.label;
|
||||||
this.$refs.inputNamelog.open()
|
this.$refs.inputNamelog.open()
|
||||||
|
|
@ -688,7 +698,7 @@ export default {
|
||||||
const funcMsg = "该功能用来设置温湿度卡片别名,如若不填则展示默认备注"
|
const funcMsg = "该功能用来设置温湿度卡片别名,如若不填则展示默认备注"
|
||||||
if ((store.getters && store.getters.name !== 'admin')
|
if ((store.getters && store.getters.name !== 'admin')
|
||||||
&& this.$auth.hasRole("test")) {
|
&& this.$auth.hasRole("test")) {
|
||||||
this.testFunction(`${this.testMsg}\n${funcMsg}`)
|
// this.testFunction(`${this.testMsg}\n${funcMsg}`)
|
||||||
this.$refs?.inputNamelog?.close();
|
this.$refs?.inputNamelog?.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -769,7 +779,7 @@ export default {
|
||||||
const funcMsg = "该功能用来设置设备运行时间及设备别名,设备运行时间即开启设备后到达运行时间自行暂停设备;设备别名不填则展示默认设备名称"
|
const funcMsg = "该功能用来设置设备运行时间及设备别名,设备运行时间即开启设备后到达运行时间自行暂停设备;设备别名不填则展示默认设备名称"
|
||||||
if ((store.getters && store.getters.name !== 'admin')
|
if ((store.getters && store.getters.name !== 'admin')
|
||||||
&& this.$auth.hasRole("test")) {
|
&& this.$auth.hasRole("test")) {
|
||||||
this.testFunction(`${this.testMsg}\n${funcMsg}`)
|
// this.testFunction(`${this.testMsg}\n${funcMsg}`)
|
||||||
this.$refs?.inputDialog?.close();
|
this.$refs?.inputDialog?.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue