更新用户校验状态,及用户隐私,token不过期直接跳到设备控制器页

master
lld 2026-02-03 19:10:07 +08:00
parent 1f90a950dc
commit 4134eef47e
4 changed files with 17 additions and 7 deletions

View File

@ -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')

View File

@ -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"
} }
] ]
} }

View File

@ -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;
} }