From 4eb8ef0f5449ceff8f6bd0b04221c9f31e99703b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com>
Date: Mon, 9 Jun 2025 20:09:52 +0800
Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E5=88=86=E4=BA=AB?=
=?UTF-8?q?=E3=80=81=E4=B8=8B=E8=BD=BD=E5=9B=BE=E7=89=87=E3=80=81=E8=A7=86?=
=?UTF-8?q?=E9=A2=91=E5=8A=9F=E8=83=BD=E7=99=BB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/workspace.xml | 64 ++--
api/house-info.js | 6 +-
common/model/Setting.js | 28 +-
components/goods-poster-popup/index.vue | 45 ++-
components/share-sheet/index.vue | 106 +++++-
sub_pages/house/detail.vue | 454 +++++++++++++++++++++++-
utils/util.js | 150 ++++++++
分享功能修复说明.md | 157 ++++++++
功能实现说明.md | 134 +++++++
最终修复方案.md | 137 +++++++
测试分享功能.md | 121 +++++++
11 files changed, 1346 insertions(+), 56 deletions(-)
create mode 100644 分享功能修复说明.md
create mode 100644 功能实现说明.md
create mode 100644 最终修复方案.md
create mode 100644 测试分享功能.md
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 8ea190b..ae94025 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,14 +5,17 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -30,21 +33,22 @@
- {
+ "keyToString": {
+ "RunOnceActivity.ShowReadmeOnStart": "true",
+ "RunOnceActivity.git.unshallow": "true",
+ "git-widget-placeholder": "master",
+ "last_opened_file_path": "/Users/gxwebsoft/APP/anshangjia-uniapp",
+ "node.js.detected.package.eslint": "true",
+ "node.js.detected.package.tslint": "true",
+ "node.js.selected.package.eslint": "(autodetect)",
+ "node.js.selected.package.tslint": "(autodetect)",
+ "nodejs_package_manager_path": "npm",
+ "settings.editor.selected.configurable": "preferences.pluginManager",
+ "ts.external.directory.path": "/Applications/WebStorm.app/Contents/plugins/javascript-plugin/jsLanguageServicesImpl/external",
+ "vue.rearranger.settings.migration": "true"
}
-}]]>
+}
@@ -70,7 +74,13 @@
-
+
+
+
+
+
+
+
@@ -80,7 +90,15 @@
1741166460514
-
+
+
+ 1749352650830
+
+
+
+ 1749352650830
+
+
diff --git a/api/house-info.js b/api/house-info.js
index ff7ec00..7d395ce 100644
--- a/api/house-info.js
+++ b/api/house-info.js
@@ -21,6 +21,9 @@ export const updateHouseInfo = (data) => http.put('/house/house-info', data)
// 删除房源信息
export const removeHouseInfo = (id) => http.delete('/house/house-info/' + id)
+// 生成海报
+export const getGeneratePoster = (id) => http.get('/house/house-info/generatePoster/' + id)
+
// 收藏房源
export const likeHouse = (data) => http.post('/house/house-like-log', data)
@@ -37,5 +40,6 @@ export default {
addHouseInfo,
likeHouse,
getLikeHouseList,
- getViewsHouseList
+ getViewsHouseList,
+ getGeneratePoster
}
diff --git a/common/model/Setting.js b/common/model/Setting.js
index c32be2a..0ea7adb 100755
--- a/common/model/Setting.js
+++ b/common/model/Setting.js
@@ -64,8 +64,32 @@ const h5Url = (isCache = false) => {
return new Promise((resolve, reject) => {
data(isCache)
.then(setting => {
- const h5Url = setting[OTHER]['h5Url']
- resolve(h5Url)
+ try {
+ // 检查设置数据是否存在
+ if (!setting || typeof setting !== 'object') {
+ throw new Error('设置数据无效')
+ }
+
+ // 检查 _other 字段是否存在
+ if (!setting[OTHER] || typeof setting[OTHER] !== 'object') {
+ throw new Error('_other 设置字段不存在')
+ }
+
+ // 检查 h5Url 字段是否存在
+ const h5UrlValue = setting[OTHER]['h5Url']
+ if (!h5UrlValue || typeof h5UrlValue !== 'string' || h5UrlValue.trim() === '') {
+ throw new Error('H5地址未配置或无效')
+ }
+
+ resolve(h5UrlValue.trim())
+ } catch (error) {
+ console.error('获取H5地址失败:', error)
+ reject(error)
+ }
+ })
+ .catch(err => {
+ console.error('获取设置数据失败:', err)
+ reject(err)
})
})
}
diff --git a/components/goods-poster-popup/index.vue b/components/goods-poster-popup/index.vue
index 71f5a6e..d1b0f1f 100755
--- a/components/goods-poster-popup/index.vue
+++ b/components/goods-poster-popup/index.vue
@@ -56,12 +56,49 @@
// 显示海报弹窗
onShowPopup() {
const app = this
- app.apiCall({ ...app.apiParam, channel: app.platform })
+ console.log('GoodsPosterPopup onShowPopup 被调用');
+ console.log('apiCall 类型:', typeof app.apiCall);
+ console.log('apiCall 函数:', app.apiCall);
+ console.log('apiParam:', app.apiParam);
+ console.log('platform:', app.platform);
+
+ if (typeof app.apiCall !== 'function') {
+ console.error('apiCall 不是一个函数!');
+ uni.showToast({
+ title: '海报生成功能异常',
+ icon: 'none'
+ });
+ app.onClose();
+ return;
+ }
+
+ const params = { ...app.apiParam, channel: app.platform };
+ console.log('调用 apiCall,参数:', params);
+
+ app.apiCall(params)
.then(result => {
- app.imageUrl = result.data.imageUrl
- app.show = true
+ console.log('apiCall 调用成功,结果:', result);
+ if (result && result.data && result.data.imageUrl) {
+ app.imageUrl = result.data.imageUrl;
+ app.show = true;
+ console.log('海报图片URL设置成功:', app.imageUrl);
+ } else {
+ console.error('apiCall 返回的数据格式不正确:', result);
+ uni.showToast({
+ title: '海报生成失败',
+ icon: 'none'
+ });
+ app.onClose();
+ }
})
- .catch(err => app.onClose())
+ .catch(err => {
+ console.error('apiCall 调用失败:', err);
+ uni.showToast({
+ title: '海报生成失败',
+ icon: 'none'
+ });
+ app.onClose();
+ });
},
// 关闭弹窗
diff --git a/components/share-sheet/index.vue b/components/share-sheet/index.vue
index d464fba..8ecc714 100755
--- a/components/share-sheet/index.vue
+++ b/components/share-sheet/index.vue
@@ -37,22 +37,22 @@
-
-
-
-
-
- 生成海报
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
@@ -76,6 +84,12 @@
租金(元/m²):{{ form.rent || '' }}
+
+ 楼层:{{ form.floor || '' }}
+
+
+ 朝向:{{ form.toward || '' }}
+
房号:{{ form.roomNumber || '' }}
@@ -115,7 +129,7 @@
-
+
@@ -127,7 +141,7 @@
-
+
@@ -166,6 +180,10 @@
已收藏
收藏
+
+
+ 分享
+
@@ -174,19 +192,44 @@
+
+
+
+
+
+
+
+
+