Commit 28a9d665 by 胡悦

feat(学习中心): 统一学习弹窗事件处理并优化UI样式

重构学习中心各页面的返回事件处理,统一使用showStudyPopup事件并添加type参数区分不同类型
优化进度条显示逻辑,添加最小宽度防止显示异常
更新无数据状态的图片和样式,统一使用common/noData.png
移除不再使用的showExamSubmitPopup事件及相关代码
1 parent 265c15a3

2.92 MB | W: | H:

2.92 MB | W: | H:

assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
<view class="task-item-text"> <view class="task-item-text">
<view class="task-item-label">任务进度</view> <view class="task-item-label">任务进度</view>
<view class="task-item-progress"> <view class="task-item-progress">
<view class="task-item-progress-bar" :style="{ width: Math.floor(item.process) + '%' }"></view> <view class="task-item-progress-bar" :style="{ width: item.process + '%', minWidth: item.process > 0 ? '10px' : '0' }"></view>
<view class="task-item-progress-text">{{ Math.floor(item.process) }}%</view> <view class="task-item-progress-text">{{ item.process }}%</view>
</view> </view>
</view> </view>
</view> </view>
...@@ -383,24 +383,26 @@ export default { ...@@ -383,24 +383,26 @@ export default {
height: 100%; height: 100%;
background: linear-gradient(128.8deg, #75bcff 0%, #2c66f7 100%); background: linear-gradient(128.8deg, #75bcff 0%, #2c66f7 100%);
border-radius: toRpx(8); border-radius: toRpx(8);
min-width: toRpx(20);
} }
} }
} }
} }
.nothing { .nothing {
width: 100%; display: flex;
flex-direction: column; align-items: center;
margin-top: toRpx(270); justify-content: center;
font-size: toRpx(28); flex-direction: column;
color: #999999; height: toRpx(1000);
color: #999999;
.icon { font-size: toRpx(24);
width: toRpx(678);
height: toRpx(284); .icon {
margin-bottom: toRpx(24); width: toRpx(344);
height: toRpx(208);
}
} }
}
.end-text { .end-text {
color: #999; color: #999;
......
...@@ -190,20 +190,25 @@ export default { ...@@ -190,20 +190,25 @@ export default {
}, },
created() { created() {
// 在组件创建时就开始监听,确保事件能被捕获 // 在组件创建时就开始监听,确保事件能被捕获
uni.$on('showExamSubmitPopup', () => { // uni.$on('showExamSubmitPopup', () => {
console.log('接收到考试提交弹窗事件') // console.log('接收到考试提交弹窗事件')
this.showExamPopup = true // this.showExamPopup = true
}) // })
uni.$on('showStudyPopup', (obj) => { uni.$on('showStudyPopup', (obj) => {
console.log('接收到学习弹窗事件', obj) console.log('接收到学习弹窗事件', obj)
// 查询是否有等级考试 if (obj.type === 'examSubmit') {
this.getLevelExamInfo() this.showExamPopup = true
} else if (obj.type === 'getLevelExamInfo') {
// 查询是否有等级考试
this.getLevelExamInfo()
}
}) })
}, },
beforeDestroy() { beforeDestroy() {
// 组件销毁前移除监听 // 组件销毁前移除监听
uni.$off('showExamSubmitPopup')
uni.$off('showStudyPopup') uni.$off('showStudyPopup')
// uni.$off('showStudyPopup')
}, },
mounted() { mounted() {
const userInfo = uni.$storage.get('userInfo') || {} const userInfo = uni.$storage.get('userInfo') || {}
...@@ -547,10 +552,13 @@ export default { ...@@ -547,10 +552,13 @@ export default {
if (!noInterceptPage.includes(item.name)) { if (!noInterceptPage.includes(item.name)) {
if (sceneType != 7) { if (sceneType != 7) {
if (await this.inspectionOfProhibitionBill()) return if (await this.inspectionOfProhibitionBill()) return
// if (await this.getLimitRecord()) { // 检查是否限制录单
// this.showStudyPermissionPopup = true const res = await this.getLimitRecord()
// return if (res.lockOrder) {
// } this.showStudyPermissionPopup = true
this.lockReason = res.lockReason
return
}
} }
if (await this.checkDailyReport(sceneType != 7)) return if (await this.checkDailyReport(sceneType != 7)) return
} }
......
...@@ -254,14 +254,6 @@ export default { ...@@ -254,14 +254,6 @@ export default {
const data = await uni.$api.commonApi.getLimitRecord() const data = await uni.$api.commonApi.getLimitRecord()
if (data) if (data)
console.log(data, '限制录单') console.log(data, '限制录单')
// uni.showModal({
// title: '温馨提示',
// content: '您已到学习次数上限,禁止录单!\n请在平板电脑上展业助手-学习中心完成学习。',
// showCancel: false,
// cancelColor: '#292D33',
// confirmText: '确定',
// confirmColor: '#347BFF'
// })
return Promise.resolve(data) return Promise.resolve(data)
}, },
} }
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
<view class="task-item-text"> <view class="task-item-text">
<view class="task-item-label">任务进度</view> <view class="task-item-label">任务进度</view>
<view class="task-item-progress" v-if="item.completeStatus == 0"> <view class="task-item-progress" v-if="item.completeStatus == 0">
<view class="task-item-progress-bar" :style="{ width: Math.floor(item.taskProgress) + '%' }"></view> <view class="task-item-progress-bar" :style="{ width: Math.floor(item.taskProgress) + '%', minWidth: item.taskProgress > 0 ? '10px' : '0' }"></view>
<view class="task-item-progress-text">{{ Math.floor(item.taskProgress) }}%</view> <view class="task-item-progress-text">{{ Math.floor(item.taskProgress) }}%</view>
</view> </view>
<view class="task-item-value" v-else><view class="dot-value"></view><view class="green">已完成</view></view> <view class="task-item-value" v-else><view class="dot-value"></view><view class="green">已完成</view></view>
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
</template> </template>
<template v-else> <template v-else>
<view class="nothing flex"> <view class="nothing flex">
<image class="icon" src="../../../../assets/images/boutique/nothing.png" /> <image class="icon" src="../../../../assets/images/common/noData.png" />
暂无数据 暂无数据
</view> </view>
</template> </template>
...@@ -599,15 +599,17 @@ export default { ...@@ -599,15 +599,17 @@ export default {
} }
} }
.nothing { .nothing {
width: 100%; display: flex;
align-items: center;
justify-content: center;
flex-direction: column; flex-direction: column;
margin-top: toRpx(270); height: toRpx(1000);
font-size: toRpx(28);
color: #999999; color: #999999;
font-size: toRpx(24);
.icon { .icon {
width: toRpx(678); width: toRpx(344);
height: toRpx(284); height: toRpx(208);
margin-bottom: toRpx(24);
} }
} }
.end-text { .end-text {
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
</template> </template>
<template v-else> <template v-else>
<view class="nothing flex"> <view class="nothing flex">
<image class="icon" src="../../../../assets/images/boutique/nothing.png" /> <image class="icon" src="../../../../assets/images/common/noData.png" />
暂无数据 暂无数据
</view> </view>
</template> </template>
...@@ -130,7 +130,7 @@ export default { ...@@ -130,7 +130,7 @@ export default {
.recommend-course-item-img { .recommend-course-item-img {
width: 100%; width: 100%;
height: toRpx(180); height: toRpx(180);
border-radius: toRpx(16) toRpx(16) 0 0; border-radius: toRpx(24) toRpx(24) 0 0;
} }
.recommend-course-content { .recommend-course-content {
padding: toRpx(32); padding: toRpx(32);
...@@ -157,15 +157,17 @@ export default { ...@@ -157,15 +157,17 @@ export default {
} }
} }
.nothing { .nothing {
width: 100%; display: flex;
align-items: center;
justify-content: center;
flex-direction: column; flex-direction: column;
margin-top: toRpx(380); height: toRpx(1000);
font-size: toRpx(28);
color: #999999; color: #999999;
font-size: toRpx(24);
.icon { .icon {
width: toRpx(678); width: toRpx(344);
height: toRpx(284); height: toRpx(208);
margin-bottom: toRpx(24);
} }
} }
.end-text { .end-text {
......
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
<view class="task-item-text"> <view class="task-item-text">
<view class="task-item-label">任务进度</view> <view class="task-item-label">任务进度</view>
<view class="task-item-progress"> <view class="task-item-progress">
<view class="task-item-progress-bar" :style="{ width: Math.floor(item.process) + '%' }"></view> <view class="task-item-progress-bar" :style="{ width: item.process + '%', minWidth: item.process > 0 ? '10px' : '0' }"></view>
<view class="task-item-progress-text">{{ Math.floor(item.process) }}%</view> <view class="task-item-progress-text">{{ item.process }}%</view>
</view> </view>
</view> </view>
</view> </view>
......
...@@ -261,7 +261,7 @@ export default { ...@@ -261,7 +261,7 @@ export default {
.recommend-course-item-img { .recommend-course-item-img {
width: 100%; width: 100%;
height: toRpx(180); height: toRpx(180);
border-radius: toRpx(16) toRpx(16) 0 0; border-radius: toRpx(24) toRpx(24) 0 0;
} }
.recommend-course-content { .recommend-course-content {
......
...@@ -101,12 +101,12 @@ export default { ...@@ -101,12 +101,12 @@ export default {
}, },
methods: { methods: {
backPage() { backPage() {
// const currentWebview = this.$scope.$getAppWebview().children()[0]; const currentWebview = this.$scope.$getAppWebview().children()[0];
// if(currentWebview){ if(currentWebview){
// currentWebview.close() currentWebview.close()
// } }
// 点击返回按钮,触发学习弹窗事件 // 点击返回按钮,触发学习弹窗事件
uni.$emit('showStudyPopup', {name: 'courseDetail'}) uni.$emit('showStudyPopup', {name: 'courseDetail', type: 'getLevelExamInfo'})
uni.navigateBack() uni.navigateBack()
}, },
async openCourse(index, item) { async openCourse(index, item) {
......
...@@ -96,7 +96,7 @@ export default { ...@@ -96,7 +96,7 @@ export default {
methods: { methods: {
back() { back() {
// 点击返回按钮,触发学习弹窗事件 // 点击返回按钮,触发学习弹窗事件
uni.$emit('showStudyPopup', {name: 'leaderboard'}) uni.$emit('showStudyPopup', {name: 'leaderboard', type: 'getLevelExamInfo'})
uni.navigateBack() uni.navigateBack()
}, },
switchTab(index) { switchTab(index) {
......
...@@ -61,7 +61,9 @@ export default { ...@@ -61,7 +61,9 @@ export default {
{ label: '正在学习', count: '0', key: 'learningCount' }, { label: '正在学习', count: '0', key: 'learningCount' },
{ label: '已学完', count: '0', key: 'completedCount' } { label: '已学完', count: '0', key: 'completedCount' }
], ],
residueInfo: {} residueInfo: {
remindType: 0
}
} }
}, },
mounted() { mounted() {
...@@ -73,7 +75,7 @@ export default { ...@@ -73,7 +75,7 @@ export default {
methods: { methods: {
back() { back() {
// 点击返回按钮,触发学习弹窗事件 // 点击返回按钮,触发学习弹窗事件
uni.$emit('showStudyPopup', {name: 'myCourse'}) uni.$emit('showStudyPopup', {name: 'myCourse', type: 'getLevelExamInfo'})
uni.navigateBack() uni.navigateBack()
}, },
switchTab(index) { switchTab(index) {
......
...@@ -70,7 +70,7 @@ export default { ...@@ -70,7 +70,7 @@ export default {
methods: { methods: {
back() { back() {
// 点击返回按钮,触发学习弹窗事件 // 点击返回按钮,触发学习弹窗事件
uni.$emit('showStudyPopup', {name: 'myExam'}) uni.$emit('showStudyPopup', {name: 'myExam', type: 'getLevelExamInfo'})
uni.navigateBack() uni.navigateBack()
}, },
switchTab(index) { switchTab(index) {
......
...@@ -124,7 +124,7 @@ ...@@ -124,7 +124,7 @@
methods: { methods: {
back() { back() {
// 点击返回按钮,触发学习弹窗事件 // 点击返回按钮,触发学习弹窗事件
uni.$emit('showStudyPopup', {name: 'myTask'}) uni.$emit('showStudyPopup', {name: 'myTask', type: 'getLevelExamInfo'})
uni.navigateBack() uni.navigateBack()
}, },
goToMyTask() { goToMyTask() {
......
...@@ -166,7 +166,10 @@ export default { ...@@ -166,7 +166,10 @@ export default {
console.log('返回成功,触发弹窗事件') console.log('返回成功,触发弹窗事件')
// 延迟触发事件,确保页面已经返回 // 延迟触发事件,确保页面已经返回
setTimeout(() => { setTimeout(() => {
uni.$emit('showExamSubmitPopup') // uni.$emit('showExamSubmitPopup')
uni.$emit('showStudyPopup', {
type: 'examSubmit'
})
}, 100) }, 100)
} }
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!