|
@@ -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'],
|
|
@@ -79,12 +80,29 @@ export default defineComponent({
|
|
|
step: 0
|
|
|
});
|
|
|
const tipShow = ref(false);
|
|
|
- const guideInfo = localStorage.getItem('teacher-guideInfo');
|
|
|
- if (guideInfo && JSON.parse(guideInfo).studentGuide) {
|
|
|
- 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.studentGuide) {
|
|
|
+ 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).studentGuide) {
|
|
|
+ // tipShow.value = false;
|
|
|
+ // } else {
|
|
|
+ // tipShow.value = true;
|
|
|
+ // }
|
|
|
const getStepELe = () => {
|
|
|
|
|
|
const ele: HTMLElement = document.getElementById(`student-${data.step}`)!;
|
|
@@ -127,15 +145,20 @@ export default defineComponent({
|
|
|
getStepELe();
|
|
|
};
|
|
|
|
|
|
- const endGuide = () => {
|
|
|
- let guideInfo =
|
|
|
- JSON.parse(localStorage.getItem('teacher-guideInfo') || '{}') || null;
|
|
|
- if (!guideInfo) {
|
|
|
- guideInfo = { studentGuide: true };
|
|
|
+ const endGuide = async() => {
|
|
|
+ // let guideInfo =
|
|
|
+ // JSON.parse(localStorage.getItem('teacher-guideInfo') || '{}') || null;
|
|
|
+ if (!guideInfo.value) {
|
|
|
+ guideInfo.value = { studentGuide: true };
|
|
|
} else {
|
|
|
- guideInfo.studentGuide = true;
|
|
|
+ guideInfo.value.studentGuide = 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')
|
|
|
};
|