|
@@ -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: "coai-guide",
|
|
|
emits: ["close"],
|
|
@@ -26,7 +26,8 @@ export default defineComponent({
|
|
|
},
|
|
|
btnsStyle: {
|
|
|
top: "4.7rem",
|
|
|
- left:'1rem'
|
|
|
+ left:'2.0rem',
|
|
|
+ transform: 'scale(1.2)'
|
|
|
},
|
|
|
boxStyle:{
|
|
|
borderRadius: '40px',
|
|
@@ -99,12 +100,35 @@ export default defineComponent({
|
|
|
step: 0,
|
|
|
});
|
|
|
const tipShow = ref(false)
|
|
|
- const guideInfo = localStorage.getItem('guideInfo')
|
|
|
- if(guideInfo&&JSON.parse(guideInfo).coaiGuide){
|
|
|
- tipShow.value =false
|
|
|
- }else {
|
|
|
- tipShow.value =true
|
|
|
- }
|
|
|
+ // const guideInfo = localStorage.getItem('guideInfo')
|
|
|
+ // if(guideInfo&&JSON.parse(guideInfo).coaiGuide){
|
|
|
+ // 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.coaiGuide) {
|
|
|
+ tipShow.value = false;
|
|
|
+ } else {
|
|
|
+ tipShow.value = true;
|
|
|
+ }
|
|
|
+ }catch(e){
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+ // const guideInfo = localStorage.getItem('teacher-guideInfo');
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ getAllGuidance()
|
|
|
const getStepELe = () => {
|
|
|
console.log(`coai-${data.step}`)
|
|
|
const ele: HTMLElement = document.getElementById(`coai-${data.step}`)!;
|
|
@@ -140,14 +164,19 @@ export default defineComponent({
|
|
|
getStepELe();
|
|
|
};
|
|
|
|
|
|
- const endGuide = ()=>{
|
|
|
- let guideInfo = JSON.parse(localStorage.getItem('guideInfo') || '{}') || null
|
|
|
- if(!guideInfo){
|
|
|
- guideInfo = {coaiGuide:true}
|
|
|
+ const endGuide = async()=>{
|
|
|
+ // let guideInfo = JSON.parse(localStorage.getItem('guideInfo') || '{}') || null
|
|
|
+ if(!guideInfo.value){
|
|
|
+ guideInfo.value = {coaiGuide:true}
|
|
|
}else{
|
|
|
- guideInfo.coaiGuide = true
|
|
|
+ guideInfo.value.coaiGuide = true
|
|
|
+ }
|
|
|
+ // localStorage.setItem('guideInfo',JSON.stringify(guideInfo))
|
|
|
+ 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')
|
|
|
}
|
|
@@ -181,7 +210,7 @@ export default defineComponent({
|
|
|
<div class={styles.btns} style={item.btnsStyle}>
|
|
|
{data.step + 1 == data.steps.length ? (
|
|
|
<>
|
|
|
- <Button class={[styles.btn]} round type="primary" onClick={() =>endGuide()}>
|
|
|
+ <Button class={[styles.btn]} round type="primary" onClick={() =>endGuide()}>
|
|
|
完成
|
|
|
</Button>
|
|
|
<Button
|
|
@@ -201,7 +230,6 @@ export default defineComponent({
|
|
|
</>
|
|
|
) : (
|
|
|
<Button class={styles.btn} round type="primary" onClick={() => handleNext()}>
|
|
|
-
|
|
|
下一步 ({data.step + 1}/{data.steps.length})
|
|
|
</Button>
|
|
|
)}
|