fix: app嵌套h5提示语

This commit is contained in:
liu.huiying@ebiz-digits.com
2025-03-14 17:15:37 +08:00
parent 753805b555
commit 8a2e54bf93
4 changed files with 41 additions and 27 deletions

View File

@@ -11,7 +11,7 @@ onMounted(async() => {
// 设置系统状态栏明暗主题 // 设置系统状态栏明暗主题
appBridge.setStatusBarStyle('light'); appBridge.setStatusBarStyle('light');
// 设置禁止原生返回 // 设置禁止原生返回
// appBridge.takeOverAndroidBack(); appBridge.takeOverAndroidBack();
} }
}); });
</script> </script>

View File

@@ -31,3 +31,18 @@
} }
} }
} }
.van-toast {
background-color: rgba(50, 50, 51, 0.9) !important;
color: white !important;
padding: 10px 16px !important;
border-radius: 5px !important;
font-size: 14px !important;
&--success {
background-color: rgba(0, 0, 0, 0.7) !important;
}
&--fail {
background-color: rgba(0, 0, 0, 0.7) !important;
}
}

View File

@@ -10,7 +10,6 @@ export default {
jsonpUrl: import.meta.env.VITE_APP_JSONPURL, jsonpUrl: import.meta.env.VITE_APP_JSONPURL,
jqrUrl: import.meta.env.VITE_APP_YQRURL, jqrUrl: import.meta.env.VITE_APP_YQRURL,
currentMode: import.meta.env.VITE_APP_CURRENTMODE, currentMode: import.meta.env.VITE_APP_CURRENTMODE,
proxyDomain: import.meta.env.VITE_APP_BASEDOMAIM || ''
// appKey: import.meta.env.VITE_APP_APPKEY, // appKey: import.meta.env.VITE_APP_APPKEY,
// appId: import.meta.env.VITE_APP_APPID // appId: import.meta.env.VITE_APP_APPID
}; };

View File

@@ -5,11 +5,9 @@
<!-- <van-cell-group v-if="status === 1" inset style="padding-top: 15px"> --> <!-- <van-cell-group v-if="status === 1" inset style="padding-top: 15px"> -->
<van-cell-group inset style="padding-top: 15px"> <van-cell-group inset style="padding-top: 15px">
<div> <div>
<img <img width="100%"
width="100%"
src="https://files.axshare.com/gsc/DR6075/44/1a/03/441a03a8b1004755a7a392b311acf97f/images/%E6%8A%95%E6%94%BE/u14.jpg?pageId=2f9ba10c-92b8-4c9b-b40b-04e65a0b4333" src="https://files.axshare.com/gsc/DR6075/44/1a/03/441a03a8b1004755a7a392b311acf97f/images/%E6%8A%95%E6%94%BE/u14.jpg?pageId=2f9ba10c-92b8-4c9b-b40b-04e65a0b4333"
alt="" alt="" />
/>
</div> </div>
<div class="qrcode"> <div class="qrcode">
<img :src="publishInfo.img_url" alt="" width="100px" height="100px" /> <img :src="publishInfo.img_url" alt="" width="100px" height="100px" />
@@ -44,7 +42,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { useRoute } from 'vue-router'; import { useRoute } from 'vue-router';
import { onMounted, reactive, ref, watch } from 'vue'; import { onMounted, reactive, ref, watch } from 'vue';
import { showFailToast, showSuccessToast } from 'vant'; import { showFailToast, showToast } from 'vant';
import utils from '@/assets/js/common'; import utils from '@/assets/js/common';
import appBridge from '@/assets/js/appBridge'; import appBridge from '@/assets/js/appBridge';
import { getQrcode } from '@/api/publish'; import { getQrcode } from '@/api/publish';
@@ -110,7 +108,7 @@ type OperateItem = (typeof operateList)[0];
// } // }
// } // }
function getCode() { function getCode () {
publishInfo.value.img_url publishInfo.value.img_url
= 'https://test-cxp-pubcos.yili.com/uat-yls//survey-api/publish/202503130938138261340.png'; = 'https://test-cxp-pubcos.yili.com/uat-yls//survey-api/publish/202503130938138261340.png';
publishInfo.value.url = `${configUrl.proxyDomain}/publish?sn=${sn && sn !== undefined ? sn : ''}`; publishInfo.value.url = `${configUrl.proxyDomain}/publish?sn=${sn && sn !== undefined ? sn : ''}`;
@@ -125,7 +123,7 @@ function getCode() {
} }
}) })
.catch((error) => { .catch((error) => {
// showFailToast(error.data?.message || error.message || '服务器错误'); showFailToast(error.data?.message || error.message || '服务器错误');
}); });
} }
// function fetchInfo() { // function fetchInfo() {
@@ -142,37 +140,37 @@ watch(status, (val) => {
getCode(); getCode();
} }
}); });
onMounted(async() => { onMounted(async () => {
// fetchInfo(); // fetchInfo();
getCode(); getCode();
}); });
const operateBtn = (item: OperateItem) => { const operateBtn = (item: OperateItem) => {
switch (item.type) { switch (item.type) {
case 'shareLink': case 'shareLink':
shareLink(); shareLink();
break; break;
case 'copyLink': case 'copyLink':
copyLink(); copyLink();
break; break;
case 'qrCode': case 'qrCode':
downLoadImg(); downLoadImg();
break; break;
default: default:
break; break;
} }
}; };
// 复制链接 // 复制链接
function copyLink() { function copyLink () {
const input = document.createElement('input'); const input = document.createElement('input');
input.value = publishInfo.value.url; input.value = publishInfo.value.url;
document.body.appendChild(input); document.body.appendChild(input);
input.select(); input.select();
document.execCommand('Copy'); document.execCommand('Copy');
document.body.removeChild(input); document.body.removeChild(input);
showSuccessToast('复制成功'); showToast('复制成功');
} }
// 分享链接 // 分享链接
function shareLink() { function shareLink () {
const params = { const params = {
type: 'shareToWx', type: 'shareToWx',
title: publishInfo.value.download_url.title, title: publishInfo.value.download_url.title,
@@ -181,16 +179,18 @@ function shareLink() {
webpageUrl: publishInfo.value.url, webpageUrl: publishInfo.value.url,
scene: 0 // 朋友圈1 微信好友0 scene: 0 // 朋友圈1 微信好友0
}; };
console.log('shareUrl',publishInfo.value.url) console.log('shareUrl', publishInfo.value.url)
appBridge.shareToWeChat(params, () => { appBridge.shareToWeChat(params, () => {
}); });
} }
// 下载二维码 // 下载二维码
function downLoadImg() { function downLoadImg () {
const { title, url } = publishInfo.value.download_url; const { title, url } = publishInfo.value.download_url;
if (utils.getSessionStorage('xToken')) { if (utils.getSessionStorage('xToken')) {
appBridge.save2Album(url, () => {}); appBridge.save2Album(url, () => {
showToast('二维码已成功保存到相册');
});
} else { } else {
const link = document.createElement('a'); const link = document.createElement('a');
link.href = url; link.href = url;