diff --git a/pages_subpack/house/commercial.vue b/pages_subpack/house/commercial.vue
index def2706..6d00970 100644
--- a/pages_subpack/house/commercial.vue
+++ b/pages_subpack/house/commercial.vue
@@ -70,6 +70,13 @@
请输入数字,支持小数点后两位
+
+
+ 请上传地块现状照片,展示地块实际情况
+
+
+
@@ -125,6 +132,7 @@
landArea: '', // 土地面积
videos: [], // 地块视频
price: '', // 价格
+ images: [], // 地块图片
description: '', // 地块介绍
longitude: '', // 经度
latitude: '', // 纬度
@@ -155,6 +163,20 @@
{ required: true, message: '请输入价格', trigger: ['blur', 'change'] },
{ pattern: /^\d+(\.\d{1,2})?$/, message: '请输入正确的价格格式', trigger: ['blur', 'change'] }
],
+ images: [
+ {
+ required: true,
+ message: '请上传地块图片',
+ trigger: ['blur', 'change'],
+ validator: (rule, value, callback) => {
+ if (!value || value.length === 0) {
+ callback(new Error('请上传地块图片'));
+ } else {
+ callback();
+ }
+ }
+ }
+ ],
classId: [
{ required: true, message: '请选择分类标识', trigger: ['blur', 'change'] }
]
@@ -290,16 +312,16 @@
for (let file of e.file) {
try {
// 创建视频元素来获取视频时长
- const duration = await this.getVideoDuration(file.url)
+ // const duration = await this.getVideoDuration(file.url)
// 检查视频时长是否超过60秒
- if (duration > 60) {
- uni.showToast({
- title: '视频时长不能超过1分钟',
- icon: 'none'
- })
- continue // 跳过这个视频
- }
+ // if (duration > 60) {
+ // uni.showToast({
+ // title: '视频时长不能超过1分钟',
+ // icon: 'none'
+ // })
+ // continue // 跳过这个视频
+ // }
// 上传视频
self.$Oss.ossUpload(file.url).then(url => {
@@ -359,6 +381,30 @@
this.debounceSaveFormData()
},
+ // 地块图片上传
+ async afterImageRead(e) {
+ let self = this
+ e.file.forEach(file => {
+ self.$Oss.ossUpload(file.url).then(url => {
+ self.form.images.push({
+ url
+ })
+ // 上传完成后保存表单数据
+ self.debounceSaveFormData()
+ // 触发表单验证更新
+ self.$refs.form.validateField('images')
+ })
+ })
+ },
+
+ deleteImagePic(event) {
+ this.form.images.splice(event.index, 1)
+ // 删除后保存表单数据
+ this.debounceSaveFormData()
+ // 触发表单验证更新
+ this.$refs.form.validateField('images')
+ },
+
// 提交表单
submit() {
this.$refs.form.validate().then(res => {
@@ -379,6 +425,14 @@
return;
}
+ if (this.form.images.length === 0) {
+ uni.showToast({
+ title: '请上传地块图片',
+ icon: 'none'
+ });
+ return;
+ }
+
// 构建与index.vue兼容的提交参数
const params = {
userId: uni.getStorageSync('userInfo')?.id || "",
@@ -422,7 +476,7 @@
timeGo: "", // 年限 - 经营性用地无此字段
title: `${this.form.type === 'rent' ? '出租' : '出让'}-经营性建设用地-${this.form.address.split('市')[1] || this.form.address}`, // 标题 - 自动生成
unit: this.form.type === 'rent' ? '元/亩/年' : '万元/亩', // 单位
- image: "", // 图片 - 经营性用地无房屋照片
+ image: this.form.images.map(item => item.url).join(','), // 地块图片
iconImage: "", // 左上角图标
homeImage: this.form.propertyImages.map(item => item.url).join(','), // 产权证照片
homeMp4: this.form.videos.map(item => item.url).join(','), // 视频
diff --git a/pages_subpack/house/other.vue b/pages_subpack/house/other.vue
index 889cb6c..373f89c 100644
--- a/pages_subpack/house/other.vue
+++ b/pages_subpack/house/other.vue
@@ -39,7 +39,9 @@
请上传资源相关照片
-