From c009e6228401b0adf5b73b0caa3c69d18eafffd0 Mon Sep 17 00:00:00 2001 From: wangdong <1551135706@qq.com> Date: Thu, 13 Jun 2024 14:29:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E6=80=81=E4=B8=8A=E4=BC=A0=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E3=80=81=E6=96=87=E4=BB=B6=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/cart/index.vue | 2 +- pages/squareDynamic/index.vue | 45 +++++++++++-- pages/squareDynamic/publish.vue | 108 ++++++++++++++++++++++++++++---- static/xls.jpeg | Bin 0 -> 12195 bytes 4 files changed, 137 insertions(+), 18 deletions(-) create mode 100644 static/xls.jpeg diff --git a/pages/cart/index.vue b/pages/cart/index.vue index 7b74fb1..407e337 100644 --- a/pages/cart/index.vue +++ b/pages/cart/index.vue @@ -22,7 +22,7 @@ - {{ '123456789' || item.goods.merchant.shop_name }} + {{ item.goods.merchant.shop_name }} diff --git a/pages/squareDynamic/index.vue b/pages/squareDynamic/index.vue index 97e165f..a14db9c 100644 --- a/pages/squareDynamic/index.vue +++ b/pages/squareDynamic/index.vue @@ -24,6 +24,12 @@ + + + + {{ solveFileName(file.file_name) }} + + @@ -45,10 +51,6 @@ 删除文案 - 下载图片 @@ -307,6 +309,12 @@       }     }) }, + solveFileName(name) { + if (name.indexOf('.xls')) { + return name.replace('.xls', ''); + } + return name.replace('.xlsx', ''); + }, togggleLike(item, index) { Api.dynamicLike({ id: item.square_id, @@ -557,6 +565,35 @@ } } } + .file-list { + display: block; + padding: 30rpx 0; + height: fit-content; + .file-box { + border-bottom: 1px solid #ddd; + display: flex; + align-items: center; + position: relative; + padding: 10rpx 20rpx; + height: 80rpx; + margin-bottom: 20rpx; + &:last-child { + border-bottom: none; + } + >image { + width: 60rpx; + height: 60rpx; + margin: 0 10rpx 0 0; + flex-shrink: 0; + } + >text { + width: calc(100% - 70rpx); + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + } + } .goods { background: #f5f5f5; padding: 20rpx; diff --git a/pages/squareDynamic/publish.vue b/pages/squareDynamic/publish.vue index 785c226..7384366 100644 --- a/pages/squareDynamic/publish.vue +++ b/pages/squareDynamic/publish.vue @@ -6,7 +6,7 @@ - + @@ -17,6 +17,14 @@ 已写{{ content.length }}/3000个字 + + + + {{ file.name }} + + + 上传附件 + 关联商品: {{ good.goods_name || '请选择' }} @@ -57,16 +65,10 @@ import * as Api from '@/api/squareDynamic/index.js' isPublish: false, loading: false, good: {}, + fileList: [], + uploadFiles: [], }; }, - watch: { - good: { - deep: true, - handler() { - console.log(this.good.goods_name); - }, - }, - }, methods: { addImage() { const that = this; @@ -79,11 +81,11 @@ import * as Api from '@/api/squareDynamic/index.js' }) { console.log(that.imageList, tempFiles); that.imageList.push(tempFiles[0].path) - that.upload(tempFiles[0]) + that.upload(tempFiles[0], 'image') } }); }, - async upload(path) { + async upload(path, type) { const that = this; // 批量上传 return new Promise((resolve, reject) => { @@ -91,7 +93,11 @@ import * as Api from '@/api/squareDynamic/index.js' UploadApi.image([path]) .then(fileIds => { console.log(fileIds); - that.uploadImages.push(fileIds[0]); + if (type === 'image') { + that.uploadImages.push(fileIds[0]); + } else { + that.uploadFiles.push(fileIds[0]) + } resolve(fileIds) }) .catch(reject) @@ -109,6 +115,39 @@ import * as Api from '@/api/squareDynamic/index.js' urls:this.imageList, }); }, + addFile() { + const that = this; + uni.chooseMessageFile({ + count: 1, + success({ + tempFiles + }) { + const nameArr = tempFiles[0].name.split('.'); + const fileType = nameArr[nameArr.length - 1]; + if (!['xls', 'xlsx'].includes(fileType)) { + uni.showToast({ + icon: 'error', + title: '文件格式错误' + }); + } + console.log(tempFiles); + that.fileList.push({ url: tempFiles[0].path, name: tempFiles[0].name.replace(`.${fileType}`, '') }); + that.upload(tempFiles[0], 'file'); + }, + fail(e) { + console.log(e); + } + }); + }, + deleteFile(index) { + this.fileList.splice(index, 1); + this.uploadFiles.splice(index, 1); + }, + previewFile(url) { + uni.openDocument({ + filePath: url, + }); + }, changePicker(e) { console.log(e); this.cateIndex = e.detail.value; @@ -135,6 +174,7 @@ import * as Api from '@/api/squareDynamic/index.js' content: this.content, cate: this.cateList[this.cateIndex], goods_id: this.good.goods_id, + files: this.uploadFiles.join(',') }) .then(res => { console.log(res); @@ -244,7 +284,7 @@ import * as Api from '@/api/squareDynamic/index.js' } } } - .cate, .good { + .cate, .good, .file-upload { margin-top: 20rpx; display: flex; justify-content: space-between; @@ -269,6 +309,48 @@ import * as Api from '@/api/squareDynamic/index.js' height: 100%; } } + .file-upload { + display: block; + padding: 30rpx; + height: fit-content; + .file-box { + border-bottom: 1px solid #ddd; + display: flex; + align-items: center; + position: relative; + padding: 10rpx 20rpx; + height: 80rpx; + margin-bottom: 20rpx; + &:last-child { + border-bottom: none; + } + >image { + &:first-child { + width: 60rpx; + height: 60rpx; + margin: 0 10rpx 0 0; + } + } + >text { + width: calc(100% - 120rpx); + } + .delete { + width: 30rpx; + height: 30rpx; + margin-left: 20rpx; + } + } + .upload-btn { + width: 160rpx; + height: 60rpx; + line-height: 60rpx; + background: #4680ff; + border-radius: 30rpx; + color: #fff; + font-size: 28rpx; + text-align: center; + } + } .good { height: fit-content; .content { diff --git a/static/xls.jpeg b/static/xls.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..52ec08978c516339978b7d5f6629bd37d292144d GIT binary patch literal 12195 zcmc(Fby$?!_Ww($q>4yMsB}n63wWfv8M;GhhAu%pg0#fYAq_)0$Pj~oNJ&dKC?z!@ zNat^q&~uLW-tT>$`#itlkG0<&Ykl^57i+D(_Io^Z{0X=!D=8xhprN4w(x^Y+coYx= z@UXCPurJ}^VB_H9;aw)6BqX?cm4JqfoQRT{?hXqR9U~*#-3R<^oT6NejDm`SqT*7r za4a*zl)bJFfX8gAC$ccpkbh+Vd7(9V_;xne4m7djv6GmL>$$9@!D-p zo1%}R{vUKH^-338bK;9q5I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