lanan-repair-app/pages/index/index.vue

68 lines
1.3 KiB
Vue
Raw Normal View History

2024-10-09 13:34:36 +08:00
<template>
<view class="content">
</view>
</template>
<script>
2024-10-25 18:52:01 +08:00
import {getToken,getUserInfo} from "@/utils/auth";
2024-10-09 13:34:36 +08:00
export default {
data() {
return {
2024-10-30 18:14:19 +08:00
keepLive: {
channelId: 'Ba-KeepAlive',
channelName: "Ba-KeepAlive",
title: "汽修小助手正在运行",
content: "汽修小助手正在运行",
dataResult: "",
type: undefined
}
2024-10-09 13:34:36 +08:00
}
},
onLoad() {
2024-10-30 18:14:19 +08:00
// #ifdef APP
//保活技术
this.register()
// #endif
2024-10-17 15:22:37 +08:00
if(getToken()){
//跳转首页
2024-10-25 18:52:01 +08:00
//判断是否是仓管,仓管需要跳单独的首页
let userInfo = getUserInfo()
if(userInfo.roleCodes.includes('repair_warehouse')){
//仓管
uni.navigateTo({
url: '/pages-warehouse/home/home'
})
}else{
uni.navigateTo({
url: '/pages-home/home/home'
})
}
2024-10-17 15:22:37 +08:00
}else{
uni.navigateTo({
url: '/pages/login/login'
})
2024-10-30 18:14:19 +08:00
}
2024-10-09 13:34:36 +08:00
},
methods: {
2024-10-30 18:14:19 +08:00
register() { //注册
console.log(keepAlivePlugin, 'keepAlive');
keepAlivePlugin.register({
channelId: this.keepLive.channelId,
channelName: this.keepLive.channelName,
title: this.keepLive.title,
content: this.keepLive.content,
},
(res) => {
console.log('保活注册', res);
});
},
2024-10-09 13:34:36 +08:00
}
}
</script>
<style>
2024-10-17 15:22:37 +08:00
</style>