Browse Source

修改后台请求接口路径及全局样式

JutarryWu 5 months ago
parent
commit
26ee4575ff

+ 1 - 1
.env.development

@@ -3,7 +3,7 @@ VITE_APP_SETTING = true
 # 页面标题
 VITE_APP_TITLE = Fantastic-mobile 基础版
 # 接口请求地址,会设置到 axios 的 baseURL 参数上
-VITE_APP_API_BASEURL = https://byly.jue-ming.com:8112/
+VITE_APP_API_BASE_URL = https://byly.jue-ming.com:8112/
 # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空
 VITE_APP_DEBUG_TOOL =
 

+ 1 - 1
.env.production

@@ -3,7 +3,7 @@ VITE_APP_SETTING = false
 # 页面标题
 VITE_APP_TITLE = Fantastic-mobile 基础版
 # 接口请求地址,会设置到 axios 的 baseURL 参数上
-VITE_APP_API_BASEURL = https://byly.jue-ming.com:8112/
+VITE_APP_API_BASE_URL = https://byly.jue-ming.com:8112/
 # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空
 VITE_APP_DEBUG_TOOL =
 

+ 1 - 1
.env.test

@@ -3,7 +3,7 @@ VITE_APP_SETTING = false
 # 页面标题
 VITE_APP_TITLE = Fantastic-mobile 基础版
 # 接口请求地址,会设置到 axios 的 baseURL 参数上
-VITE_APP_API_BASEURL = /
+VITE_APP_API_BASE_URL = /
 # 调试工具,可设置 eruda 或 vconsole,如果不需要开启则留空
 VITE_APP_DEBUG_TOOL =
 

+ 56 - 36
.idea/workspace.xml

@@ -4,18 +4,30 @@
     <option name="autoReloadType" value="SELECTIVE" />
   </component>
   <component name="ChangeListManager">
-    <list default="true" id="b9dc0b93-aea2-4509-84d8-c1e57bc059b1" name="更改" comment="修改后台请求接口路径">
-      <change afterPath="$PROJECT_DIR$/src/api/game.ts" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/src/api/typing.ts" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/src/store/mutation-type.ts" afterDir="false" />
-      <change afterPath="$PROJECT_DIR$/src/utils/request.ts" afterDir="false" />
+    <list default="true" id="b9dc0b93-aea2-4509-84d8-c1e57bc059b1" name="更改" comment="修改后台请求接口路径及全局样式">
+      <change afterPath="$PROJECT_DIR$/src/assets/styles/globals.scss" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.env.development" beforeDir="false" afterPath="$PROJECT_DIR$/.env.development" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.env.production" beforeDir="false" afterPath="$PROJECT_DIR$/.env.production" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/.env.test" beforeDir="false" afterPath="$PROJECT_DIR$/.env.test" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/pnpm-lock.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/pnpm-lock.yaml" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/api/index.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/api/index.ts" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/assets/styles/globals.css" beforeDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/components/VoiceImp/index.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/VoiceImp/index.vue" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/components/WuIsCorrect/index.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/WuIsCorrect/index.vue" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/main.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/main.ts" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/src/router/guards.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/router/guards.ts" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/types/components.d.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/types/components.d.ts" afterDir="false" />
-      <change beforePath="$PROJECT_DIR$/src/types/typed-router.d.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/types/typed-router.d.ts" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/utils/request.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/utils/request.ts" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/views/cognitiveTasks/BreadthTraining/BTRandomPentagram.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/views/cognitiveTasks/BreadthTraining/BTRandomPentagram.vue" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/views/cognitiveTasks/BreadthTraining/index.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/views/cognitiveTasks/BreadthTraining/index.vue" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/views/cognitiveTasks/ContinueAddition/index.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/views/cognitiveTasks/ContinueAddition/index.vue" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/views/cognitiveTasks/PictureNaming/index.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/views/cognitiveTasks/PictureNaming/index.vue" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/views/cognitiveTasks/PicturePuzzle/components/PPCountDown/index.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/views/cognitiveTasks/PicturePuzzle/components/PPCountDown/index.vue" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/views/cognitiveTasks/PicturePuzzle/components/PicturePuzzleChild/index.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/views/cognitiveTasks/PicturePuzzle/components/PicturePuzzleChild/index.vue" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/views/cognitiveTasks/PicturePuzzle/index.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/views/cognitiveTasks/PicturePuzzle/index.vue" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/views/cognitiveTasks/cocos/index.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/views/cognitiveTasks/cocos/index.vue" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/src/views/cognitiveTasks/main/index.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/views/cognitiveTasks/main/index.vue" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/src/views/cognitiveTasks/spatialOrientationAbility/index.vue" beforeDir="false" afterPath="$PROJECT_DIR$/src/views/cognitiveTasks/spatialOrientationAbility/index.vue" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/vite.config.ts" beforeDir="false" afterPath="$PROJECT_DIR$/vite.config.ts" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -36,7 +48,7 @@
   <component name="Git.Settings">
     <option name="RECENT_BRANCH_BY_REPOSITORY">
       <map>
-        <entry key="$PROJECT_DIR$" value="dev" />
+        <entry key="$PROJECT_DIR$" value="20240919-Jutarry" />
       </map>
     </option>
     <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
@@ -82,31 +94,31 @@
     <option name="hideEmptyMiddlePackages" value="true" />
     <option name="showLibraryContents" value="true" />
   </component>
-  <component name="PropertiesComponent"><![CDATA[{
-  "keyToString": {
-    "RunOnceActivity.ShowReadmeOnStart": "true",
-    "git-widget-placeholder": "20240919-Jutarry",
-    "javascript.nodejs.core.library.configured.version": "20.13.1",
-    "javascript.nodejs.core.library.typings.version": "20.13.0",
-    "last_opened_file_path": "E:/WorkSpace/Web/insomnia-cognition-h5/src/utils",
-    "list.type.of.created.stylesheet": "Less",
-    "node.js.detected.package.eslint": "true",
-    "node.js.detected.package.standard": "true",
-    "node.js.detected.package.tslint": "true",
-    "node.js.selected.package.eslint": "(autodetect)",
-    "node.js.selected.package.standard": "",
-    "node.js.selected.package.tslint": "(autodetect)",
-    "nodejs_package_manager_path": "pnpm",
-    "settings.editor.selected.configurable": "preferences.pluginManager",
-    "ts.external.directory.path": "E:\\WorkSpace\\Web\\insomnia-cognition-h5\\node_modules\\typescript\\lib",
-    "vue.rearranger.settings.migration": "true"
+  <component name="PropertiesComponent">{
+  &quot;keyToString&quot;: {
+    &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
+    &quot;git-widget-placeholder&quot;: &quot;dev&quot;,
+    &quot;javascript.nodejs.core.library.configured.version&quot;: &quot;20.13.1&quot;,
+    &quot;javascript.nodejs.core.library.typings.version&quot;: &quot;20.13.0&quot;,
+    &quot;last_opened_file_path&quot;: &quot;E:/WorkSpace/Web/insomnia-cognition-h5/src/utils&quot;,
+    &quot;list.type.of.created.stylesheet&quot;: &quot;Less&quot;,
+    &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
+    &quot;node.js.detected.package.standard&quot;: &quot;true&quot;,
+    &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
+    &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
+    &quot;node.js.selected.package.standard&quot;: &quot;&quot;,
+    &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
+    &quot;nodejs_package_manager_path&quot;: &quot;pnpm&quot;,
+    &quot;settings.editor.selected.configurable&quot;: &quot;preferences.pluginManager&quot;,
+    &quot;ts.external.directory.path&quot;: &quot;E:\\WorkSpace\\Web\\insomnia-cognition-h5\\node_modules\\typescript\\lib&quot;,
+    &quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
   },
-  "keyToStringList": {
-    "vue.recent.templates": [
-      "Vue Composition API Component"
+  &quot;keyToStringList&quot;: {
+    &quot;vue.recent.templates&quot;: [
+      &quot;Vue Composition API Component&quot;
     ]
   }
-}]]></component>
+}</component>
   <component name="RecentsManager">
     <key name="CopyFile.RECENT_KEYS">
       <recent name="E:\WorkSpace\Web\insomnia-cognition-h5\src\utils" />
@@ -390,7 +402,15 @@
       <option name="project" value="LOCAL" />
       <updated>1726732700840</updated>
     </task>
-    <option name="localTasksCounter" value="30" />
+    <task id="LOCAL-00030" summary="修改基础配置1">
+      <option name="closed" value="true" />
+      <created>1726737001708</created>
+      <option name="number" value="00030" />
+      <option name="presentableId" value="LOCAL-00030" />
+      <option name="project" value="LOCAL" />
+      <updated>1726737001708</updated>
+    </task>
+    <option name="localTasksCounter" value="31" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">
@@ -455,8 +475,6 @@
     </option>
   </component>
   <component name="VcsManagerConfiguration">
-    <MESSAGE value="倒计时组件" />
-    <MESSAGE value="feat:倒计时组件&#10;创建倒计时组件" />
     <MESSAGE value="feat(组件类): 新增倒计时组件" />
     <MESSAGE value="feat(图片): 新增空间定位训练图片" />
     <MESSAGE value="feat(路由及样式): 新增空间定位训练框架" />
@@ -479,7 +497,9 @@
     <MESSAGE value="feat(认知任务): 部署服务后优化" />
     <MESSAGE value="feat(认知任务): 优化" />
     <MESSAGE value="init" />
+    <MESSAGE value="修改基础配置1" />
     <MESSAGE value="修改后台请求接口路径" />
-    <option name="LAST_COMMIT_MESSAGE" value="修改后台请求接口路径" />
+    <MESSAGE value="修改后台请求接口路径及全局样式" />
+    <option name="LAST_COMMIT_MESSAGE" value="修改后台请求接口路径及全局样式" />
   </component>
 </project>

+ 1 - 1
src/api/index.ts

@@ -5,7 +5,7 @@ import Message from 'vue-m-message'
 import useUserStore from '@/store/modules/user'
 
 const api = axios.create({
-  baseURL: (import.meta.env.DEV && import.meta.env.VITE_OPEN_PROXY === 'true') ? '/proxy/' : import.meta.env.VITE_APP_API_BASEURL,
+  baseURL: (import.meta.env.DEV && import.meta.env.VITE_OPEN_PROXY === 'true') ? '/proxy/' : import.meta.env.VITE_APP_API_BASE_URL,
   timeout: 1000 * 60,
   responseType: 'json',
 })

+ 0 - 35
src/assets/styles/globals.css

@@ -1,35 +0,0 @@
-:root {
-  --g-navbar-height: 50px;
-  --g-tabbar-height: 60px;
-
-  color-scheme: light;
-
-  &.dark {
-    color-scheme: dark;
-  }
-}
-
-html {
-  overscroll-behavior: none;
-}
-
-body {
-  box-sizing: border-box;
-  margin: 0;
-}
-
-* {
-  box-sizing: inherit;
-}
-
-/* 全局样式 */
-#app {
-  overflow: hidden auto;
-  font-size: 14px;
-  background-color: var(--g-bg);
-}
-
-.medium-zoom-overlay,
-.medium-zoom-image--opened {
-  z-index: 1100;
-}

+ 105 - 0
src/assets/styles/globals.scss

@@ -0,0 +1,105 @@
+:root {
+  --g-navbar-height: 50px;
+  --g-tabbar-height: 60px;
+
+  color-scheme: light;
+
+  &.dark {
+    color-scheme: dark;
+  }
+}
+
+html {
+  overscroll-behavior: none;
+}
+
+body {
+  box-sizing: border-box;
+  margin: 0;
+}
+
+* {
+  box-sizing: inherit;
+}
+
+/* 全局样式 */
+#app {
+  overflow: hidden auto;
+  font-size: 14px;
+  background-color: var(--g-bg);
+}
+
+.medium-zoom-overlay,
+.medium-zoom-image--opened {
+  z-index: 1100;
+}
+
+.app-container {
+  width: 100vw;
+  height: 100vh;
+  margin: 0;
+  padding: 0;
+  overflow: hidden;
+  background: #f5f5f5;
+  position: relative;
+
+  .flex-row {
+    display: flex;
+    flex-direction: row;
+  }
+
+  .flex-column {
+    display: flex;
+    flex-direction: column;
+  }
+
+  .flex-center {
+    display: flex;
+    justify-content: center;
+    align-items: center;
+  }
+
+  .bottom-block-btn {
+    position: absolute;
+    bottom: 25px;
+    left: 50%;
+    transform: translateX(-50%);
+    padding: 0;
+    height: 42px;
+    width: 340px;
+    border-radius: 20px;
+    font-size: 16px;
+  }
+
+  .van-nav-bar {
+    &.self-nav-bar {
+      background: rgba(255, 255, 255, 0);
+      &:after {
+        border: none;
+      }
+      .van-nav-bar__title {
+        font-size: 19px;
+        color: #191919;
+        mix-blend-mode: difference;
+      }
+
+      .van-icon {
+        color: #191919;
+      }
+    }
+  }
+
+  .absolute-center {
+    position: absolute;
+    top: 50%;
+    left: 50%;
+    transform: translate(-50%, -50%);
+  }
+}
+
+.van-toast {
+  &.rotate-toast {
+    transform: rotate(90deg) translateX(50%);
+    transform-origin: right top;
+  }
+}

+ 1 - 1
src/components/VoiceImp/index.vue

@@ -52,7 +52,7 @@ defineExpose({
   </section>
 </template>
 
-<style scoped lang="less">
+<style scoped lang="scss">
 .voice-container {
   width: 0;
   height: 0;

+ 1 - 1
src/components/WuIsCorrect/index.vue

@@ -20,4 +20,4 @@ const props = defineProps({
   </div>
 </template>
 
-<style scoped lang="less"></style>
+<style scoped lang="scss"></style>

+ 1 - 1
src/main.ts

@@ -19,7 +19,7 @@ import 'virtual:svg-icons-register'
 import 'virtual:uno.css'
 
 // 全局样式
-import '@/assets/styles/globals.css'
+import '@/assets/styles/globals.scss'
 
 const app = createApp(App)
 

+ 24 - 23
src/router/guards.ts

@@ -2,34 +2,35 @@ import type { Router } from 'vue-router/auto'
 import { useNProgress } from '@vueuse/integrations/useNProgress'
 import '@/assets/styles/nprogress.css'
 import useSettingsStore from '@/store/modules/settings'
-import useUserStore from '@/store/modules/user'
+// import useUserStore from '@/store/modules/user'
 import useKeepAliveStore from '@/store/modules/keepAlive'
 
 // 鉴权
 function setupAuth(router: Router) {
   router.beforeEach(async (to, from, next) => {
-    const settingsStore = useSettingsStore()
-    const userStore = useUserStore()
-    if (to.meta.auth) {
-      if (userStore.isLogin) {
-        // 获取用户权限
-        if (settingsStore.settings.app.enablePermission) {
-          !userStore.isGetPermissions && await userStore.getPermissions()
-        }
-        next()
-      }
-      else {
-        next({
-          name: 'login',
-          query: {
-            redirect: to.fullPath,
-          },
-        })
-      }
-    }
-    else {
-      next()
-    }
+    next()
+    // const settingsStore = useSettingsStore()
+    // const userStore = useUserStore()
+    // if (to.meta.auth) {
+    //   if (userStore.isLogin) {
+    //     // 获取用户权限
+    //     if (settingsStore.settings.app.enablePermission) {
+    //       !userStore.isGetPermissions && await userStore.getPermissions()
+    //     }
+    //     next()
+    //   }
+    //   else {
+    //     next({
+    //       name: 'login',
+    //       query: {
+    //         redirect: to.fullPath,
+    //       },
+    //     })
+    //   }
+    // }
+    // else {
+    //   next()
+    // }
   })
 }
 

+ 1 - 1
src/utils/request.ts

@@ -48,7 +48,7 @@ function errorHandler(error: RequestError): Promise<any> {
 
 // 请求拦截器
 function requestHandler(config: InternalAxiosRequestConfig): InternalAxiosRequestConfig | Promise<InternalAxiosRequestConfig> {
-  const savedToken = localStorage.get(STORAGE_TOKEN_KEY)
+  const savedToken = localStorage.getItem(STORAGE_TOKEN_KEY)
   // 如果 token 存在
   // 让每个请求携带自定义 token, 请根据实际情况修改
   if (savedToken) {

+ 1 - 1
src/views/cognitiveTasks/BreadthTraining/BTRandomPentagram.vue

@@ -110,7 +110,7 @@ defineExpose({
   </section>
 </template>
 
-<style scoped lang="less">
+<style scoped lang="scss">
 .b-t-random-pentagram-container {
   border: 1px solid #ffc400;
 

+ 1 - 1
src/views/cognitiveTasks/BreadthTraining/index.vue

@@ -301,7 +301,7 @@ onMounted(() => {
   </section>
 </template>
 
-<style scoped lang="less">
+<style scoped lang="scss">
 .app-container {
   background-image: url('/static/image/game/bg-breadthTraining.png');
   background-size: cover;

+ 1 - 1
src/views/cognitiveTasks/ContinueAddition/index.vue

@@ -226,7 +226,7 @@ onMounted(() => {
   </section>
 </template>
 
-<style scoped lang="less">
+<style scoped lang="scss">
 .app-container {
   background-image: url('/static/image/game/bg-continue-addition.png');
   background-size: 100% 100%;

+ 1 - 1
src/views/cognitiveTasks/PictureNaming/index.vue

@@ -250,7 +250,7 @@ onBeforeUnmount(() => {
   </section>
 </template>
 
-<style scoped lang="less">
+<style scoped lang="scss">
 .app-container {
   background-image: url('/static/image/game/bg-pic-naming.png');
   background-size: 100% 100%;

+ 1 - 1
src/views/cognitiveTasks/PicturePuzzle/components/PPCountDown/index.vue

@@ -88,7 +88,7 @@ defineExpose({
   </section>
 </template>
 
-<style scoped lang="less">
+<style scoped lang="scss">
 .p-p-count-down-container {
 }
 </style>

+ 1 - 1
src/views/cognitiveTasks/PicturePuzzle/components/PicturePuzzleChild/index.vue

@@ -288,7 +288,7 @@ defineExpose({
   </section>
 </template>
 
-<style scoped lang="less">
+<style scoped lang="scss">
 .picture-puzzle-child-container {
   :deep(.van-image) {
     &.activeImg {

+ 1 - 1
src/views/cognitiveTasks/PicturePuzzle/index.vue

@@ -150,7 +150,7 @@ onMounted(() => {
   </section>
 </template>
 
-<style scoped lang="less">
+<style scoped lang="scss">
 .app-container {
   transform: rotate(90deg);
   transform-origin: right top;

+ 1 - 1
src/views/cognitiveTasks/cocos/index.vue

@@ -30,7 +30,7 @@ onMounted(() => {
   </section>
 </template>
 
-<style scoped lang="less">
+<style scoped lang="scss">
 .app-container {
 }
 </style>

+ 2 - 2
src/views/cognitiveTasks/main/index.vue

@@ -5,7 +5,7 @@
  * 创建日期: 2024/8/16
  * 编写者: JutarryWu
  */
-import GameAPI, { type GameVO } from '@/api/modules/game'
+import GameAPI, { type GameVO } from '@/api/game'
 
 const router = useRouter()
 const route = useRoute()
@@ -69,7 +69,7 @@ onMounted(() => {
   </section>
 </template>
 
-<style scoped lang="less">
+<style scoped lang="scss">
 .app-container {
   background-color: #f0f6f6 !important;
   background-image: url('@/assets/images/bg-main.png');

+ 1 - 1
src/views/cognitiveTasks/spatialOrientationAbility/index.vue

@@ -379,7 +379,7 @@ onMounted(() => {
   </section>
 </template>
 
-<style scoped lang="less">
+<style scoped lang="scss">
 .app-container {
   background-image: url('@/assets/images/bg-soa.png');
   background-size: cover;

+ 1 - 1
vite.config.ts

@@ -22,7 +22,7 @@ export default ({ mode, command }) => {
       port: 9000,
       proxy: {
         '/proxy': {
-          target: env.VITE_APP_API_BASEURL,
+          target: env.VITE_APP_API_BASE_URL,
           changeOrigin: command === 'serve' && env.VITE_OPEN_PROXY === 'true',
           rewrite: path => path.replace(/\/proxy/, ''),
         },