|
@@ -10,15 +10,15 @@ import {
|
|
} from 'vue';
|
|
} from 'vue';
|
|
import styles from './index.module.less';
|
|
import styles from './index.module.less';
|
|
import { getImage } from './images';
|
|
import { getImage } from './images';
|
|
-import {px2vw} from '@/utils/index'
|
|
|
|
-import {getGuidance,setGuidance} from './api'
|
|
|
|
|
|
+import { eventGlobal, px2vw } from '@/utils/index';
|
|
|
|
+import { getGuidance, setGuidance } from './api';
|
|
export default defineComponent({
|
|
export default defineComponent({
|
|
name: 'shareResources-guide',
|
|
name: 'shareResources-guide',
|
|
emits: ['close'],
|
|
emits: ['close'],
|
|
setup(props, { emit }) {
|
|
setup(props, { emit }) {
|
|
const data = reactive({
|
|
const data = reactive({
|
|
box: {
|
|
box: {
|
|
- height:'0px',
|
|
|
|
|
|
+ height: '0px'
|
|
} as any,
|
|
} as any,
|
|
show: false,
|
|
show: false,
|
|
/**
|
|
/**
|
|
@@ -37,74 +37,71 @@ export default defineComponent({
|
|
imgStyle: {
|
|
imgStyle: {
|
|
top: px2vw(-4),
|
|
top: px2vw(-4),
|
|
left: px2vw(-263),
|
|
left: px2vw(-263),
|
|
- width: px2vw(553),
|
|
|
|
- height: px2vw(229)
|
|
|
|
|
|
+ width: px2vw(553),
|
|
|
|
+ height: px2vw(229)
|
|
},
|
|
},
|
|
btnsStyle: {
|
|
btnsStyle: {
|
|
- bottom:px2vw(30),
|
|
|
|
- left: px2vw(-102),
|
|
|
|
|
|
+ bottom: px2vw(30),
|
|
|
|
+ left: px2vw(-102)
|
|
},
|
|
},
|
|
- eleRectPadding:{
|
|
|
|
- left:14,
|
|
|
|
- top:14,
|
|
|
|
- width:28,
|
|
|
|
- height:28
|
|
|
|
- },
|
|
|
|
- boxStyle:{
|
|
|
|
- borderRadius: '30px',
|
|
|
|
|
|
+ eleRectPadding: {
|
|
|
|
+ left: 14,
|
|
|
|
+ top: 14,
|
|
|
|
+ width: 28,
|
|
|
|
+ height: 28
|
|
},
|
|
},
|
|
|
|
+ boxStyle: {
|
|
|
|
+ borderRadius: '30px'
|
|
|
|
+ }
|
|
},
|
|
},
|
|
{
|
|
{
|
|
ele: '',
|
|
ele: '',
|
|
img: getImage('shareResources2.png'),
|
|
img: getImage('shareResources2.png'),
|
|
imgStyle: {
|
|
imgStyle: {
|
|
-
|
|
|
|
- left: px2vw(99),
|
|
|
|
|
|
+ left: px2vw(99),
|
|
width: px2vw(618),
|
|
width: px2vw(618),
|
|
- height:px2vw(273)
|
|
|
|
|
|
+ height: px2vw(273)
|
|
},
|
|
},
|
|
btnsStyle: {
|
|
btnsStyle: {
|
|
bottom: px2vw(88),
|
|
bottom: px2vw(88),
|
|
- left: px2vw(240),
|
|
|
|
|
|
+ left: px2vw(240)
|
|
},
|
|
},
|
|
|
|
|
|
- eleRectPadding:{
|
|
|
|
- left:7,
|
|
|
|
- top:7,
|
|
|
|
- width:14,
|
|
|
|
- height:14
|
|
|
|
|
|
+ eleRectPadding: {
|
|
|
|
+ left: 7,
|
|
|
|
+ top: 7,
|
|
|
|
+ width: 14,
|
|
|
|
+ height: 14
|
|
},
|
|
},
|
|
- boxStyle:{
|
|
|
|
|
|
+ boxStyle: {
|
|
borderRadius: '15px'
|
|
borderRadius: '15px'
|
|
},
|
|
},
|
|
- type:'bottom'
|
|
|
|
-
|
|
|
|
- },
|
|
|
|
|
|
+ type: 'bottom'
|
|
|
|
+ }
|
|
],
|
|
],
|
|
step: 0
|
|
step: 0
|
|
});
|
|
});
|
|
const tipShow = ref(false);
|
|
const tipShow = ref(false);
|
|
- const guideInfo = ref({} as any)
|
|
|
|
- const getAllGuidance = async()=>{
|
|
|
|
- try{
|
|
|
|
- const res = await getGuidance({guideTag:'teacher-guideInfo'})
|
|
|
|
- if(res.data){
|
|
|
|
- guideInfo.value = JSON.parse(res.data?.guideValue) || null
|
|
|
|
- }else{
|
|
|
|
- guideInfo.value = {}
|
|
|
|
|
|
+ const guideInfo = ref({} as any);
|
|
|
|
+ const getAllGuidance = async () => {
|
|
|
|
+ try {
|
|
|
|
+ const res = await getGuidance({ guideTag: 'teacher-guideInfo' });
|
|
|
|
+ if (res.data) {
|
|
|
|
+ guideInfo.value = JSON.parse(res.data?.guideValue) || null;
|
|
|
|
+ } else {
|
|
|
|
+ guideInfo.value = {};
|
|
}
|
|
}
|
|
if (guideInfo.value && guideInfo.value.shareResourcesGuide) {
|
|
if (guideInfo.value && guideInfo.value.shareResourcesGuide) {
|
|
tipShow.value = false;
|
|
tipShow.value = false;
|
|
} else {
|
|
} else {
|
|
tipShow.value = true;
|
|
tipShow.value = true;
|
|
}
|
|
}
|
|
- }catch(e){
|
|
|
|
- console.log(e)
|
|
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.log(e);
|
|
}
|
|
}
|
|
// const guideInfo = localStorage.getItem('teacher-guideInfo');
|
|
// const guideInfo = localStorage.getItem('teacher-guideInfo');
|
|
-
|
|
|
|
- }
|
|
|
|
- getAllGuidance()
|
|
|
|
|
|
+ };
|
|
|
|
+ getAllGuidance();
|
|
// const guideInfo = localStorage.getItem('teacher-guideInfo');
|
|
// const guideInfo = localStorage.getItem('teacher-guideInfo');
|
|
// if (guideInfo && JSON.parse(guideInfo).shareResourcesGuide) {
|
|
// if (guideInfo && JSON.parse(guideInfo).shareResourcesGuide) {
|
|
// tipShow.value = false;
|
|
// tipShow.value = false;
|
|
@@ -112,8 +109,9 @@ export default defineComponent({
|
|
// tipShow.value = true;
|
|
// tipShow.value = true;
|
|
// }
|
|
// }
|
|
const getStepELe = () => {
|
|
const getStepELe = () => {
|
|
-
|
|
|
|
- const ele: HTMLElement = document.getElementById(`shareResources-${data.step}`)!;
|
|
|
|
|
|
+ const ele: HTMLElement = document.getElementById(
|
|
|
|
+ `shareResources-${data.step}`
|
|
|
|
+ )!;
|
|
|
|
|
|
if (ele) {
|
|
if (ele) {
|
|
const eleRect = ele.getBoundingClientRect();
|
|
const eleRect = ele.getBoundingClientRect();
|
|
@@ -121,40 +119,67 @@ export default defineComponent({
|
|
const left = data.steps[data.step].eleRectPadding?.left || 0;
|
|
const left = data.steps[data.step].eleRectPadding?.left || 0;
|
|
const top = data.steps[data.step].eleRectPadding?.top || 0;
|
|
const top = data.steps[data.step].eleRectPadding?.top || 0;
|
|
const width = data.steps[data.step].eleRectPadding?.width || 0;
|
|
const width = data.steps[data.step].eleRectPadding?.width || 0;
|
|
- const height = data.steps[data.step].eleRectPadding?.height || 0
|
|
|
|
|
|
+ const height = data.steps[data.step].eleRectPadding?.height || 0;
|
|
|
|
|
|
- if(`shareResources-${data.step}`=='shareResources-1'){
|
|
|
|
|
|
+ if (`shareResources-${data.step}` == 'shareResources-1') {
|
|
data.box = {
|
|
data.box = {
|
|
- left: eleRect.x - left+ 'px',
|
|
|
|
- top: eleRect.y - top +'px',
|
|
|
|
- width: (eleRect.width + width)*2+width+'px',
|
|
|
|
- height: eleRect.height +height+ 'px'
|
|
|
|
|
|
+ left: eleRect.x - left + 'px',
|
|
|
|
+ top: eleRect.y - top + 'px',
|
|
|
|
+ width: (eleRect.width + width) * 2 + width + 'px',
|
|
|
|
+ height: eleRect.height + height + 'px'
|
|
};
|
|
};
|
|
- console.log( data.box.width,'---',eleRect.width)
|
|
|
|
- }else{
|
|
|
|
|
|
+ console.log(data.box.width, '---', eleRect.width);
|
|
|
|
+ } else {
|
|
data.box = {
|
|
data.box = {
|
|
- left: eleRect.x - left+ 'px',
|
|
|
|
- top: eleRect.y - top +'px',
|
|
|
|
- width: eleRect.width + width+'px',
|
|
|
|
- height: eleRect.height +height+ 'px'
|
|
|
|
|
|
+ left: eleRect.x - left + 'px',
|
|
|
|
+ top: eleRect.y - top + 'px',
|
|
|
|
+ width: eleRect.width + width + 'px',
|
|
|
|
+ height: eleRect.height + height + 'px'
|
|
};
|
|
};
|
|
}
|
|
}
|
|
- console.log(`coai-${data.step}`,data.box);
|
|
|
|
- }else{
|
|
|
|
- handleNext()
|
|
|
|
|
|
+ console.log(`coai-${data.step}`, data.box);
|
|
|
|
+ } else {
|
|
|
|
+ handleNext();
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ const onResetGuide = async (name: string) => {
|
|
|
|
+ try {
|
|
|
|
+ if (name !== 'shareResources') return;
|
|
|
|
+ if (!guideInfo.value) {
|
|
|
|
+ guideInfo.value = { classGuide: false };
|
|
|
|
+ } else {
|
|
|
|
+ guideInfo.value.classGuide = false;
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ await setGuidance({
|
|
|
|
+ guideTag: 'teacher-guideInfo',
|
|
|
|
+ guideValue: JSON.stringify(guideInfo.value)
|
|
|
|
+ });
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.log(e);
|
|
|
|
+ }
|
|
|
|
+ data.step = 0;
|
|
|
|
+ getStepELe();
|
|
|
|
+ tipShow.value = true;
|
|
|
|
+ } catch {
|
|
|
|
+ //
|
|
}
|
|
}
|
|
};
|
|
};
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
getStepELe();
|
|
getStepELe();
|
|
- window.addEventListener("resize", resetSize);
|
|
|
|
|
|
+ window.addEventListener('resize', resetSize);
|
|
|
|
+ eventGlobal.on('natural-resources-guide', (name: string) =>
|
|
|
|
+ onResetGuide(name)
|
|
|
|
+ );
|
|
});
|
|
});
|
|
- const resetSize = ()=>{
|
|
|
|
|
|
+ const resetSize = () => {
|
|
getStepELe();
|
|
getStepELe();
|
|
- }
|
|
|
|
|
|
+ };
|
|
|
|
|
|
- onUnmounted(()=>{
|
|
|
|
- window.removeEventListener("resize", resetSize);
|
|
|
|
- })
|
|
|
|
|
|
+ onUnmounted(() => {
|
|
|
|
+ window.removeEventListener('resize', resetSize);
|
|
|
|
+ eventGlobal.off('natural-resources-guide', onResetGuide);
|
|
|
|
+ });
|
|
|
|
|
|
const handleNext = () => {
|
|
const handleNext = () => {
|
|
if (data.step >= 4) {
|
|
if (data.step >= 4) {
|
|
@@ -165,7 +190,7 @@ export default defineComponent({
|
|
getStepELe();
|
|
getStepELe();
|
|
};
|
|
};
|
|
|
|
|
|
- const endGuide = async() => {
|
|
|
|
|
|
+ const endGuide = async () => {
|
|
// let guideInfo =
|
|
// let guideInfo =
|
|
// JSON.parse(localStorage.getItem('teacher-guideInfo')||'{}') || null;
|
|
// JSON.parse(localStorage.getItem('teacher-guideInfo')||'{}') || null;
|
|
if (!guideInfo.value) {
|
|
if (!guideInfo.value) {
|
|
@@ -174,10 +199,13 @@ export default defineComponent({
|
|
guideInfo.value.shareResourcesGuide = true;
|
|
guideInfo.value.shareResourcesGuide = true;
|
|
}
|
|
}
|
|
// localStorage.setItem('teacher-guideInfo', JSON.stringify(guideInfo));
|
|
// 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)
|
|
|
|
|
|
+ try {
|
|
|
|
+ const res = await setGuidance({
|
|
|
|
+ guideTag: 'teacher-guideInfo',
|
|
|
|
+ guideValue: JSON.stringify(guideInfo.value)
|
|
|
|
+ });
|
|
|
|
+ } catch (e) {
|
|
|
|
+ console.log(e);
|
|
}
|
|
}
|
|
tipShow.value = false;
|
|
tipShow.value = false;
|
|
// localStorage.setItem('endC')
|
|
// localStorage.setItem('endC')
|
|
@@ -199,25 +227,25 @@ export default defineComponent({
|
|
</div>
|
|
</div>
|
|
<div
|
|
<div
|
|
class={styles.box}
|
|
class={styles.box}
|
|
- style={{...data.box,...data.steps[data.step].boxStyle}}
|
|
|
|
|
|
+ style={{ ...data.box, ...data.steps[data.step].boxStyle }}
|
|
id={`modeType-${data.step}`}>
|
|
id={`modeType-${data.step}`}>
|
|
-
|
|
|
|
{data.steps.map((item: any, index) => (
|
|
{data.steps.map((item: any, index) => (
|
|
-
|
|
|
|
<div
|
|
<div
|
|
onClick={(e: Event) => e.stopPropagation()}
|
|
onClick={(e: Event) => e.stopPropagation()}
|
|
class={styles.item}
|
|
class={styles.item}
|
|
- style={ item.type=='bottom'? {
|
|
|
|
- display: index === data.step ? '' : 'none',
|
|
|
|
- left: `${item.eleRect?.left}px`,
|
|
|
|
- top:`-${item.imgStyle?.height}`
|
|
|
|
-
|
|
|
|
- }:{
|
|
|
|
- display: index === data.step ? '' : 'none',
|
|
|
|
- left: `${item.eleRect?.left}px`,
|
|
|
|
- top: `${data.box?.height}`,
|
|
|
|
-
|
|
|
|
- }}>
|
|
|
|
|
|
+ style={
|
|
|
|
+ item.type == 'bottom'
|
|
|
|
+ ? {
|
|
|
|
+ display: index === data.step ? '' : 'none',
|
|
|
|
+ left: `${item.eleRect?.left}px`,
|
|
|
|
+ top: `-${item.imgStyle?.height}`
|
|
|
|
+ }
|
|
|
|
+ : {
|
|
|
|
+ display: index === data.step ? '' : 'none',
|
|
|
|
+ left: `${item.eleRect?.left}px`,
|
|
|
|
+ top: `${data.box?.height}`
|
|
|
|
+ }
|
|
|
|
+ }>
|
|
<img
|
|
<img
|
|
class={styles.img}
|
|
class={styles.img}
|
|
style={item.imgStyle}
|
|
style={item.imgStyle}
|
|
@@ -231,7 +259,7 @@ export default defineComponent({
|
|
<div class={styles.btns} style={item.btnsStyle}>
|
|
<div class={styles.btns} style={item.btnsStyle}>
|
|
{data.step + 1 == data.steps.length ? (
|
|
{data.step + 1 == data.steps.length ? (
|
|
<>
|
|
<>
|
|
- <div
|
|
|
|
|
|
+ <div
|
|
class={[styles.endBtn]}
|
|
class={[styles.endBtn]}
|
|
onClick={() => endGuide()}>
|
|
onClick={() => endGuide()}>
|
|
完成
|
|
完成
|
|
@@ -244,7 +272,6 @@ export default defineComponent({
|
|
}}>
|
|
}}>
|
|
再看一遍
|
|
再看一遍
|
|
</div>
|
|
</div>
|
|
-
|
|
|
|
</>
|
|
</>
|
|
) : (
|
|
) : (
|
|
<div class={styles.btn} onClick={() => handleNext()}>
|
|
<div class={styles.btn} onClick={() => handleNext()}>
|