|
|
@@ -9,9 +9,9 @@
|
|
|
<view class="close-icon" @click="delFile(index)">
|
|
|
<uni-icons type="closeempty" size="18" color="#fff"></uni-icons>
|
|
|
</view>
|
|
|
- <view class="image-box display-around-column" @click="()=>openFile(item.url)">
|
|
|
- <image src="../../../static/file.png" mode="aspectFill" style="width: 90rpx;height: 70rpx;"></image>
|
|
|
- <view class="margin-top-3">{{item.name}}</view>
|
|
|
+ <view class="image-box display-evenly-column" @click="()=>openFile(item.url)">
|
|
|
+ <image :src=" fileType[item.type] ||'../../../static/file.png'" mode="aspectFill" style="width: 70rpx;height: 70rpx;"></image>
|
|
|
+ <view class="file-font-box">{{item.name}}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view v-if="uploadList.length < 3" class="note-image-item" @click="chooseFile()">
|
|
|
@@ -67,6 +67,14 @@
|
|
|
contentDesc:'',
|
|
|
type:'add',
|
|
|
isShowShareModal:false,
|
|
|
+ fileType:{
|
|
|
+ 'docx':'../../../static/files-icon/word.png',
|
|
|
+ 'doc':'../../../static/files-icon/word.png',
|
|
|
+ 'pdf':'../../../static/files-icon/pdf.png',
|
|
|
+ 'xlsx':'../../../static/files-icon/excel.png',
|
|
|
+ 'xls':'../../../static/files-icon/excel.png',
|
|
|
+ 'ppt':'../../../static/files-icon/ppt.png',
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
onLoad(option) {
|
|
|
@@ -96,6 +104,13 @@
|
|
|
});
|
|
|
setTimeout(()=>{uni.navigateBack({})},500)
|
|
|
},
|
|
|
+ splitFileNameList(fileList){
|
|
|
+ let arr = fileList;
|
|
|
+ arr.forEach((item,index)=>{
|
|
|
+ item.type = item.name.split('.').pop().toLowerCase();
|
|
|
+ })
|
|
|
+ return arr;
|
|
|
+ },
|
|
|
getInfos(id){
|
|
|
let md5Sign = md5(
|
|
|
"method=" +"activity" + "×tamp=" + getApp().globalData.globalTimestamp +
|
|
|
@@ -116,10 +131,14 @@
|
|
|
success: (res) => {
|
|
|
if (res.data.code === 200) {
|
|
|
let obj = res.data.data;
|
|
|
- console.log(obj)
|
|
|
this.recordId = obj.id;
|
|
|
this.contentDesc = obj.content;
|
|
|
- this.uploadList = obj.file_list;
|
|
|
+ obj.file_list.forEach((item)=>{
|
|
|
+ this.fileIdList.push(item.id)
|
|
|
+ })
|
|
|
+ let fileArr = obj.file_list;
|
|
|
+ console.log(fileArr)
|
|
|
+ this.uploadList = this.splitFileNameList(fileArr);
|
|
|
console.log(this.uploadList)
|
|
|
}
|
|
|
},
|
|
|
@@ -230,6 +249,11 @@
|
|
|
chooseFile(){
|
|
|
//chooseMessageFile
|
|
|
let that = this;
|
|
|
+ uni.showLoading({
|
|
|
+ mask:true,
|
|
|
+ title:'上传中...',
|
|
|
+ icon:'none'
|
|
|
+ })
|
|
|
uni.chooseMessageFile({
|
|
|
count: 3,
|
|
|
type: 'file',
|
|
|
@@ -244,6 +268,11 @@
|
|
|
})
|
|
|
console.log('文件上传')
|
|
|
},
|
|
|
+ splitFileName(param){
|
|
|
+ let obj = param;
|
|
|
+ obj.type = param.name.split('.').pop().toLowerCase();
|
|
|
+ return obj;
|
|
|
+ },
|
|
|
uploadFileRequest(fileVal){
|
|
|
let that = this;
|
|
|
let md5Sign = md5(
|
|
|
@@ -264,10 +293,11 @@
|
|
|
},
|
|
|
success: res => {
|
|
|
this.fileObj = JSON.parse(res.data);
|
|
|
- console.log(this.fileObj.data)
|
|
|
+ this.fileObj.data = this.splitFileName(this.fileObj.data);
|
|
|
this.fileObj.data.url = getApp().globalData.shareUrl + this.fileObj.data.url;
|
|
|
this.uploadList.push(this.fileObj.data);
|
|
|
this.fileIdList.push(this.fileObj.data.id);
|
|
|
+ uni.hideLoading();
|
|
|
},
|
|
|
fail:res=>{
|
|
|
console.log("上传请求失败");
|
|
|
@@ -278,6 +308,7 @@
|
|
|
delFile(idx) {
|
|
|
this.uploadList.splice(idx, 1);
|
|
|
this.fileIdList.splice(idx, 1);
|
|
|
+ console.log(this.fileIdList)
|
|
|
},
|
|
|
}
|
|
|
}
|
|
|
@@ -584,4 +615,12 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ .file-font-box {
|
|
|
+ margin-top: 10rpx;
|
|
|
+ width: 60%;
|
|
|
+ white-space: nowrap;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ font-size: 24rpx;
|
|
|
+ }
|
|
|
</style>
|