|
|
@@ -12,6 +12,7 @@
|
|
|
<view class="form-input-wrapper">
|
|
|
<textarea
|
|
|
class="form-input"
|
|
|
+ style="height: 100rpx;"
|
|
|
v-model="formData.title"
|
|
|
placeholder="请输入标题"
|
|
|
maxlength="50"
|
|
|
@@ -74,25 +75,35 @@
|
|
|
</view>
|
|
|
<view class="form-tips">仅支持jpg/png文件,单个图片不超过2M</view>
|
|
|
<view class="upload-cover" @click="chooseCoverImage">
|
|
|
- <image class="img" v-if="formData.coverImage" :src="formData.coverImage" mode="aspectFill"></image>
|
|
|
+ <image class="img" v-if="formData.coverImage" :src="formData.coverImage" mode=""></image>
|
|
|
<view v-else class="upload-placeholder">
|
|
|
<image class="w48 h48" src="@/static/image/icon_camera1.png" mode=""></image>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
-
|
|
|
+ <!-- 上传进度弹窗 -->
|
|
|
+ <view class="upload-modal" v-if="showUploadModal">
|
|
|
+ <view class="upload-modal-content">
|
|
|
+ <view class="upload-modal-title">文件上传中</view>
|
|
|
+ <view class="upload-progress-wrapper">
|
|
|
+ <progress :percent="percent" stroke-width="8" show-info activeColor="#4CAF50" border-radius="10"></progress>
|
|
|
+ </view>
|
|
|
+ <view class="upload-modal-tips">请勿关闭页面</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
<!-- 上传附件 -->
|
|
|
<view class="form-section">
|
|
|
<view class="form-label">
|
|
|
<text class="required">*</text>
|
|
|
<text>上传附件</text>
|
|
|
</view>
|
|
|
- <view class="form-tips">支持MP4等文件,单个文件不超过500M</view>
|
|
|
+ <view v-if="taskType==4" class="form-tips">支持PDF等文件,单个文件不超过2M</view>
|
|
|
+ <view v-else class="form-tips">支持MP4等文件,单个文件不超过500M</view>
|
|
|
<view class="attachment-list">
|
|
|
<view class="attachment-item" v-for="(item, index) in formData.attachments" :key="index">
|
|
|
- <text class="attachment-icon">📎</text>
|
|
|
- <view class="attachment-info">
|
|
|
- <text class="attachment-name">{{ item.name }}</text>
|
|
|
+ <text class="attachment-icon"></text>
|
|
|
+ <view class="attachment-info" style="width: 90%;">
|
|
|
+ <text class="attachment-name one-t" style="width: 90%;">{{ item.name }}</text>
|
|
|
<text class="attachment-size">{{ item.size }}</text>
|
|
|
</view>
|
|
|
<text class="attachment-delete" @click="removeAttachment(index)">×</text>
|
|
|
@@ -124,8 +135,8 @@
|
|
|
:class="{ active: tempGroupId === item.id }"
|
|
|
v-for="(item, index) in groupOptions"
|
|
|
:key="index"
|
|
|
- @click="tempGroupId = item.id; tempGroupName = item.name">
|
|
|
- {{ item.name }}
|
|
|
+ @click="tempGroupId = item.id; tempGroupName = item.projectName">
|
|
|
+ {{ item.projectName }}
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -141,11 +152,11 @@
|
|
|
</view>
|
|
|
<view class="picker-body">
|
|
|
<view class="picker-item"
|
|
|
- :class="{ active: tempTagId === item.id }"
|
|
|
+ :class="{ active: tempTagId === item.dictValue }"
|
|
|
v-for="(item, index) in tagOptions"
|
|
|
:key="index"
|
|
|
- @click="tempTagId = item.id; tempTagName = item.name">
|
|
|
- {{ item.name }}
|
|
|
+ @click="tempTagId = item.dictValue; tempTagName = item.dictLabel">
|
|
|
+ {{ item.dictLabel }}
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -154,12 +165,16 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { submitTask, getGroupOptions, getTagOptions, uploadFile } from '@/api-js/airClassroom'
|
|
|
+import { submitTask, getGroupOptions, getTagOptions } from '@/api/airClassroom'
|
|
|
+import { deleteFile, deleteBatch, checkFast, complete,postPolicy} from '@/api/common.js'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+ percent: 0,
|
|
|
+ showUploadModal: false, // 控制上传进度弹窗显示
|
|
|
statusBarHeight: uni.getSystemInfoSync().statusBarHeight + 'px',
|
|
|
taskId: '',
|
|
|
+ taskType:null,
|
|
|
isEdit: false,
|
|
|
showGroupPicker: false,
|
|
|
showTagPicker: false,
|
|
|
@@ -178,14 +193,14 @@ export default {
|
|
|
attachments: []
|
|
|
},
|
|
|
groupOptions: [
|
|
|
- { id: '1', name: '学术' },
|
|
|
- { id: '2', name: '临床' },
|
|
|
- { id: '3', name: '科研' }
|
|
|
+ // { id: '1', name: '学术' },
|
|
|
+ // { id: '2', name: '临床' },
|
|
|
+ // { id: '3', name: '科研' }
|
|
|
],
|
|
|
tagOptions: [
|
|
|
- { id: '1', name: '长视频' },
|
|
|
- { id: '2', name: '短视频' },
|
|
|
- { id: '3', name: '文章' }
|
|
|
+ // { id: '1', name: '长视频' },
|
|
|
+ // { id: '2', name: '短视频' },
|
|
|
+ // { id: '3', name: '文章' }
|
|
|
]
|
|
|
}
|
|
|
},
|
|
|
@@ -200,6 +215,7 @@ export default {
|
|
|
onLoad(options) {
|
|
|
if (options.id) {
|
|
|
this.taskId = options.id
|
|
|
+ this.taskType = options.taskType
|
|
|
}
|
|
|
if (options.edit === 'true') {
|
|
|
this.isEdit = true
|
|
|
@@ -232,54 +248,252 @@ export default {
|
|
|
count: 1,
|
|
|
sizeType: ['compressed'],
|
|
|
sourceType: ['album', 'camera'],
|
|
|
- success: async (res) => {
|
|
|
- try {
|
|
|
- uni.showLoading({ title: '上传中...' })
|
|
|
- const uploadRes = await uploadFile({
|
|
|
- file: res.tempFilePaths[0],
|
|
|
- type: 'cover'
|
|
|
- })
|
|
|
- uni.hideLoading()
|
|
|
- if (uploadRes.code === 200 && uploadRes.data) {
|
|
|
- this.formData.coverImage = uploadRes.data.url
|
|
|
+ success: (res) => {
|
|
|
+ uni.showLoading({ title: '上传中...' })
|
|
|
+ console.log('图片路径',res)
|
|
|
+ const filePath = res.tempFilePaths[0]
|
|
|
+ const requestPath = uni.getStorageSync('requestPath')
|
|
|
+ const uploadTask = uni.uploadFile({
|
|
|
+ url: `${requestPath}/app/common/uploadOSS`,
|
|
|
+ filePath: filePath,
|
|
|
+ name: 'file',
|
|
|
+ formData: {},
|
|
|
+ success: (uploadRes) => {
|
|
|
+ uni.hideLoading()
|
|
|
+ try {
|
|
|
+ const result = typeof uploadRes.data === 'string' ? JSON.parse(uploadRes.data) : uploadRes.data
|
|
|
+ if (result.code == 200) {
|
|
|
+ this.formData.coverImage = result.url
|
|
|
+ uni.showToast({ icon: 'success', title: '上传成功' })
|
|
|
+ } else {
|
|
|
+ uni.showToast({ icon: 'none', title: result.msg || '上传失败' })
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ uni.hideLoading()
|
|
|
+ console.error('解析上传结果失败', e)
|
|
|
+ uni.showToast({ icon: 'none', title: '上传失败' })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ // this.percent = 0;
|
|
|
+ console.error('上传失败', err)
|
|
|
+ uni.showToast({ icon: 'none', title: '上传失败' })
|
|
|
}
|
|
|
- } catch (e) {
|
|
|
- uni.hideLoading()
|
|
|
- uni.showToast({ icon: 'none', title: '上传失败' })
|
|
|
- }
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- chooseAttachment() {
|
|
|
- uni.chooseFile({
|
|
|
- count: 1,
|
|
|
- type: 'file',
|
|
|
- success: async (res) => {
|
|
|
- const file = res.tempFiles[0]
|
|
|
- if (file.size > 500 * 1024 * 1024) {
|
|
|
- uni.showToast({ icon: 'none', title: '文件大小不能超过500M' })
|
|
|
- return
|
|
|
- }
|
|
|
- try {
|
|
|
- uni.showLoading({ title: '上传中...' })
|
|
|
- const uploadRes = await uploadFile({
|
|
|
- file: file.path,
|
|
|
- type: 'attachment'
|
|
|
- })
|
|
|
- uni.hideLoading()
|
|
|
- if (uploadRes.code === 200 && uploadRes.data) {
|
|
|
- this.formData.attachments.push({
|
|
|
- name: file.name,
|
|
|
- size: this.formatFileSize(file.size),
|
|
|
- url: uploadRes.data.url
|
|
|
- })
|
|
|
- }
|
|
|
- } catch (e) {
|
|
|
- uni.hideLoading()
|
|
|
- uni.showToast({ icon: 'none', title: '上传失败' })
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
+ chooseAttachment(){
|
|
|
+ var vm = this;
|
|
|
+
|
|
|
+ // 对更多字符编码的 url encode 格式
|
|
|
+ var camSafeUrlEncode = function (str) {
|
|
|
+ return encodeURIComponent(str)
|
|
|
+ .replace(/!/g, '%21')
|
|
|
+ .replace(/'/g, '%27')
|
|
|
+ .replace(/\(/g, '%28')
|
|
|
+ .replace(/\)/g, '%29')
|
|
|
+ .replace(/\*/g, '%2A');
|
|
|
+ };
|
|
|
+ const requestPath = uni.getStorageSync('requestPath')
|
|
|
+ // 获取上传路径、上传凭证
|
|
|
+ var getUploadInfo = function (extName, callback) {
|
|
|
+ // 传入文件后缀,让后端生成随机的 COS 对象路径,并返回上传域名、PostObject 接口要用的 policy 签名
|
|
|
+ // 参考服务端示例:https://github.com/tencentyun/cos-demo/tree/main/server/post-policy
|
|
|
+ uni.request({
|
|
|
+ url: `${requestPath}/app/upload/post-policy?ext=` + extName,
|
|
|
+ success: (res) => {
|
|
|
+ // 确认返回格式是否正确
|
|
|
+ //console.log(res);
|
|
|
+ callback && callback(null, res.data);
|
|
|
+ },
|
|
|
+ error(err) {
|
|
|
+ callback && callback(err);
|
|
|
+ },
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ // 发起上传请求,上传使用 PostObject 接口,使用 policy 签名保护
|
|
|
+ // 接口文档:https://cloud.tencent.com/document/product/436/14690#.E7.AD.BE.E5.90.8D.E4.BF.9D.E6.8A.A4
|
|
|
+ var uploadFile = function (opt, callback) {
|
|
|
+ console.log("上传参数", opt);
|
|
|
+ // 构建表单数据(字段名必须使用带连字符的格式,符合腾讯云 PostObject 接口要求)
|
|
|
+ var formData = {
|
|
|
+ key: opt.data.key, // 文件路径(必须是 key,不是 cosKey)
|
|
|
+ policy: opt.data.policy, // policy 的 base64 字符串
|
|
|
+ success_action_status: '200', // 成功状态码
|
|
|
+ 'q-sign-algorithm': opt.data.qsignAlgorithm,// 签名算法(必须是 q-sign-algorithm)
|
|
|
+ 'q-ak': opt.data.qak,
|
|
|
+ 'q-key-time': opt.data.qkeyTime, // 密钥有效时间(必须是 q-key-time)
|
|
|
+ 'q-signature': opt.data.qsignature // 签名(必须是 q-signature)
|
|
|
+ };
|
|
|
+
|
|
|
+ // 如果服务端用了临时密钥计算,需要传 x-cos-security-token
|
|
|
+ if (opt.data.securityToken) {
|
|
|
+ formData['x-cos-security-token'] = opt.data.securityToken;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ console.log("上传URL", opt.data.url);
|
|
|
+ console.log("文件路径", opt.filePath);
|
|
|
+
|
|
|
+ // 显示上传进度弹窗
|
|
|
+ vm.showUploadModal = true;
|
|
|
+ vm.percent = 0;
|
|
|
+
|
|
|
+ const uploadTask=uni.uploadFile({
|
|
|
+ url: opt.data.url, // COS 上传域名
|
|
|
+ filePath: opt.filePath, // 文件路径(不在 formData 中)
|
|
|
+ name: 'file', // 文件字段名
|
|
|
+ formData: formData, // 表单数据
|
|
|
+ success: (res) => {
|
|
|
+ console.log("上传响应", res);
|
|
|
+ // 关闭上传进度弹窗
|
|
|
+ vm.showUploadModal = false;
|
|
|
+ vm.percent = 0;
|
|
|
+
|
|
|
+ if (![200, 204].includes(res.statusCode)) {
|
|
|
+ console.error("上传失败,状态码:", res.statusCode, res);
|
|
|
+ return callback && callback(res);
|
|
|
+ }
|
|
|
+ // 构建文件访问 URL
|
|
|
+ var fileUrl = opt.data.url + '/' + camSafeUrlEncode(opt.data.key).replace(/%2F/g, '/');
|
|
|
+ console.log("上传成功,文件URL:", fileUrl);
|
|
|
+ callback && callback(null, fileUrl);
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ console.error("上传失败", err);
|
|
|
+ // 关闭上传进度弹窗
|
|
|
+ vm.showUploadModal = false;
|
|
|
+ vm.percent = 0;
|
|
|
+ callback && callback(err);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ uploadTask.onProgressUpdate(function(res) {
|
|
|
+ vm.percent = res.progress;
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ // 根据 taskType 选择不同的文件类型
|
|
|
+ // taskType = 4(科普文章):上传普通文档文件
|
|
|
+ // taskType = 5 或 6:上传视频文件
|
|
|
+
|
|
|
+ var taskType = vm.taskType;
|
|
|
+ console.log('当前 taskType:', taskType);
|
|
|
+
|
|
|
+ // taskType = 5 或 6,选择视频文件
|
|
|
+ if (taskType == 5 || taskType == 6) {
|
|
|
+ // 选择视频文件
|
|
|
+ wx.chooseMessageFile({
|
|
|
+ count: 3,
|
|
|
+ type: 'video',
|
|
|
+ success: (chooseRes) => {
|
|
|
+ console.log('选择视频', chooseRes);
|
|
|
+ var filePath = chooseRes.tempFiles[0].path;
|
|
|
+ var size = chooseRes.tempFiles[0].size;
|
|
|
+ var name = chooseRes.tempFiles[0].name;
|
|
|
+ var lastIndex = filePath.lastIndexOf('.');
|
|
|
+ var extName = lastIndex > -1 ? filePath.slice(lastIndex + 1) : '';
|
|
|
+ // 获取预上传用的域名、路径、凭证
|
|
|
+ getUploadInfo(extName, function (err, info) {
|
|
|
+ if (err) {
|
|
|
+ console.error('获取上传信息失败', err);
|
|
|
+ uni.showToast({ icon: 'none', title: '获取上传信息失败' });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ console.log("上传信息", info);
|
|
|
+ info.filePath = filePath;
|
|
|
+ // 上传文件
|
|
|
+ uploadFile(info, function (err, fileUrl) {
|
|
|
+ if (err) {
|
|
|
+ console.error('上传失败', err);
|
|
|
+ uni.showToast({ icon: 'none', title: '上传失败' });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ console.log('上传成功,文件URL:', fileUrl);
|
|
|
+ // 添加到附件列表
|
|
|
+ vm.formData.attachments.push({
|
|
|
+ name:name,
|
|
|
+ size: vm.formatFileSize(size || 0),
|
|
|
+ url: fileUrl
|
|
|
+ });
|
|
|
+ uni.showToast({ icon: 'success', title: '上传成功' });
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ if (err.errMsg && !err.errMsg.includes('cancel')) {
|
|
|
+ console.error('选择视频失败', err);
|
|
|
+ uni.showToast({ icon: 'none', title: '选择视频失败' });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }else{
|
|
|
+ wx.chooseMessageFile({
|
|
|
+ count: 1,
|
|
|
+ type: 'file', // 选择文档文件(不包括视频和图片)
|
|
|
+ success: (res) => {
|
|
|
+ console.log('文档路径',res)
|
|
|
+ const filePath = res.tempFiles[0].path
|
|
|
+ const fileName = res.tempFiles[0].name
|
|
|
+ const size = res.tempFiles[0].size;
|
|
|
+ const requestPath = uni.getStorageSync('requestPath')
|
|
|
+
|
|
|
+ // 显示上传进度弹窗
|
|
|
+ vm.showUploadModal = true;
|
|
|
+ vm.percent = 0;
|
|
|
+
|
|
|
+ const uploadTask = uni.uploadFile({
|
|
|
+ url: `${requestPath}/app/common/uploadOSS`,
|
|
|
+ filePath: filePath,
|
|
|
+ name: 'file',
|
|
|
+ formData: {},
|
|
|
+ success: (uploadRes) => {
|
|
|
+ // 关闭上传进度弹窗
|
|
|
+ vm.showUploadModal = false;
|
|
|
+ vm.percent = 0;
|
|
|
+
|
|
|
+ try {
|
|
|
+ const result = typeof uploadRes.data === 'string' ? JSON.parse(uploadRes.data) : uploadRes.data
|
|
|
+ if (result.code == 200) {
|
|
|
+ //this.formData.attachmentUrl = result.url
|
|
|
+ vm.formData.attachments.push({
|
|
|
+ name:fileName,
|
|
|
+ size: vm.formatFileSize(size || 0),
|
|
|
+ url: result.url
|
|
|
+ });
|
|
|
+ uni.showToast({ icon: 'success', title: '上传成功' })
|
|
|
+ } else {
|
|
|
+ uni.showToast({ icon: 'none', title: result.msg || '上传失败' })
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ console.error('解析上传结果失败', e)
|
|
|
+ uni.showToast({ icon: 'none', title: '上传失败' })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ // 关闭上传进度弹窗
|
|
|
+ vm.showUploadModal = false;
|
|
|
+ vm.percent = 0;
|
|
|
+ console.error('上传失败', err)
|
|
|
+ uni.showToast({ icon: 'none', title: '上传失败' })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ // 监听上传进度
|
|
|
+ uploadTask.onProgressUpdate(function(res) {
|
|
|
+ vm.percent = res.progress;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ if (err.errMsg && !err.errMsg.includes('cancel')) {
|
|
|
+ console.error('选择文档失败', err);
|
|
|
+ uni.showToast({ icon: 'none', title: '选择文档失败' });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
},
|
|
|
removeAttachment(index) {
|
|
|
this.formData.attachments.splice(index, 1)
|
|
|
@@ -289,11 +503,43 @@ export default {
|
|
|
if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(2) + 'KB'
|
|
|
return (bytes / (1024 * 1024)).toFixed(2) + 'MB'
|
|
|
},
|
|
|
+ // 根据文件扩展名获取文件类型
|
|
|
+ getFileType(fileExt) {
|
|
|
+ const typeMap = {
|
|
|
+ // 视频
|
|
|
+ 'mp4': 'video',
|
|
|
+ 'avi': 'video',
|
|
|
+ 'mov': 'video',
|
|
|
+ 'wmv': 'video',
|
|
|
+ 'flv': 'video',
|
|
|
+ 'mkv': 'video',
|
|
|
+ // 音频
|
|
|
+ 'mp3': 'audio',
|
|
|
+ 'wav': 'audio',
|
|
|
+ 'wma': 'audio',
|
|
|
+ // 图片
|
|
|
+ 'jpg': 'image',
|
|
|
+ 'jpeg': 'image',
|
|
|
+ 'png': 'image',
|
|
|
+ 'gif': 'image',
|
|
|
+ 'bmp': 'image',
|
|
|
+ // 文档
|
|
|
+ 'pdf': 'document',
|
|
|
+ 'doc': 'document',
|
|
|
+ 'docx': 'document',
|
|
|
+ 'xls': 'document',
|
|
|
+ 'xlsx': 'document',
|
|
|
+ 'ppt': 'document',
|
|
|
+ 'pptx': 'document',
|
|
|
+ 'txt': 'document'
|
|
|
+ }
|
|
|
+ return typeMap[fileExt] || 'other'
|
|
|
+ },
|
|
|
async loadOptions() {
|
|
|
try {
|
|
|
const [groupRes, tagRes] = await Promise.all([
|
|
|
getGroupOptions(),
|
|
|
- getTagOptions()
|
|
|
+ getTagOptions({dictType:'project_label'})
|
|
|
])
|
|
|
if (groupRes.code === 200 && groupRes.data) {
|
|
|
this.groupOptions = groupRes.data
|
|
|
@@ -325,17 +571,47 @@ export default {
|
|
|
uni.showToast({ icon: 'none', title: '请上传封面' })
|
|
|
return
|
|
|
}
|
|
|
- if (this.formData.attachments.length === 0) {
|
|
|
- uni.showToast({ icon: 'none', title: '请上传附件' })
|
|
|
- return
|
|
|
- }
|
|
|
+ // 附件可选,不再强制要求
|
|
|
+ // if (this.formData.attachments.length === 0) {
|
|
|
+ // uni.showToast({ icon: 'none', title: '请上传附件' })
|
|
|
+ // return
|
|
|
+ // }
|
|
|
|
|
|
try {
|
|
|
uni.showLoading({ title: '提交中...' })
|
|
|
- const res = await submitTask({
|
|
|
- taskId: this.taskId,
|
|
|
- ...this.formData
|
|
|
- })
|
|
|
+
|
|
|
+ // 获取用户信息
|
|
|
+ const userInfo = JSON.parse(uni.getStorageSync('userInfo') || '{}')
|
|
|
+ const userId = userInfo.id || ''
|
|
|
+
|
|
|
+ // 构建附件 URL(多个附件用逗号分隔,确保是字符串类型)
|
|
|
+ const attachmentUrl = this.formData.attachments && this.formData.attachments.length > 0
|
|
|
+ ? this.formData.attachments.map(item => item.url).filter(url => url).join(',')
|
|
|
+ : '' // 如果没有附件,返回空字符串
|
|
|
+
|
|
|
+ // 按照 API 要求的 JSON 结构构建提交数据
|
|
|
+ const submitData = {
|
|
|
+ attachmentUrl: attachmentUrl, // 附件 URL(多个用逗号分隔)
|
|
|
+ content: this.formData.summary || '', // 摘要/内容
|
|
|
+ coverImage: this.formData.coverImage, // 封面图片
|
|
|
+ projectId: parseInt(this.formData.groupId) || 0, // 项目分组 ID
|
|
|
+ tagIds: this.formData.tagId || '', // 标签 ID(字符串)
|
|
|
+ taskId: parseInt(this.taskId) || 0, // 任务 ID
|
|
|
+ title: this.formData.title, // 标题
|
|
|
+ userId: userId, // 用户 ID
|
|
|
+ taskType:this.taskType,
|
|
|
+ // 以下字段为可选,设置默认值
|
|
|
+ // deliveryName: '',
|
|
|
+ // deliveryNo: '',
|
|
|
+ // projectLink: '',
|
|
|
+ // remark: '',
|
|
|
+ // taskName: '',
|
|
|
+ // taskType:this.taskType,
|
|
|
+ // validViews: 0,
|
|
|
+ // viewCount: 0
|
|
|
+ }
|
|
|
+
|
|
|
+ const res = await submitTask(submitData)
|
|
|
uni.hideLoading()
|
|
|
if (res.code === 200) {
|
|
|
uni.navigateTo({
|
|
|
@@ -346,6 +622,7 @@ export default {
|
|
|
}
|
|
|
} catch (e) {
|
|
|
uni.hideLoading()
|
|
|
+ console.error('提交失败', e)
|
|
|
uni.showToast({ icon: 'none', title: '提交失败' })
|
|
|
}
|
|
|
}
|
|
|
@@ -365,7 +642,6 @@ export default {
|
|
|
width: 100%;
|
|
|
background: #fff;
|
|
|
}
|
|
|
-
|
|
|
.header {
|
|
|
position: relative;
|
|
|
height: 88rpx;
|
|
|
@@ -653,6 +929,47 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+// 上传进度弹窗样式
|
|
|
+.upload-modal {
|
|
|
+ position: fixed;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ bottom: 0;
|
|
|
+ background: rgba(0, 0, 0, 0.6);
|
|
|
+ z-index: 9999;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+
|
|
|
+ .upload-modal-content {
|
|
|
+ width: 560rpx;
|
|
|
+ background: #fff;
|
|
|
+ border-radius: 24rpx;
|
|
|
+ padding: 48rpx 40rpx;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ .upload-modal-title {
|
|
|
+ font-size: 32rpx;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #333;
|
|
|
+ margin-bottom: 40rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .upload-progress-wrapper {
|
|
|
+ width: 100%;
|
|
|
+ margin-bottom: 32rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .upload-modal-tips {
|
|
|
+ font-size: 24rpx;
|
|
|
+ color: #999;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|
|
|
|
|
|
|
|
|
@@ -663,3 +980,9 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|