shjz-applet/App.vue

50 lines
1.5 KiB
Vue

<script>
export default {
globalData:{
projectname:'', // 项目名称
lat:'', // 公司地址维度
lng:'' ,// 公司地址经度
hostapi:'https://wechat.sinochainlogistics.com.cn:6542' // 域名配置
},
// 优先于show方法
onLaunch: function() {
uni.login({
success: (res) => {
uni.request({
url: this.globalData.hostapi +'/api/user/login',
data:{code:res.code},
success: (result) => {
if(result.data.code == 0) {
uni.setStorageSync('userId',result.data.account_id);
uni.setStorageSync('token',result.data.data.token);//缓存token
uni.setStorageSync('openid',result.data.data.openid);//缓存openid
uni.setStorageSync('expire',result.data.data.expire);//缓存失效时间(时间戳格式)
uni.setStorageSync('phone_active',result.data.data.phone_active);//是否授权手机号
uni.setStorageSync('is_active',result.data.data.is_active);//是否授权头像和昵称
uni.setStorageSync('invite_code',result.data.data.invite_code);//缓存邀请码
}
}
})
}
})
},
};
</script>
<style>
/* 阿里巴巴矢量图标库 start */
@import url("./commons/icon-font.css");
/* 阿里巴巴矢量图标库 end */
/* 项目基础样式 start */
@import url("./commons/base.css");
/* 项目基础样式 end */
/* 动画样式 start */
@import url("./commons/animate.min.css");
/* 动画样式 end */
@import url("./commons/loading.css");
</style>