Bläddra i källkod

修改引导页

1
mo 1 år sedan
förälder
incheckning
73a9f5811a

+ 20 - 0
src/custom-plugins/guide-page/api.ts

@@ -0,0 +1,20 @@
+import request from '@/utils/request';
+
+/**
+ * 设置引导页
+ */
+export const setGuidance = (params: any) => {
+  return request.post('/edu-app/functionGuidance/save', {
+    data: params
+  });
+};
+
+/**
+ * 获取引导页
+ */
+export const getGuidance = (params: any) => {
+  return request.get('/edu-app/functionGuidance/queryTagDetail', {
+    data: params,
+    params
+  });
+};

+ 29 - 12
src/custom-plugins/guide-page/attent-guide.tsx

@@ -12,6 +12,7 @@ import styles from './index.module.less';
 import { getImage } from './images';
 import { px2vw, px2vwH } from '@/utils/index';
 import { useRoute } from 'vue-router';
+import {getGuidance,setGuidance} from './api'
 export default defineComponent({
   name: 'attent-guide',
   emits: ['close'],
@@ -133,12 +134,24 @@ export default defineComponent({
       step: 0
     });
     const tipShow = ref(false);
-    const guideInfo = localStorage.getItem('teacher-guideInfo');
-    if (guideInfo && JSON.parse(guideInfo).attentGuide) {
-      tipShow.value = false;
-    } else {
-      tipShow.value = true;
+    const guideInfo = ref({} as any)
+    const getAllGuidance = async()=>{
+      try{
+        const res = await getGuidance({guideTag:'teacher-guideInfo'})
+        guideInfo.value = JSON.parse(res.data?.guideValue)
+        if (guideInfo.value &&guideInfo.value.attentGuide) {
+          tipShow.value = false;
+        } else {
+          tipShow.value = true;
+        }
+      }catch(e){
+        console.log(e)
+      }
+      // const guideInfo = localStorage.getItem('teacher-guideInfo');
+
     }
+
+    getAllGuidance()
     const getStepELe = () => {
       const ele: HTMLElement = document.getElementById(`attent-${data.step}`)!;
 
@@ -180,16 +193,20 @@ export default defineComponent({
       getStepELe();
     };
 
-    const endGuide = () => {
-      let guideInfo =
-        JSON.parse(localStorage.getItem('teacher-guideInfo') || '{}') || null;
-      if (!guideInfo) {
-        guideInfo = { attentGuide: true };
+    const endGuide = async() => {
+
+      if (!guideInfo.value) {
+        guideInfo.value = { attentGuide: true };
       } else {
-        guideInfo.attentGuide = true;
+        guideInfo.value.attentGuide = true;
       }
-      localStorage.setItem('teacher-guideInfo', JSON.stringify(guideInfo));
+      // localStorage.setItem('teacher-guideInfo', JSON.stringify(guideInfo));
       tipShow.value = false;
+      try{
+        const res = await setGuidance({guideTag:'teacher-guideInfo',guideValue:JSON.stringify(guideInfo.value)})
+      }catch(e){
+        console.log(e)
+      }
       //  localStorage.setItem('endC')
     };
     return () => (

+ 34 - 12
src/custom-plugins/guide-page/class-guide.tsx

@@ -11,6 +11,7 @@ import {
 import styles from './index.module.less';
 import { getImage } from './images';
 import { px2vw, px2vwH } from '@/utils/index';
+import {getGuidance,setGuidance} from './api'
 export default defineComponent({
   name: 'coai-guide',
   emits: ['close'],
@@ -95,12 +96,30 @@ export default defineComponent({
       step: 0
     });
     const tipShow = ref(false);
-    const guideInfo = localStorage.getItem('teacher-guideInfo');
-    if (guideInfo && JSON.parse(guideInfo).classGuide) {
-      tipShow.value = false;
-    } else {
-      tipShow.value = true;
+
+    const guideInfo = ref({} as any)
+    const getAllGuidance = async()=>{
+      try{
+        const res = await getGuidance({guideTag:'teacher-guideInfo'})
+        guideInfo.value = JSON.parse(res.data?.guideValue)
+        if (guideInfo.value && guideInfo.value.classGuide) {
+          tipShow.value = false;
+        } else {
+          tipShow.value = true;
+        }
+      }catch(e){
+        console.log(e)
+      }
+      // const guideInfo = localStorage.getItem('teacher-guideInfo');
+
     }
+    getAllGuidance()
+    // const guideInfo = localStorage.getItem('teacher-guideInfo');
+    // if (guideInfo && JSON.parse(guideInfo).classGuide) {
+    //   tipShow.value = false;
+    // } else {
+    //   tipShow.value = true;
+    // }
     const getStepELe = () => {
       const ele: HTMLElement = document.getElementById(`class-${data.step}`)!;
 
@@ -143,15 +162,18 @@ export default defineComponent({
       getStepELe();
     };
 
-    const endGuide = () => {
-      let guideInfo =
-        JSON.parse(localStorage.getItem('teacher-guideInfo') || '{}') || null;
-      if (!guideInfo) {
-        guideInfo = { classGuide: true };
+    const endGuide = async() => {
+
+      if (!guideInfo.value) {
+        guideInfo.value = { classGuide: true };
       } else {
-        guideInfo.classGuide = true;
+        guideInfo.value.classGuide = true;
+      }
+      try{
+        const res = await setGuidance({guideTag:'teacher-guideInfo',guideValue:JSON.stringify(guideInfo.value)})
+      }catch(e){
+        console.log(e)
       }
-      localStorage.setItem('teacher-guideInfo', JSON.stringify(guideInfo));
       tipShow.value = false;
       //  localStorage.setItem('endC')
     };

+ 36 - 12
src/custom-plugins/guide-page/data-guide.tsx

@@ -10,6 +10,7 @@ import {
 } from 'vue';
 import styles from './index.module.less';
 import { getImage } from './images';
+import {getGuidance,setGuidance} from './api'
 import {px2vw,px2vwH} from '@/utils/index'
 export default defineComponent({
   name: 'data-guide',
@@ -106,12 +107,30 @@ export default defineComponent({
       step: 0
     });
     const tipShow = ref(false);
-    const guideInfo = localStorage.getItem('teacher-guideInfo');
-    if (guideInfo && JSON.parse(guideInfo).dataGuide) {
-      tipShow.value = false;
-    } else {
-      tipShow.value = true;
+
+    const guideInfo = ref({} as any)
+    const getAllGuidance = async()=>{
+      try{
+        const res = await getGuidance({guideTag:'teacher-guideInfo'})
+        guideInfo.value = JSON.parse(res.data?.guideValue)
+        if (guideInfo.value && guideInfo.value.dataGuide) {
+          tipShow.value = false;
+        } else {
+          tipShow.value = true;
+        }
+      }catch(e){
+        console.log(e)
+      }
+      // const guideInfo = localStorage.getItem('teacher-guideInfo');
+
     }
+    getAllGuidance()
+    // const guideInfo = localStorage.getItem('teacher-guideInfo');
+    // if (guideInfo && JSON.parse(guideInfo).dataGuide) {
+    //   tipShow.value = false;
+    // } else {
+    //   tipShow.value = true;
+    // }
     const getStepELe = () => {
 
       const ele: HTMLElement = document.getElementById(`data-${data.step}`)!;
@@ -155,15 +174,20 @@ export default defineComponent({
       getStepELe();
     };
 
-    const endGuide = () => {
-      let guideInfo =
-        JSON.parse(localStorage.getItem('teacher-guideInfo')|| '{}') || null;
-      if (!guideInfo) {
-        guideInfo = { dataGuide: true };
+    const endGuide = async() => {
+      // let guideInfo =
+      //   JSON.parse(localStorage.getItem('teacher-guideInfo')|| '{}') || null;
+      if (!guideInfo.value) {
+        guideInfo.value = { dataGuide: true };
       } else {
-        guideInfo.dataGuide = true;
+        guideInfo.value.dataGuide = true;
+      }
+      // localStorage.setItem('teacher-guideInfo', JSON.stringify(guideInfo));
+      try{
+        const res = await setGuidance({guideTag:'teacher-guideInfo',guideValue:JSON.stringify(guideInfo.value)})
+      }catch(e){
+        console.log(e)
       }
-      localStorage.setItem('teacher-guideInfo', JSON.stringify(guideInfo));
       tipShow.value = false;
       //  localStorage.setItem('endC')
     };

+ 30 - 12
src/custom-plugins/guide-page/home-guide.tsx

@@ -11,6 +11,7 @@ import {
 import styles from './index.module.less';
 import { getImage } from './images';
 import {px2vw,px2vwH} from '@/utils/index'
+import {getGuidance,setGuidance} from './api'
 export default defineComponent({
   name: 'coai-guide',
   emits: ['close'],
@@ -172,12 +173,24 @@ export default defineComponent({
       step: 0
     });
     const tipShow = ref(false);
-    const guideInfo = localStorage.getItem('teacher-guideInfo');
-    if (guideInfo && JSON.parse(guideInfo).homeGuide) {
-      tipShow.value = false;
-    } else {
-      tipShow.value = true;
+
+    const guideInfo = ref({} as any)
+    const getAllGuidance = async()=>{
+      try{
+        const res = await getGuidance({guideTag:'teacher-guideInfo'})
+        guideInfo.value = JSON.parse(res.data?.guideValue)
+        if (guideInfo.value && guideInfo.value.homeGuide) {
+          tipShow.value = false;
+        } else {
+          tipShow.value = true;
+        }
+      }catch(e){
+        console.log(e)
+      }
+      // const guideInfo = localStorage.getItem('teacher-guideInfo');
+
     }
+    getAllGuidance()
     const getStepELe = () => {
 
       const ele: HTMLElement = document.getElementById(`home-${data.step}`)!;
@@ -219,15 +232,20 @@ export default defineComponent({
       getStepELe();
     }
 
-    const endGuide = () => {
-      let guideInfo =
-        JSON.parse(localStorage.getItem('teacher-guideInfo') || '{}') || null;
-      if (!guideInfo) {
-        guideInfo = { homeGuide: true };
+    const endGuide = async () => {
+      // let guideInfo =
+      //   JSON.parse(localStorage.getItem('teacher-guideInfo') || '{}') || null;
+      if (!guideInfo.value) {
+        guideInfo.value = { homeGuide: true };
       } else {
-        guideInfo.homeGuide = true;
+        guideInfo.value.homeGuide = true;
+      }
+      try{
+        const res = await setGuidance({guideTag:'teacher-guideInfo',guideValue:JSON.stringify(guideInfo.value)})
+      }catch(e){
+        console.log(e)
       }
-      localStorage.setItem('teacher-guideInfo', JSON.stringify(guideInfo));
+      // localStorage.setItem('teacher-guideInfo', JSON.stringify(guideInfo));
       tipShow.value = false;
       //  localStorage.setItem('endC')
     };

+ 36 - 12
src/custom-plugins/guide-page/lessons-guide.tsx

@@ -11,6 +11,7 @@ import {
 import styles from './index.module.less';
 import { getImage } from './images';
 import {px2vw,px2vwH} from '@/utils/index'
+import {getGuidance,setGuidance} from './api'
 export default defineComponent({
   name: 'lessons-guide',
   emits: ['close'],
@@ -144,12 +145,30 @@ export default defineComponent({
       step: 0
     });
     const tipShow = ref(false);
-    const guideInfo = localStorage.getItem('teacher-guideInfo');
-    if (guideInfo && JSON.parse(guideInfo).lessonsGuide) {
-      tipShow.value = false;
-    } else {
-      tipShow.value = true;
+
+    const guideInfo = ref({} as any)
+    const getAllGuidance = async()=>{
+      try{
+        const res = await getGuidance({guideTag:'teacher-guideInfo'})
+        guideInfo.value = JSON.parse(res.data?.guideValue)
+        if (guideInfo.value && guideInfo.value.lessonsGuide) {
+          tipShow.value = false;
+        } else {
+          tipShow.value = true;
+        }
+      }catch(e){
+        console.log(e)
+      }
+      // const guideInfo = localStorage.getItem('teacher-guideInfo');
+
     }
+    getAllGuidance()
+    // const guideInfo = localStorage.getItem('teacher-guideInfo');
+    // if (guideInfo && JSON.parse(guideInfo).lessonsGuide) {
+    //   tipShow.value = false;
+    // } else {
+    //   tipShow.value = true;
+    // }
     const getStepELe = () => {
 
       const ele: HTMLElement = document.getElementById(`lessons-${data.step}`)!;
@@ -193,15 +212,20 @@ export default defineComponent({
       getStepELe();
     };
 
-    const endGuide = () => {
-      let guideInfo =
-        JSON.parse(localStorage.getItem('teacher-guideInfo')|| '{}') || null;
-      if (!guideInfo) {
-        guideInfo = { lessonsGuide: true };
+    const endGuide = async() => {
+      // let guideInfo =
+      //   JSON.parse(localStorage.getItem('teacher-guideInfo')|| '{}') || null;
+      if (!guideInfo.value) {
+        guideInfo.value = { lessonsGuide: true };
       } else {
-        guideInfo.lessonsGuide = true;
+        guideInfo.value.lessonsGuide = true;
+      }
+      try{
+        const res = await setGuidance({guideTag:'teacher-guideInfo',guideValue:JSON.stringify(guideInfo.value)})
+      }catch(e){
+        console.log(e)
       }
-      localStorage.setItem('teacher-guideInfo', JSON.stringify(guideInfo));
+      // localStorage.setItem('teacher-guideInfo', JSON.stringify(guideInfo));
       tipShow.value = false;
       //  localStorage.setItem('endC')
     };

+ 35 - 12
src/custom-plugins/guide-page/music-guide.tsx

@@ -11,6 +11,7 @@ import {
 import styles from './index.module.less';
 import { getImage } from './images';
 import {px2vw,px2vwH} from '@/utils/index'
+import {getGuidance,setGuidance} from './api'
 export default defineComponent({
   name: 'music-guide',
   emits: ['close'],
@@ -102,12 +103,29 @@ export default defineComponent({
       step: 0
     });
     const tipShow = ref(false);
-    const guideInfo = localStorage.getItem('teacher-guideInfo');
-    if (guideInfo && JSON.parse(guideInfo).musicGuide) {
-      tipShow.value = false;
-    } else {
-      tipShow.value = true;
+    const guideInfo = ref({} as any)
+    const getAllGuidance = async()=>{
+      try{
+        const res = await getGuidance({guideTag:'teacher-guideInfo'})
+        guideInfo.value = JSON.parse(res.data?.guideValue)
+        if (guideInfo.value && guideInfo.value.musicGuide) {
+          tipShow.value = false;
+        } else {
+          tipShow.value = true;
+        }
+      }catch(e){
+        console.log(e)
+      }
+      // const guideInfo = localStorage.getItem('teacher-guideInfo');
+
     }
+    getAllGuidance()
+    // const guideInfo = localStorage.getItem('teacher-guideInfo');
+    // if (guideInfo && JSON.parse(guideInfo).musicGuide) {
+    //   tipShow.value = false;
+    // } else {
+    //   tipShow.value = true;
+    // }
     const getStepELe = () => {
 
       const ele: HTMLElement = document.getElementById(`music-${data.step}`)!;
@@ -155,15 +173,20 @@ export default defineComponent({
       getStepELe();
     };
 
-    const endGuide = () => {
-      let guideInfo =
-        JSON.parse(localStorage.getItem('teacher-guideInfo')|| '{}') || null;
-      if (!guideInfo) {
-        guideInfo = { musicGuide: true };
+    const endGuide = async() => {
+      // let guideInfo =
+      //   JSON.parse(localStorage.getItem('teacher-guideInfo')|| '{}') || null;
+      if (!guideInfo.value) {
+        guideInfo.value = { musicGuide: true };
       } else {
-        guideInfo.musicGuide = true;
+        guideInfo.value.musicGuide = true;
+      }
+      // localStorage.setItem('teacher-guideInfo', JSON.stringify(guideInfo));
+      try{
+        const res = await setGuidance({guideTag:'teacher-guideInfo',guideValue:JSON.stringify(guideInfo.value)})
+      }catch(e){
+        console.log(e)
       }
-      localStorage.setItem('teacher-guideInfo', JSON.stringify(guideInfo));
       tipShow.value = false;
       //  localStorage.setItem('endC')
     };

+ 34 - 13
src/custom-plugins/guide-page/myColloge-guide.tsx

@@ -11,7 +11,7 @@ import {
 import styles from './index.module.less';
 import { getImage } from './images';
 import {px2vw} from '@/utils/index'
-
+import {getGuidance,setGuidance} from './api'
 export default defineComponent({
   name: 'myColloge-guide',
   emits: ['close'],
@@ -55,12 +55,28 @@ export default defineComponent({
       step: 0
     });
     const tipShow = ref(false);
-    const guideInfo = localStorage.getItem('teacher-guideInfo');
-    if (guideInfo && JSON.parse(guideInfo).myColloge) {
-      tipShow.value = false;
-    } else {
-      tipShow.value = true;
+    const guideInfo = ref({} as any)
+    const getAllGuidance = async()=>{
+      try{
+        const res = await getGuidance({guideTag:'teacher-guideInfo'})
+        guideInfo.value = JSON.parse(res.data?.guideValue)
+        if (guideInfo.value && guideInfo.value.myColloge) {
+          tipShow.value = false;
+        } else {
+          tipShow.value = true;
+        }
+      }catch(e){
+        console.log(e)
+      }
+      // const guideInfo = localStorage.getItem('teacher-guideInfo');
     }
+    getAllGuidance()
+    // const guideInfo = localStorage.getItem('teacher-guideInfo');
+    // if (guideInfo && JSON.parse(guideInfo).myColloge) {
+    //   tipShow.value = false;
+    // } else {
+    //   tipShow.value = true;
+    // }
     const getStepELe = () => {
 
       const ele: HTMLElement = document.getElementById(`myColloge-${data.step}`)!;
@@ -103,15 +119,20 @@ export default defineComponent({
       getStepELe();
     };
 
-    const endGuide = () => {
-      let guideInfo =
-        JSON.parse(localStorage.getItem('teacher-guideInfo') || '{}') || null;
-      if (!guideInfo) {
-        guideInfo = { myColloge: true };
+    const endGuide = async() => {
+      // let guideInfo =
+      //   JSON.parse(localStorage.getItem('teacher-guideInfo') || '{}') || null;
+      if (!guideInfo.value) {
+        guideInfo.value = { myColloge: true };
       } else {
-        guideInfo.myColloge = true;
+        guideInfo.value.myColloge = true;
+      }
+      try{
+        const res = await setGuidance({guideTag:'teacher-guideInfo',guideValue:JSON.stringify(guideInfo.value)})
+      }catch(e){
+        console.log(e)
       }
-      localStorage.setItem('teacher-guideInfo', JSON.stringify(guideInfo));
+      // localStorage.setItem('teacher-guideInfo', JSON.stringify(guideInfo));
       tipShow.value = false;
       //  localStorage.setItem('endC')
     };

+ 36 - 13
src/custom-plugins/guide-page/myResources-guide.tsx

@@ -11,7 +11,7 @@ import {
 import styles from './index.module.less';
 import { getImage } from './images';
 import {px2vw} from '@/utils/index'
-
+import {getGuidance,setGuidance} from './api'
 export default defineComponent({
   name: 'myResources-guide',
   emits: ['close'],
@@ -59,12 +59,30 @@ export default defineComponent({
       step: 0
     });
     const tipShow = ref(false);
-    const guideInfo = localStorage.getItem('teacher-guideInfo');
-    if (guideInfo && JSON.parse(guideInfo).myResourcesGuide) {
-      tipShow.value = false;
-    } else {
-      tipShow.value = true;
+
+    const guideInfo = ref({} as any)
+    const getAllGuidance = async()=>{
+      try{
+        const res = await getGuidance({guideTag:'teacher-guideInfo'})
+        guideInfo.value = JSON.parse(res.data?.guideValue)
+        if (guideInfo.value && guideInfo.value.myResourcesGuide) {
+          tipShow.value = false;
+        } else {
+          tipShow.value = true;
+        }
+      }catch(e){
+        console.log(e)
+      }
+      // const guideInfo = localStorage.getItem('teacher-guideInfo');
+
     }
+    getAllGuidance()
+    // const guideInfo = localStorage.getItem('teacher-guideInfo');
+    // if (guideInfo && JSON.parse(guideInfo).myResourcesGuide) {
+    //   tipShow.value = false;
+    // } else {
+    //   tipShow.value = true;
+    // }
     const getStepELe = () => {
 
       const ele: HTMLElement = document.getElementById(`myResources-${data.step}`)!;
@@ -108,15 +126,20 @@ export default defineComponent({
       getStepELe();
     };
 
-    const endGuide = () => {
-      let guideInfo =
-        JSON.parse(localStorage.getItem('teacher-guideInfo') || '{}') || null;
-      if (!guideInfo) {
-        guideInfo = { myResourcesGuide: true };
+    const endGuide = async() => {
+      // let guideInfo =
+      //   JSON.parse(localStorage.getItem('teacher-guideInfo') || '{}') || null;
+      if (guideInfo.value) {
+        guideInfo.value = { myResourcesGuide: true };
       } else {
-        guideInfo.myResourcesGuide = true;
+        guideInfo.value.myResourcesGuide = true;
+      }
+      // localStorage.setItem('teacher-guideInfo', JSON.stringify(guideInfo));
+      try{
+        const res = await setGuidance({guideTag:'teacher-guideInfo',guideValue:JSON.stringify(guideInfo.value)})
+      }catch(e){
+        console.log(e)
       }
-      localStorage.setItem('teacher-guideInfo', JSON.stringify(guideInfo));
       tipShow.value = false;
       //  localStorage.setItem('endC')
     };

+ 35 - 18
src/custom-plugins/guide-page/shareResources-guide.tsx

@@ -11,7 +11,7 @@ import {
 import styles from './index.module.less';
 import { getImage } from './images';
 import {px2vw} from '@/utils/index'
-
+import {getGuidance,setGuidance} from './api'
 export default defineComponent({
   name: 'shareResources-guide',
   emits: ['close'],
@@ -51,7 +51,7 @@ export default defineComponent({
             height:28
           },
           boxStyle:{
-            borderRadius: '30px'
+            borderRadius: '30px',
           },
         },
         {
@@ -59,13 +59,13 @@ export default defineComponent({
           img: getImage('shareResources2.png'),
           imgStyle: {
 
-            left:  px2vw(134),
-            width: px2vw(515),
-            height:px2vw(227)
+            left:  px2vw(99),
+            width: px2vw(618),
+            height:px2vw(273)
           },
           btnsStyle: {
-            bottom: px2vw(75),
-            left: px2vw(253),
+            bottom: px2vw(88),
+            left: px2vw(240),
           },
 
           eleRectPadding:{
@@ -84,12 +84,29 @@ export default defineComponent({
       step: 0
     });
     const tipShow = ref(false);
-    const guideInfo = localStorage.getItem('teacher-guideInfo');
-    if (guideInfo && JSON.parse(guideInfo).shareResourcesGuide) {
-      tipShow.value = false;
-    } else {
-      tipShow.value = true;
+    const guideInfo = ref({} as any)
+    const getAllGuidance = async()=>{
+      try{
+        const res = await getGuidance({guideTag:'teacher-guideInfo'})
+        guideInfo.value = JSON.parse(res.data?.guideValue)
+        if (guideInfo.value && guideInfo.value.shareResourcesGuide) {
+          tipShow.value = false;
+        } else {
+          tipShow.value = true;
+        }
+      }catch(e){
+        console.log(e)
+      }
+      // const guideInfo = localStorage.getItem('teacher-guideInfo');
+
     }
+    getAllGuidance()
+    // const guideInfo = localStorage.getItem('teacher-guideInfo');
+    // if (guideInfo && JSON.parse(guideInfo).shareResourcesGuide) {
+    //   tipShow.value = false;
+    // } else {
+    //   tipShow.value = true;
+    // }
     const getStepELe = () => {
 
       const ele: HTMLElement = document.getElementById(`shareResources-${data.step}`)!;
@@ -144,13 +161,13 @@ export default defineComponent({
       getStepELe();
     };
 
-    const endGuide = () => {
-      let guideInfo =
-        JSON.parse(localStorage.getItem('teacher-guideInfo')||'{}') || null;
-      if (!guideInfo) {
-        guideInfo = { shareResourcesGuide: true };
+    const endGuide = async() => {
+      // let guideInfo =
+      //   JSON.parse(localStorage.getItem('teacher-guideInfo')||'{}') || null;
+      if (!guideInfo.value) {
+        guideInfo.value = { shareResourcesGuide: true };
       } else {
-        guideInfo.shareResourcesGuide = true;
+        guideInfo.value.shareResourcesGuide = true;
       }
       localStorage.setItem('teacher-guideInfo', JSON.stringify(guideInfo));
       tipShow.value = false;