refactor: simplify TopNavBar and update sharedWork back handling
remove leftAction prop and hardcode left icon type in TopNavBar move home navigation logic out of TopNavBar to parent components update sharedWork.vue to use new TopNavBar API and implement proper back handling
This commit is contained in:
@@ -1,17 +1,15 @@
|
||||
<template>
|
||||
<view class="shared-work-page">
|
||||
<view class="shared-work-nav">
|
||||
<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" />
|
||||
<TopNavBar :title="shareDetail.templateName || '旅行作品'" background="#fff" title-color="#173a5f"
|
||||
back-icon-color="#173a5f" :align-with-menu-button="true" :z-index="3" @back="handleBack" />
|
||||
</view>
|
||||
|
||||
<view class="shared-work-scroll">
|
||||
<template v-if="shareDetail">
|
||||
<video v-if="isVideo" class="shared-work-media is-video" :src="videoResultUrl"
|
||||
:poster="imageResultUrl" controls object-fit="cover" />
|
||||
<image v-else-if="imageResultUrl" class="shared-work-media" :src="imageResultUrl"
|
||||
mode="aspectFill" />
|
||||
<video v-if="isVideo" class="shared-work-media is-video" :src="videoResultUrl" :poster="imageResultUrl" controls
|
||||
object-fit="cover" />
|
||||
<image v-else-if="imageResultUrl" class="shared-work-media" :src="imageResultUrl" mode="aspectFill" />
|
||||
|
||||
<view class="shared-work-meta">
|
||||
<text class="shared-work-title">{{ shareDetail.templateName || "旅行作品" }}</text>
|
||||
@@ -107,11 +105,14 @@ const openAigcHome = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const openAppHome = () => {
|
||||
uni.reLaunch({
|
||||
url: "/pages/index/index",
|
||||
fail: () => showToast("打开首页失败"),
|
||||
});
|
||||
const handleBack = () => {
|
||||
const pages = getCurrentPages();
|
||||
if (pages.length > 1) {
|
||||
uni.navigateBack();
|
||||
return;
|
||||
}
|
||||
|
||||
openAigcHome();
|
||||
};
|
||||
|
||||
const handleCreateOwn = async () => {
|
||||
|
||||
Reference in New Issue
Block a user