50 lines
1.2 KiB
Vue
Raw Normal View History

2025-04-14 10:57:27 +08:00
<script>
2025-06-25 13:37:32 +08:00
import * as api from "@/utils/api.js";
2025-08-08 09:22:47 +08:00
import systemInfoUtil from "@/utils/systemInfo.js";
2025-06-25 13:37:32 +08:00
export default {
2025-08-08 09:22:47 +08:00
onLaunch: async function () {
2025-06-25 13:37:32 +08:00
setTimeout(() => {
console.log("onLaunch执行完毕");
}, 100);
this.checkIsLogin();
2025-08-08 09:22:47 +08:00
await systemInfoUtil.init();
2025-06-25 13:37:32 +08:00
},
onShow: function () {
console.log("App Show");
},
onHide: function () {
console.log("App Hide");
},
methods: {
checkIsLogin() {
let token = uni.getStorageSync("token");
//请求后端接口查看token是否有效
api
.calluser("auth/check?Authorization=" + token, {}, "get")
.then((res) => {
if (res.code == 200) {
// let url = "/pages/devops/ebikeinfo/ebikeinfo";
2025-08-12 11:45:30 +08:00
// let url = "/pages/warehouse/maintainOrder/maintainOrderList";
2025-08-08 09:22:47 +08:00
// let url = "/pages/mine/mine";
2025-06-25 13:37:32 +08:00
let url = "/pages/home/home";
setTimeout(() => {
uni.reLaunch({
url,
});
}, 50);
}
});
},
},
};
2025-04-14 10:57:27 +08:00
</script>
<style lang="scss">
2025-06-25 13:37:32 +08:00
/*每个页面公共css */
@import "@/static/iconfont.css";
@import "./common/uni.css";
@import "./colorui/main.css";
@import "./colorui/icon.css";
@import "./common/uni-main.scss";
</style>