Commit 9a4179f5 authored by 罗超's avatar 罗超

新增微信登录

parent 56046388
......@@ -13,11 +13,11 @@
<input type="password" v-model="msg.password" placeholder="请输入你的登录密码" :class="{'focus':currentFocus=='pwd'}" @blur="changeCurrentFocus('')" @focus="changeCurrentFocus('pwd')">
</view>
<view class="login-item">
<view @click="loginERPHandler" class="login-btn" :class="{'disable':msg.account==''||msg.password==''}">立即登录</view>
<view @click="loginByAccount" class="login-btn" :class="{'disable':msg.account==''||msg.password==''}">立即登录</view>
</view>
<u-divider contentPosition="center" :margin-top="60" :margin-bottom="60">其他登录方式</u-divider>
<view style="text-align: center;">
<button class="wechat-login">
<button class="wechat-login" @click="loginByOpenId">
<image src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Test/Upload/Goods/1695266425000_759.png" mode="widthFix"></image>
</button>
</view>
......@@ -35,7 +35,8 @@
platform:3,
OpenId:''
},
currentFocus:''
currentFocus:'',
loginLoading:false
}
},
mounted() {
......@@ -45,22 +46,37 @@
changeCurrentFocus(val){
this.currentFocus=val
},
loginERPHandler(){
loginByAccount(){
if(this.msg.account!='' && this.msg.password!=''){
this.loginErpHandler()
}
},
loginByOpenId(){
if(this.msg.OpenId!=''){
this.loginErpHandler()
}else{
uni.showToast({
icon:'none',
title:'获取微信信息失败,请使用账号密码登录'
})
}
},
loginErpHandler(){
if(this.loginLoading) return;
this.loginLoading=true
uni.showLoading({
title:'登录中...'
})
this.apipost("b2b_post_Login",this.msg,(res) => {
//console.log(res)
if (res.resultCode == 1) {
uni.setStorageSync('b2b_user',res.data)
this.getLogin()
}
},(error)=>{
this.loginLoading=false
uni.hideLoading()
})
}
},
getUserProfileHandler(){
wx.login({
......@@ -120,6 +136,7 @@
},
(res) => {
uni.hideLoading()
this.loginLoading=false
if (res.resultCode == 1) {
uni.setStorageSync("mall_UserInfo", res.data);
uni.removeStorageSync("pid");
......@@ -133,7 +150,10 @@
}
},
(err)=>{uni.hideLoading()});
(err)=>{
uni.hideLoading()
this.loginLoading=false
});
},
}
}
......
......@@ -88,7 +88,7 @@
"
@click="login(user_info)"
>{{
b2b_user_info ? b2b_user_info.name : "立即登录"
customer_info ? customer_info.customerName : "立即登录"
}}</Text
>
<!-- 判断是甲鹤小程序 -->
......@@ -643,6 +643,7 @@ export default {
isAttestationEdu: 0, //学员是否认证了 0否1是
appid: encodeURIComponent(JSON.stringify({ appId: "2021002181604459" })),
userId: uni.getStorageSync("mall_UserInfo").UserId,
customer_info:{}
};
},
components: {
......@@ -658,7 +659,7 @@ export default {
? uni.getStorageSync("basedata").mall.setting.mallStyle.IsEducation
: 0
: 0;
this.userinfo();
//this.userinfo();
this.setting = uni.getStorageSync("basedata").mall.setting;
this.isCompany = uni.getStorageSync("user_type")
? uni.getStorageSync("user_type") == "company"
......@@ -671,6 +672,7 @@ export default {
? basedata.user_info.isAttestationEdu
: 0;
this.b2b_user_info = uni.getStorageSync('b2b_user')
this.getCustomerInfo()
},
onLoad() {
this.navHeight = this.$navHeight - 2;
......@@ -685,7 +687,7 @@ export default {
}
},
mounted() {
this.getComponyStatus();
//this.getComponyStatus();
let currentPages = getCurrentPages();
let c = this.$uiConfig.is_bang ? 80 : 52;
this.bottommargin = c + 10 + "px";
......@@ -719,7 +721,7 @@ export default {
onShow() {
this.userinfo(2);
if (this.mall_UserInfo) {
this.getUserPoint();
//this.getUserPoint();
}
let basedata = uni.getStorageSync("basedata")
? uni.getStorageSync("basedata")
......@@ -729,6 +731,15 @@ export default {
: 0;
},
methods: {
getCustomerInfo(){
if(this.b2b_user_info && this.b2b_user_info.token){
this.apipost("b2b_get_GetCustomerManagerInfo",{},(res) => {
if (res.resultCode == 1) {
this.customer_info=res.data
}
})
}
},
goHome() {
uni.redirectTo({
url: "/pages/index/main",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment