四零语境前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

85 lines
1.6 KiB

<script>
export default {
methods: {
// 提前获取二维码并保存起来
async getQrcode() {
uni.getImageInfo({
src: `${this.$config.baseURL}/promotion/qrCode?token=${uni.getStorageSync('token')}`
// #ifdef H5
+ '&type=official'
// #endif
,
success: (image) => {
this.Qrcode = image.path;
this.$store.commit('setQrcode', this.Qrcode)
},
fail: (err) => {
console.error('获取二维码失败:', err);
}
});
}
},
onLaunch() {
// 提前获取二维码
this.getQrcode()
},
async onShow() {
// if(!uni.getStorageSync('token')){
// uni.redirectTo({
// url: '/subPages/login/login',
// })
// }
await this.$store.dispatch('initData')
console.log('配置数据初始化完成')
if(uni.getStorageSync('token')){
this.getUserInfo()
}
},
onHide: function() {
console.log('App Hide')
},
async getUserInfo() {
const res = await this.$api.login.getUserInfo();
if (res.code === 200) {
this.userInfo = res.result;
// 存储用户信息到store
this.$store.dispatch('updateUserInfo', this.userInfo)
}
},
}
</script>
<style lang="scss">
// @import '@/uni_modules/uv-ui-tools/index.scss';
/* 富文本全局样式 - rich-text组件的class样式必须写在全局中 */
h1, h2, h3, h4, h5, h6 {
font-weight: bold;
margin: 10px 0;
line-height: 1.4;
}
h2 {
font-size: 20px;
color: #333;
}
p {
margin: 8px 0;
line-height: 1.6;
color: #666;
}
strong {
font-weight: bold;
color: #333;
}
/* 首行缩进样式 */
.text-indent {
text-indent: 2em;
}
</style>