diff --git a/src/App.vue b/src/App.vue index d0a7234..78fbb31 100644 --- a/src/App.vue +++ b/src/App.vue @@ -17,7 +17,8 @@ } // 微信静默授权 - await initJweixinSDK() + await snsapiBaseAuthorize() + // await initJweixinSDK() }) onShow((options) => { console.log('App Show', options) diff --git a/src/api/tea.ts b/src/api/tea.ts index 1283054..308c43d 100644 --- a/src/api/tea.ts +++ b/src/api/tea.ts @@ -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 + ) +} \ No newline at end of file diff --git a/src/hooks/useWeiXin.ts b/src/hooks/useWeiXin.ts index 0eccb05..0dfe503 100644 --- a/src/hooks/useWeiXin.ts +++ b/src/hooks/useWeiXin.ts @@ -58,8 +58,8 @@ export async function snsapiBaseAuthorize() { if (code == null || code === '' || code == 'undefined' || code == oldCode) { // 如果没有code,就去请求获取code - console.log('当前没有code,进入授权页面') let uri = encodeURIComponent(local) + console.log("🚀 ~ 当前没有code,进入授权页面 snsapiBaseAuthorize ~ uri:", uri) // 设置旧的code为0,避免死循环 uni.setStorageSync('wechatCode',0) window.location.href = diff --git a/src/http/alova.ts b/src/http/alova.ts index ecf9823..268be32 100644 --- a/src/http/alova.ts +++ b/src/http/alova.ts @@ -56,8 +56,6 @@ const alovaInstance = createAlova({ } const { config } = method - console.log("🚀 ~ config.meta?.ignoreAuth:", config) - const ignoreAuth = !config.meta?.ignoreAuth console.log('ignoreAuth===>', ignoreAuth) // 处理认证信息 自行处理认证问题 @@ -71,6 +69,10 @@ const alovaInstance = createAlova({ const userStore = useUserStore() const { token } = userStore.userInfo as unknown as IUserInfo if (!token) { + toast.info('请先登录') + setTimeout(() => { + uni.switchTab({ url: '/pages/my/my' }) + }, 500) throw new Error('[请求错误]:未登录') } method.config.headers.token = token; diff --git a/src/pages/index/detail.vue b/src/pages/index/detail.vue index 8d1be63..fe87f32 100644 --- a/src/pages/index/detail.vue +++ b/src/pages/index/detail.vue @@ -111,7 +111,7 @@ - + @@ -270,7 +270,7 @@