From 3c5e2578c05efa3bc56bebfcf6a4c5846ca0f3eb Mon Sep 17 00:00:00 2001 From: MJ Date: Tue, 5 Aug 2025 19:20:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 20 +++++++++++++++++--- package.json | 22 +++++++++++++++++++++- pnpm-lock.yaml | 26 +++++++++++++++++++++++--- src/App.vue | 1 + src/api/global.ts | 7 +------ src/api/inspector/mine.ts | 14 +++++++------- src/api/request/interceptor.ts | 3 +++ src/main.ts | 22 +++++++++++----------- src/pages/home/index.vue | 5 ++++- src/pages/login/index.vue | 20 +++++++------------- src/pages/mine/patriarchCard.vue | 2 +- src/router/router.ts | 1 - src/store/user.ts | 13 +++++++++---- src/utils/hud.ts | 4 +++- 14 files changed, 108 insertions(+), 52 deletions(-) diff --git a/index.html b/index.html index 84dca45..e3978b1 100644 --- a/index.html +++ b/index.html @@ -13,10 +13,24 @@ '" />', ) - diff --git a/package.json b/package.json index 814bf1a..60c495b 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "@dcloudio/vite-plugin-uni": "3.0.0-3081220230817001", "@typescript-eslint/eslint-plugin": "^6.8.0", "@typescript-eslint/parser": "^6.8.0", - "@vue/runtime-core": "^3.2.45", + "@vue/runtime-core": "^3.4.21", "@vue/tsconfig": "^0.1.3", "eslint": "^8.51.0", "eslint-config-alloy": "^5.1.2", @@ -106,5 +106,25 @@ "prettier --write", "eslint --fix" ] + }, + "uni-app": { + "scripts": { + "h5-test": { + "title": "h5-test", + "env": { + "UNI_PLATFORM": "h5", + "VITE_HOST": "http://127.0.0.1:9053", + "VITE_WS_URL": "wss://test.pi.xuexiaole.com/ws/device" + } + }, + "h5-prod": { + "title": "h5-prod", + "env": { + "UNI_PLATFORM": "h5", + "VITE_HOST": "https://pi.xuexiaole.com", + "VITE_WS_URL": "wss://pi.xuexiaole.com/ws/device" + } + } + } } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ed436c3..156886d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -127,8 +127,8 @@ importers: specifier: ^6.8.0 version: 6.8.0(eslint@8.51.0)(typescript@4.9.5) '@vue/runtime-core': - specifier: ^3.2.45 - version: 3.3.4 + specifier: ^3.4.21 + version: 3.5.18 '@vue/tsconfig': specifier: ^0.1.3 version: 0.1.3(@types/node@20.5.1) @@ -1829,9 +1829,15 @@ packages: '@vue/reactivity@3.3.4': resolution: {integrity: sha512-kLTDLwd0B1jG08NBF3R5rqULtv/f8x3rOFByTDz4J53ttIQEDmALqKqXY0J+XQeN0aV2FBxY8nJDf88yvOPAqQ==} + '@vue/reactivity@3.5.18': + resolution: {integrity: sha512-x0vPO5Imw+3sChLM5Y+B6G1zPjwdOri9e8V21NnTnlEvkxatHEH5B5KEAJcjuzQ7BsjGrKtfzuQ5eQwXh8HXBg==} + '@vue/runtime-core@3.3.4': resolution: {integrity: sha512-R+bqxMN6pWO7zGI4OMlmvePOdP2c93GsHFM/siJI7O2nxFRzj55pLwkpCedEY+bTMgp5miZ8CxfIZo3S+gFqvA==} + '@vue/runtime-core@3.5.18': + resolution: {integrity: sha512-DUpHa1HpeOQEt6+3nheUfqVXRog2kivkXHUhoqJiKR33SO4x+a5uNOMkV487WPerQkL0vUuRvq/7JhRgLW3S+w==} + '@vue/runtime-dom@3.3.4': resolution: {integrity: sha512-Aj5bTJ3u5sFsUckRghsNjVTtxZQ1OyMWCr5dZRAPijF/0Vy4xEoRCwLyHXcj4D0UFbJ4lbx3gPTgg06K/GnPnQ==} @@ -1854,6 +1860,9 @@ packages: '@vue/shared@3.4.21': resolution: {integrity: sha512-PuJe7vDIi6VYSinuEbUIQgMIRZGgM8e4R+G+/dQTk0X1NEdvgvvgv7m+rfmDH1gZzyA1OjjoWskvHlfRNfQf3g==} + '@vue/shared@3.5.18': + resolution: {integrity: sha512-cZy8Dq+uuIXbxCZpuLd2GJdeSO/lIzIspC2WtkqIpje5QyFbvLaI5wZtdUjLHjGZrlVX6GilejatWwVYYRc8tA==} + '@vue/tsconfig@0.1.3': resolution: {integrity: sha512-kQVsh8yyWPvHpb8gIc9l/HIDiiVUy1amynLNpCy8p+FoCiZXCo6fQos5/097MmnNZc9AtseDsCrfkhqCrJ8Olg==} peerDependencies: @@ -7298,7 +7307,7 @@ snapshots: '@volar/source-map': 1.10.4 '@vue/compiler-dom': 3.3.4 '@vue/reactivity': 3.3.4 - '@vue/shared': 3.3.4 + '@vue/shared': 3.4.21 minimatch: 9.0.3 muggle-string: 0.3.1 vue-template-compiler: 2.7.14 @@ -7325,11 +7334,20 @@ snapshots: dependencies: '@vue/shared': 3.3.4 + '@vue/reactivity@3.5.18': + dependencies: + '@vue/shared': 3.5.18 + '@vue/runtime-core@3.3.4': dependencies: '@vue/reactivity': 3.3.4 '@vue/shared': 3.3.4 + '@vue/runtime-core@3.5.18': + dependencies: + '@vue/reactivity': 3.5.18 + '@vue/shared': 3.5.18 + '@vue/runtime-dom@3.3.4': dependencies: '@vue/runtime-core': 3.3.4 @@ -7354,6 +7372,8 @@ snapshots: '@vue/shared@3.4.21': {} + '@vue/shared@3.5.18': {} + '@vue/tsconfig@0.1.3(@types/node@20.5.1)': optionalDependencies: '@types/node': 20.5.1 diff --git a/src/App.vue b/src/App.vue index c912937..acad5b8 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,6 +6,7 @@ import db from './utils/db' onLaunch(() => { const { code } = parseUrlParams() if (code) { + console.log('code', code) // 公众号回调地址传来的code db.set('code', code) } diff --git a/src/api/global.ts b/src/api/global.ts index 08c348b..a474bfe 100644 --- a/src/api/global.ts +++ b/src/api/global.ts @@ -1,9 +1,5 @@ import { http } from './request/request' -// 获取用户信息 -export const getUserInfo = async () => - await http.get('/sysUser/selectUser') - // 获取客服信息 export const getCsInfo = async (id: string) => await http.get(`/customerService/getInfoByUserId/${id}`) @@ -21,8 +17,7 @@ export const getAgreeInfo = async (id: string, isChat = false) => }) // 获取字典 -export const getDict = async () => - await http.get('/sysDictType/tree') +export const getDict = async () => await http.get('/sysDictType/tree') // 设备通知注册 export const bindRegId = async (data: any) => diff --git a/src/api/inspector/mine.ts b/src/api/inspector/mine.ts index 4278463..60003ba 100644 --- a/src/api/inspector/mine.ts +++ b/src/api/inspector/mine.ts @@ -1,24 +1,24 @@ -import { http } from '../request/request'; +import { http } from '../request/request' /** * 获取督学师信息 * @param data 请求参数 */ export const getUserInfo = async (data = {}): Promise => { - return await http.post('/phone/inspectorTeacher/myInfo', data); -}; + return await http.post('/phone/inspectorTeacher/myInfo', data) +} /** * 查询用户角色 * @param params 请求参数 */ export const queryUserRoles = async (params = {}): Promise => { - return await http.get('/sysUser/getAdminTypeByPhone', params); -}; + return await http.get('/sysUser/getAdminTypeByPhone', params) +} /** * 切换用户角色 */ export const switchRole = async (adminType: number): Promise => { return await http.get('/sysUser/changeAdminType', { adminType, - }); -}; + }) +} diff --git a/src/api/request/interceptor.ts b/src/api/request/interceptor.ts index fee8040..526e6ad 100644 --- a/src/api/request/interceptor.ts +++ b/src/api/request/interceptor.ts @@ -80,8 +80,10 @@ export const errorInterceptor = (error: any): Promise => { } // 显示错误提示 + let showed = false if (message) { toast.error(message) + showed = true if (toLogin) { router.toLogin() } @@ -91,5 +93,6 @@ export const errorInterceptor = (error: any): Promise => { code: -1, message, data: error, + showed, }) } diff --git a/src/main.ts b/src/main.ts index 3b81e8d..5120730 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,18 +1,18 @@ -import { createSSRApp } from 'vue'; -import App from './App.vue'; +import { createSSRApp } from 'vue' +import App from './App.vue' -import * as Pinia from 'pinia'; -import './styles/global.scss'; -import './styles/font.scss'; -import './styles/iconfont.scss'; -import BackBar from '@/components/BackBar/index'; +import * as Pinia from 'pinia' +import './styles/global.scss' +import './styles/font.scss' +import './styles/iconfont.scss' +import BackBar from '@/components/BackBar/index' export function createApp() { - const app = createSSRApp(App); - app.use(Pinia.createPinia()); - app.component('BackBar', BackBar); + const app = createSSRApp(App) + app.use(Pinia.createPinia()) + app.component('BackBar', BackBar) return { app, Pinia, - }; + } } diff --git a/src/pages/home/index.vue b/src/pages/home/index.vue index e9693d2..992da0e 100644 --- a/src/pages/home/index.vue +++ b/src/pages/home/index.vue @@ -84,7 +84,9 @@ import { storeToRefs } from 'pinia' import hud from '@/utils/hud' import router from '@/router/router' -const { userInfo } = storeToRefs(user()) +const userStore = user() +const { getUserInfo } = userStore +const { userInfo } = storeToRefs(userStore) const OSS_URL = import.meta.env.VITE_OSS_HOST const scanQr = `${OSS_URL}/iconfont/scan_qr.png` const arrow = `${OSS_URL}/iconfont/down_arrow.png` @@ -200,6 +202,7 @@ async function getParentBindDevice() { }) } onMounted(async () => { + await getUserInfo() getParentBindDevice() }) diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue index e94efcc..dd8366f 100644 --- a/src/pages/login/index.vue +++ b/src/pages/login/index.vue @@ -52,23 +52,13 @@