APP登录增加账号密码登录流程
This commit is contained in:
parent
967c8788fd
commit
7c2e14772a
2
App.vue
2
App.vue
@ -6,7 +6,7 @@
|
||||
|
||||
export default {
|
||||
onLaunch: function(options) {
|
||||
this.authLogin(options.scene, options.query.source || '')
|
||||
// this.authLogin(options.scene, options.query.source || '')
|
||||
getShopInfo()
|
||||
// this.isLogin()
|
||||
// this.judgeLogin()
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
const url = 'https://shop.chutang66.com' // 正式
|
||||
// const url = 'https://shop.dev.chutang66.com' // 测试
|
||||
// const url = 'http://warehouse.dev.chutang66.com' // 测试
|
||||
// const url = 'http://192.168.99.31:8095' // 本地1
|
||||
// const url = 'http://192.168.88.6:8092' // 本地2
|
||||
// const url = 'http://192.168.31.70:82' // 本地1
|
||||
// const url = 'http://192.168.30.6:8092' // 本地2
|
||||
const appId = 'wx73163c7bace1750b'
|
||||
const protoId = 'gh_ca74730c9f77'
|
||||
const webUrl = 'http://uniapp.dcloud.io'
|
||||
|
||||
@ -1162,7 +1162,8 @@
|
||||
use_coupons: data.use_coupons,
|
||||
scene: uni.getEnterOptionsSync().scene,
|
||||
score_cash: data.is_use_score,
|
||||
pay_type: data.pay_method == 'wxpay' ? 1 : 2
|
||||
pay_type: data.pay_method == 'wxpay' ? 1 : 2,
|
||||
channel: 'app'
|
||||
}
|
||||
if(data.needReal) {
|
||||
params.identity_card_id = realInfo.value.id
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
"name" : "妙选商城",
|
||||
"appid" : "__UNI__743F2C0",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.6",
|
||||
"versionCode" : 106,
|
||||
"versionName" : "1.0.7",
|
||||
"versionCode" : 107,
|
||||
"transformPx" : false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus" : {
|
||||
|
||||
@ -833,7 +833,8 @@
|
||||
scene: uni.getEnterOptionsSync().scene,
|
||||
gift_goods_ids: data.gift_ids,
|
||||
score_cash: data.is_use_score,
|
||||
pay_type: data.pay_method == 'wxpay' ? 1 : 2
|
||||
pay_type: data.pay_method == 'wxpay' ? 1 : 2,
|
||||
channel: 'app'
|
||||
}
|
||||
if(data.needReal) {
|
||||
params.identity_card_id = realInfo.value.id
|
||||
|
||||
@ -115,7 +115,7 @@
|
||||
<up-icon name="arrow-right" color="#999" size="14"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="row flex1" @click="toPage('/pages/user/setpwd')">
|
||||
<view class="row flex1" @click="toPage('/pages/user/setpwd')" v-if="showSet && isIOS">
|
||||
<view class="left">
|
||||
<up-icon name="lock" color="#444" size="17"></up-icon>
|
||||
<text>设置密码</text>
|
||||
@ -191,7 +191,9 @@ export default {
|
||||
count: {},
|
||||
showFill: false,
|
||||
score_on: 0,
|
||||
statusBarHeight: 0
|
||||
statusBarHeight: 0,
|
||||
showSet: false,
|
||||
isIOS: false
|
||||
})
|
||||
|
||||
const user = reactive({
|
||||
@ -246,6 +248,12 @@ export default {
|
||||
data.user_bg = res.user_background_img
|
||||
}
|
||||
|
||||
function getUserInfo() {
|
||||
get('/api/v1/user/detail').then((res) => {
|
||||
data.showSet = res.data.mobile ? true : false
|
||||
})
|
||||
}
|
||||
|
||||
return {
|
||||
...toRefs(data),
|
||||
...toRefs(user),
|
||||
@ -253,17 +261,22 @@ export default {
|
||||
toOrder,
|
||||
getUserNum,
|
||||
toVip,
|
||||
getStoreInfo
|
||||
getStoreInfo,
|
||||
getUserInfo
|
||||
}
|
||||
},
|
||||
async onLoad(options) {
|
||||
// await this.$onLaunched
|
||||
if (plus.os.name === 'iOS') {
|
||||
this.isIOS = true
|
||||
}
|
||||
uni.getSystemInfo({
|
||||
success: (res) => {
|
||||
this.statusBarHeight = res.statusBarHeight
|
||||
}
|
||||
})
|
||||
this.getStoreInfo()
|
||||
this.getUserInfo()
|
||||
},
|
||||
onShow() {
|
||||
this.cartNum = Number(uni.getStorageSync('cartNum')) || 0
|
||||
|
||||
@ -216,6 +216,8 @@ import { func } from '../../uni_modules/uview-plus/libs/function/test'
|
||||
uni.removeStorageSync('expires_in')
|
||||
uni.removeStorageSync('login_type')
|
||||
uni.removeStorageSync('unionid_open')
|
||||
uni.removeStorageSync('msgNum')
|
||||
uni.removeStorageSync('cartNum')
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
|
||||
@ -94,6 +94,7 @@
|
||||
logo: uni.getStorageSync('logo'),
|
||||
Checked: false,
|
||||
Color: uni.getStorageSync('theme_color'),
|
||||
shopId: uni.getStorageSync('shop_id'),
|
||||
error: '',
|
||||
login_error: '',
|
||||
authResult: '',
|
||||
@ -325,21 +326,17 @@
|
||||
mobile: data.mobile,
|
||||
password: data.password
|
||||
}
|
||||
post('/api/app/login/mobile/code/validate', params).then(async(res) => {
|
||||
if(res.data.from == 'mini-app') { // 已经注册过小程序
|
||||
await unionidLogin('abcdefg', res.data.shop_id, res.data.unionid_open)
|
||||
post('/api/app/login/mobile/loginByPwd', params).then(async(res) => {
|
||||
if(res.data.login_code == 0) { // 已经注册过小程序
|
||||
await unionidLogin('abcdefg', data.shopId, res.data.unionid_open)
|
||||
uni.hideLoading()
|
||||
} else {
|
||||
uni.setStorageSync('avatar', res.data.avatar)
|
||||
uni.setStorageSync('nickname', res.data.nickname)
|
||||
uni.setStorageSync('shop_id', res.data.shop_id)
|
||||
uni.setStorageSync('login_type', res.data.from)
|
||||
uni.setStorageSync('unionid_open', res.data.unionid_open)
|
||||
uni.hideLoading()
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
showToast('账号不存在')
|
||||
}
|
||||
}).catch((err) => {
|
||||
console.log(err)
|
||||
uni.hideLoading()
|
||||
showToast('账号密码错误')
|
||||
})
|
||||
} else {
|
||||
showToast('请勾选《用户协议》和《隐私政策》')
|
||||
@ -392,10 +389,9 @@
|
||||
},
|
||||
async onLoad(options) {
|
||||
// await this.$onLaunched
|
||||
this.showOther = true
|
||||
// if (plus.os.name === 'iOS') {
|
||||
// this.showOther = true
|
||||
// }
|
||||
if (plus.os.name === 'iOS') {
|
||||
this.showOther = true
|
||||
}
|
||||
let login_type = uni.getStorageSync('login_type')
|
||||
if(login_type == 'mobile') { // 已经手机号登陆,未授权微信
|
||||
uni.redirectTo({
|
||||
|
||||
@ -50,6 +50,8 @@
|
||||
return showToast('请输入密码')
|
||||
} else if(!data.password_again) {
|
||||
return showToast('请输入确认密码')
|
||||
} else if(data.password != data.password_again) {
|
||||
return showToast('两次密码输入不一致')
|
||||
}
|
||||
uni.showLoading({
|
||||
title: '加载中...',
|
||||
@ -57,23 +59,13 @@
|
||||
})
|
||||
let params = {
|
||||
password: data.password,
|
||||
password_again: data.password_again
|
||||
confirm_password: data.password_again
|
||||
}
|
||||
post('/api/app/login/mobile/code/validate', params).then(async(res) => {
|
||||
if(res.data.from == 'mini-app') { // 已经注册过小程序
|
||||
await unionidLogin('abcdefg', res.data.shop_id, res.data.unionid_open)
|
||||
uni.hideLoading()
|
||||
} else {
|
||||
uni.setStorageSync('avatar', res.data.avatar)
|
||||
uni.setStorageSync('nickname', res.data.nickname)
|
||||
uni.setStorageSync('shop_id', res.data.shop_id)
|
||||
uni.setStorageSync('login_type', res.data.from)
|
||||
uni.setStorageSync('unionid_open', res.data.unionid_open)
|
||||
uni.hideLoading()
|
||||
uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
}
|
||||
post('/api/app/login/mobile/setPassword', params).then(async(res) => {
|
||||
showToast('设置成功', 'success')
|
||||
setTimeout(() => {
|
||||
uni.navigateBack({delta:1})
|
||||
}, 1000)
|
||||
})
|
||||
}
|
||||
|
||||
@ -120,7 +112,7 @@
|
||||
background-color: v-bind('Color');
|
||||
color: #fff;
|
||||
border-radius: 80rpx;
|
||||
margin: 24rpx auto;
|
||||
margin: 80rpx auto 0;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user