修改webview
This commit is contained in:
parent
1601a3e4ae
commit
3586dc4a35
354
App.vue
354
App.vue
|
|
@ -1,201 +1,203 @@
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
globalData: {
|
globalData: {
|
||||||
NativeEvent: true,
|
NativeEvent: true,
|
||||||
recentNativeEvent: "", // 初始化一个全局变量
|
recentNativeEvent: "", // 初始化一个全局变量
|
||||||
recentNativeData: 0 // 初始化一个全局变量
|
recentNativeData: 0 // 初始化一个全局变量
|
||||||
},
|
},
|
||||||
onLaunch: function (options) {
|
onLaunch: function(options) {
|
||||||
|
|
||||||
// console.log=()=>{}
|
// console.log=()=>{}
|
||||||
// === wgt 包启动诊断日志 ===
|
// === wgt 包启动诊断日志 ===
|
||||||
console.log('=== App Launch 开始 ===')
|
console.log('=== App Launch 开始 ===')
|
||||||
console.log('启动参数:', JSON.stringify(options))
|
console.log('启动参数:', JSON.stringify(options))
|
||||||
console.log('环境:', process.env.NODE_ENV)
|
console.log('环境:', process.env.NODE_ENV)
|
||||||
|
|
||||||
|
|
||||||
uni.setStorageSync('onNativeEventReceive', "no")
|
uni.setStorageSync('onNativeEventReceive', "no")
|
||||||
// 清除上次遗留的跳转指令,防止正常启动时自动跳转
|
// 清除上次遗留的跳转指令,防止正常启动时自动跳转
|
||||||
uni.removeStorageSync('jumpTarget_url');
|
uni.removeStorageSync('jumpTarget_url');
|
||||||
const startTime = Date.now()
|
const startTime = Date.now()
|
||||||
|
|
||||||
// 1. 获取并存储系统信息(只获取一次)
|
// 1. 获取并存储系统信息(只获取一次)
|
||||||
const systemInfo = uni.getSystemInfoSync()
|
const systemInfo = uni.getSystemInfoSync()
|
||||||
uni.setStorageSync('systemInfo', {
|
uni.setStorageSync('systemInfo', {
|
||||||
platform: systemInfo.platform,
|
platform: systemInfo.platform,
|
||||||
system: systemInfo.system,
|
system: systemInfo.system,
|
||||||
osName: systemInfo.osName,
|
osName: systemInfo.osName,
|
||||||
osVersion: systemInfo.osVersion,
|
osVersion: systemInfo.osVersion,
|
||||||
statusBarHeight: systemInfo.statusBarHeight,
|
statusBarHeight: systemInfo.statusBarHeight,
|
||||||
windowWidth: systemInfo.windowWidth,
|
windowWidth: systemInfo.windowWidth,
|
||||||
windowHeight: systemInfo.windowHeight,
|
windowHeight: systemInfo.windowHeight,
|
||||||
isIOS: systemInfo.platform === 'ios',
|
isIOS: systemInfo.platform === 'ios',
|
||||||
isAndroid: systemInfo.platform === 'android'
|
isAndroid: systemInfo.platform === 'android'
|
||||||
})
|
})
|
||||||
|
|
||||||
// 2. 立即设置宿主消息监听(避免错过消息)
|
// 2. 立即设置宿主消息监听(避免错过消息)
|
||||||
this.setupNativeEventListener()
|
this.setupNativeEventListener()
|
||||||
|
|
||||||
// 3. 同步初始化配置(必须完成)
|
// 3. 同步初始化配置(必须完成)
|
||||||
this.initConfig(options)
|
this.initConfig(options)
|
||||||
|
|
||||||
// 启动完成
|
// 启动完成
|
||||||
console.log(`=== App 启动完成,耗时: ${Date.now() - startTime}ms ===`)
|
console.log(`=== App 启动完成,耗时: ${Date.now() - startTime}ms ===`)
|
||||||
|
|
||||||
// 初始化埋点,进入支付宝模拟器首页
|
// 初始化埋点,进入支付宝模拟器首页
|
||||||
this.$apiUserEvent('all', {
|
this.$apiUserEvent('all', {
|
||||||
type: 'event',
|
type: 'event',
|
||||||
key: 'index',
|
key: 'index',
|
||||||
value: "进入支付宝模拟器首页",
|
value: "进入支付宝模拟器首页",
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
onShow: function () {
|
onShow: function() {
|
||||||
console.log('App Show')
|
console.log('App Show')
|
||||||
// 监听已在 onLaunch 中设置,这里不再重复
|
// 监听已在 onLaunch 中设置,这里不再重复
|
||||||
},
|
},
|
||||||
|
|
||||||
onHide: function () {
|
onHide: function() {
|
||||||
console.log('App Hide')
|
console.log('App Hide')
|
||||||
},
|
},
|
||||||
onExit: function () {
|
onExit: function() {
|
||||||
// 关闭数据库
|
// 关闭数据库
|
||||||
// #ifdef APP
|
// #ifdef APP
|
||||||
// plus.sqlite.closeDatabase({ name: 'zyds' })
|
// plus.sqlite.closeDatabase({ name: 'zyds' })
|
||||||
uni.sendNativeEvent('unimp_stop_alipay', "stop", ret => {
|
uni.sendNativeEvent('unimp_stop_alipay', "stop", ret => {
|
||||||
// console.log('宿主App回传的数据:' + ret);
|
// console.log('宿主App回传的数据:' + ret);
|
||||||
});
|
});
|
||||||
// #endif
|
// #endif
|
||||||
console.log('App onExit')
|
console.log('App onExit')
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
/**
|
/**
|
||||||
* 设置宿主消息监听(在 onLaunch 中调用)
|
* 设置宿主消息监听(在 onLaunch 中调用)
|
||||||
*/
|
*/
|
||||||
setupNativeEventListener() {
|
setupNativeEventListener() {
|
||||||
if (this.globalData.NativeEvent) {
|
if (this.globalData.NativeEvent) {
|
||||||
this.globalData.NativeEvent = false
|
this.globalData.NativeEvent = false
|
||||||
console.log('开始监听宿主消息')
|
console.log('开始监听宿主消息')
|
||||||
|
|
||||||
if (typeof uni.onNativeEventReceive === 'function') {
|
if (typeof uni.onNativeEventReceive === 'function') {
|
||||||
uni.onNativeEventReceive((event, data) => {
|
uni.onNativeEventReceive((event, data) => {
|
||||||
if (event) {
|
if (event) {
|
||||||
console.log('接收到宿主消息:', event, data)
|
console.log('接收到宿主消息:', event, data)
|
||||||
|
|
||||||
if (event == "token") {
|
if (event == "token") {
|
||||||
let header = uni.getStorageSync('header') || {}
|
let header = uni.getStorageSync('header') || {}
|
||||||
header["x-token"] = data
|
header["x-token"] = data
|
||||||
uni.setStorageSync('header', header)
|
uni.setStorageSync('header', header)
|
||||||
console.log('已更新 token')
|
console.log('已更新 token')
|
||||||
|
|
||||||
//获取宿主用户信息
|
//获取宿主用户信息
|
||||||
try {
|
try {
|
||||||
this.$getUserInfo()
|
this.$getUserInfo()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('获取用户信息失败:', error)
|
console.error('获取用户信息失败:', error)
|
||||||
|
}
|
||||||
|
} else if (event == "jump") {
|
||||||
|
if (data) {
|
||||||
|
console.log('接收到跳转指令,已缓存目标地址:', data);
|
||||||
|
uni.setStorageSync('jumpTarget_url', data);
|
||||||
|
// 强制重定向到首页,触发onShow获取用户信息后再跳转
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/index/index'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if (event == 'wx_pay_result' || event == 'ios_pay_result') {
|
||||||
|
this.globalData.recentNativeEvent = event
|
||||||
|
this.globalData.recentNativeData = data
|
||||||
}
|
}
|
||||||
} else if (event == "jump") {
|
|
||||||
if (data) {
|
|
||||||
console.log('接收到跳转指令,已缓存目标地址:', data);
|
|
||||||
uni.setStorageSync('jumpTarget_url', data);
|
|
||||||
// 强制重定向到首页,触发onShow获取用户信息后再跳转
|
|
||||||
uni.reLaunch({
|
|
||||||
url: '/pages/index/index'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else if (event == 'wx_pay_result' || event == 'ios_pay_result') {
|
|
||||||
this.globalData.recentNativeEvent = event
|
|
||||||
this.globalData.recentNativeData = data
|
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
} else {
|
||||||
} else {
|
console.log('uni.onNativeEventReceive 不可用,跳过监听')
|
||||||
console.log('uni.onNativeEventReceive 不可用,跳过监听')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始化应用配置
|
|
||||||
*/
|
|
||||||
initConfig(options) {
|
|
||||||
console.log('=== 配置初始化 ===')
|
|
||||||
|
|
||||||
// 检查是否有外部传入的配置数据
|
|
||||||
const hasExtraData = options?.referrerInfo?.extraData &&
|
|
||||||
JSON.stringify(options.referrerInfo.extraData) !== '{}'
|
|
||||||
|
|
||||||
console.log('宿主是否传递配置:', hasExtraData)
|
|
||||||
|
|
||||||
if (hasExtraData) {
|
|
||||||
console.log('→ 使用宿主 extraData')
|
|
||||||
this.initFromExtraData(options.referrerInfo.extraData)
|
|
||||||
} else {
|
|
||||||
console.log('→ 宿主未传递配置,使用默认配置')
|
|
||||||
// ⚠️ 关键修改:不再强制退出,使用默认配置
|
|
||||||
this.initDevelopmentConfig()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 从外部数据初始化配置
|
|
||||||
*/
|
|
||||||
initFromExtraData(extraData) {
|
|
||||||
// 批量设置 Storage,减少 I/O 次数
|
|
||||||
const storageData = {
|
|
||||||
host: extraData.host,
|
|
||||||
header: {
|
|
||||||
"x-token": extraData['x-token'],
|
|
||||||
"x-version": extraData['x-version'],
|
|
||||||
"x-platform": extraData['x-platform'],
|
|
||||||
"x-device-id": extraData['x-device-id'],
|
|
||||||
"x-mobile-brand": extraData['x-mobile-brand'],
|
|
||||||
"x-mobile-model": extraData['x-mobile-model'],
|
|
||||||
"x-channel": extraData['x-channel'],
|
|
||||||
"x-package": extraData['x-package'],
|
|
||||||
"x-click-id": extraData['x-click-id'],
|
|
||||||
// #ifdef APP-PLUS
|
|
||||||
"header": {
|
|
||||||
"version": this.$version,
|
|
||||||
}
|
}
|
||||||
// #endif
|
}
|
||||||
},
|
},
|
||||||
encrypt: extraData['encrypt'],
|
|
||||||
decrypt: extraData['decrypt']
|
/**
|
||||||
|
* 初始化应用配置
|
||||||
|
*/
|
||||||
|
initConfig(options) {
|
||||||
|
console.log('=== 配置初始化 ===')
|
||||||
|
|
||||||
|
// 检查是否有外部传入的配置数据
|
||||||
|
const hasExtraData = options?.referrerInfo?.extraData &&
|
||||||
|
JSON.stringify(options.referrerInfo.extraData) !== '{}'
|
||||||
|
|
||||||
|
console.log('宿主是否传递配置:', hasExtraData)
|
||||||
|
|
||||||
|
if (hasExtraData) {
|
||||||
|
console.log('→ 使用宿主 extraData')
|
||||||
|
this.initFromExtraData(options.referrerInfo.extraData)
|
||||||
|
} else {
|
||||||
|
console.log('→ 宿主未传递配置,使用默认配置')
|
||||||
|
// ⚠️ 关键修改:不再强制退出,使用默认配置
|
||||||
|
this.initDevelopmentConfig()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从外部数据初始化配置
|
||||||
|
*/
|
||||||
|
initFromExtraData(extraData) {
|
||||||
|
// 批量设置 Storage,减少 I/O 次数
|
||||||
|
const storageData = {
|
||||||
|
host: extraData.host,
|
||||||
|
header: {
|
||||||
|
"x-token": extraData['x-token'],
|
||||||
|
"x-version": extraData['x-version'],
|
||||||
|
"x-platform": extraData['x-platform'],
|
||||||
|
"x-device-id": extraData['x-device-id'],
|
||||||
|
"x-mobile-brand": extraData['x-mobile-brand'],
|
||||||
|
"x-mobile-model": extraData['x-mobile-model'],
|
||||||
|
"x-channel": extraData['x-channel'],
|
||||||
|
"x-package": extraData['x-package'],
|
||||||
|
"x-click-id": extraData['x-click-id'],
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
"header": {
|
||||||
|
"version": this.$version,
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
},
|
||||||
|
encrypt: extraData['encrypt'],
|
||||||
|
decrypt: extraData['decrypt']
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量写入
|
||||||
|
Object.keys(storageData).forEach(key => {
|
||||||
|
uni.setStorageSync(key, storageData[key])
|
||||||
|
})
|
||||||
|
if (extraData['isCombo']) {
|
||||||
|
uni.setStorageSync('isCombo', extraData['isCombo'])
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化开发环境配置(也作为默认配置)
|
||||||
|
*/
|
||||||
|
initDevelopmentConfig() {
|
||||||
|
console.log('初始化默认配置')
|
||||||
|
|
||||||
|
// 批量设置开发环境配置
|
||||||
|
const devConfig = {
|
||||||
|
host: "https://flaunt.batiao8.com/",
|
||||||
|
header: {
|
||||||
|
"x-token": "ebe42caa-845a-4cb2-a324-18abe8ced7c0"
|
||||||
|
},
|
||||||
|
decrypt: "e4rOtnF8tJjtHO7ecZeJHN1rapED5ImB",
|
||||||
|
encrypt: "xn08hYoizXhZ1zHP8DVqfCm2yHxPmhil"
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.keys(devConfig).forEach(key => {
|
||||||
|
uni.setStorageSync(key, devConfig[key])
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log('默认配置初始化完成')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 批量写入
|
|
||||||
Object.keys(storageData).forEach(key => {
|
|
||||||
uni.setStorageSync(key, storageData[key])
|
|
||||||
})
|
|
||||||
if (extraData['isCombo']) {
|
|
||||||
uni.setStorageSync('isCombo', extraData['isCombo'])
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始化开发环境配置(也作为默认配置)
|
|
||||||
*/
|
|
||||||
initDevelopmentConfig() {
|
|
||||||
console.log('初始化默认配置')
|
|
||||||
|
|
||||||
// 批量设置开发环境配置
|
|
||||||
const devConfig = {
|
|
||||||
host: "https://flaunt.batiao8.com/",
|
|
||||||
header: { "x-token": "da884e6e-fbd7-4d8d-ab0e-cb7b07f9f6fa" },
|
|
||||||
decrypt: "e4rOtnF8tJjtHO7ecZeJHN1rapED5ImB",
|
|
||||||
encrypt: "xn08hYoizXhZ1zHP8DVqfCm2yHxPmhil"
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.keys(devConfig).forEach(key => {
|
|
||||||
uni.setStorageSync(key, devConfig[key])
|
|
||||||
})
|
|
||||||
|
|
||||||
console.log('默认配置初始化完成')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
||||||
2
main.js
2
main.js
|
|
@ -29,7 +29,7 @@ export function createApp() {
|
||||||
app.config.globalProperties.$system = plus.os.name;
|
app.config.globalProperties.$system = plus.os.name;
|
||||||
// #endif
|
// #endif
|
||||||
app.config.globalProperties.$systemInfo = systemInfo
|
app.config.globalProperties.$systemInfo = systemInfo
|
||||||
uni.setStorageSync('version', '1.0.4.sp21')
|
uni.setStorageSync('version', '1.0.4.sp23')
|
||||||
app.config.globalProperties.$version = uni.getStorageSync('version')
|
app.config.globalProperties.$version = uni.getStorageSync('version')
|
||||||
app.use(globalMethods);
|
app.use(globalMethods);
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
|
|
@ -1,134 +1,151 @@
|
||||||
<!-- pages/webview/webview.vue -->
|
<!-- pages/webview/webview.vue -->
|
||||||
<template>
|
<template>
|
||||||
<view class="webview-container">
|
<view class="webview-container">
|
||||||
<navBar class="nav-bar" :title="pageTitle" :bgColor="data.navBar.bgColor" isBack></navBar>
|
<navBar class="nav-bar" :title="pageTitle" :bgColor="data.navBar.bgColor" isBack>
|
||||||
|
<template v-if="isClose" v-slot:right>
|
||||||
|
<image style="width:22px;height: 22px;" src='/static/image/close.png' @click="onConfirm()"></image>
|
||||||
|
</template>
|
||||||
|
</navBar>
|
||||||
<web-view :src="url" :webview-styles="webviewStyles"></web-view>
|
<web-view :src="url" :webview-styles="webviewStyles"></web-view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
// 自定义头部
|
// 自定义头部
|
||||||
// import ZdyNavbar from "@/components/navbar/navbar.vue"
|
// import ZdyNavbar from "@/components/navbar/navbar.vue"
|
||||||
import navBar from '@/components/nav-bar/nav-bar.vue'
|
import navBar from '@/components/nav-bar/nav-bar.vue'
|
||||||
import { util } from '@/utils/common.js'
|
import {
|
||||||
|
util
|
||||||
|
} from '@/utils/common.js'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ref,
|
ref,
|
||||||
reactive,
|
reactive,
|
||||||
watch,
|
watch,
|
||||||
nextTick,
|
nextTick,
|
||||||
getCurrentInstance,
|
getCurrentInstance,
|
||||||
onMounted,
|
onMounted,
|
||||||
onBeforeUnmount,
|
onBeforeUnmount,
|
||||||
toRefs,
|
toRefs,
|
||||||
computed
|
computed
|
||||||
} from "vue";
|
} from "vue";
|
||||||
import {
|
import {
|
||||||
onLoad,
|
onLoad,
|
||||||
onReady,
|
onReady,
|
||||||
onShow
|
onShow
|
||||||
} from '@dcloudio/uni-app'
|
} from '@dcloudio/uni-app'
|
||||||
|
|
||||||
const data = reactive({
|
const data = reactive({
|
||||||
navBar: {
|
navBar: {
|
||||||
title: "",
|
title: "",
|
||||||
bgColor: '#ffffff',
|
bgColor: '#ffffff',
|
||||||
},
|
},
|
||||||
dark: "dark",
|
dark: "dark",
|
||||||
// 状态栏高度
|
// 状态栏高度
|
||||||
systemBarHeight: "0",
|
systemBarHeight: "0",
|
||||||
})
|
isClose: false
|
||||||
|
})
|
||||||
|
|
||||||
let {
|
let {
|
||||||
systemBarHeight
|
systemBarHeight,
|
||||||
} = toRefs(data)
|
isClose
|
||||||
|
} = toRefs(data)
|
||||||
|
|
||||||
const url = ref('')
|
const url = ref('')
|
||||||
const pageTitle = ref('')
|
const pageTitle = ref('')
|
||||||
|
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
uni.getSystemInfo({
|
if (options.isClose) {
|
||||||
success: res => {
|
isClose.value = options.isClose
|
||||||
systemBarHeight.value = res.statusBarHeight; // 获取状态栏高度
|
}
|
||||||
|
uni.getSystemInfo({
|
||||||
|
success: res => {
|
||||||
|
systemBarHeight.value = res.statusBarHeight; // 获取状态栏高度
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (options.url) {
|
||||||
|
url.value = decodeURIComponent(options.url)
|
||||||
|
// const videoExps = [/\.mp4$/i, /\.m3u8$/i, /\.flv$/i, /\.avi$/i, /\.mov$/i, /\.wmv$/i, /\.webm$/i,
|
||||||
|
// /\.mkv$/i
|
||||||
|
// ];
|
||||||
|
// const isVideo = videoExps.some(exp => exp.test(url.value))
|
||||||
|
// console.log(isVideo)
|
||||||
|
// if (isVideo) {
|
||||||
|
// plus.navigator.setStatusBarStyle("light");
|
||||||
|
// } else {
|
||||||
|
// plus.navigator.setStatusBarStyle("dark");
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
console.log("options参数", options);
|
||||||
|
if (options.title) {
|
||||||
|
console.log("标题", options.title);
|
||||||
|
pageTitle.value = decodeURIComponent(options.title)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (options.url) {
|
|
||||||
url.value = decodeURIComponent(options.url)
|
onShow(() => {
|
||||||
// const videoExps = [/\.mp4$/i, /\.m3u8$/i, /\.flv$/i, /\.avi$/i, /\.mov$/i, /\.wmv$/i, /\.webm$/i,
|
// #ifdef APP-PLUS
|
||||||
// /\.mkv$/i
|
util.setAndroidSystemBarColor('#ffffff')
|
||||||
// ];
|
setTimeout(() => {
|
||||||
// const isVideo = videoExps.some(exp => exp.test(url.value))
|
plus.navigator.setStatusBarStyle("dark");
|
||||||
// console.log(isVideo)
|
}, 500);
|
||||||
// if (isVideo) {
|
// #endif
|
||||||
// plus.navigator.setStatusBarStyle("light");
|
})
|
||||||
// } else {
|
|
||||||
// plus.navigator.setStatusBarStyle("dark");
|
const onConfirm = () => {
|
||||||
// }
|
uni.reLaunch({
|
||||||
|
url: '/pages/index/index'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
console.log("options参数", options);
|
|
||||||
if (options.title) {
|
const goBack = () => {
|
||||||
console.log("标题", options.title);
|
uni.navigateBack()
|
||||||
pageTitle.value = decodeURIComponent(options.title)
|
|
||||||
}
|
}
|
||||||
})
|
|
||||||
|
|
||||||
onShow(() => {
|
const isVideo = computed(() => {
|
||||||
// #ifdef APP-PLUS
|
if (!url.value) return false
|
||||||
util.setAndroidSystemBarColor('#ffffff')
|
const videoExps = [/\.mp4$/i, /\.m3u8$/i, /\.flv$/i, /\.avi$/i, /\.mov$/i, /\.wmv$/i, /\.webm$/i,
|
||||||
setTimeout(() => {
|
/\.mkv$/i
|
||||||
plus.navigator.setStatusBarStyle("dark");
|
];
|
||||||
}, 500);
|
return videoExps.some(exp => exp.test(url.value));
|
||||||
// #endif
|
})
|
||||||
})
|
|
||||||
|
|
||||||
const goBack = () => {
|
const webviewStyles = computed(() => {
|
||||||
uni.navigateBack()
|
return {
|
||||||
}
|
top: `${Number(systemBarHeight.value) + 40}px`,
|
||||||
|
bottom: '0px',
|
||||||
const isVideo = computed(() => {
|
'padding-bottom': '20px'
|
||||||
if (!url.value) return false
|
}
|
||||||
const videoExps = [/\.mp4$/i, /\.m3u8$/i, /\.flv$/i, /\.avi$/i, /\.mov$/i, /\.wmv$/i, /\.webm$/i,
|
})
|
||||||
/\.mkv$/i
|
|
||||||
];
|
|
||||||
return videoExps.some(exp => exp.test(url.value));
|
|
||||||
})
|
|
||||||
|
|
||||||
const webviewStyles = computed(() => {
|
|
||||||
return {
|
|
||||||
top: `${Number(systemBarHeight.value) + 40}px`,
|
|
||||||
bottom: '0px',
|
|
||||||
'padding-bottom': '20px'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.webview-container {
|
.webview-container {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
padding: 20rpx;
|
padding: 20rpx;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-bottom: 1rpx solid #eee;
|
border-bottom: 1rpx solid #eee;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-size: 32rpx;
|
font-size: 32rpx;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.video-web {
|
.video-web {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: #000;
|
background-color: #000;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<style>
|
<style>
|
||||||
page {
|
page {
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
@ -529,7 +529,7 @@ const clickNotice = () => {
|
||||||
console.log("点击公告", noticeInfo.value)
|
console.log("点击公告", noticeInfo.value)
|
||||||
if (!noticeInfo.value.url) return
|
if (!noticeInfo.value.url) return
|
||||||
const url = noticeInfo.value.url + `&uni_id=${userInfo.value.user_id}`
|
const url = noticeInfo.value.url + `&uni_id=${userInfo.value.user_id}`
|
||||||
util.goPage(`/pages/common/webview/webview?url=${encodeURIComponent(url)}&title=${noticeInfo.value.title}`)
|
util.goPage(`/pages/common/webview/webview?url=${encodeURIComponent(url)}&title=${noticeInfo.value.title}&isClose=${true}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 339 B |
Loading…
Reference in New Issue