调试模式 不显示二维码

解决跨域问题
This commit is contained in:
hawk86104 2025-03-12 08:16:21 +08:00
parent 9a1e020905
commit 7b9a415d58
4 changed files with 19 additions and 14 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.uni=n()}(this,function(){"use strict";var e={},a=[],n=function(e,n){if(0===a.length){var i=plus.webview.currentWebview();if(!i)throw new Error("plus.webview.currentWebview() is undefined");var t=i.parent();if(!t)throw new Error("plus.webview.currentWebview().parent() is undefined");a.push(t.id)}var r=JSON.stringify({options:{timestamp:+new Date},name:e,arg:n});plus.webview.getLaunchWebview().evalJS('UniPlusBridge.subscribeHandler("WEB_INVOKE_APPSERVICE",'+r+","+JSON.stringify(a)+");")};e.navigateTo=function(){var e=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).url;n("navigateTo",{url:encodeURI(e)})},e.navigateBack=function(){var e=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).delta;n("navigateBack",{delta:parseInt(e)||1})},e.switchTab=function(){var e=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).url;n("switchTab",{url:encodeURI(e)})},e.reLaunch=function(){var e=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).url;n("reLaunch",{url:encodeURI(e)})},e.redirectTo=function(){var e=(0<arguments.length&&void 0!==arguments[0]?arguments[0]:{}).url;n("redirectTo",{url:encodeURI(e)})},e.getEnv=function(e){e({plus:!0})},e.postMessage=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};n("postMessage",e.data||{})};var i={};"undefined"!=typeof wx&&wx.miniProgram&&(i.navigateTo=wx.miniProgram.navigateTo,i.navigateBack=wx.miniProgram.navigateBack,i.switchTab=wx.miniProgram.switchTab,i.reLaunch=wx.miniProgram.reLaunch,i.redirectTo=wx.miniProgram.redirectTo,i.postMessage=wx.miniProgram.postMessage,i.getEnv=wx.miniProgram.getEnv);var t=/uni-app/i.test(navigator.userAgent),r=/micromessenger/i.test(navigator.userAgent),o={},d=function(){window.UniAppJSBridge=!0,document.dispatchEvent(new CustomEvent("UniAppJSBridgeReady",{bubbles:!0,cancelable:!0}))};return t&&(o=e,window.plus&&/complete|loaded|interactive/.test(document.readyState)?d():document.addEventListener("plusready",d)),r&&(o=i,window.WeixinJSBridge&&WeixinJSBridge.invoke?d():document.addEventListener("WeixinJSBridgeReady",d)),o});

View File

@ -1,7 +1,7 @@
<template>
<div v-if="hasPreview">
<FTooltip mode="popover" :offset="-208" placement="bottom" :getContainer="getContainer" :disabled="detectDeviceType() !== 'PC'">
<FImage class="w-full max-h-70 h-14em" style="cursor: pointer" fit="contain" :src="publicPath + onePreview.src" lazy />
<FImage class="w-full max-h-70 h-14em" fit="contain" :src="publicPath + onePreview.src" lazy />
<template #content>
<div style="width: 280px; height: 180px; display: flex; justify-content: center; align-items: center">
<div class="one-item-qrcode">
@ -29,7 +29,7 @@
</FTooltip>
</div>
<div v-else>
<FImage class="w-full max-h-70 h-14em" style="cursor: pointer" fit="contain" :src="publicPath + onePreview.src" lazy />
<FImage class="w-full max-h-70 h-14em" fit="contain" :src="publicPath + onePreview.src" lazy />
</div>
</template>
<script setup lang="ts">
@ -56,18 +56,18 @@ const publicPath = process.env.BASE_URL
// console.log(props.onePreview)
// console.log(props.onePlugin)
function sanitizeFilename(filename:string) {
const invalidChars = /[\\\/:\*\?"<>\|]/g;
const controlChars = /[\x00-\x1F\x7F]/g; //
let sanitized = filename.replace(invalidChars, '');
function sanitizeFilename(filename: string) {
const invalidChars = /[\\\/:\*\?"<>\|]/g
const controlChars = /[\x00-\x1F\x7F]/g //
let sanitized = filename.replace(invalidChars, '')
if (sanitized.startsWith('.')) {
sanitized = 'f' + sanitized; //
sanitized = 'f' + sanitized //
}
sanitized = sanitized.replace(controlChars, '');
sanitized = sanitized.replace(controlChars, '')
if (sanitized.length > 255) {
sanitized = sanitized.substring(0, 255);
sanitized = sanitized.substring(0, 255)
}
return sanitized;
return sanitized
}
let hasPreview = true
let comUrl = 'https://opensource.icegl.cn/#/plugins/'
@ -86,6 +86,9 @@ if (props.onePreview.url) {
comUrl += props.onePreview.name + '/'
imgName = encodeURIComponent((props.onePlugin.name + props.onePreview.name).slice(-16))
}
if (!process.env.FES_APP_ONLINE_API) {
hasPreview = false
}
comUrl = encodeURIComponent(comUrl)
let miniPre = `https://www.icegl.cn/addons/tvt/mini/onePreview?urlPath=${comUrl}`
miniPre = encodeURIComponent(miniPre)
@ -97,7 +100,7 @@ const errH5Img = (e: any) => {
).then((response) => {
response
.text()
.then((data) => {
.then((data) => {
urlMobile.value = data
})
.catch((error) => {

View File

@ -4,7 +4,7 @@
* @Autor: 地虎降天龙
* @Date: 2025-03-05 11:49:24
* @LastEditors: 地虎降天龙
* @LastEditTime: 2025-03-05 11:52:28
* @LastEditTime: 2025-03-12 08:14:29
*/
export function loadJweixin () {
return new Promise((resolve, reject) => {
@ -13,7 +13,7 @@ export function loadJweixin () {
return
}
const script = document.createElement('script')
script.src = 'https://opensource-1314935952.cos.ap-nanjing.myqcloud.com/lib/jweixin-1.6.0.js'//'https://res.wx.qq.com/open/js/jweixin-1.6.0.js' // 适当更换版本
script.src = '/plugins/uniAppView/lib/jweixin-1.6.0.js'//'https://res.wx.qq.com/open/js/jweixin-1.6.0.js' // 适当更换版本
script.onload = () => resolve(window.wx)
script.onerror = reject
document.body.appendChild(script)
@ -27,7 +27,7 @@ export function loadWebView () {
return
}
const script = document.createElement('script')
script.src = 'https://opensource-1314935952.cos.ap-nanjing.myqcloud.com/lib/uni.webview.0.1.52.js'//'https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.0.1.52.js' // 适当更换版本
script.src = '/plugins/uniAppView/lib/uni.webview.0.1.52.js'//'https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.0.1.52.js' // 适当更换版本
script.onload = () => resolve(window.wx)
script.onerror = reject
document.body.appendChild(script)