Compare commits
2 Commits
7ff5fa6933
...
dc12b8ba88
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc12b8ba88 | ||
|
|
cf723e5b93 |
@@ -8,9 +8,9 @@
|
||||
class="flex flex-items-center flex-justify-between border-box pl-8 pr-8"
|
||||
:style="navContentStyle"
|
||||
>
|
||||
<!-- 左侧返回按钮 -->
|
||||
<!-- 左侧导航按钮 -->
|
||||
<view class="nav-bar-left flex flex-items-center flex-justify-center" v-if="showBack" @click="handleBack">
|
||||
<uni-icons type="left" size="20" :color="backIconColor" />
|
||||
<uni-icons :type="leftIconType" size="20" :color="backIconColor" />
|
||||
</view>
|
||||
|
||||
<!-- 中间标题区域 -->
|
||||
@@ -53,6 +53,12 @@ const props = defineProps({
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
// 左侧按钮行为
|
||||
leftAction: {
|
||||
type: String,
|
||||
default: "back",
|
||||
validator: (value) => ["back", "home"].includes(value),
|
||||
},
|
||||
// 背景颜色
|
||||
background: {
|
||||
type: String,
|
||||
@@ -148,6 +154,8 @@ const navContentStyle = computed(() => {
|
||||
};
|
||||
});
|
||||
|
||||
const leftIconType = computed(() => (props.leftAction === "home" ? "home-filled" : "left"));
|
||||
|
||||
const hasBackListener = computed(() => {
|
||||
const vnodeProps = instance?.vnode?.props || {};
|
||||
return Boolean(vnodeProps.onBack);
|
||||
@@ -159,6 +167,14 @@ const handleBack = () => {
|
||||
emit("back");
|
||||
return;
|
||||
}
|
||||
|
||||
if (props.leftAction === "home") {
|
||||
uni.reLaunch({
|
||||
url: "/pages/index/index",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果没有监听back事件,默认执行返回上一页
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
|
||||
@@ -229,7 +229,10 @@ const handleBack = () => {
|
||||
};
|
||||
|
||||
const handleRecharge = () => {
|
||||
showPlaceholderToast("积分充值");
|
||||
uni.navigateTo({
|
||||
url: "/pages-aigc/recharge/recharge",
|
||||
fail: () => showPlaceholderToast("打开充值页面失败"),
|
||||
});
|
||||
};
|
||||
|
||||
const downloadMedia = (url) =>
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<template>
|
||||
<view class="shared-work-page">
|
||||
<view class="shared-work-nav">
|
||||
<TopNavBar :title="shareDetail.templateName || '旅行作品'" background="#fff" title-color="#173a5f"
|
||||
back-icon-color="#173a5f" :align-with-menu-button="true" :z-index="3" @back="handleBack" />
|
||||
<TopNavBar :title="shareDetail?.templateName || '旅行作品'" background="#fff" title-color="#173a5f"
|
||||
back-icon-color="#173a5f" left-action="home" :align-with-menu-button="true" :z-index="3"
|
||||
@back="openAppHome" />
|
||||
</view>
|
||||
|
||||
<view class="shared-work-scroll">
|
||||
@@ -106,14 +107,11 @@ const openAigcHome = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const handleBack = () => {
|
||||
const pages = getCurrentPages();
|
||||
if (pages.length > 1) {
|
||||
uni.navigateBack();
|
||||
return;
|
||||
}
|
||||
|
||||
openAigcHome();
|
||||
const openAppHome = () => {
|
||||
uni.reLaunch({
|
||||
url: "/pages/index/index",
|
||||
fail: () => showToast("打开首页失败"),
|
||||
});
|
||||
};
|
||||
|
||||
const handleCreateOwn = async () => {
|
||||
|
||||
Reference in New Issue
Block a user