|
@@ -74,6 +74,9 @@ export default defineComponent({
|
|
|
const headeRef = ref();
|
|
|
const data = reactive({
|
|
|
visiableStatus: true,
|
|
|
+ visiableConfirmText: '下一题',
|
|
|
+ isLastIndex: false,
|
|
|
+ itemIndex: 0,
|
|
|
isMember: false, // 是否为会员
|
|
|
videoData: null as any,
|
|
|
trainings: [] as any[],
|
|
@@ -240,7 +243,7 @@ export default defineComponent({
|
|
|
) {
|
|
|
let isLastIndex = false;
|
|
|
let itemIndex = 0;
|
|
|
- console.log(data.isPlayBaseStatus, data.isPlayAll, data.trainings);
|
|
|
+ // console.log(data.isPlayBaseStatus, data.isPlayAll, data.trainings);
|
|
|
if (data.isPlayBaseStatus) {
|
|
|
itemIndex = data.trainings.findIndex(
|
|
|
(n: any) => n.id == data.videoData?.id
|
|
@@ -262,37 +265,32 @@ export default defineComponent({
|
|
|
isLastIndex = status;
|
|
|
}
|
|
|
|
|
|
- showConfirmDialog({
|
|
|
- title: '课后作业',
|
|
|
- message: '你已完成该练习~',
|
|
|
- confirmButtonColor: 'var(--van-primary)',
|
|
|
- confirmButtonText: isLastIndex ? '完成' : '下一题',
|
|
|
- cancelButtonText: '继续'
|
|
|
- })
|
|
|
- .then(() => {
|
|
|
- if (!isLastIndex) {
|
|
|
- const nextItem = data.trainings[itemIndex + 1];
|
|
|
- if (nextItem.musicScoreName) {
|
|
|
- popupData.tabName = nextItem.musicScoreName;
|
|
|
- }
|
|
|
- data.itemList = [nextItem];
|
|
|
- data.videoData = nextItem;
|
|
|
- handleExerciseCompleted();
|
|
|
- } else {
|
|
|
- postMessage({ api: 'goBack' });
|
|
|
- }
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- console.log(
|
|
|
- data.trainings,
|
|
|
- itemIndex,
|
|
|
- data.trainings[itemIndex],
|
|
|
- 'data.trainings[itemIndex]'
|
|
|
- );
|
|
|
- data.trainings[itemIndex].currentTime = 0;
|
|
|
- data.trainings[itemIndex].videoEle.currentTime(0);
|
|
|
- });
|
|
|
+ data.visiableConfirmText = isLastIndex ? '完成' : '下一题';
|
|
|
+ data.visiableStatus = true;
|
|
|
+ data.itemIndex = itemIndex;
|
|
|
+ data.isLastIndex = isLastIndex;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ const dialogConfirm = () => {
|
|
|
+ if (!data.isLastIndex) {
|
|
|
+ const nextItem = data.trainings[data.itemIndex + 1];
|
|
|
+ if (nextItem.musicScoreName) {
|
|
|
+ popupData.tabName = nextItem.musicScoreName;
|
|
|
+ }
|
|
|
+ data.itemList = [nextItem];
|
|
|
+ data.videoData = nextItem;
|
|
|
+ handleExerciseCompleted();
|
|
|
+ } else {
|
|
|
+ postMessage({ api: 'goBack' });
|
|
|
}
|
|
|
+
|
|
|
+ data.visiableStatus = false;
|
|
|
+ };
|
|
|
+ const dialogCancel = () => {
|
|
|
+ data.trainings[data.itemIndex].currentTime = 0;
|
|
|
+ data.trainings[data.itemIndex].videoEle.currentTime(0);
|
|
|
+ data.visiableStatus = false;
|
|
|
};
|
|
|
|
|
|
watch(pageVisibility, (value: any) => {
|
|
@@ -368,21 +366,22 @@ export default defineComponent({
|
|
|
</Transition>
|
|
|
</div>
|
|
|
|
|
|
- {/* <Popup
|
|
|
+ <Popup
|
|
|
v-model:show={data.visiableStatus}
|
|
|
- closeable
|
|
|
- class={styles.visiablePopup}>
|
|
|
+ // closeable
|
|
|
+ class={styles.visiablePopup}
|
|
|
+ closeOnClickOverlay={false}>
|
|
|
<div class={styles.title}>温馨提示</div>
|
|
|
<p class={styles.content}>您已完成该练习~</p>
|
|
|
<div class={styles.btnGroup}>
|
|
|
- <Button color="#ccc" round>
|
|
|
- 取消
|
|
|
+ <Button round block onClick={dialogCancel}>
|
|
|
+ 继续
|
|
|
</Button>
|
|
|
- <Button color="#FF8057" round>
|
|
|
- 下一步
|
|
|
+ <Button color="#01C1B5" round block onClick={dialogConfirm}>
|
|
|
+ {data.visiableConfirmText}
|
|
|
</Button>
|
|
|
</div>
|
|
|
- </Popup> */}
|
|
|
+ </Popup>
|
|
|
</div>
|
|
|
);
|
|
|
}
|