|
@@ -3,7 +3,7 @@ import { } from "vant";
|
|
|
import { defineComponent, nextTick, onMounted, onUnmounted, reactive, ref, watch } from "vue";
|
|
|
import styles from "./index.module.less";
|
|
|
import { getImage } from "./images";
|
|
|
-
|
|
|
+import {getGuidance,setGuidance} from './api'
|
|
|
export default defineComponent({
|
|
|
name: "courseware-detail",
|
|
|
emits: ["close"],
|
|
@@ -21,6 +21,9 @@ export default defineComponent({
|
|
|
left:"0.98rem",
|
|
|
transform: 'rotate(-90deg)'
|
|
|
},
|
|
|
+ boxStyle:{
|
|
|
+ 'borderRadius':'0.1rem'
|
|
|
+ },
|
|
|
imgStyle: {
|
|
|
top: "-1.3rem",
|
|
|
left:"2.2rem",
|
|
@@ -35,12 +38,34 @@ export default defineComponent({
|
|
|
step: 0,
|
|
|
});
|
|
|
const tipShow = ref(false)
|
|
|
- const guideInfo = localStorage.getItem('guideInfo')
|
|
|
- if(guideInfo&&JSON.parse(guideInfo).coursewareDetail){
|
|
|
- tipShow.value =false
|
|
|
- }else {
|
|
|
- tipShow.value =true
|
|
|
- }
|
|
|
+ const guideInfo = ref({} as any)
|
|
|
+ const getAllGuidance = async()=>{
|
|
|
+ try{
|
|
|
+ const res = await getGuidance({guideTag:'guideInfo'})
|
|
|
+ if(res.data){
|
|
|
+ guideInfo.value = JSON.parse(res.data?.guideValue) || null
|
|
|
+ }else{
|
|
|
+ guideInfo.value = {}
|
|
|
+ }
|
|
|
+ if (guideInfo.value &&guideInfo.value.coursewareDetail) {
|
|
|
+ tipShow.value = false;
|
|
|
+ } else {
|
|
|
+ tipShow.value = true;
|
|
|
+ }
|
|
|
+ }catch(e){
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+ // const guideInfo = localStorage.getItem('teacher-guideInfo');
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ getAllGuidance()
|
|
|
+ // const guideInfo = localStorage.getItem('guideInfo')
|
|
|
+ // if(guideInfo&&JSON.parse(guideInfo).coursewareDetail){
|
|
|
+ // tipShow.value =false
|
|
|
+ // }else {
|
|
|
+ // tipShow.value =true
|
|
|
+ // }
|
|
|
const getStepELe = () => {
|
|
|
console.log(`coursewareDetail-${data.step}`)
|
|
|
const ele: HTMLElement = document.getElementById(`coursewareDetail-${data.step}`)!;
|
|
@@ -77,14 +102,19 @@ export default defineComponent({
|
|
|
getStepELe();
|
|
|
};
|
|
|
|
|
|
- const endGuide = ()=>{
|
|
|
- let guideInfo = JSON.parse(localStorage.getItem('guideInfo')|| '{}') || null
|
|
|
- if(!guideInfo){
|
|
|
- guideInfo = {coursewareDetail:true}
|
|
|
+ const endGuide = async()=>{
|
|
|
+ // let guideInfo = JSON.parse(localStorage.getItem('guideInfo')|| '{}') || null
|
|
|
+ if(!guideInfo.value){
|
|
|
+ guideInfo.value = {coursewareDetail:true}
|
|
|
}else{
|
|
|
- guideInfo.coursewareDetail = true
|
|
|
+ guideInfo.value.coursewareDetail = true
|
|
|
+ }
|
|
|
+
|
|
|
+ try{
|
|
|
+ const res = await setGuidance({guideTag:'guideInfo',guideValue:JSON.stringify(guideInfo.value)})
|
|
|
+ }catch(e){
|
|
|
+ console.log(e)
|
|
|
}
|
|
|
- localStorage.setItem('guideInfo',JSON.stringify(guideInfo))
|
|
|
tipShow.value = false
|
|
|
// localStorage.setItem('endC')
|
|
|
}
|
|
@@ -101,7 +131,7 @@ export default defineComponent({
|
|
|
|
|
|
跳过
|
|
|
</div>}
|
|
|
- <div class={styles.box} style={data.box} id={`modeType-${data.step}`}>
|
|
|
+ <div class={styles.box} style={{...data.box,...data.steps[data.step].boxStyle}} id={`modeType-${data.step}`}>
|
|
|
{data.steps.map((item: any, index) => (
|
|
|
|
|
|
<div
|