重新修改登录逻辑
This commit is contained in:
@ -17,7 +17,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 微信静默授权
|
// 微信静默授权
|
||||||
await initJweixinSDK()
|
await snsapiBaseAuthorize()
|
||||||
|
// await initJweixinSDK()
|
||||||
})
|
})
|
||||||
onShow((options) => {
|
onShow((options) => {
|
||||||
console.log('App Show', options)
|
console.log('App Show', options)
|
||||||
|
|||||||
@ -18,3 +18,18 @@ export function getTeaSpecialistDetails(data: ITeaSpecialistDetailsParams) {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收藏和取消收藏茶艺师
|
||||||
|
*/
|
||||||
|
export interface ICollectTeaSpecialistParams {
|
||||||
|
id: number
|
||||||
|
user_id: number
|
||||||
|
status: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export function collectTeaSpecialist(data: ICollectTeaSpecialistParams) {
|
||||||
|
return http.Post('/api/Teamaster/teamasterCollect',
|
||||||
|
data
|
||||||
|
)
|
||||||
|
}
|
||||||
@ -58,8 +58,8 @@ export async function snsapiBaseAuthorize() {
|
|||||||
|
|
||||||
if (code == null || code === '' || code == 'undefined' || code == oldCode) {
|
if (code == null || code === '' || code == 'undefined' || code == oldCode) {
|
||||||
// 如果没有code,就去请求获取code
|
// 如果没有code,就去请求获取code
|
||||||
console.log('当前没有code,进入授权页面')
|
|
||||||
let uri = encodeURIComponent(local)
|
let uri = encodeURIComponent(local)
|
||||||
|
console.log("🚀 ~ 当前没有code,进入授权页面 snsapiBaseAuthorize ~ uri:", uri)
|
||||||
// 设置旧的code为0,避免死循环
|
// 设置旧的code为0,避免死循环
|
||||||
uni.setStorageSync('wechatCode',0)
|
uni.setStorageSync('wechatCode',0)
|
||||||
window.location.href =
|
window.location.href =
|
||||||
|
|||||||
@ -56,8 +56,6 @@ const alovaInstance = createAlova({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { config } = method
|
const { config } = method
|
||||||
console.log("🚀 ~ config.meta?.ignoreAuth:", config)
|
|
||||||
|
|
||||||
const ignoreAuth = !config.meta?.ignoreAuth
|
const ignoreAuth = !config.meta?.ignoreAuth
|
||||||
console.log('ignoreAuth===>', ignoreAuth)
|
console.log('ignoreAuth===>', ignoreAuth)
|
||||||
// 处理认证信息 自行处理认证问题
|
// 处理认证信息 自行处理认证问题
|
||||||
@ -71,6 +69,10 @@ const alovaInstance = createAlova({
|
|||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
const { token } = userStore.userInfo as unknown as IUserInfo
|
const { token } = userStore.userInfo as unknown as IUserInfo
|
||||||
if (!token) {
|
if (!token) {
|
||||||
|
toast.info('请先登录')
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.switchTab({ url: '/pages/my/my' })
|
||||||
|
}, 500)
|
||||||
throw new Error('[请求错误]:未登录')
|
throw new Error('[请求错误]:未登录')
|
||||||
}
|
}
|
||||||
method.config.headers.token = token;
|
method.config.headers.token = token;
|
||||||
|
|||||||
@ -111,7 +111,7 @@
|
|||||||
<wd-img :src="`${OSS}icon/icon_gold_medal.png`" width="36rpx" height="36rpx"></wd-img>
|
<wd-img :src="`${OSS}icon/icon_gold_medal.png`" width="36rpx" height="36rpx"></wd-img>
|
||||||
</view>
|
</view>
|
||||||
<view>
|
<view>
|
||||||
<tea-specialist-level :level="TeaSpecialistLevelValue[info.teamasterLevel[0].level_name]"></tea-specialist-level>
|
<tea-specialist-level :level="TeaSpecialistLevelValue[info.teamasterLevel?.[0]?.level_name] || 'junior'"></tea-specialist-level>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -270,7 +270,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import TeaSpecialistLevel from '@/components/TeaSpecialistLevel.vue'
|
import TeaSpecialistLevel from '@/components/TeaSpecialistLevel.vue'
|
||||||
import { useMessage } from 'wot-design-uni'
|
import { useMessage } from 'wot-design-uni'
|
||||||
import { getTeaSpecialistDetails } from '@/api/tea'
|
import { getTeaSpecialistDetails, collectTeaSpecialist } from '@/api/tea'
|
||||||
import { ITeaSpecialistDetailsFields } from '@/api/types/tea'
|
import { ITeaSpecialistDetailsFields } from '@/api/types/tea'
|
||||||
import {toast} from '@/utils/toast'
|
import {toast} from '@/utils/toast'
|
||||||
import {TeaSpecialistLevelValue} from '@/utils/teaSpecialist'
|
import {TeaSpecialistLevelValue} from '@/utils/teaSpecialist'
|
||||||
@ -349,8 +349,13 @@
|
|||||||
|
|
||||||
const Detail = {
|
const Detail = {
|
||||||
// 处理收藏
|
// 处理收藏
|
||||||
handleCollect: () => {
|
handleCollect: async () => {
|
||||||
console.log('收藏')
|
const res = await collectTeaSpecialist({
|
||||||
|
user_id: 1,
|
||||||
|
id: 1,
|
||||||
|
status: 1
|
||||||
|
})
|
||||||
|
console.log('收藏=', res)
|
||||||
},
|
},
|
||||||
|
|
||||||
// 处理分享
|
// 处理分享
|
||||||
|
|||||||
@ -14,12 +14,12 @@
|
|||||||
<view class="font-400 text-28rpx leading-44rpx text-[#6B7280] mt-12rpx"> {{ page.desc }}</view>
|
<view class="font-400 text-28rpx leading-44rpx text-[#6B7280] mt-12rpx"> {{ page.desc }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="mt-106rpx mx-48rpx">
|
<view class="mt-106rpx mx-48rpx">
|
||||||
<wd-form ref="form" :model="form">
|
<wd-form ref="form" :model="formModel">
|
||||||
<view>
|
<view>
|
||||||
<view class="font-400 text-30rpx text-[#606266] leading-44rpx">手机号</view>
|
<view class="font-400 text-30rpx text-[#606266] leading-44rpx">手机号</view>
|
||||||
<view class="mt-20rpx">
|
<view class="mt-20rpx">
|
||||||
<wd-input
|
<wd-input
|
||||||
v-model="form.mobile"
|
v-model="formData.mobile"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="请输入手机号码"
|
placeholder="请输入手机号码"
|
||||||
inputmode="numeric"
|
inputmode="numeric"
|
||||||
@ -34,7 +34,7 @@
|
|||||||
<view class="mt-40rpx">
|
<view class="mt-40rpx">
|
||||||
<view class="font-400 text-30rpx text-[#606266] leading-44rpx">验证码</view>
|
<view class="font-400 text-30rpx text-[#606266] leading-44rpx">验证码</view>
|
||||||
<view class="mt-20rpx">
|
<view class="mt-20rpx">
|
||||||
<wd-input type="text" placeholder="请输入验证码" v-model="form.code" inputmode="numeric" no-border custom-class="!bg-[#F6F7F8] !border !border-solid !border-[#EAECF0] !rounded-16rpx" custom-input-class="!px-32rpx !h-104rpx">
|
<wd-input type="text" placeholder="请输入验证码" v-model="formData.code" inputmode="numeric" no-border custom-class="!bg-[#F6F7F8] !border !border-solid !border-[#EAECF0] !rounded-16rpx" custom-input-class="!px-32rpx !h-104rpx">
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<view class="flex items-center mr-34rpx">
|
<view class="flex items-center mr-34rpx">
|
||||||
<view class="flex items-center">
|
<view class="flex items-center">
|
||||||
@ -104,19 +104,17 @@
|
|||||||
const startCountDown = ref<boolean>(false) // 是否开始倒计时
|
const startCountDown = ref<boolean>(false) // 是否开始倒计时
|
||||||
const countDown = ref<any>(null) // 倒计时组件
|
const countDown = ref<any>(null) // 倒计时组件
|
||||||
|
|
||||||
/** 表单相关 **/
|
// 表单相关
|
||||||
const form = reactive<{
|
const formData = reactive<{
|
||||||
mobile: string
|
mobile: string
|
||||||
code: string
|
code: string
|
||||||
}>({
|
}>({
|
||||||
mobile: '15005837859',
|
mobile: '15005837859',
|
||||||
code: ''
|
code: ''
|
||||||
})
|
})
|
||||||
/** 结束 **/
|
|
||||||
|
|
||||||
/** 服务协议和隐私政策 **/
|
// 服务协议和隐私政策
|
||||||
const agree = ref<boolean>(false)
|
const agree = ref<boolean>(false)
|
||||||
/** 结束 **/
|
|
||||||
|
|
||||||
onLoad((args) => {
|
onLoad((args) => {
|
||||||
// 从个人登录页面进入
|
// 从个人登录页面进入
|
||||||
@ -132,8 +130,8 @@
|
|||||||
const mobile = {
|
const mobile = {
|
||||||
// 验证手机号
|
// 验证手机号
|
||||||
handleInputMobile: (e: {value: string}) => {
|
handleInputMobile: (e: {value: string}) => {
|
||||||
form.mobile = e.value
|
formData.mobile = e.value
|
||||||
disabled.value = !testMobile(form.mobile)
|
disabled.value = !testMobile(formData.mobile)
|
||||||
},
|
},
|
||||||
|
|
||||||
// 发送验证码
|
// 发送验证码
|
||||||
@ -153,7 +151,7 @@
|
|||||||
|
|
||||||
// 发送验证码请求
|
// 发送验证码请求
|
||||||
console.log("🚀 ~ 发送验证码请求:")
|
console.log("🚀 ~ 发送验证码请求:")
|
||||||
smsCode({ mobile: Number(form.mobile), scene: 'YZMDL' }).then(() => {
|
smsCode({ mobile: Number(formData.mobile), scene: 'YZMDL' }).then(() => {
|
||||||
toast.show({
|
toast.show({
|
||||||
iconClass: 'success-circle',
|
iconClass: 'success-circle',
|
||||||
msg: '验证码发送成功',
|
msg: '验证码发送成功',
|
||||||
@ -185,7 +183,7 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!testMobile(form.mobile)) {
|
if (!testMobile(formData.mobile)) {
|
||||||
toast.show({
|
toast.show({
|
||||||
iconClass: 'info-circle',
|
iconClass: 'info-circle',
|
||||||
msg: '手机号码错误请重新输入',
|
msg: '手机号码错误请重新输入',
|
||||||
@ -194,7 +192,7 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!form.code) {
|
if (!formData.code) {
|
||||||
toast.show({
|
toast.show({
|
||||||
iconClass: 'info-circle',
|
iconClass: 'info-circle',
|
||||||
msg: '验证码错误',
|
msg: '验证码错误',
|
||||||
|
|||||||
@ -254,23 +254,16 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
// 跳转到个人信息
|
// 跳转到个人信息
|
||||||
handleToProfile: async () => {
|
handleToProfile: () => {
|
||||||
if (isLogin.value) {
|
if (isLogin.value) {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/bundle/profile/profile'
|
url: '/bundle/profile/profile'
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// 登录操作
|
// 登录操作
|
||||||
await snsapiBaseAuthorize()
|
uni.navigateTo({
|
||||||
const userStore = useUserStore()
|
url: '/bundle/vip/benefits'
|
||||||
if (!userStore.userInfo.mobile) {
|
})
|
||||||
uni.navigateTo({
|
|
||||||
url: '/pages/login/mobile'
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
userInfo.value = userStore.userInfo
|
|
||||||
isLogin.value = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -30,15 +30,15 @@ const MescrollCompMixin = {
|
|||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
handlePageScroll(e){
|
handlePageScroll(e){
|
||||||
let item = this.$refs["mescrollItem"];
|
let item = this && this.$refs && this.$refs["mescrollItem"];
|
||||||
if(item && item.mescroll) item.mescroll.onPageScroll(e);
|
if(item && item.mescroll) item.mescroll.onPageScroll(e);
|
||||||
},
|
},
|
||||||
handleReachBottom(){
|
handleReachBottom(){
|
||||||
let item = this.$refs["mescrollItem"];
|
let item = this && this.$refs && this.$refs["mescrollItem"];
|
||||||
if(item && item.mescroll) item.mescroll.onReachBottom();
|
if(item && item.mescroll) item.mescroll.onReachBottom();
|
||||||
},
|
},
|
||||||
handlePullDownRefresh(){
|
handlePullDownRefresh(){
|
||||||
let item = this.$refs["mescrollItem"];
|
let item = this && this.$refs && this.$refs["mescrollItem"];
|
||||||
if(item && item.mescroll) item.mescroll.onPullDownRefresh();
|
if(item && item.mescroll) item.mescroll.onPullDownRefresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,13 +46,13 @@ const MescrollMoreMixin = {
|
|||||||
getMescroll(i){
|
getMescroll(i){
|
||||||
if(!this.mescrollItems) this.mescrollItems = [];
|
if(!this.mescrollItems) this.mescrollItems = [];
|
||||||
if(!this.mescrollItems[i]) {
|
if(!this.mescrollItems[i]) {
|
||||||
// v-for中的refs
|
// v-for中的refs(增加防护,避免 this 未定义时报错)
|
||||||
let vForItem = this.$refs["mescrollItem"];
|
let vForItem = this && this.$refs && this.$refs["mescrollItem"];
|
||||||
if(vForItem){
|
if (vForItem) {
|
||||||
this.mescrollItems[i] = vForItem[i]
|
this.mescrollItems[i] = vForItem[i]
|
||||||
}else{
|
} else {
|
||||||
// 普通的refs,不可重复
|
// 普通的refs,不可重复
|
||||||
this.mescrollItems[i] = this.$refs["mescrollItem"+i];
|
this.mescrollItems[i] = this && this.$refs && this.$refs["mescrollItem"+i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let item = this.mescrollItems[i]
|
let item = this.mescrollItems[i]
|
||||||
|
|||||||
@ -26,11 +26,8 @@ export async function initJweixinSDK(): Promise<any> {
|
|||||||
|
|
||||||
let isiOS = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
|
let isiOS = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
|
||||||
let signLink = isiOS ? window.entryUrl : location.href.split('#')[0];
|
let signLink = isiOS ? window.entryUrl : location.href.split('#')[0];
|
||||||
console.log('-----------当前签名url--------------')
|
|
||||||
console.log(signLink)
|
|
||||||
let url = encodeURIComponent(signLink);
|
let url = encodeURIComponent(signLink);
|
||||||
const res = await wxSignature({ url })
|
const res = await wxSignature({ url })
|
||||||
console.log("🚀 ~ initJweixin ~ res:", res)
|
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
wx.config({
|
wx.config({
|
||||||
debug: false,
|
debug: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user