water-mall/App.vue

68 lines
1.7 KiB
Vue
Raw Permalink Normal View History

2024-10-11 07:13:13 +00:00
<script>
import toolAll from '@/jsFile/tools.js'
import {
postUserInfo,
getInfo
} from "@/api/index";
export default {
globalData:{
projectname:'', // 项目名称
lat:'', // 公司地址维度
lng:'' ,// 公司地址经度
hostapi:'https://water-mall-new.dev.scdxtc.cn' ,// 域名配置
code:'',//缓存code
},
onLaunch() {
let that = this;
if (process.env.NODE_ENV === 'development') {
this.globalData.hostapi = 'https://water-mall-new.dev.scdxtc.cn' //测试
} else {
this.globalData.hostapi = 'https://water-mall-new.dev.scdxtc.cn' //正式
}
//新版登录方式
uni.login({
provider: 'weixin',
success: (result)=> {
// 获取基本信息
getInfo().then(res => {
if (res.code == 0) {
uni.setStorageSync('baseInfo',res.data)//缓存用户基本信息
}
});
let code = result.code; //result.code
that.$requst.post('/api.login/index',{code:code}).then(res => {
if(res.code == 0){
uni.setStorageSync('token',res.data.token) //缓存token
uni.setStorageSync('userInfo',res.data.baseInfo)//缓存用户信息
that.$isResolve()
}
})
}
})
}
};
</script>
<style lang="scss">
@import "@/components/uview-ui/index.scss";
/* 阿里巴巴矢量图标库 start */
@import url("./commons/icon-font.css");
/* 阿里巴巴矢量图标库 end */
/* 项目页面样式 start */
@import url("./commons/common.css");
@import url("./commons/style.css");
/* 项目页面样式 end */
/* 加载中样式 start */
@import url("./commons/loading.css");
/* 加载中样式 end */
/* 共用样式 */
@import "@/jsFile/style.scss";
</style>