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