This commit is contained in:
whitechiina 2026-10-12 13:18:53 +08:00
parent d5c45ca962
commit bb77078191
34 changed files with 21 additions and 135 deletions

View File

@ -122,11 +122,6 @@ export default {
this.navLayout = fallbackLayout;
},
handleBack() {
if (this.$listeners && this.$listeners["back-click"]) {
this.$emit("back-click");
return;
}
if (getCurrentPages().length > 1) {
uni.navigateBack();
return;

View File

@ -1,9 +1,6 @@
<template>
<view class="asset-page asset-theme points-home-page">
<asset-page-shell
title="积分转换"
@back-click="handleShellBack"
/>
<asset-page-shell v-if="!hideNavigation" title="积分转换" />
<view class="asset-scroll points-home-scroll">
<view class="hero-card">
@ -99,19 +96,13 @@
import AssetPageShell from "../../components/asset-page-shell.vue";
import { fetchPointsConvertHome } from "../../api/assets";
const EXIT_WEBVIEW_PROTOCOL_URL = "uniwebview://close";
function isEnabledFlag(value) {
return String(value || "").trim() === "1";
}
export default {
components: {
AssetPageShell,
},
data() {
return {
shouldExitWebview: false,
hideNavigation: false,
hasShown: false,
selectedMonth: "",
detail: {
@ -154,7 +145,8 @@ export default {
},
},
onLoad(options) {
this.shouldExitWebview = isEnabledFlag(options && options.ewuFlag);
this.hideNavigation =
String(options && options.ewuFlag ? options.ewuFlag : "").trim() === "1";
this.selectedMonth = this.currentMonth();
this.resetPagingState();
this.loadPage(true, 1);
@ -178,107 +170,6 @@ export default {
this.loadMore();
},
methods: {
handleShellBack() {
if (!this.shouldExitWebview) {
this.defaultNavigateBack();
return;
}
if (this.tryCloseAppWebview()) {
return;
}
if (this.isH5Runtime()) {
this.backToPreviousH5Url();
return;
}
if (this.tryNotifyHostClose()) {
return;
}
this.defaultNavigateBack();
},
defaultNavigateBack() {
if (
typeof getCurrentPages === "function" &&
getCurrentPages().length > 1 &&
typeof uni !== "undefined" &&
typeof uni.navigateBack === "function"
) {
uni.navigateBack();
return;
}
uni.reLaunch({
url: "/pages/index/index",
});
},
tryCloseAppWebview() {
try {
if (
typeof plus !== "undefined" &&
plus.webview &&
typeof plus.webview.currentWebview === "function"
) {
const currentWebview = plus.webview.currentWebview();
if (currentWebview && typeof currentWebview.close === "function") {
currentWebview.close("auto");
return true;
}
}
} catch (error) {
// H5 环境可能没有 plus,继续走宿主协议和浏览器兜底。
}
return false;
},
isH5Runtime() {
return (
typeof window !== "undefined" &&
typeof document !== "undefined" &&
!this.hasAppWebviewHint()
);
},
hasAppWebviewHint() {
if (typeof plus !== "undefined") {
return true;
}
const userAgent =
typeof navigator !== "undefined" ? navigator.userAgent || "" : "";
return userAgent.toLowerCase().indexOf("html5plus") > -1;
},
backToPreviousH5Url() {
if (typeof window === "undefined") {
this.defaultNavigateBack();
return;
}
if (window.history && window.history.length > 1) {
window.history.back();
return;
}
const referrer =
typeof document !== "undefined" ? String(document.referrer || "") : "";
if (referrer) {
window.location.replace(referrer);
return;
}
this.defaultNavigateBack();
},
tryNotifyHostClose() {
if (typeof window === "undefined" || !window.location) {
return false;
}
window.location.href = EXIT_WEBVIEW_PROTOCOL_URL;
return true;
},
resetPagingState() {
this.page = 1;
this.hasMore = false;

View File

@ -1,2 +1,2 @@
<!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>白马交易所</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/bmt/static/index.883130ca.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/bmt/static/js/chunk-vendors.a58c62f3.js></script><script src=/bmt/static/js/index.0a43b5b8.js></script></body></html>
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/bmt/static/index.883130ca.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/bmt/static/js/chunk-vendors.a58c62f3.js></script><script src=/bmt/static/js/index.4e100dbe.js></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long