Merge branch 'feat/camcard' into dev/1.0

This commit is contained in:
2026-10-28 08:47:15 +08:00
3 changed files with 223 additions and 5 deletions

View File

@@ -0,0 +1,82 @@
<template>
<view :style="themeColor">
<!-- #ifndef MP-HARMONY -->
<view class="iconfont iconshang navigate-back" @click="navigateBack"></view>
<!-- #endif -->
<web-view :src="src" @titleUpdate="updateNavbarTitle"></web-view>
<!-- #ifdef MP-HARMONY -->
<cover-view class="iconfont iconshang navigate-back" @click="navigateBack"></cover-view>
<!-- #endif -->
<!-- 隐私弹窗 -->
<privacy-popup ref="privacyPopup"></privacy-popup>
</view>
</template>
<script>
import { decodeEntity } from '@/common/js/util.js';
/**
* 必须真机调试
* 在微信模拟器中,行为和真机不一样
* 1. 模拟器中,设置标题不生效,但是,在真机是可以的。
*/
export default {
data() {
return {
src: '',
title: '', // 标题栏标题
enableSetTitle: false, // 是否强制设置标题,用来替换Webview中的默认标题
};
},
onLoad(option) {
this.title = decodeURIComponent(option?.title ?? '');
this.enableSetTitle = decodeURIComponent(option?.enable_set_title) == 1;
// #ifdef H5
this.src = decodeEntity(decodeURIComponent(option.src));
// #endif
// #ifndef H5
this.src = decodeEntity(decodeURIComponent(`${option.src}&from=mp-webview`));
// #endif
},
onShow() {
this.updateNavbarTitle();
},
watch: {
title(newVal) {
this.updateNavbarTitle(newVal);
},
enableSetTitle() {
this.updateNavbarTitle();
}
},
methods: {
navigateBack() {
uni.navigateBack({
delta: 1
});
},
updateNavbarTitle(newTitle) {
const title = newTitle ?? this.title;
if (this.enableSetTitle) {
uni.setNavigationBarTitle({title});
}
}
}
};
</script>
<style lang="scss">
.navigate-back {
position: absolute;
top: 34rpx;
left: 34rpx;
z-index: 5;
font-size: $font-size-toolbar;
}
</style>