Commit cc39e508 by 岑成威

fix:webview样式

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