版本1.2.3

This commit is contained in:
xk_guohonglei
2020-10-14 11:40:08 +08:00
parent 80d2a48dec
commit 9320a99366
26 changed files with 2136 additions and 852 deletions

View File

@@ -12,16 +12,16 @@
<view class="pannel">
<view class="bg-white margin padding radius shadow-warp">
<view class="cu-form-group">
<view class="title text-black">手机号</view>
<view class="title mini-label text-black">手机号</view>
<input type="number" v-model="auth.phone" placeholder="请输入手机号" name="input" />
</view>
<view class="cu-form-group padding-top-sm" v-if="showRandom">
<view class="title text-black">验证码</view>
<view class="cu-form-group padding-top-sm" v-if="showRandom">
<view class="title text-black mini-label">验证码</view>
<input type="number" :maxlength="6" v-model="auth.captcha" placeholder="六位数字验证码" name="input" />
<text :class="frozen?'text-gray':'oil-main-color'" @tap="sendMsg">{{tips}}</text>
</view>
<view class="cu-form-group padding-top-sm" v-else>
<view class="title text-black">密码</view>
<view class=" cu-form-group padding-top-sm" v-else>
<view class="title mini-label text-black">密码</view>
<input type="password" v-model="auth.password" placeholder="请输入登入密码" name="input" />
</view>
</view>
@@ -33,7 +33,7 @@
<text class="text-sm text-red padding-right">密码登录</text>
</view>
</view>
<view class="margin-lg padding-lg bottom-bg">
<view class="margin-lg padding-lg bottom-bg">
<button class="bg-main-oil round" v-if="showRandom" @tap="loginRandom">登录</button>
<button class="bg-main-oil round" v-else @tap="loginPwd">登录</button>
</view>
@@ -64,9 +64,73 @@
},
created() {
uni.showShareMenu()
// this.loginWeixin()
},
methods: {
loginWeixin() {
uni.login({
provider: 'weixin',
success: loginRes => {
const code = loginRes.code
console.log('启动页code', code)
loginApi.loginWeixin(code).then(res => {
if (res.code === 20000) {
uni.reLaunch({
url: '/pages/index/index',
fail: (err) => {
console.log(err)
}
})
uni.showToast({
title: res.msg,
icon: 'success',
duration: 3000
})
uni.setStorage({
key: 'Authorization',
data: res.data.accessToken,
success: () => {
console.log('Authorization成功', res.data.accessToken)
}
})
uni.setStorage({
key: 'device',
data: res.data.openid,
success: () => {
console.log('deviceopenid', res.data.openid)
}
})
uni.setStorageSync('userMenu', res.data.loginUser.procedureAuthList)
uni.setStorageSync('loginUser', {
id: res.data.loginUser.id,
name: res.data.loginUser.name,
userPhone: res.data.loginUser.userPhone
})
} else {
uni.reLaunch({
url: '/pages/login/boforeLogin/boforeLogin',
fail: (err) => {
console.log(err)
}
})
console.log('res', res.code)
}
}).catch(err => {
uni.reLaunch({
url: '/pages/login/boforeLogin/boforeLogin',
fail: (err) => {
console.log(err)
}
})
})
},
fail: err => {
console.log(err)
}
});
},
loginPwd() {
uni.login({
provider: 'weixin',
@@ -117,7 +181,8 @@
uni.setStorageSync('userMenu', res.data.loginUser.procedureAuthList)
uni.setStorageSync('loginUser', {
id: res.data.loginUser.id,
name: res.data.loginUser.name
name: res.data.loginUser.name,
userPhone: res.data.loginUser.userPhone
})
}
})
@@ -164,10 +229,16 @@
uni.setStorageSync('userMenu', res.data.loginUser.procedureAuthList)
uni.setStorageSync('loginUser', {
id: res.data.loginUser.id,
name: res.data.loginUser.name
name: res.data.loginUser.name,
userPhone: res.data.loginUser.userPhone
})
} else {
console.log('res', res.code)
uni.showToast({
title: '未绑定微信',
icon: 'none',
duration: 1500
})
}
@@ -272,7 +343,8 @@
uni.setStorageSync('userMenu', res.data.loginUser.procedureAuthList)
uni.setStorageSync('loginUser', {
id: res.data.loginUser.id,
name: res.data.loginUser.name
name: res.data.loginUser.name,
userPhone: res.data.loginUser.userPhone
})
}
})