Compare commits

..

No commits in common. "6ae8c93a6136380d1bebdf22d69c2a9adc45d435" and "c1dbf6b002397f7c734ece6bcacb7d1e009037c6" have entirely different histories.

3 changed files with 24 additions and 110 deletions

View File

@ -316,15 +316,9 @@
},
//
goPasswordLogin(){
if(this.query.tenantId){
uni.reLaunch({
url: './passwordLogin?tenantId='+this.query.tenantId
});
}else{
uni.reLaunch({
url: './passwordLogin'
});
}
uni.reLaunch({
url: './passwordLogin'
});
},
goPolicy() {
uni.navigateTo({

View File

@ -331,15 +331,9 @@
},
//
goPhoneLogin(){
if(this.query.tenantId){
uni.reLaunch({
url: './codeLogin?tenantId='+this.query.tenantId
});
}else{
uni.reLaunch({
url: './codeLogin'
});
}
uni.reLaunch({
url: './codeLogin'
});
},
goPolicy() {
uni.navigateTo({

View File

@ -44,11 +44,6 @@
</view>
<u-button @click="chooseImage(item,index)" type="primary" :disabled="getDisabledStatus()"
:loading="item.uploading">{{ item.attrValue ? '重新上传' : '上传图片' }}</u-button>
<!-- 上传进度条 -->
<view v-if="item.uploadProgress > 0 && item.uploadProgress < 100" class="progress-container">
<u-line-progress :percent="item.uploadProgress" :show-percent="true" height="20"></u-line-progress>
</view>
</view>
</template>
@ -61,12 +56,7 @@
</view>
<u-button @click="chooseAudio(item,index)" type="primary" :disabled="getDisabledStatus()"
:loading="item.uploading">{{ item.attrValue ? '重新上传' : '上传音频' }}</u-button>
<!-- 上传进度条 -->
<view v-if="item.uploadProgress > 0 && item.uploadProgress < 100" class="progress-container">
<u-line-progress :percent="item.uploadProgress" :show-percent="true" height="20"></u-line-progress>
</view>
<!-- <text v-if="item.fileUrl" class="audio-name">已上传音频文件</text> -->
<text class="upload-tip">{{'最大' + audioSize + 'MB'}}</text>
</view>
</template>
@ -81,12 +71,6 @@
</view>
<u-button @click="chooseVideo(item,index)" type="primary" :disabled="getDisabledStatus()"
:loading="item.uploading">{{ item.attrValue ? '重新上传' : '上传视频' }}</u-button>
<!-- 上传进度条 -->
<view v-if="item.uploadProgress > 0 && item.uploadProgress < 100" class="progress-container">
<u-line-progress :percent="item.uploadProgress" :show-percent="true" height="20"></u-line-progress>
</view>
<text class="upload-tip">{{'最大' + videoSize + 'MB'}}</text>
</view>
</template>
@ -132,7 +116,7 @@
//
materialShow:false,
audioSize: 10,
videoSize: 100,
videoSize: 50,
audioType: ['.wav', '.mp3', '.aac', '.flac', '.ogg'],
audioH5Type: ['wav', 'mp3', 'aac', 'flac', 'ogg'],
buttonLoading:false,
@ -181,8 +165,6 @@
item.orderItemId = this.orderItemId;
item.dictId = this.materialfrom.dictId;
item.id = null;
item.uploading = false;
item.uploadProgress = 0;
return item;
});
},
@ -195,10 +177,6 @@
this.scriptContent = res.rows[0].script || '';
this.materialTemplateList = res.rows[0].materialItems || [];
res.rows[0].materialItems.forEach(async (item,index)=>{
//
this.$set(this.materialTemplateList[index], 'uploading', false);
this.$set(this.materialTemplateList[index], 'uploadProgress', 0);
if(item.attrType !== 0 && item.attrValue !== ''){
let {fileUrl,fileName} = await this.getFileDetail(item.attrValue);
console.log("fileUrl,fileName",fileUrl,fileName)
@ -253,31 +231,24 @@
return `${shortenedName}...${extension}`;
},
chooseImage(item, index) {
this.materialTemplateList[index].uploading = true;
uni.chooseImage({
count: 1,
success: (res) => {
this.$nextTick(()=>{
this.$set(this.materialTemplateList[index], 'uploading', true);
this.$set(this.materialTemplateList[index], 'uploadProgress', 0);
})
const tempFilePath = res.tempFilePaths[0];
this.uploadFile(tempFilePath, 'image', item, index);
},
fail: () => {
complete: () => {
this.materialTemplateList[index].uploading = false;
this.materialTemplateList[index].uploadProgress = 0;
}
});
},
chooseVideo(item,index) {
this.materialTemplateList[index].uploading = true;
uni.chooseVideo({
count: 1,
maxDuration: 60,
success: (res) => {
this.$nextTick(()=>{
this.$set(this.materialTemplateList[index], 'uploading', true);
this.$set(this.materialTemplateList[index], 'uploadProgress', 0);
})
const tempFilePath = res.tempFilePath;
const fileSize = res.size;
if (fileSize > this.videoSize * 1024 * 1024) {
@ -286,7 +257,6 @@
icon: 'none'
});
this.materialTemplateList[index].uploading = false;
this.materialTemplateList[index].uploadProgress = 0;
return;
}
this.uploadFile(tempFilePath, 'video', item, index);
@ -297,17 +267,14 @@
title: '选择视频失败',
icon: 'none'
});
this.materialTemplateList[index].uploading = false;
this.materialTemplateList[index].uploadProgress = 0;
},
complete: () => {
console.log("权限选择视频")
this.materialTemplateList[index].uploading = false;
this.materialTemplateList[index].uploadProgress = 0;
}
});
},
chooseAudio(item,index) {
this.materialTemplateList[index].uploading = true;
// H5chooseFile
// #ifdef H5
uni.chooseFile({
@ -315,10 +282,6 @@
type: 'all',
extension: this.audioType,
success: (res) => {
this.$nextTick(()=>{
this.$set(this.materialTemplateList[index], 'uploading', true);
this.$set(this.materialTemplateList[index], 'uploadProgress', 0);
})
const tempFilePath = res.tempFiles[0].path;
const fileSize = res.tempFiles[0].size;
const fileName = res.tempFiles[0].name;
@ -328,7 +291,6 @@
icon: 'none'
});
this.materialTemplateList[index].uploading = false;
this.materialTemplateList[index].uploadProgress = 0;
return;
}
this.uploadFile(tempFilePath, 'audio', item, index, fileName);
@ -339,8 +301,9 @@
title: '选择音频失败',
icon: 'none'
});
},
complete: () => {
this.materialTemplateList[index].uploading = false;
this.materialTemplateList[index].uploadProgress = 0;
}
});
// #endif
@ -351,10 +314,6 @@
type: 'file',
extension: this.audioH5Type,
success: (res) => {
this.$nextTick(()=>{
this.$set(this.materialTemplateList[index], 'uploading', true);
this.$set(this.materialTemplateList[index], 'uploadProgress', 0);
})
const tempFilePath = res.tempFiles[0].path;
const fileSize = res.tempFiles[0].size;
const fileName = res.tempFiles[0].name;
@ -364,7 +323,6 @@
icon: 'none'
});
this.materialTemplateList[index].uploading = false;
this.materialTemplateList[index].uploadProgress = 0;
return;
}
this.uploadFile(tempFilePath, 'audio', item, index, fileName);
@ -375,8 +333,9 @@
title: '选择音频失败',
icon: 'none'
});
},
complete: () => {
this.materialTemplateList[index].uploading = false;
this.materialTemplateList[index].uploadProgress = 0;
}
});
// #endif
@ -384,9 +343,8 @@
uploadFile(filePath, fileType, item, index, fileName = '') {
//
const uploadUrl = config.baseUrl + '/resource/oss/upload';
//
const uploadTask = uni.uploadFile({
uni.uploadFile({
url: uploadUrl,
filePath: filePath,
name: 'file',
@ -398,6 +356,7 @@
const data = JSON.parse(uploadRes.data);
console.log("data", data)
// URL
// this.materialTemplateList[index].fileUrl = data.url
this.materialTemplateList[index].attrValue = data.data.ossId;
this.materialTemplateList[index].fileUrl = data.data.url;
this.materialTemplateList[index].fileName = data.data.fileName;
@ -412,28 +371,8 @@
title: '上传失败',
icon: 'none'
});
},
complete: () => {
console.log('上传结束');
this.materialTemplateList[index].uploading = false;
// 1000
this.materialTemplateList[index].uploadProgress = 100;
setTimeout(() => {
this.materialTemplateList[index].uploadProgress = 0;
}, 500);
}
});
//
uploadTask.onProgressUpdate((res) => {
console.log('上传进度', res.progress - 15);
console.log('已经上传的数据长度', res.totalBytesSent);
console.log('预期需要上传的数据总长度', res.totalBytesExpectedToSend);
let progress = (res.progress - 15 > 0)?(res.progress - 15) : res.progress;
this.materialTemplateList[index].uploadProgress = progress;
});
},
deleteFile(item,index) {
uni.showModal({
@ -446,7 +385,6 @@
this.materialTemplateList[index].attrValue = '';
this.materialTemplateList[index].fileUrl = '';
this.materialTemplateList[index].fileName = '';
this.materialTemplateList[index].uploadProgress = 0;
uni.showToast({
title: '删除成功',
icon: 'success'
@ -479,17 +417,6 @@
})
return;
}
//
const isUploading = this.materialTemplateList.some(item => item.uploading || (item.uploadProgress > 0 && item.uploadProgress < 100));
if (isUploading) {
this.$refs.uToast.show({
title: '请等待文件上传完成',
type: 'warning',
})
return;
}
let btnTitle = status==='draft' ?'暂存':'提交'
uni.showModal({
title: '操作确认',
@ -659,6 +586,9 @@
margin-bottom: 10rpx;
}
.audio-preview {
display: flex;
align-items: center;
@ -680,10 +610,7 @@
}
}
.progress-container {
margin: 10rpx 0;
width: 100%;
}
.upload-tip {
margin-top: 5rpx;
@ -710,5 +637,4 @@
align-items: center;
}
}
</style>
</style>