|
@@ -4,7 +4,11 @@
|
|
|
<StatusBarSpace backgroundColor="transparent" />
|
|
<StatusBarSpace backgroundColor="transparent" />
|
|
|
<NavBar leftButton="back" :iconProps="{ color: 'white', innerStyle: { backgroundColor: 'rgba(0,0,0,0.2)' } }" textColor="white" />
|
|
<NavBar leftButton="back" :iconProps="{ color: 'white', innerStyle: { backgroundColor: 'rgba(0,0,0,0.2)' } }" textColor="white" />
|
|
|
</FlexCol>
|
|
</FlexCol>
|
|
|
- <SimplePageContentLoader :loader="loader">
|
|
|
|
|
|
|
+ <FlexCol v-if="errorMessage" :padding="30" :gap="30" center height="100%">
|
|
|
|
|
+ <Result status="error" :description="errorMessage" />
|
|
|
|
|
+ <Button type="primary" @click="loadPageConfig">重新加载</Button>
|
|
|
|
|
+ </FlexCol>
|
|
|
|
|
+ <SimplePageContentLoader v-else :loader="loader">
|
|
|
<template v-if="loader.content.value">
|
|
<template v-if="loader.content.value">
|
|
|
<view class="d-flex flex-col">
|
|
<view class="d-flex flex-col">
|
|
|
|
|
|
|
@@ -53,24 +57,27 @@
|
|
|
class="w-100"
|
|
class="w-100"
|
|
|
titleColor="title-text"
|
|
titleColor="title-text"
|
|
|
title2
|
|
title2
|
|
|
- :image="appConfiguration?.articleBorrow?.icon"
|
|
|
|
|
|
|
+ :image="currentCommonCategoryContentDefine?.props.articleBorrow?.icon"
|
|
|
:title="loader.content.value.title"
|
|
:title="loader.content.value.title"
|
|
|
- :desc="appConfiguration?.articleBorrow?.text"
|
|
|
|
|
|
|
+ :desc="currentCommonCategoryContentDefine?.props.articleBorrow?.text"
|
|
|
@click="goBorrow(loader.content.value.title)"
|
|
@click="goBorrow(loader.content.value.title)"
|
|
|
/>
|
|
/>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<!-- 源网页 -->
|
|
<!-- 源网页 -->
|
|
|
- <view v-if="loader.content.value.externalLink && querys.navToExternalLink !== 'none'" class="mt-3">
|
|
|
|
|
|
|
+ <view v-if="currentCommonCategoryContentDefine?.props.topButtons" class="mt-3">
|
|
|
|
|
+ <template v-for="button in currentCommonCategoryContentDefine?.props.topButtons">
|
|
|
<Box2LineImageRightShadow
|
|
<Box2LineImageRightShadow
|
|
|
|
|
+ v-if="evaluateButtonVisible(button.visible)"
|
|
|
class="w-100"
|
|
class="w-100"
|
|
|
titleColor="title-text"
|
|
titleColor="title-text"
|
|
|
title2
|
|
title2
|
|
|
:image="archiveInfo.archiveIcon"
|
|
:image="archiveInfo.archiveIcon"
|
|
|
- :title="loader.content.value.title"
|
|
|
|
|
- desc="点击查看源网页"
|
|
|
|
|
- @click="goExternalLink(loader.content.value.externalLink)"
|
|
|
|
|
|
|
+ :title="button.text"
|
|
|
|
|
+ :desc="loader.content.value.title"
|
|
|
|
|
+ @click="executeButtonAction(button.expression)"
|
|
|
/>
|
|
/>
|
|
|
|
|
+ </template>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<!-- 内容 -->
|
|
<!-- 内容 -->
|
|
@@ -117,19 +124,23 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
-import type { GetContentDetailItem } from "@/api/CommonContent";
|
|
|
|
|
import { onShareTimeline, onShareAppMessage } from "@dcloudio/uni-app";
|
|
import { onShareTimeline, onShareAppMessage } from "@dcloudio/uni-app";
|
|
|
import { DataDateUtils } from "@imengyu/js-request-transform";
|
|
import { DataDateUtils } from "@imengyu/js-request-transform";
|
|
|
import { useSimplePageContentLoader } from "@/common/composeabe/SimplePageContentLoader";
|
|
import { useSimplePageContentLoader } from "@/common/composeabe/SimplePageContentLoader";
|
|
|
import { useLoadQuerys } from "@/common/composeabe/LoadQuerys";
|
|
import { useLoadQuerys } from "@/common/composeabe/LoadQuerys";
|
|
|
-import { computed } from "vue";
|
|
|
|
|
-import { FormatUtils, StringUtils } from "@imengyu/imengyu-utils";
|
|
|
|
|
|
|
+import { computed, onMounted, ref } from "vue";
|
|
|
|
|
+import { FormatUtils, StringUtils, waitTimeOut } from "@imengyu/imengyu-utils";
|
|
|
import { injectAppConfiguration } from "@/api/system/useAppConfiguration";
|
|
import { injectAppConfiguration } from "@/api/system/useAppConfiguration";
|
|
|
import { useSimpleDataLoader } from "@/common/composeabe/SimpleDataLoader";
|
|
import { useSimpleDataLoader } from "@/common/composeabe/SimpleDataLoader";
|
|
|
import { navTo, redirectTo } from "@/components/utils/PageAction";
|
|
import { navTo, redirectTo } from "@/components/utils/PageAction";
|
|
|
|
|
+import { resolveCommonContentFormData } from "./common/CommonContent";
|
|
|
|
|
+import { injectCommonCategory } from "./data/CommonCategoryGlobalLoader";
|
|
|
|
|
+import { getIsDevtoolsPlatform } from "@/common/utils/MpVersions";
|
|
|
|
|
+import { doCallDynamicFunction, doEvaluateDynamicCompareExpression } from "./data/CommonCategoryDynamicEvax";
|
|
|
|
|
+import type { GetContentDetailItem } from "@/api/CommonContent";
|
|
|
|
|
+import type { IHomeCommonArticleDetailDefine } from "./data/CommonCategoryDefine";
|
|
|
import CommonContent, { GetContentListParams } from "@/api/CommonContent";
|
|
import CommonContent, { GetContentListParams } from "@/api/CommonContent";
|
|
|
import Box2LineImageRightShadow from "../parts/Box2LineImageRightShadow.vue";
|
|
import Box2LineImageRightShadow from "../parts/Box2LineImageRightShadow.vue";
|
|
|
-import AppCofig from "@/common/config/AppCofig";
|
|
|
|
|
import LikeFooter from "../parts/LikeFooter.vue";
|
|
import LikeFooter from "../parts/LikeFooter.vue";
|
|
|
import Image from "@/components/basic/Image.vue";
|
|
import Image from "@/components/basic/Image.vue";
|
|
|
import ArticleCorrect from "../parts/ArticleCorrect.vue";
|
|
import ArticleCorrect from "../parts/ArticleCorrect.vue";
|
|
@@ -148,8 +159,64 @@ import FlexCol from "@/components/layout/FlexCol.vue";
|
|
|
import Footer from "@/components/display/Footer.vue";
|
|
import Footer from "@/components/display/Footer.vue";
|
|
|
import NavBar from "@/components/nav/NavBar.vue";
|
|
import NavBar from "@/components/nav/NavBar.vue";
|
|
|
import StatusBarSpace from "@/components/layout/space/StatusBarSpace.vue";
|
|
import StatusBarSpace from "@/components/layout/space/StatusBarSpace.vue";
|
|
|
-import { resolveCommonContentFormData } from "./common/CommonContent";
|
|
|
|
|
|
|
|
|
|
|
|
+export interface CommonArticleDetailProps {
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询借阅功能按钮
|
|
|
|
|
+ */
|
|
|
|
|
+ articleBorrow: {
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询借阅功能按钮链接
|
|
|
|
|
+ */
|
|
|
|
|
+ url: string,
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询借阅功能按钮文本
|
|
|
|
|
+ */
|
|
|
|
|
+ text: string,
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询借阅功能按钮图标
|
|
|
|
|
+ */
|
|
|
|
|
+ icon: string,
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 顶部按钮配置
|
|
|
|
|
+ */
|
|
|
|
|
+ topButtons: {
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 按钮可见性表达式
|
|
|
|
|
+ */
|
|
|
|
|
+ visible: string,
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 按钮文本
|
|
|
|
|
+ */
|
|
|
|
|
+ text: string,
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 按钮图标
|
|
|
|
|
+ */
|
|
|
|
|
+ icon: string,
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 按钮动作表达式
|
|
|
|
|
+ */
|
|
|
|
|
+ expression: string,
|
|
|
|
|
+ }[],
|
|
|
|
|
+ /**
|
|
|
|
|
+ * TODO: 顶部显示信息配置
|
|
|
|
|
+ */
|
|
|
|
|
+ topShowInfos: {
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 显示信息键
|
|
|
|
|
+ */
|
|
|
|
|
+ key: string,
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 显示信息前缀
|
|
|
|
|
+ */
|
|
|
|
|
+ prefix: string,
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 显示信息表达式
|
|
|
|
|
+ */
|
|
|
|
|
+ expression: string,
|
|
|
|
|
+ }[],
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
const { querys } = useLoadQuerys({
|
|
const { querys } = useLoadQuerys({
|
|
|
id: 0,
|
|
id: 0,
|
|
@@ -180,6 +247,12 @@ const { querys } = useLoadQuerys({
|
|
|
* @description 'auto' 自动跳转,'manual' 手动跳转,'none' 不跳转
|
|
* @description 'auto' 自动跳转,'manual' 手动跳转,'none' 不跳转
|
|
|
*/
|
|
*/
|
|
|
navToExternalLink: 'auto',
|
|
navToExternalLink: 'auto',
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 顶部显示信息
|
|
|
|
|
+ * @default 'all'
|
|
|
|
|
+ * @description 'all' 显示所有信息,'none' 不显示任何信息,多个信息用逗号分隔
|
|
|
|
|
+ */
|
|
|
|
|
+ topShowInfos: 'all',
|
|
|
}, (t) => loader.loadData(t));
|
|
}, (t) => loader.loadData(t));
|
|
|
|
|
|
|
|
const loader = useSimplePageContentLoader<
|
|
const loader = useSimplePageContentLoader<
|
|
@@ -198,8 +271,11 @@ const loader = useSimplePageContentLoader<
|
|
|
return res;
|
|
return res;
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+const currentCommonCategoryContentDefine = ref<IHomeCommonArticleDetailDefine>();
|
|
|
|
|
+const commonCategory = injectCommonCategory();
|
|
|
const appConfiguration = injectAppConfiguration();
|
|
const appConfiguration = injectAppConfiguration();
|
|
|
|
|
|
|
|
|
|
+const errorMessage = ref('');
|
|
|
const emptyContent = computed(() => (loader.content.value?.content || '').trim() === '')
|
|
const emptyContent = computed(() => (loader.content.value?.content || '').trim() === '')
|
|
|
const archiveInfo = computed(() => {
|
|
const archiveInfo = computed(() => {
|
|
|
const hasArchive = Boolean(loader.content.value?.archives);
|
|
const hasArchive = Boolean(loader.content.value?.archives);
|
|
@@ -244,6 +320,22 @@ const recommendListLoader = useSimpleDataLoader(async () => {
|
|
|
return resolveCommonContentFormData(res);
|
|
return resolveCommonContentFormData(res);
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+function evaluateButtonVisible(expression: string) {
|
|
|
|
|
+ return doEvaluateDynamicCompareExpression(expression, {
|
|
|
|
|
+ sourceData: {
|
|
|
|
|
+ main: loader.content.value || {},
|
|
|
|
|
+ customData: {},
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+}
|
|
|
|
|
+function executeButtonAction(expression: string) {
|
|
|
|
|
+ doCallDynamicFunction(expression, {
|
|
|
|
|
+ sourceData: {
|
|
|
|
|
+ main: loader.content.value || {},
|
|
|
|
|
+ customData: {},
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+}
|
|
|
function goExternalLink(url: string) {
|
|
function goExternalLink(url: string) {
|
|
|
redirectTo('/pages/article/web/ewebview', { url });
|
|
redirectTo('/pages/article/web/ewebview', { url });
|
|
|
}
|
|
}
|
|
@@ -306,10 +398,9 @@ function goDetails(id: number) {
|
|
|
}
|
|
}
|
|
|
function goBorrow(title: string) {
|
|
function goBorrow(title: string) {
|
|
|
navTo('/pages/article/web/ewebview', {
|
|
navTo('/pages/article/web/ewebview', {
|
|
|
- url: FormatUtils.formatString(appConfiguration.value?.articleBorrow?.url || '', { title })
|
|
|
|
|
|
|
+ url: FormatUtils.formatString(currentCommonCategoryContentDefine.value?.props.articleBorrow?.url || '', { title })
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
function getPageShareData() {
|
|
function getPageShareData() {
|
|
|
if (!loader.content.value)
|
|
if (!loader.content.value)
|
|
|
return { title: '文章详情', imageUrl: '' }
|
|
return { title: '文章详情', imageUrl: '' }
|
|
@@ -318,6 +409,32 @@ function getPageShareData() {
|
|
|
imageUrl: loader.content.value.images[0],
|
|
imageUrl: loader.content.value.images[0],
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+async function loadPageConfig() {
|
|
|
|
|
+ if (getIsDevtoolsPlatform()) {
|
|
|
|
|
+ await waitTimeOut(500);
|
|
|
|
|
+ }
|
|
|
|
|
+ const pageConfigName = 'common-details';
|
|
|
|
|
+ const currentCommonCategoryDefine = commonCategory.value.page
|
|
|
|
|
+ .find((item) => item.name === pageConfigName);
|
|
|
|
|
+ if (!currentCommonCategoryDefine) {
|
|
|
|
|
+ errorMessage.value = '未找到指定的分类配置:' + pageConfigName;
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (currentCommonCategoryDefine.content.type !== 'CommonDetails') {
|
|
|
|
|
+ errorMessage.value = '分类配置:' + pageConfigName + ' 不是默认详情类型';
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ currentCommonCategoryContentDefine.value = currentCommonCategoryDefine.content;
|
|
|
|
|
+ uni.setNavigationBarTitle({
|
|
|
|
|
+ title: currentCommonCategoryDefine.title || '',
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+onMounted(() => {
|
|
|
|
|
+ loadPageConfig();
|
|
|
|
|
+});
|
|
|
onShareTimeline(() => {
|
|
onShareTimeline(() => {
|
|
|
return getPageShareData();
|
|
return getPageShareData();
|
|
|
})
|
|
})
|