Commit cc39e508 by 岑成威

fix:webview样式

1 parent f3aa22bb
......@@ -399,6 +399,10 @@ export default {
},
handleStudyPermissionConfirm() {
this.showStudyPermissionPopup = false
if (this.lockReason == '2') {
uni.navigateTo({ url: '/pages/common/serviceDetail/index?moduleType=9' })
return
}
// 切换到学习中心 tab
const tabs = this.$refs.leftBox?.tabs
if (tabs) {
......
......@@ -28,7 +28,7 @@
<!-- 按钮 -->
<view class="goto-button" @click="handleGoToStudy">
去往学习中心
{{ lockReason == '2' ? '去往服务中心' : '去往学习中心' }}
</view>
</view>
</template>
......
......@@ -381,6 +381,10 @@ export default {
// 跳转学习中心
handleStudyPermissionConfirm() {
this.showStudyPermissionPopup = false
if (this.lockReason == '2') {
uni.navigateTo({ url: '/pages/common/serviceDetail/index?moduleType=9' })
return
}
uni.navigateBack({
success: () => {
setTimeout(() => {
......
......@@ -137,7 +137,7 @@ export default {
if (!noInterceptPage.includes(item.name) && (await this.checkDailyReport())) return
// 提示去学习中心弹窗
const res = await this.getLimitRecord()
if (res.lockOrder) {
if (!res.lockOrder) {
this.showStudyPermissionPopup = true
this.lockReason = res.lockReason
return
......@@ -197,13 +197,20 @@ export default {
// 跳转学习中心
handleStudyPermissionConfirm() {
this.showStudyPermissionPopup = false
uni.navigateBack({
console.log(this.lockReason,'lockReason')
if (this.lockReason == '2') {
uni.navigateTo({ url: '/pages/common/serviceDetail/index?moduleType=9' })
return
}else{
uni.navigateBack({
success: () => {
setTimeout(() => {
uni.$emit('studyCenter')
}, 100)
}
})
}
},
// 确认选择的月份
confirmMonth(month) {
......
......@@ -252,7 +252,8 @@
<learn-popup
ref="learn"
content="尚未完成复盘,\n是否退出?"
@confirm="backPage"
@cancel="handlePracticeExitCancel"
@confirm="handleBackConfirm"
/>
</view>
</template>
......@@ -298,6 +299,7 @@
rightBoxMode: 'knowledge',
practiceUrl: '',
practiceWv: null,
practiceWvStyle: null,
practiceSceneIndex: 1
}
},
......@@ -641,6 +643,16 @@
this.rightBoxMode = 'knowledge'
this.hidePracticeWebview()
},
handlePracticeExitCancel () {
// 继续学习:把 webview 复原到原位
// #ifdef APP-PLUS
if (this.practiceWv && this.practiceWvStyle) {
try {
this.practiceWv.setStyle(this.practiceWvStyle)
} catch (e) {}
}
// #endif
},
openPracticeWebview () {
// 仅 App-Plus 支持子 webview 方式嵌入指定区域
// #ifdef APP-PLUS
......@@ -674,13 +686,14 @@
const barH = (barRect && barRect.height)
? barRect.height
: (typeof uni.upx2px === 'function' ? uni.upx2px(120) : 0)
wv.setStyle({
this.practiceWvStyle = {
left: `${bodyRect.left}px`,
top: `${bodyRect.top + barH}px`,
width: `${bodyRect.width}px`,
height: `${Math.max(0, bodyRect.height - barH)}px`,
background: 'transparent'
})
}
wv.setStyle(this.practiceWvStyle)
wv.show()
// 用页面内 CSS 实现圆角(原生 webview 本身不可靠支持圆角裁剪)
try {
......@@ -890,14 +903,20 @@
},
handleBackConfirm () {
this.closePracticeWebview()
this.backPage()
},
back () {
const report = (this.courseDetail && Array.isArray(this.courseDetail.aiReviewReport))
? this.courseDetail.aiReviewReport
: []
const shouldBlockExit = !report.length || report.some(e => Number(e.examStatus) !== 2)
if (shouldBlockExit) this.learnRef.open()
else this.backPage()
// 先把 webview 移出可视区(如果存在)
// #ifdef APP-PLUS
if (this.practiceWv) {
try {
this.practiceWv.setStyle({ left: '-9999px', top: '-9999px' })
} catch (e) {}
}
// #endif
this.learnRef.open()
}
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!