From 653e810bdd5978fa726a03000641e6d62730a1ac Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Sun, 28 Sep 2025 14:26:30 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=8D=E9=A6=88=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/calendar-grid/calendar-grid.vue | 37 ++++++--- packages/hr/index.vue | 2 +- packages/schoolmate/index.vue | 2 +- packages/supply/detail.vue | 12 +-- packages/supply/my-posts.vue | 40 +++++++-- packages/supply/publish.vue | 95 +++++++++++++++++----- pages/course/index.vue | 3 +- 7 files changed, 146 insertions(+), 45 deletions(-) diff --git a/components/calendar-grid/calendar-grid.vue b/components/calendar-grid/calendar-grid.vue index 2f200cb..2a385ec 100644 --- a/components/calendar-grid/calendar-grid.vue +++ b/components/calendar-grid/calendar-grid.vue @@ -17,7 +17,7 @@ {{ cell.date }} - + {{ formatTitle(ev.title) }} @@ -348,6 +348,7 @@ export default { // 暴露给实例:为单日事件预留空间 & 判定与跨天冲突 this.laneCountByDate = laneCountByDate this.segCountByDate = segCountByDate + return segs } }, @@ -356,7 +357,13 @@ export default { // 根据覆盖该日期的跨天事件层数,为单日事件预留顶部空间,避免与跨天条重叠 const lanes = this.laneCountByDate && this.laneCountByDate[fullDate] ? this.laneCountByDate[fullDate] : 0 if (!lanes) return 0 - return lanes * (this.barHeight + this.barSpacing) + + // 如果有冲突(既有跨天事件又有单天事件),增加额外的空间 + const hasConflict = this.hasSpanConflict(fullDate) + const basePadding = lanes * (this.barHeight + this.barSpacing) + const extraPadding = hasConflict ? 40 : 0 // 额外增加40rpx的空间 + + return basePadding + extraPadding }, isSingleEvent(fullDate) { try { @@ -370,7 +377,9 @@ export default { // 有跨天覆盖且该日也有单日事件 const hasMulti = !!(this.segCountByDate && this.segCountByDate[fullDate] > 0) const hasSingle = (this.eventsForDate(fullDate) || []).length > 0 - return hasMulti && hasSingle + const result = hasMulti && hasSingle + + return result }, onEventClick(ev) { this.$emit('eventClick', ev) @@ -452,7 +461,7 @@ export default { eventsForDate(fullDate) { const d0 = new Date(fullDate) d0.setHours(0,0,0,0) - return (this.events || []).filter(ev => { + const result = (this.events || []).filter(ev => { if (!ev || !ev.start_time) return false const s = this.parseDateTime(ev.start_time) const e = ev.end_time ? this.parseDateTime(ev.end_time) : this.parseDateTime(ev.start_time) @@ -462,6 +471,13 @@ export default { if (isMulti) return false return d0.getTime() === s.getTime() }) + + // 调试信息 + if (result.length > 0) { + console.log(`日期 ${fullDate} 的单天事件:`, result) + } + + return result }, pad2(n) { n = Number(n) || 0 @@ -610,15 +626,16 @@ export default { -webkit-box-orient: vertical; overflow: hidden; } -/* 与跨天冲突时,单日事件强制两行省略并稍作下移 */ +/* 与跨天冲突时,单日事件强制一行省略 */ .event-chip.conflict { - white-space: normal !important; - display: -webkit-box !important; - -webkit-box-orient: vertical; - -webkit-line-clamp: 2 !important; + white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; - margin-top: 6rpx; +} + +/* 当有跨天事件时,单天事件需要更多上边距 */ +.event-chip.has-multi-day { + padding-top: 10px !important; } .overlay { diff --git a/packages/hr/index.vue b/packages/hr/index.vue index f6c7661..69108b0 100644 --- a/packages/hr/index.vue +++ b/packages/hr/index.vue @@ -1,6 +1,6 @@ diff --git a/packages/schoolmate/index.vue b/packages/schoolmate/index.vue index 6c78abe..f31232e 100644 --- a/packages/schoolmate/index.vue +++ b/packages/schoolmate/index.vue @@ -128,7 +128,7 @@ 设置 - 您想以下哪些学员能够查看到您的联系方式 + 您想给哪些校友展示联系电话? diff --git a/packages/supply/detail.vue b/packages/supply/detail.vue index 04875ce..830eab8 100644 --- a/packages/supply/detail.vue +++ b/packages/supply/detail.vue @@ -23,15 +23,15 @@ 金额 - {{ formatAmount(detail.amount) }} + {{ formatAmount(detail.amount) }}万元 融资阶段 {{ detail.fund_stage }} - - 期望资金属性 - {{ detail.expect_fund_attr }} + + 公司名称 + {{ detail.fund_company }} 行业类型 @@ -118,10 +118,10 @@ - + 私信 已过期 diff --git a/packages/supply/my-posts.vue b/packages/supply/my-posts.vue index f186ebf..1b4db0a 100644 --- a/packages/supply/my-posts.vue +++ b/packages/supply/my-posts.vue @@ -21,7 +21,7 @@ {{ item.created_at }} {{ item.title }} - {{ item.content }} + {{ item.content?item.content:'' }} {{ tag }} @@ -35,9 +35,13 @@ 查看 - + + 编辑 + + 取消发布 + @@ -72,13 +76,16 @@ statusTabs: [ { name: '全部' }, { name: '已发布' }, - { name: '退回修改' }, + // { name: '退回修改' }, { name: '已拒绝' } ] } }, - onLoad() { + onShow(){ this.fetchMyPosts(); + }, + onLoad() { + }, onReachBottom() { if (this.status === 'loadmore' && !this.loading) { @@ -150,6 +157,25 @@ url: '/packages/supply/publish' }) }, + goToDelete(id) { + this.$u.api.supplyDemandSave({ + id: id, + status: 4 + }).then(res => { + uni.showToast({ + title: '取消发布成功', + icon: 'success', + success: () => { + setTimeout(() => { + this.fetchMyPosts(); + }, 1200); + } + }); + }).catch(err => { + console.error('取消发布失败:', err); + this.$u.toast('取消发布失败,请重试'); + }) + }, changeStatusTab(index) { this.currentStatusTab = index; this.page = 1; @@ -184,7 +210,7 @@ case 3: return '退回修改'; case 4: - return '永久隐藏'; + return '取消发布'; default: return '未知'; } @@ -361,6 +387,10 @@ background: linear-gradient(to right, #5d5ebc, #12099a); } + .view-button-delete { + background: linear-gradient(to right, #d32f2f, #b71c1c); + } + .button-text { color: white; font-size: 26rpx; diff --git a/packages/supply/publish.vue b/packages/supply/publish.vue index 0cbfe90..144149f 100644 --- a/packages/supply/publish.vue +++ b/packages/supply/publish.vue @@ -35,13 +35,13 @@ - + - - + + @@ -156,7 +156,7 @@ - {{ form.type === 'supply' ? '发布供应' : '发布需求' }} + 更新并发布 @@ -176,6 +176,7 @@ activeInput: null, tagInput: '', header: {}, // 添加header对象 + id:'', form: { type: 'supply', // supply or demand or finance or industry title: '', @@ -184,7 +185,7 @@ fund_type: '投资', amount: '', fund_stage: '', - expect_fund_attr: '', + fund_company: '', industry_type: '', product: '', finance_desc: '', @@ -197,6 +198,7 @@ expiryDate: '', // 具体日期 images: [], // 图片列表 }, + existingFiles: [], // 已存在的文件信息(包含id和url) showDatePicker: false, dateParams: { year: true, @@ -218,7 +220,11 @@ return placeholders[this.form.contactType] } }, - onLoad() { + onLoad(options) { + this.id = options.id; + if(this.id){ + this.getDetail(); + } // 获取当前用户信息,设置默认联系人 const currentUser = this.$store.state.vuex_user; if (currentUser && currentUser.name) { @@ -258,6 +264,7 @@ sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 success: (res) => { + // 新选择的图片添加到images数组中 this.form.images.push(...res.tempFilePaths); } }); @@ -302,6 +309,41 @@ }); }); }, + // 获取详情 + async getDetail() { + const res = await this.$u.api.supplyDemandDetail({ + id: this.id + }); + + // 映射详情数据到表单字段 + this.form = { + type: res.type === 1 ? 'supply' : res.type === 2 ? 'demand' : res.type === 3 ? 'finance' : 'industry', + title: res.title || '', + description: res.content || '', + // 投融资字段映射 + fund_type: res.fund_type || '投资', + amount: res.amount || '', + fund_stage: res.fund_stage || '', + fund_company: res.fund_company || '', + industry_type: res.industry_type || '', + product: res.product || '', + finance_desc: res.desc || res.content || '', + tags: res.tag ? res.tag.split(',').filter(t => t.trim()) : [], + contactType: res.wechat ? 'wechat' : res.mobile ? 'phone' : res.email ? 'email' : 'wechat', + contactValue: res.wechat || res.mobile || res.email || '', + contactName: res.contact_name || '', + publicWay: res.public_way || 1, + expiryType: res.expire_time ? 'specific' : 'longterm', + expiryDate: res.expire_time ? res.expire_time.split(' ')[0] : '', + images: res.files ? res.files.map(f => f.url) : [] + }; + + // 保存已存在的文件信息 + this.existingFiles = res.files ? res.files.map(f => ({ + id: f.id, + url: f.url + })) : []; + }, async submit() { // 表单验证 if (!this.form.title.trim()) { @@ -331,23 +373,32 @@ }); try { - // 先上传图片文件 + // 处理图片文件:区分已存在的文件和新上传的文件 const fileIds = []; if (this.form.images.length > 0) { for (let i = 0; i < this.form.images.length; i++) { const imagePath = this.form.images[i]; - try { - const uploadResult = await this.uploadImage(imagePath); - // 根据coursePay.vue的实现,直接使用result.id - if (uploadResult && uploadResult.id) { - fileIds.push(uploadResult.id); - } else { - throw new Error('未获取到文件ID'); + + // 检查是否是已存在的文件 + const existingFile = this.existingFiles.find(f => f.url === imagePath); + if (existingFile) { + // 使用已存在文件的ID + fileIds.push(existingFile.id); + } else { + // 新上传的文件 + try { + const uploadResult = await this.uploadImage(imagePath); + // 根据coursePay.vue的实现,直接使用result.id + if (uploadResult && uploadResult.id) { + fileIds.push(uploadResult.id); + } else { + throw new Error('未获取到文件ID'); + } + } catch (error) { + console.error('图片上传失败:', error); + this.$u.toast(`第${i + 1}张图片上传失败`); + return; } - } catch (error) { - console.error('图片上传失败:', error); - this.$u.toast(`第${i + 1}张图片上传失败`); - return; } } } @@ -371,7 +422,7 @@ params.fund_type = this.form.fund_type || '' params.amount = this.form.amount || '' params.fund_stage = this.form.fund_stage || '' - params.expect_fund_attr = this.form.expect_fund_attr || '' + params.fund_company = this.form.fund_company || '' params.industry_type = this.form.industry_type || '' params.product = this.form.product || '' params.desc = this.form.finance_desc || '' @@ -383,11 +434,15 @@ } // 调用保存接口 + if(this.id){ + params.id = this.id; + } + params.status = 1 const res = await this.$u.api.supplyDemandSave(params); uni.hideLoading(); uni.showToast({ - title: '发布成功, 请等待审核', + title: this.id ? '更新成功' : '发布成功', icon: 'success', success: () => { setTimeout(() => { diff --git a/pages/course/index.vue b/pages/course/index.vue index f298699..ba59df0 100644 --- a/pages/course/index.vue +++ b/pages/course/index.vue @@ -143,8 +143,7 @@ this.base.imgHost('type1.png'), this.base.imgHost('type2.png'), this.base.imgHost('type3.png'), - this.base.imgHost('type4.png'), - this.base.imgHost('type5.png') + this.base.imgHost('type4.png') ], swiperCurrent: 0, hasMobile: false,