diff --git a/pages.json b/pages.json
index d9004c3..6f22756 100644
--- a/pages.json
+++ b/pages.json
@@ -95,6 +95,13 @@
}
},
{
+ "path": "pages/article/article-detail",
+ "style": {
+ "navigationBarTitleText": "文章详情",
+ "enablePullDownRefresh": false,
+ "navigationStyle": "custom"
+ }
+ }, {
"path": "pages/institutionalStructure/donationRecord",
"style": {
"navigationBarTitleText": "",
diff --git a/pages/article/article-detail.vue b/pages/article/article-detail.vue
new file mode 100644
index 0000000..6859b9f
--- /dev/null
+++ b/pages/article/article-detail.vue
@@ -0,0 +1,229 @@
+
+
+
+
+
+
+
+
+ 加载中...
+
+
+
+
+
+
+
+ {{ articleData.title }}
+ {{ articleData.subtitle }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 发布时间:{{ formatTime(articleData.createTime) }}
+ 寺庙:{{ articleData.templeName }}
+
+
+
+
+
+
+ 内容加载失败
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/nearbystores/index.vue b/pages/nearbystores/index.vue
index 1308df6..576a3af 100644
--- a/pages/nearbystores/index.vue
+++ b/pages/nearbystores/index.vue
@@ -368,9 +368,78 @@ import { getArticleById } from "../../api/article/article.js";
}
},
- // 页面跳转方法 - 使用路由仓库
- navigateToPage(pageType) {
- navigateToPage(pageType);
+ // 兼容两种跳转方式:page路由跳转 或 aid文章详情跳转
+ async navigateToPage(item, index) {
+ try {
+ console.log('导航项信息:', item);
+ console.log('导航项索引:', index);
+
+ // 优先使用page字段进行路由跳转
+ if (item.page) {
+ console.log('使用page字段进行路由跳转:', item.page);
+ // 导入路由工具
+ const { navigateToPage: routerNavigate } = await import("../../utils/router.js");
+ routerNavigate(item.page);
+ return;
+ }
+
+ // 如果没有page字段,则使用aid进行文章详情跳转
+ if (item.aid) {
+ console.log('使用aid字段获取文章详情:', item.aid);
+
+ // 显示加载提示
+ uni.showLoading({
+ title: '加载中...',
+ mask: true
+ });
+
+ // 调用API获取文章详情
+ const response = await getArticleById(item.aid);
+
+ // 隐藏加载提示
+ uni.hideLoading();
+
+ if (response.code === 200 && response.data) {
+ console.log('获取文章详情成功:', response.data);
+
+ // 将文章数据存储到本地,供目标页面使用
+ uni.setStorageSync('currentArticle', response.data);
+
+ // 直接跳转到文章详情页面
+ uni.navigateTo({
+ url: '/pages/article/article-detail',
+ fail: (err) => {
+ console.error('跳转到文章详情页面失败:', err);
+ uni.showToast({
+ title: '页面跳转失败',
+ icon: 'none'
+ });
+ }
+ });
+ } else {
+ console.error('获取文章详情失败:', response);
+ uni.showToast({
+ title: '获取内容失败',
+ icon: 'none'
+ });
+ }
+ } else {
+ console.error('导航项既没有page字段也没有aid字段:', item);
+ uni.showToast({
+ title: '配置错误',
+ icon: 'none'
+ });
+ }
+ } catch (error) {
+ // 隐藏加载提示
+ uni.hideLoading();
+
+ console.error('导航跳转出错:', error);
+ uni.showToast({
+ title: '网络错误',
+ icon: 'none'
+ });
+ }
}
}
}