Browse Source

查询参数修改

黄琪勇 2 months ago
parent
commit
3741795928

+ 8 - 3
src/api/pptOperate.ts

@@ -1,10 +1,15 @@
 import { httpAxios } from "@/api/ApiInstance"
+import { type queryParamsType } from "@/queryParams/"
 
 //根据id获取课程信息
-export const getTeacherChapterKnowledgeMaterial = (id: string) => {
+export const getTeacherChapterKnowledgeMaterial = (id: string, fromType: queryParamsType["fromType"]) => {
   return httpAxios.axioseRquest({
-    method: "get",
-    url: `/edu-app/teacherChapterKnowledgeMaterial/detail/${id}`
+    method: "post",
+    url: "/edu-app/teacherChapterKnowledgeMaterial/detail",
+    data: {
+      id,
+      fromType
+    }
   })
 }
 

+ 1 - 1
src/plugins/loadingBar/loadingBar.vue

@@ -81,7 +81,7 @@ body.h-loadingBarBody {
     position: absolute;
     top: 50%;
     left: 50%;
-    transform: translate(-50%, -100%);
+    transform: translate(-50%, -50%);
     z-index: 1;
     display: flex;
     flex-direction: column;

+ 5 - 2
src/queryParams/index.ts

@@ -2,16 +2,19 @@ import { reactive } from "vue"
 import router from "@/router"
 
 /** 维护其他系统过来的特殊字段  这里用来记录,以免其他系统传过来的参数混乱 不好维护 */
-type queryParamsType = {
+export type queryParamsType = {
   hideFullScreen: boolean
+  fromType: "PLATFORM" | "TEACHER" | "CLASS"
 }
 const queryParams = reactive<queryParamsType>({
-  hideFullScreen: false // 隐藏预览时候的全屏按钮
+  hideFullScreen: false, // 隐藏预览时候的全屏按钮
+  fromType: "TEACHER"
 })
 
 export function initQueryParams() {
   const query = router.currentRoute.value.query
   queryParams.hideFullScreen = !!query.hideFullScreen
+  query.fromType && (queryParams.fromType = query.fromType as any)
 }
 
 export default queryParams

+ 0 - 4
src/router/index.ts

@@ -4,7 +4,6 @@ import NProgress from "@/plugins/nprogress"
 import { ElMessage } from "element-plus"
 import { getToken, CODE401 } from "@/libs/auth"
 import userStore from "@/store/user"
-import { initQueryParams } from "@/queryParams"
 
 const userStoreHook = userStore()
 
@@ -72,7 +71,4 @@ router.afterEach(() => {
   NProgress.done()
 })
 
-router.isReady().then(() => {
-  initQueryParams()
-})
 export default router

+ 4 - 1
src/store/pptWork.ts

@@ -9,10 +9,13 @@ import fileUpload from "@/utils/oss-file-upload"
 import { ElMessage } from "element-plus"
 import { toBlob } from "html-to-image"
 import { useSlidesStore } from "@/store"
+import queryParams, { initQueryParams } from "@/queryParams"
 
 type pptWork = { id: string; coverImg: string; jsonUrl: string; isSave: boolean }
+
 const useStore = defineStore("pptWork", {
   state: (): pptWork => {
+    initQueryParams()
     const route = useRoute()
     return {
       id: route.query.id as string,
@@ -26,7 +29,7 @@ const useStore = defineStore("pptWork", {
     async initPPTData() {
       if (this.id) {
         LoadingBar.loading(true, "资源加载中,请稍等...")
-        const res = await httpAjaxErrMsg(getTeacherChapterKnowledgeMaterial, this.id)
+        const res = await httpAjaxErrMsg(getTeacherChapterKnowledgeMaterial, this.id, queryParams.fromType)
         if (res.code === 200) {
           const { dataJson, chapterLessonCoursewareName } = res.data || {}
           const { coverImg, jsonUrl } = JSON.parse(dataJson)

+ 2 - 2
src/views/Screen/BaseView.vue

@@ -23,7 +23,7 @@
       <IconRightTwo class="tool-btn" theme="two-tone" :fill="['#111', '#fff']" @click="execNext()" />
     </div>
 
-    <div
+    <!-- <div
       class="tools-right"
       v-if="screenStore.mode !== 'mobileScreen'"
       :class="{ visible: rightToolsVisible }"
@@ -42,7 +42,7 @@
         </template>
         <IconPower v-if="screenStore.mode === 'pptEditor'" class="tool-btn" v-tooltip="'结束放映'" @click="exitScreening()" />
       </div>
-    </div>
+    </div> -->
   </div>
 </template>
 

+ 1 - 1
vite.config.ts

@@ -28,7 +28,7 @@ export default defineConfig({
     proxy: {
       // 正则表达式写法
       "^/pptApi/.*": {
-        target: "https://test.kt.colexiu.com",
+        target: "https://dev.kt.colexiu.com",
         changeOrigin: true,
         rewrite: path => path.replace(/^\/pptApi/, "")
       }