|
@@ -32,9 +32,10 @@ const data = reactive<any>({
|
|
|
mySwiper: {},
|
|
|
projectList: [],
|
|
|
timerManager: {},
|
|
|
- device_info: {}
|
|
|
+ device_info: {},
|
|
|
+ listenWs: false,//是否监听手势
|
|
|
});
|
|
|
-const { mySwiper, projectList, timerManager, device_info } = toRefs(data);
|
|
|
+const { mySwiper, projectList, timerManager, device_info, listenWs } = toRefs(data);
|
|
|
|
|
|
/**
|
|
|
* 清空定时任务
|
|
@@ -142,29 +143,40 @@ const confirm = (myProject?: any) => {
|
|
|
/**
|
|
|
* 退出
|
|
|
*/
|
|
|
-const getLogout = () => {
|
|
|
- proxy?.$modal.prompt('请输入密码', 'password').then((e: any) => {
|
|
|
- // console.log("e", e)
|
|
|
- if (e.action == 'confirm' && e.value) {
|
|
|
- let params = {
|
|
|
- password: e.value
|
|
|
- };
|
|
|
- proxy?.$http.common.checkPassword(params).then((res: any) => {
|
|
|
- if (res.status === 200 || res.status === 1) {
|
|
|
- proxy?.$http.common.logout({}).then((res: any) => {
|
|
|
- });
|
|
|
- proxy?.$modal?.closeLoading()
|
|
|
- //清空缓存
|
|
|
- localStorage.clear();
|
|
|
- //跳转
|
|
|
- router.push({ path: '/login/qrcode' });
|
|
|
- } else {
|
|
|
- proxy?.$modal.msgError(res.message);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- }).finally(() => {
|
|
|
- });
|
|
|
+const getLogout = async () => {
|
|
|
+ if (import.meta.env.DEV) {
|
|
|
+ proxy?.$modal.msgSuccess('测试环境免密退出');
|
|
|
+ await proxy?.$http.common.logout({}).then((res: any) => {
|
|
|
+ });
|
|
|
+ proxy?.$modal?.closeLoading()
|
|
|
+ //清空缓存
|
|
|
+ localStorage.clear();
|
|
|
+ //跳转
|
|
|
+ router.push({ path: '/login/qrcode' });
|
|
|
+ } else {
|
|
|
+ proxy?.$modal.prompt('请输入密码', 'password').then((e: any) => {
|
|
|
+ // console.log("e", e)
|
|
|
+ if (e.action == 'confirm' && e.value) {
|
|
|
+ let params = {
|
|
|
+ password: e.value
|
|
|
+ };
|
|
|
+ proxy?.$http.common.checkPassword(params).then(async (res: any) => {
|
|
|
+ if (res.status === 200 || res.status === 1) {
|
|
|
+ await proxy?.$http.common.logout({}).then((res: any) => {
|
|
|
+ });
|
|
|
+ proxy?.$modal?.closeLoading()
|
|
|
+ //清空缓存
|
|
|
+ localStorage.clear();
|
|
|
+ //跳转
|
|
|
+ router.push({ path: '/login/qrcode' });
|
|
|
+ } else {
|
|
|
+ proxy?.$modal.msgError(res.message);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }).finally(() => {
|
|
|
+ });
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
/**
|
|
@@ -188,10 +200,14 @@ onBeforeMount(() => {
|
|
|
handWs((e: any) => {
|
|
|
//发送设备
|
|
|
if (e?.wksid) {
|
|
|
- console.log("111", e)
|
|
|
+ console.log("e.wksid", e.wksid)
|
|
|
+ listenWs.value = true;
|
|
|
let deviceid = localStorage.getItem("deviceid");
|
|
|
startDevice({ deviceid: deviceid })
|
|
|
}
|
|
|
+ if (listenWs.value == false) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
//接收参数
|
|
|
if (e?.device_info) {
|
|
|
console.log("222", e)
|
|
@@ -225,6 +241,7 @@ onMounted(() => {
|
|
|
getTips();
|
|
|
})
|
|
|
onBeforeUnmount(() => {
|
|
|
+ listenWs.value = false;
|
|
|
getClearTimer();
|
|
|
})
|
|
|
</script>
|