Commit a4d5e27d by Lin

feat: 预学习页面及弹框补充优化

1 parent eeb7c314
...@@ -266,7 +266,7 @@ import { interceptionMixin } from '@/mixin/index' ...@@ -266,7 +266,7 @@ import { interceptionMixin } from '@/mixin/index'
import StudyPopup from '@/components/StudyPopup.vue' import StudyPopup from '@/components/StudyPopup.vue'
import StudyPopupContent from '@/components/StudyPopupContent.vue' import StudyPopupContent from '@/components/StudyPopupContent.vue'
import ExamSubmitPopup from '@/components/ExamSubmitPopup.vue' import ExamSubmitPopup from '@/components/ExamSubmitPopup.vue'
import PreStudyPopup from '@/components/PreStudyPopup.vue' import PreStudyPopup from '@/components/PreStudy/PreStudyPopup.vue'
import StudyCenterPermissionPopup from '@/components/StudyCenterPermissionPopup.vue' import StudyCenterPermissionPopup from '@/components/StudyCenterPermissionPopup.vue'
import ActivityPopup from './components/ActivityPopup.vue' import ActivityPopup from './components/ActivityPopup.vue'
import ErrorOrderPopup from '@/components/ErrorOrderPopup.vue' import ErrorOrderPopup from '@/components/ErrorOrderPopup.vue'
......
<template>
<view class="exam-submit-popup-wrapper">
<view class="content-box">
<view class="text-box">
退出将消耗1次跳过机会
</view>
<view class="sub-text">
剩余次数2次,是否确认退出?
</view>
</view>
<view class="button-group">
<view class="cancel-button" @click="handleCancel">
取消
</view>
<view class="confirm-button" @click="handleConfirm">
{{ confirmText }}
</view>
</view>
</view>
</template>
<script>
export default {
name: 'ExamSubmitPopup',
props: {
confirmText: {
type: String,
default: '确认'
}
},
methods: {
handleCancel() {
this.$emit('cancel')
},
handleConfirm() {
this.$emit('confirm')
},
}
}
</script>
<style lang="scss" scoped>
.exam-submit-popup-wrapper {
position: relative;
width: 100%;
min-height: toRpx(400);
display: flex;
flex-direction: column;
align-items: center;
padding-bottom: toRpx(48);
}
.content-box {
width: toRpx(720);
height: toRpx(156);
border-radius: toRpx(16);
background: #FDECE9;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin-bottom: toRpx(24);
}
.text-box {
font-size: toRpx(40);
color: #333;
text-align: center;
font-weight: 500;
line-height: toRpx(60);
}
.sub-text {
color: #999;
text-align: center;
font-size: toRpx(28);
font-style: normal;
font-weight: 400;
line-height: toRpx(48);
}
.button-group {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
gap: toRpx(16);
margin-top: toRpx(48);
}
.cancel-button {
width: toRpx(344);
height: toRpx(80);
border-radius: toRpx(64);
background: #f0f1f5;
color: #1a1a1a;
font-size: toRpx(28);
font-weight: 400;
font-family: "HarmonyOSSansSC";
text-align: center;
line-height: toRpx(80);
}
.confirm-button {
width: toRpx(360);
height: toRpx(80);
border-radius: toRpx(48);
border: toRpx(2) solid #979797;
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
color: #ffffff;
font-size: toRpx(28);
font-weight: 500;
font-family: "HarmonyOSSansSC";
text-align: center;
line-height: toRpx(80);
&:active {
opacity: 0.8;
}
}
</style>
<template> <template>
<view class="exam-submit-popup-wrapper"> <view class="exam-submit-popup-wrapper">
<view class="content-box"> <view class="content-box">
<scroll-view class="course-list" scroll-y> <scroll-view class="course-list" scroll-y>
<view <view
class="course-item" class="course-item"
v-for="(item, index) in displayCourseList" v-for="(item, index) in displayCourseList"
:key="item.id || index" :key="item.id || index"
> >
<view class="course-item-title"> <view class="course-item-title">
<view class="course-item-title-text">{{ item.title }}</view> <view class="course-item-title-text">{{ item.title }}</view>
<view class="course-item-desc">{{ item.description }}</view> <view class="course-item-desc">{{ item.description }}</view>
</view> </view>
<view <view
class="course-item-btn" class="course-item-btn"
v-if="item.state === 0" v-if="item.state === 0"
@click.stop="handleStartStudy(item, index)" @click.stop="handleStartStudy(item, index)"
>开启学习</view> >开启学习</view>
<view class="course-item-btn course-item-btn--learned" v-else>已学习</view> <view class="course-item-btn course-item-btn--learned" v-else>已学习</view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
<!-- 按钮组(始终显示) --> <!-- 按钮组(始终显示) -->
<view class="button-group"> <view class="button-group">
<view class="confirm-button" @click="handleConfirm"> <view class="confirm-button" @click="handleConfirm">
{{ confirmText }} {{ confirmText }}
</view> </view>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
const DEFAULT_COURSE_LIST = [ const DEFAULT_COURSE_LIST = [
{ {
id: 1, id: 1,
title: 'AITO 春醒悦享车衣套餐', title: 'AITO 春醒悦享车衣套餐',
description: '包含:原厂定制隐形车衣 + 专属天窗....', description: '包含:原厂定制隐形车衣 + 专属天窗....',
state:1 state:1
}, },
{ {
id: 2, id: 2,
title: 'AITO 春醒悦享车衣套餐', title: 'AITO 春醒悦享车衣套餐',
description: '包含:原厂定制隐形车衣 + 专属天窗....', description: '包含:原厂定制隐形车衣 + 专属天窗....',
state:0 state:0
} }
] ]
export default { export default {
name: 'PreStudyPopup', name: 'PreStudyPopup',
props: { props: {
confirmText: { confirmText: {
type: String, type: String,
default: '跳过' default: '跳过'
}, },
courseList: { courseList: {
type: Array, type: Array,
default: () => [] default: () => []
} }
}, },
computed: { computed: {
displayCourseList() { displayCourseList() {
return this.courseList.length ? this.courseList : DEFAULT_COURSE_LIST return this.courseList.length ? this.courseList : DEFAULT_COURSE_LIST
} }
}, },
methods: { methods: {
handleStartStudy(item, index) { handleStartStudy(item, index) {
if (item.state !== 0) return if (item.state !== 0) return
this.$emit('start-study', item, index) this.$emit('start-study', item, index)
uni.navigateTo({ uni.navigateTo({
url: '/pages/common/prelearnBridge' url: '/pages/common/prelearnBridge'
}) })
}, },
handleCancel() { handleCancel() {
this.$emit('cancel') this.$emit('cancel')
}, },
handleConfirm() { handleConfirm() {
this.$emit('confirm') this.$emit('confirm')
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.exam-submit-popup-wrapper { .exam-submit-popup-wrapper {
position: relative; position: relative;
width: 100%; width: 100%;
min-height: toRpx(400); min-height: toRpx(400);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
padding-bottom: toRpx(48); padding-bottom: toRpx(48);
} }
.content-box { .content-box {
width: toRpx(720); width: toRpx(720);
box-sizing: border-box; box-sizing: border-box;
} }
.course-list { .course-list {
width: 100%; width: 100%;
height: toRpx(440); height: toRpx(440);
box-sizing: border-box; box-sizing: border-box;
} }
.course-item { .course-item {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
gap: toRpx(16); gap: toRpx(16);
width: 100%; width: 100%;
padding: toRpx(16); padding: toRpx(16);
border-radius: toRpx(16); border-radius: toRpx(16);
border: toRpx(2) solid #e4e9f7; border: toRpx(2) solid #e4e9f7;
background: #f5f7fa; background: #f5f7fa;
box-sizing: border-box; box-sizing: border-box;
margin-bottom: toRpx(48); margin-bottom: toRpx(48);
} }
.course-item-title { .course-item-title {
flex: 1; flex: 1;
min-width: 0; min-width: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: toRpx(16); gap: toRpx(16);
} }
.course-item-title-text { .course-item-title-text {
width: 100%; width: 100%;
color: #333333; color: #333333;
font-size: toRpx(40); font-size: toRpx(40);
font-weight: 500; font-weight: 500;
font-family: "HarmonyOSSansSC"; font-family: "HarmonyOSSansSC";
line-height: toRpx(60); line-height: toRpx(60);
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.course-item-desc { .course-item-desc {
width: 100%; width: 100%;
color: #999999; color: #999999;
font-size: toRpx(28); font-size: toRpx(28);
font-weight: 400; font-weight: 400;
font-family: "HarmonyOSSansSC"; font-family: "HarmonyOSSansSC";
line-height: toRpx(48); line-height: toRpx(48);
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.course-item-btn { .course-item-btn {
flex-shrink: 0; flex-shrink: 0;
height: toRpx(56); height: toRpx(56);
padding: 0 toRpx(16); padding: 0 toRpx(16);
border-radius: toRpx(8); border-radius: toRpx(8);
border: toRpx(2) solid rgba(44, 102, 247, 0.1); border: toRpx(2) solid rgba(44, 102, 247, 0.1);
background: #2c66f7; background: #2c66f7;
color: #ffffff; color: #ffffff;
font-size: toRpx(26); font-size: toRpx(26);
font-weight: 400; font-weight: 400;
font-family: "HarmonyOSSansSC"; font-family: "HarmonyOSSansSC";
line-height: toRpx(56); line-height: toRpx(56);
text-align: center; text-align: center;
white-space: nowrap; white-space: nowrap;
&--learned { &--learned {
border: 1px solid rgba(44, 102, 247, 0.10); border: 1px solid rgba(44, 102, 247, 0.10);
background: rgba(44, 102, 247, 0.05); background: rgba(44, 102, 247, 0.05);
color: #2c66f7; color: #2c66f7;
} }
} }
.button-group { .button-group {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 100%; width: 100%;
gap: toRpx(16); gap: toRpx(16);
margin-top: toRpx(8); margin-top: toRpx(8);
} }
.confirm-button { .confirm-button {
width: toRpx(338); width: toRpx(338);
height: toRpx(80); height: toRpx(80);
margin: 0 auto; margin: 0 auto;
border-radius: toRpx(48); border-radius: toRpx(48);
border: toRpx(2) solid #979797; border: toRpx(2) solid #979797;
background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%); background: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%);
color: #ffffff; color: #ffffff;
font-size: toRpx(28); font-size: toRpx(28);
font-weight: 500; font-weight: 500;
font-family: "HarmonyOSSansSC"; font-family: "HarmonyOSSansSC";
text-align: center; text-align: center;
line-height: toRpx(80); line-height: toRpx(80);
&:active { &:active {
opacity: 0.8; opacity: 0.8;
} }
} }
</style> </style>
......
...@@ -32,17 +32,46 @@ ...@@ -32,17 +32,46 @@
@onPostMessage="handleWebMessage" @onPostMessage="handleWebMessage"
></web-view> ></web-view>
</view> </view>
<!-- 返回拦截确认弹窗 -->
<StudyPopup
:show.sync="showBackPopup"
title="提示"
:width="848"
:height="686"
:topImage="require('@/assets/images/common/warning-notice.webp')"
:topImageWidth="848"
:topImageHeight="248"
class="prelearn-back-popup"
>
<PreBackPopup
:confirmText="backPopInfo.confirmText"
@cancel="handleBackPopupCancel"
@confirm="handleBackPopupConfirm"
/>
</StudyPopup>
</view> </view>
</template> </template>
<script> <script>
import StudyPopup from '@/components/StudyPopup.vue'
import PreBackPopup from '@/components/PreStudy/PreBackPopup.vue'
export default { export default {
name: 'PrelearnBridge', name: 'PrelearnBridge',
components: {
StudyPopup,
PreBackPopup,
},
data() { data() {
return { return {
webviewUrl: '', webviewUrl: '',
childWebview: null, childWebview: null,
measuredNavBottomPx: 0, measuredNavBottomPx: 0,
showBackPopup: false,
backPopInfo: {
confirmText: '确认',
},
prelearnContext: { prelearnContext: {
activityId: 'activity-demo-202606', activityId: 'activity-demo-202606',
packageId: 'package-main-film', packageId: 'package-main-film',
...@@ -457,6 +486,15 @@ export default { ...@@ -457,6 +486,15 @@ export default {
// #endif // #endif
}, },
back() { back() {
this.showBackPopup = true
},
handleBackPopupCancel() {
this.showBackPopup = false
this.backPopInfo.confirmText = '确认已提交'
},
handleBackPopupConfirm() {
this.showBackPopup = false
this.backPopInfo.confirmText = '确认已提交'
this.notifyH5AppBackPressed() this.notifyH5AppBackPressed()
}, },
navigateBack() { navigateBack() {
...@@ -544,4 +582,8 @@ export default { ...@@ -544,4 +582,8 @@ export default {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
::v-deep .prelearn-back-popup .study-popup-mask {
z-index: 9999999;
}
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!