新增任务提交

This commit is contained in:
weipengfei 2023-09-14 14:27:42 +08:00
parent 682e891c5d
commit 036c737f1d
2 changed files with 84 additions and 43 deletions

View File

@ -29,9 +29,15 @@ export const taskAddTricycleCoordinate = (data) => oahttp.post('/task/add_tricyc
/** /**
* 任务:入股详情 * 任务:入股详情
*/ */
export const taskShareholder = (data) => oahttp.post('/task/shareholder', data) export const taskShareholder = (data) => oahttp.get('/task/shareholder', data)
/** /**
* 任务:三轮车详情 * 任务:其他任务详情
*/ */
export const taskOtherTaskDetail = (data) => oahttp.get('/task/other_task_detail', data) export const taskOtherTaskDetail = (data) => oahttp.get('/task/other_task_detail', data)
/**
* 任务:提交其他任务
*/
export const taskOtherTaskUpload = (data) => oahttp.post('/task/commit', data)

View File

@ -1,31 +1,37 @@
<template> <template>
<view style="padding-top: 28rpx;padding-bottom: 160rpx;"> <view style="padding-top: 28rpx;padding-bottom: 160rpx;">
<view class="card"> <view class="card">
<view class="title">任务名称: 入股任务</view> <view class="title">任务名称: {{task_info.title}}</view>
<u-line style="margin: 14rpx 0;"></u-line> <u-line style="margin: 14rpx 0;"></u-line>
<view class="text">阶段类型: 单次</view> <!-- <view class="text">阶段类型: 单次</view> -->
<view class="text" style="color: #FF7C32;">任务金额: 3000</view> <view class="text" style="color: #FF7C32;">任务金额: {{task_info.money}}</view>
</view> </view>
<view class="card"> <view class="card">
<view class="title">任务描述</view> <view class="title">任务描述</view>
<u-line style="margin: 14rpx 0;"></u-line> <u-line style="margin: 14rpx 0;"></u-line>
<view class="text">完成公司分配入股任务时限30日内完成公司分配入股任务时限30日内完成公司分配入股任务时限30日内</view> <view class="text">{{task_info.content}}</view>
</view> </view>
<view class="card"> <view class="card">
<view class="title">详情描述</view> <view class="title">详情描述</view>
<u-line style="margin: 14rpx 0;"></u-line> <u-line style="margin: 14rpx 0;"></u-line>
<u--textarea v-model="formData.text" placeholder="请输入内容" placeholderStyle="font-size: 22rpx;" style="font-size: 28rpx;background-color: #eee;min-height: 100px;" autoHeight maxlength="-1"></u--textarea> <u--textarea v-model="other.note" placeholder="请输入内容" placeholderStyle="font-size: 22rpx;"
style="font-size: 28rpx;background-color: #eee;min-height: 100px;" autoHeight maxlength="-1"></u--textarea>
<view class="title" style="margin: 16rpx 0;">添加附件</view> <view class="title" style="margin: 16rpx 0;">添加附件</view>
<view class="file"> <view class="file">
<view class="file_item" v-for="(item, index) in formData.fileList" :key="'file'+index"> <view class="file_item" v-for="(item, index) in fileList" :key="'file'+index">
<image class="image" :src="item" @click="priview(index)"></image> <image class="image" :src="item" @click="priview(index)"></image>
<image class="del" src="/static/icons/delete.png" @click.stop="deleteFile(index)"></image> <image class="del" src="/static/icons/delete.png" @click.stop="deleteFile(index)"></image>
</view> </view>
<view class="file_btn" @click="chooseFile"><image src="/static/icons/plus.png"></image></view> <view class="file_btn" @click="chooseFile">
<image src="/static/icons/plus.png"></image>
</view>
<view class="file_empty" v-for="k in placeholderLength" :key="'empty'+k"></view> <view class="file_empty" v-for="k in placeholderLength" :key="'empty'+k"></view>
</view> </view>
</view> </view>
<mybtn text="确认提交"></mybtn> <mybtn v-if="!other.is_commit" text="确认提交" @click="$u.throttle(submit, 1500)"></mybtn>
<mybtn v-else-if="task_info.status==3" text="已完成" :my_btn_disabled="true"></mybtn>
<mybtn v-else-if="task_info.status==5" text="已关闭" :my_btn_disabled="true"></mybtn>
<mybtn v-else text="已提交" :my_btn_disabled="true"></mybtn>
</view> </view>
</template> </template>
@ -34,16 +40,23 @@
upLoadImage upLoadImage
} from "@/api/file.js" } from "@/api/file.js"
import { import {
taskOtherTaskDetail taskOtherTaskDetail,
taskOtherTaskUpload
} from "@/api/task.js" } from "@/api/task.js"
import { Toast } from "../../libs/uniApi";
export default { export default {
data() { data() {
return { return {
task_id: -1, task_id: -1,
formData: { task_info: {
text: '',
},
other: {
annex: [], //
is_commit: 0, //
note: "", //
},
fileList: [] fileList: []
}
}; };
}, },
onLoad(options) { onLoad(options) {
@ -53,15 +66,31 @@
computed: { computed: {
// //
placeholderLength() { placeholderLength() {
return (this.formData.fileList.length+1)%3==0? 0 : 3-(this.formData.fileList.length+1)%3; return (this.fileList.length + 1) % 3 == 0 ? 0 : 3 - (this.fileList.length + 1) % 3;
} }
}, },
methods: { methods: {
initDetail() { initDetail() {
taskOtherTaskDetail({ id: this.task_id }).then((res) => { taskOtherTaskDetail({ id: this.task_id }).then((res) => {
this.formData = res.data; this.task_info = res.data;
this.other = res.data?.extend?.other;
}) })
}, },
async submit(){
console.log('提交');
if(this.other.note.trim()=='')return Toast('详情描述不能为空');
await taskOtherTaskUpload({
id: this.task_id,
extend: {
other: {
note: this.other.note,
annex: this.other.annex
}
}
});
this.other.is_commit = 1;
Toast('提交成功')
},
chooseFile() { chooseFile() {
uni.chooseImage({ uni.chooseImage({
sizeType: ['compressed'], sizeType: ['compressed'],
@ -71,15 +100,15 @@
filePath: item.path, filePath: item.path,
name: 'file' name: 'file'
}); });
this.formData.fileList.push(res.data.uri); this.fileList.push(res.data.uri);
} }
// this.formData.fileList = [...this.formData.fileList, res.tempFiles] // this.fileList = [...this.fileList, res.tempFiles]
} }
}) })
}, },
priview(index) { priview(index) {
uni.previewImage({ uni.previewImage({
urls: this.formData.fileList, urls: this.fileList,
current: index, current: index,
longPressActions: { longPressActions: {
itemList: ['删除'], itemList: ['删除'],
@ -91,7 +120,7 @@
}) })
}, },
deleteFile(index) { deleteFile(index) {
this.formData.fileList.splice(index, 1); this.fileList.splice(index, 1);
}, },
navTo(url) { navTo(url) {
if (url) { if (url) {
@ -134,6 +163,7 @@
display: flex; display: flex;
justify-content: left; justify-content: left;
flex-wrap: wrap; flex-wrap: wrap;
&_item { &_item {
flex-shrink: 0; flex-shrink: 0;
width: 200rpx; width: 200rpx;
@ -144,10 +174,12 @@
border-radius: 10rpx; border-radius: 10rpx;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
.image { .image {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.del { .del {
position: absolute; position: absolute;
height: 40rpx; height: 40rpx;
@ -156,6 +188,7 @@
right: 10rpx; right: 10rpx;
} }
} }
&_btn { &_btn {
flex-shrink: 0; flex-shrink: 0;
width: 200rpx; width: 200rpx;
@ -168,11 +201,13 @@
align-items: center; align-items: center;
flex-direction: column; flex-direction: column;
border-radius: 10rpx; border-radius: 10rpx;
image { image {
width: 100rpx; width: 100rpx;
height: 100rpx; height: 100rpx;
} }
} }
&_empty { &_empty {
flex-shrink: 0; flex-shrink: 0;
width: 200rpx; width: 200rpx;