更改登录流程

This commit is contained in:
魏啾
2024-05-27 14:24:11 +08:00
parent 8386120c87
commit 72be3befa7
3 changed files with 38 additions and 14 deletions

View File

@@ -52,6 +52,7 @@
uni.scanCode({ uni.scanCode({
success: (res) => { success: (res) => {
let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code') let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code')
uni.cache.set('tableCode', this.tableCode)
if (tableCode) { if (tableCode) {
uni.pro.navigateTo('order_food/order_food', { uni.pro.navigateTo('order_food/order_food', {
tableCode: tableCode, tableCode: tableCode,

View File

@@ -2,9 +2,9 @@
<view class="container"> <view class="container">
<view class="box flex-center"> <view class="box flex-center">
<!-- <text>欢迎登录零点八零</text> --> <!-- <text>欢迎登录零点八零</text> -->
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/Logo" mode=""></image> <image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/Logo" mode=""></image>
</view> </view>
<view class="top_box"> <view class="top_box">
<view class="top_box_one" v-if="showbox"> <view class="top_box_one" v-if="showbox">
<text class="top_box_one_text">手机号码</text> <text class="top_box_one_text">手机号码</text>
@@ -50,14 +50,14 @@
<view class="toLogin" v-if="showbox" @click="toLoginconfirm">登录</view> <view class="toLogin" v-if="showbox" @click="toLoginconfirm">登录</view>
<view class="toLogins" @click="showbox = !showbox">其他手机号登录/注册</view> <view class="toLogins" @click="showbox = !showbox">其他手机号登录/注册</view>
<!-- #endif --> <!-- #endif -->
<view class="agreement flex-start"> <!-- <view class="agreement flex-start">
<u-checkbox-group><u-checkbox shape="circle" @change="radioChange" <u-checkbox-group><u-checkbox shape="circle" @change="radioChange"
size="24"></u-checkbox></u-checkbox-group> size="24"></u-checkbox></u-checkbox-group>
<text>阅读并同意零点八零</text> <text>阅读并同意零点八零</text>
<view class="agreement-Item" @click="Privacy(1)">用户协议</view> <view class="agreement-Item" @click="Privacy(1)">用户协议</view>
<view class="agreement-Item" @click="Privacy(2)">隐私政策</view> <view class="agreement-Item" @click="Privacy(2)">隐私政策</view>
</view> </view> -->
</view> </view>
<!-- #ifdef APP-PLUS || H5 --> <!-- #ifdef APP-PLUS || H5 -->
<view class="box_conf" v-if="debug" @click="showpicker = true">{{ baseUrl || '切换' }}</view> <view class="box_conf" v-if="debug" @click="showpicker = true">{{ baseUrl || '切换' }}</view>
@@ -118,6 +118,7 @@
second: 60, second: 60,
showText: true, showText: true,
Recapture: '发送验证码', Recapture: '发送验证码',
types: '', //判断是否是微信扫码点餐进来
form: { form: {
//密码 //密码
loginName: '', loginName: '',
@@ -131,7 +132,13 @@
this.computed_h(); this.computed_h();
}, },
onLoad() { onLoad(e) {
console.log(e)
try {
this.types = e.type
} catch (e) {
//TODO handle the exception
}
// #ifdef APP-PLUS || H5 // #ifdef APP-PLUS || H5
this.showbox = true this.showbox = true
// #endif // #endif
@@ -280,8 +287,13 @@
uni.cache.set('miniAppOpenId', res.data.userInfo uni.cache.set('miniAppOpenId', res.data.userInfo
.miniAppOpenId) .miniAppOpenId)
uni.cache.set('userInfo', res.data.userInfo); uni.cache.set('userInfo', res.data.userInfo);
// uni.cache.set('shopUser', res.data.shopUser); if (this.types == 0) {
uni.pro.switchTab('index/index') uni.pro.navigateTo('order_food/order_food')
} else {
// uni.cache.set('shopUser', res.data.shopUser);
uni.pro.switchTab('index/index')
}
} }
}, },
@@ -330,8 +342,13 @@
uni.cache.set('miniAppOpenId', res.data.userInfo uni.cache.set('miniAppOpenId', res.data.userInfo
.miniAppOpenId) .miniAppOpenId)
uni.cache.set('userInfo', res.data.userInfo); uni.cache.set('userInfo', res.data.userInfo);
uni.cache.set('shopUser', res.data.shopUser); // uni.cache.set('shopUser', res.data.shopUser);
uni.pro.switchTab('index/index') if (this.types == 0) {
uni.pro.navigateTo('order_food/order_food')
} else {
// uni.cache.set('shopUser', res.data.shopUser);
uni.pro.switchTab('index/index')
}
} }
}, },
fail: (err) => { fail: (err) => {

View File

@@ -276,11 +276,13 @@
if (e.q) { if (e.q) {
this.tableCode = this.getQueryString(decodeURIComponent(e.q), 'code') this.tableCode = this.getQueryString(decodeURIComponent(e.q), 'code')
uni.cache.set('tableCode', this.tableCode) uni.cache.set('tableCode', this.tableCode)
this.scanCodehandle() // this.scanCodehandle()
uni.pro.navigateTo('login/login', {
type: 0
})
} else { } else {
this.tableCode = e.tableCode this.tableCode = uni.cache.get('tableCode')
uni.cache.set('tableCode', this.tableCode) this.productqueryShopIdByTableCode() //获取shop User id
this.productqueryShopIdByTableCode()//获取shop User id
} }
uni.$on('message', this.getMessage) uni.$on('message', this.getMessage)
@@ -293,6 +295,11 @@
this.socketTicket.Close() this.socketTicket.Close()
uni.$off('message') uni.$off('message')
}, },
onShow() {
if (uni.cache.get('token')) {
this.productqueryShopIdByTableCode() //获取shop User id
}
},
methods: { methods: {
// 单独获取他的shopUserid // 单独获取他的shopUserid
async productqueryShopIdByTableCode() { async productqueryShopIdByTableCode() {
@@ -399,7 +406,6 @@
} }
}, },
scanCodehandle(e) { scanCodehandle(e) {
// #ifdef MP-WEIXIN || MP-ALIPAY // #ifdef MP-WEIXIN || MP-ALIPAY
uni.login({ //alipay weixin uni.login({ //alipay weixin
provider: 'weixin', provider: 'weixin',