68 lines
1.7 KiB
Vue
68 lines
1.7 KiB
Vue
|
<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>
|
||
|
|