2023-03-02 09:44:12 +08:00
|
|
|
<script>
|
2023-03-07 18:03:25 +08:00
|
|
|
import {
|
|
|
|
request
|
|
|
|
} from 'common/request.js'
|
2023-03-02 09:44:12 +08:00
|
|
|
export default {
|
2023-03-07 18:03:25 +08:00
|
|
|
onLaunch: async function() {
|
|
|
|
const token = uni.getStorageSync("token");
|
|
|
|
if (!token) {
|
|
|
|
uni.redirectTo({
|
|
|
|
url: "/pages/my/login",
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
request({
|
|
|
|
url: "/api/daily/user/refresh_token"
|
|
|
|
}).then(res => {
|
|
|
|
uni.setStorageSync("token", res.token)
|
|
|
|
}).catch(e => {
|
|
|
|
uni.redirectTo({
|
|
|
|
url: "/pages/my/login",
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
2023-03-02 09:44:12 +08:00
|
|
|
},
|
2023-03-07 18:03:25 +08:00
|
|
|
onShow: function() {},
|
|
|
|
onLoad: function() {
|
|
|
|
wx.setEnableDebug(({
|
|
|
|
enableDebug: false
|
|
|
|
}))
|
2023-03-02 09:44:12 +08:00
|
|
|
},
|
|
|
|
onHide: function() {
|
|
|
|
console.log('App Hide')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
/*每个页面公共css */
|
|
|
|
page {
|
|
|
|
height: 100vh;
|
|
|
|
}
|
|
|
|
</style>
|