|
@@ -35,6 +35,8 @@
|
|
|
</view>
|
|
</view>
|
|
|
<!-- <view class="device-body_ops-time">{{ state.time }}</view>-->
|
|
<!-- <view class="device-body_ops-time">{{ state.time }}</view>-->
|
|
|
</view>
|
|
</view>
|
|
|
|
|
+
|
|
|
|
|
+ <login-bar class="w100 text-center"></login-bar>
|
|
|
</view>
|
|
</view>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -44,6 +46,7 @@ import {reactive, ref} from "vue";
|
|
|
import {debounce, fmtDictName} from "@/utils/common";
|
|
import {debounce, fmtDictName} from "@/utils/common";
|
|
|
import {get, post} from "@/utils/https";
|
|
import {get, post} from "@/utils/https";
|
|
|
import {tryLogin} from "@/utils/auth";
|
|
import {tryLogin} from "@/utils/auth";
|
|
|
|
|
+import LoginBar from "@/components/login-bar/index.vue";
|
|
|
|
|
|
|
|
const initState = () => ({
|
|
const initState = () => ({
|
|
|
device: {
|
|
device: {
|
|
@@ -52,7 +55,8 @@ const initState = () => ({
|
|
|
state: ''
|
|
state: ''
|
|
|
},
|
|
},
|
|
|
time: "00:00:00",
|
|
time: "00:00:00",
|
|
|
- start: new Date()
|
|
|
|
|
|
|
+ start: new Date(),
|
|
|
|
|
+ deviceId:null
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
const state = reactive(initState())
|
|
const state = reactive(initState())
|
|
@@ -69,7 +73,8 @@ onLoad((options: any) => {
|
|
|
let scanTime = options.scancode_time;
|
|
let scanTime = options.scancode_time;
|
|
|
console.log(query, scanTime)
|
|
console.log(query, scanTime)
|
|
|
if (query) {
|
|
if (query) {
|
|
|
- id = query.split("#")[1]
|
|
|
|
|
|
|
+ id = query.split("#")[1].split("?")[0]
|
|
|
|
|
+ state.deviceId =id;
|
|
|
} else {
|
|
} else {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
@@ -84,16 +89,38 @@ onLoad((options: any) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
onShow(() => {
|
|
onShow(() => {
|
|
|
- if (!state.device?.id) {
|
|
|
|
|
|
|
+ addListener();
|
|
|
|
|
+ if (!state.deviceId) {
|
|
|
console.log(getApp<any>().globalData.deviceId)
|
|
console.log(getApp<any>().globalData.deviceId)
|
|
|
let deviceId = getApp<any>().globalData.deviceId;
|
|
let deviceId = getApp<any>().globalData.deviceId;
|
|
|
if (deviceId) {
|
|
if (deviceId) {
|
|
|
loadDeviceDetail(deviceId);
|
|
loadDeviceDetail(deviceId);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-const loadDeviceDetail = (id: number) => {
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+const addListener = () => {
|
|
|
|
|
+ uni.$on('login', function (data) {
|
|
|
|
|
+ if(state.deviceId){
|
|
|
|
|
+ loadDeviceDetail(state.deviceId);
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ uni.$on('logout', function (data) {
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const removeListener = () => {
|
|
|
|
|
+ uni.$off('logout');
|
|
|
|
|
+ uni.$off('login');
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+const loadDeviceDetail = (id: any) => {
|
|
|
|
|
+ state.deviceId =id;
|
|
|
get(`/wash-device/queryDevice/${id}`).then((res: any) => {
|
|
get(`/wash-device/queryDevice/${id}`).then((res: any) => {
|
|
|
if (res.currentUserId && res.currentUserId != getApp<any>().globalData.user.id) {
|
|
if (res.currentUserId && res.currentUserId != getApp<any>().globalData.user.id) {
|
|
|
uni.showToast({
|
|
uni.showToast({
|