This commit is contained in:
lnn19986213 2022-07-18 05:44:54 +08:00
parent 70abe49fc9
commit 29476e5f69
1 changed files with 314 additions and 2 deletions

View File

@ -1,11 +1,323 @@
<template>
<view class="">
需求发布
<view class="form_line">
<view class="form_left">
名称
</view>
<view class="form_right">
<u--input placeholder="请输入名称" v-model="name" clearable border="none" inputAlign="right" style="color: #251B1D;">
</u--input>
</view>
</view>
<view class="form_line">
<view class="form_left">
类型
</view>
<view class="form_right" @click="showType=true">
<u--input placeholder="请选择类型" clearable border="none" inputAlign="right" style="color: #251B1D;" suffixIcon="map-fill" readonly v-model="type" disabledColor="#ffffff">
</u--input>
</view>
</view>
<u-popup :show="showType" @close="close" closeOnClickOverlay :round="5"
customStyle="padding: 16px;">
<u-radio-group @change="selectForm1" v-model="type" :borderBottom="true" placement="column"
iconPlacement="right">
<u-radio :customStyle="{marginBottom: '16px' }" v-for="(item, index) in radiolist1" :key="index"
:label="item.label" labelSize="28rpx" labelColor="#231F1C" :name="item.label"
activeColor="#99241B ">
</u-radio>
<u-button class="custom-style" style="background-color:#99241B ; color: #FFFFFF; margin-top: 32rpx;"
type="default" @click="showType=false">确认</u-button>
</u-radio-group>
</u-popup>
<view class="form_box">
<view class="form_left">
需求清单
</view>
</view>
<view class="text_box">
<u--textarea v-model="text1" placeholder="请输入需求清单" maxlength="-1"></u--textarea>
</view>
<view class="form_box">
<view class="form_left">
具体内容
</view>
</view>
<view class="text_box">
<u--textarea v-model="text2" placeholder="请输入具体内容" maxlength="-1"></u--textarea>
</view>
<view class="form_line">
<view class="form_left">
截止时间
</view>
<view class="form_right" @click="chooseTime(0)">
<u--input placeholder="请选择" clearable border="none" inputAlign="right" style="color: #251B1D;" suffixIcon="map-fill" readonly v-model="eTime" disabledColor="#ffffff">
</u--input>
</view>
</view>
<view class="form_line">
<view class="form_left">
活动时间
</view>
<view class="form_right" @click="chooseTime(1)">
<u--input placeholder="请选择" clearable border="none" inputAlign="right" style="color: #251B1D;" suffixIcon="map-fill" readonly v-model="wTime" disabledColor="#ffffff">
</u--input>
</view>
</view>
<u-datetime-picker :show="showTime" v-model="timeValue" value-format="yyyy-MM-dd" mode="date"
@close="close" @cancel="close" @confirm="sureTime"></u-datetime-picker>
<view class="gap">
接单设置
</view>
<view class="form_line">
<view class="form_left">
可接单用户选择
</view>
<view class="form_right" @click="showUser=true">
<u--input placeholder="请选择" clearable border="none" inputAlign="right" style="color: #251B1D;" suffixIcon="map-fill" readonly v-model="userType" disabledColor="#ffffff">
</u--input>
</view>
</view>
<u-popup :show="showUser" @close="close" closeOnClickOverlay :round="5"
customStyle="padding: 16px;">
<u-checkbox-group @change="selectForm2" v-model="radiovalue2" :borderBottom="true" placement="column"
iconPlacement="right">
<u-checkbox :customStyle="{marginBottom: '16px' }" v-for="(item, index) in radiolist2" :key="index"
:label="item.label" labelSize="28rpx" labelColor="#231F1C" :name="item.label"
activeColor="#99241B ">
</u-checkbox>
<u-button class="custom-style" style="background-color:#99241B ; color: #FFFFFF; margin-top: 32rpx;"
type="default" @click="showUser=false">确认</u-button>
</u-checkbox-group>
</u-popup>
<view class="form_line">
<view class="form_left">
是否支持多人接单
</view>
<view>
<u-switch v-model="morePer" @change="changeTrue"></u-switch>
</view>
</view>
<view class="form_line">
<view class="form_left">
可接单人数
</view>
<view>
<u-number-box v-model="perNumber" @change="valChange"></u-number-box>
</view>
</view>
<view class="gap">
附件上传
</view>
<u-upload class="upload" accept="file" width="172rpx" height="172rpx" :fileList="fileList3"
@afterRead="afterRead" @delete="deletePic" name="3" multiple>
<image style="width: 172rpx;height: 172rpx;" src="../../static/improveData/jia.png"></image>
</u-upload>
<view class="operation" @click="next">
发布
</view>
</view>
</template>
<script>
import http from '../../request/interface.js'
export default{
data(){
return{
name:'',
typeId: '',
showType: false,
type:'',
radiolist1: [
{
label:'qwe',
id:'123',
},
{
label:'asd',
id:'124',
},
{
label:'zxc',
id:'125',
},
],
text1: '',
text2: '',
showTime:false,
timeTab: 0,
eTime:'',
wTime:'',
timeValue: Number(new Date()),
showUser:false,
userType:'',
radiovalue2: [],
radiolist2: [
{
label:'qwe567',
id:'123',
},
{
label:'asd67',
id:'124',
},
{
label:'zxc67',
id:'125',
},
],
morePer: true,
perNumber: 0,
fileList3: [],
}
},
methods: {
close() {
this.showType = false
this.showTime = false
this.showUser = false
},
selectForm1(form) {
this.typeId = form
},
chooseTime(val){
this.showTime = true
this.timeTab = val
},
sureTime(e) {
if(this.timeTab == 0){
this.eTime = uni.$u.timeFormat(e.value)
}else{
this.wTime = uni.$u.timeFormat(e.value)
}
this.showTime = false
},
selectForm2(form) {
let data = form
this.userType = data.join(',')
},
changeTrue(e) {
console.log('change', e);
},
valChange(e) {
console.log('当前值为: ' + e.value)
},
//
deletePic(event) {
this[`fileList${event.name}`].splice(event.index, 1)
},
//
async afterRead(event) {
// mutiple true , file
let lists = [].concat(event.file)
let fileListLen = this[`fileList${event.name}`].length
lists.map((item) => {
this[`fileList${event.name}`].push({
...item,
status: 'uploading',
message: '上传中'
})
})
for (let i = 0; i < lists.length; i++) {
const result = await this.uploadFilePromise(lists[i].url)
let item = this[`fileList${event.name}`][fileListLen]
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
status: 'success',
message: '',
url: result
}))
fileListLen++
}
},
uploadFilePromise(url) {
return new Promise((resolve, reject) => {
let a = uni.uploadFile({
url: http.config.baseUrl + '/file/upload',
filePath: url,
name: 'file',
formData: {
user: 'test'
},
success: (res) => {
console.log(res)
if(JSON.parse(res.data).code == 200){
setTimeout(() => {
resolve(JSON.parse(res.data).data.path)
}, 1000)
}else{
uni.showToast({
title: JSON.parse(res.data).message,
icon: "none",
});
this.fileList3.pop()
}
}
});
})
},
next(){
}
}
}
</script>
<style>
<style lang="scss" scoped>
.form_line{
width: 686rpx;
padding: 0 32rpx;
display: flex;
align-items: center;
font-size: 32rpx;
justify-content: space-between;
height: 104rpx;
border-bottom: 1rpx solid #dadbde;
.form_right{
width: 450rpx;
}
}
.form_box{
width: 686rpx;
padding: 0 32rpx;
display: flex;
align-items: center;
font-size: 32rpx;
justify-content: space-between;
height: 104rpx;
}
.text_box{
width: 686rpx;
padding: 0 32rpx;
}
.gap {
color: #AFADB0;
height: 50rpx;
background: #F5F5F5;
opacity: 1;
padding: 10rpx 32rpx;
font-size: 32rpx;
}
.upload {
padding: 32rpx;
}
.operation {
width: 654rpx;
height: 96rpx;
margin: 32rpx 48rpx 48rpx;
text-align: center;
line-height: 96rpx;
background-color: #99241B;
color: #fff;
font-size: 36rpx;
font-weight: 600;
}
</style>