diff --git a/packages/chat/chatWindow.vue b/packages/chat/chatWindow.vue
index b6b2c99..b6f0f45 100644
--- a/packages/chat/chatWindow.vue
+++ b/packages/chat/chatWindow.vue
@@ -58,7 +58,7 @@
const userId = options.userId;
const userName = options.userName;
const supplyDemandId = options.supplyDemandId;
- const supplyDemandTitle = options.supplyDemandTitle ? decodeURIComponent(options.supplyDemandTitle) : '';
+ const supplyDemandTitle = options.supplyDemandTitle;
// 保存供应需求ID
this.supplyDemandId = supplyDemandId;
@@ -82,6 +82,7 @@
// 使用正确的API调用方式
this.$u.api.supplyDemandMessageList({
+ to_user_id: this.theirUserId,
supply_demand_id: supplyDemandId,
page: page,
per_page: this.pageSize
diff --git a/packages/library/detail.vue b/packages/library/detail.vue
index bef0551..7ccbeac 100644
--- a/packages/library/detail.vue
+++ b/packages/library/detail.vue
@@ -13,13 +13,13 @@
- {{ bookInfo.title }}
- 作者:{{ bookInfo.author }}
- 出版社:{{ bookInfo.publisher }}
- 出版年份:{{ bookInfo.year }}
- ISBN:{{ bookInfo.isbn }}
+ {{ bookInfo.title || '暂无标题' }}
+ 作者:{{ bookInfo.author || '暂无' }}
+ 出版社:{{ bookInfo.publisher || '暂无' }}
+ 出版年份:{{ bookInfo.year || '暂无' }}
+ ISBN:{{ bookInfo.isbn || '暂无' }}
-
+
@@ -37,10 +37,6 @@
状态:
-
- 创建时间:
- {{ formatDate(bookInfo.created_at) }}
-
@@ -99,7 +95,6 @@
category: book.category,
description: book.description,
status: book.status,
- created_at: book.created_at,
image: book.cover ? book.cover.url : ''
};
} else {
@@ -139,13 +134,6 @@
3: 'error'
};
return typeMap[status] || 'info';
- },
-
- // 格式化日期
- formatDate(dateStr) {
- if (!dateStr) return '未知';
- const date = new Date(dateStr);
- return date.toLocaleDateString('zh-CN');
}
}
}
diff --git a/packages/library/index.vue b/packages/library/index.vue
index 38fa2ff..2765374 100644
--- a/packages/library/index.vue
+++ b/packages/library/index.vue
@@ -28,9 +28,9 @@
- {{ book.title }}
- {{ book.author }}
- {{ book.publisher }} · {{ book.year }}
+ {{ book.title || '暂无标题' }}
+ {{ book.author || '暂无作者' }}
+ {{ (book.publisher || '暂无') }} · {{ book.year || '暂无' }}
@@ -139,10 +139,10 @@
const newBooks = (bookData.data || []).map(book => {
return {
id: book.id,
- title: book.title,
- author: book.author,
- publisher: book.publisher,
- year: book.publish_year,
+ title: book.title || '暂无标题',
+ author: book.author || '暂无作者',
+ publisher: book.publisher || '暂无',
+ year: book.publish_year || '暂无',
image: book.cover ? book.cover.url : '',
tags: [
{
@@ -150,7 +150,7 @@
type: 'primary'
},
{
- text: `ISBN: ${book.isbn || '未知'}`,
+ text: `ISBN: ${book.isbn || '暂无'}`,
type: 'info'
}
]
diff --git a/packages/supply/detail.vue b/packages/supply/detail.vue
index ba4481d..9306ca3 100644
--- a/packages/supply/detail.vue
+++ b/packages/supply/detail.vue
@@ -1,31 +1,104 @@
-
@@ -47,6 +120,50 @@
isCollected: false
}
},
+ computed: {
+ hasContactInfo() {
+ if (!this.detail) return false;
+
+ // 根据public_way字段控制联系方式的显示
+ switch (this.detail.public_way) {
+ case 1: // 直接公开
+ return this.detail.user || this.detail.wechat || this.detail.mobile || this.detail.email;
+ case 2: // 私信后自动公开
+ return this.detail.user || this.detail.wechat || this.detail.mobile || this.detail.email;
+ case 3: // 不公开
+ return false;
+ default:
+ return this.detail.user || this.detail.wechat || this.detail.mobile || this.detail.email;
+ }
+ },
+ // 新增计算属性:是否需要私信后查看联系方式
+ needMessageToShowContact() {
+ // 如果已经私信过(messages_count > 0),则显示联系方式
+ if (this.detail && this.detail.messages_count > 0) {
+ return false;
+ }
+ // 否则根据public_way判断是否需要私信后查看
+ return this.detail && this.detail.public_way === 2;
+ },
+ // 新增计算属性:判断是否已过期
+ isExpired() {
+ if (!this.detail || !this.detail.expire_time) {
+ return false;
+ }
+ // 使用moment比较当前时间和到期时间
+ const currentTime = this.$moment();
+ const expireTime = this.$moment(this.detail.expire_time);
+ return currentTime.isAfter(expireTime);
+ },
+ // 新增计算属性:过滤出图片类型的文件
+ imageFiles() {
+ if (!this.detail || !this.detail.files) return [];
+ return this.detail.files.filter(f => {
+ const ext = f.extension ? f.extension.toLowerCase() : '';
+ return ['jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp'].includes(ext);
+ });
+ }
+ },
onLoad(options) {
console.log("页面ID:", options.id);
this.fetchDetailData(options.id);
@@ -75,9 +192,24 @@
uni.navigateTo({
url: `/packages/chat/chatWindow?userId=${this.detail.user.id}&userName=${userName}`
});
+
+ // 如果是私信后自动公开的情况,且还没有私信过,显示联系方式
+ if (this.detail.public_way === 2 && this.detail.messages_count === 0) {
+ this.$u.toast('私信后联系方式将自动公开');
+ }
} else {
this.$u.toast('用户信息不完整');
}
+ },
+ // 新增方法:预览图片
+ previewImage(file, index) {
+ if (this.imageFiles.length === 0) return;
+
+ uni.previewImage({
+ urls: this.imageFiles.map(f => f.url),
+ current: file.url,
+ index: index
+ });
}
}
}
@@ -86,7 +218,14 @@
\ No newline at end of file
diff --git a/packages/supply/index.vue b/packages/supply/index.vue
index 37109c2..12e540b 100644
--- a/packages/supply/index.vue
+++ b/packages/supply/index.vue
@@ -1,7 +1,15 @@
-
+
@@ -171,6 +179,12 @@
uni.navigateTo({
url: `/packages/chat/chatWindow?userId=${item.user_id}&userName=${item.user.name}&supplyDemandId=${item.id}`
})
+ },
+ toggleMyPosts() {
+ // 跳转到我的发布页面
+ uni.navigateTo({
+ url: '/packages/supply/my-posts'
+ })
}
}
}
@@ -187,6 +201,38 @@
background-color: #fff;
}
+ .search-header {
+ display: flex;
+ align-items: center;
+ gap: 20rpx;
+ margin-bottom: 20rpx;
+ }
+
+ .my-posts-button {
+ display: flex;
+ align-items: center;
+ background: linear-gradient(to right, #e3ccb2, #cba579);
+ padding: 20rpx 30rpx;
+ border-radius: 60rpx;
+ box-shadow: 0 4rpx 12rpx rgba(203, 165, 121, 0.3);
+ transition: all 0.3s ease;
+ }
+
+ .my-posts-button:active {
+ transform: scale(0.95);
+ }
+
+ .my-posts-text {
+ color: #fff;
+ font-size: 28rpx;
+ font-weight: 500;
+ margin-left: 10rpx;
+ }
+
+ .search-input-container {
+ flex: 1;
+ }
+
.list-container {
background: linear-gradient(to bottom, #e9f2fa, #e9f2fa);
padding: 20rpx;
diff --git a/packages/supply/my-posts.vue b/packages/supply/my-posts.vue
new file mode 100644
index 0000000..750964d
--- /dev/null
+++ b/packages/supply/my-posts.vue
@@ -0,0 +1,392 @@
+
+
+
+
+
+
+
+
+
+
+
+ 您还没有发布任何供需信息
+
+ 立即发布
+
+
+
+
+ {{ item.title }}
+ {{ item.content }}
+
+ {{ tag }}
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/supply/publish.vue b/packages/supply/publish.vue
index 81b9e30..3b9dd80 100644
--- a/packages/supply/publish.vue
+++ b/packages/supply/publish.vue
@@ -38,9 +38,32 @@
建议添加相关行业标签, 方便其他校友找到你
-
+
+
+ 图片上传
+
+
+
+
+
+
+
+
+
+
+ 添加图片
+
+
+ 最多上传9张图片,支持jpg、png格式
+
+
+
- 联系方式 *
+ 联系方式
+
+
+
@@ -57,22 +80,66 @@
+
+ 公开模式
+
+
+
+ 直接公开
+
+
+
+ 私信后公开
+
+
+
+ 不公开
+
+
隐私保护: 您的联系方式仅对感兴趣的校友可见, 平台内置防骚扰机制, 保护您的隐私安全。
+
+ 时效性
+
+
+
+ 长期有效
+
+
+
+ 具体日期
+
+
+
+
+
+
+
+
+
+
+