添加页面
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<!--
|
||||
* @Date: 2024-10-08 14:29:36
|
||||
* @LastEditors: shirlwang
|
||||
* @LastEditTime: 2025-11-04 14:29:24
|
||||
* @LastEditTime: 2025-11-04 17:33:17
|
||||
-->
|
||||
<template>
|
||||
<view class="input-outer-part">
|
||||
<scroll-view scroll-y="true" :style="{height: edit?'calc(100vh - 200rpx)':'calc(100vh - 194rpx)'}">
|
||||
<scroll-view scroll-y="true" :style="{height: edit?'calc(100vh - 380rpx)':'calc(100vh - 194rpx)'}">
|
||||
<view class="inner">
|
||||
<view class="part-title" style="display: flex;justify-content: space-between;">创业需求信息
|
||||
<view v-if="!edit&&formData.id&&formData.currentStatus!=3" class="btn"
|
||||
@@ -31,10 +31,27 @@
|
||||
<u-icon slot="right" name="edit-pen" color="#A6A6A6"></u-icon>
|
||||
</uni-forms-item> -->
|
||||
<uni-forms-item label="有无场地需求" name="ywcdxq" required>
|
||||
<radio-group :disabled="!edit" :value="formData.ywcdxq" placement="row">
|
||||
<!-- <radio-group :disabled="!edit" :value="formData.ywcdxq" placement="row">
|
||||
<radio :customStyle="{marginRight: '16px'}" label="是" value="是">是</radio>
|
||||
<radio :customStyle="{marginRight: '16px'}" label="否" value="否">否</radio>
|
||||
</radio-group>
|
||||
</radio-group> -->
|
||||
<view class="radio-group">
|
||||
<view
|
||||
:class="['radio-item', { 'radio-disabled': !edit }]"
|
||||
@click="formData.ywcdxq = '是'"
|
||||
v-if="edit">
|
||||
<view :class="['radio', { 'radio-checked': formData.ywcdxq === '是' }]"></view>
|
||||
<text>是</text>
|
||||
</view>
|
||||
<view
|
||||
:class="['radio-item', { 'radio-disabled': !edit }]"
|
||||
@click="formData.ywcdxq = '否'"
|
||||
v-if="edit">
|
||||
<view :class="['radio', { 'radio-checked': formData.ywcdxq === '否' }]"></view>
|
||||
<text>否</text>
|
||||
</view>
|
||||
<view v-else>{{ formData.ywcdxq }}</view>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="场地面积" name="cdmj">
|
||||
<input :disabled="!edit" v-model="formData.cdmj" border="none"
|
||||
@@ -225,8 +242,8 @@
|
||||
},
|
||||
// setName(){
|
||||
// this.formData.personName = this.name
|
||||
// this.formData.personId = this.needid
|
||||
// this.formData.userId = this.needid
|
||||
// this.formData.personId = this.needId
|
||||
// this.formData.userId = this.needId
|
||||
|
||||
// this.$forceUpdate();
|
||||
// },
|
||||
@@ -255,13 +272,13 @@
|
||||
}
|
||||
this.formData.fileUrl = this.$arrayToString(this.formData.fileUrl)
|
||||
},
|
||||
addOne() {
|
||||
addOne(userId) {
|
||||
this.formData = {}
|
||||
this.setDefaultValues()
|
||||
this.getPersonInfo()
|
||||
if(this.name){
|
||||
this.formData.personName = this.name
|
||||
this.formData.userId = this.needid
|
||||
this.formData.userId = userId
|
||||
}
|
||||
this.edit = true
|
||||
},
|
||||
@@ -349,23 +366,33 @@
|
||||
this.formData.demandType = 2;
|
||||
let successMessage;
|
||||
if (this.formData.id) {
|
||||
response = await updatePersonDemand(this.formData);
|
||||
successMessage = '修改成功';
|
||||
updatePersonDemand(this.formData).then(response => {
|
||||
uni.showToast({title: '修改成功', icon: 'none'});
|
||||
if (response.code == 200) {
|
||||
// 如果是编辑模式,关闭编辑状态;否则返回上一页
|
||||
if (this.formData.id) {
|
||||
this.edit = false;
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 2000);
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
response = await addPersonDemand(this.formData);
|
||||
successMessage = '保存成功';
|
||||
}
|
||||
|
||||
// 检查响应码是否为200
|
||||
if (response.code === 200) {
|
||||
uni.showToast({title: successMessage, icon: 'none'});
|
||||
// 如果是编辑模式,关闭编辑状态;否则返回上一页
|
||||
if (this.formData.id) {
|
||||
this.edit = false;
|
||||
} else {
|
||||
await this.$delay(1000); // 延迟1秒后返回上一页
|
||||
uni.navigateBack();
|
||||
}
|
||||
addPersonDemand(this.formData).then(response => {
|
||||
uni.showToast({title: '保存成功', icon: 'none'});
|
||||
if (response.code == 200) {
|
||||
// 如果是编辑模式,关闭编辑状态;否则返回上一页
|
||||
if (this.formData.id) {
|
||||
this.edit = false;
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
uni.navigateBack();
|
||||
}, 2000);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
if(error.length){
|
||||
@@ -423,6 +450,49 @@
|
||||
.noValue {
|
||||
color: rgb(192, 196, 204);
|
||||
}
|
||||
/* 单选框样式 */
|
||||
.radio-group {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.radio-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 32rpx;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.radio-item.radio-disabled {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.radio {
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
border-radius: 50%;
|
||||
border: 2rpx solid #dcdfe6;
|
||||
margin-right: 12rpx;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.radio.radio-checked {
|
||||
border-color: #409eff;
|
||||
background-color: #409eff;
|
||||
}
|
||||
|
||||
.radio.radio-checked::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 12rpx;
|
||||
height: 12rpx;
|
||||
border-radius: 50%;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.disabledLine {
|
||||
background: rgb(245, 247, 250);
|
||||
|
||||
Reference in New Issue
Block a user