代码拉取完成,页面将自动刷新
<script>
import store from '@/store/index.js';
export default {
onLaunch: async function() {
// console.log(uni.$u.config.v);
let token = uni.getStorageSync('token');
let loginData = uni.getStorageSync('userInfo');
if (token && loginData) {
console.info('查找到用户信息直接登录');
store.commit('modifyToken', token);
store.dispatch('updateLoginUser', loginData);
} else {
console.info('用户没有登录');
/*#ifdef H5*/
this.h5DevLogin();
/*#endif*/
/*#ifdef MP*/
// uni.reLaunch({
// url: '/pages/loveStart/loveStart'
// });
// 静默登录
// await store.dispatch('login');
/*#endif*/
}
},
onShow: function() {
// console.log('App Show')
},
onHide: function() {
// console.log('App Hide')
},
methods: {
h5DevLogin() {
if (process.env.NODE_ENV === 'development') {
let tokentemp =
"wx eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyVVVJRCI6ImU1NzUzMzUwLTZhNmQtNGQyMi05NmRmLTFiNzBjMjVlYWYzOCJ9.1muLZfeQKsax3-pKASKYmtk2m_S9ZUxXjNYGJCUd43I";
let usertemp =
'{"id":25,"username":"pig_xy79e91ntf","gender":0,"nickname":"joke","avatar":"https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTLLnsXvmY93UaEB9M1JIaNNjdI243VX5v5ekpuiaNzBDTzJKL4KGLoLR4nKkwf39v2XChWD0JMc0eA/132","signature":"","city":"","loveId":536,"spouseId":255,"state":0,"createTime":1648290437000,"modifyTime":1653230616000}';
console.info('h5开发者登录');
uni.setStorageSync('token', tokentemp);
uni.setStorageSync('userInfo', JSON.parse(usertemp));
store.commit('modifyToken', tokentemp);
store.dispatch('updateLoginUser', JSON.parse(usertemp));
this.navigatePath(JSON.parse(usertemp));
}
}
}
};
</script>
<style lang="scss">
@import 'uview-ui/index.scss';
/*每个页面公共css */
::-webkit-scrollbar {
display: none;
width: 0 !important;
height: 0 !important;
color: transparent !important;
}
scroll-view ::-webkit-scrollbar {
display: none;
width: 0;
height: 0;
color: transparent;
}
</style>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。