|
|
|
@ -3,15 +3,15 @@ |
|
|
|
<view> |
|
|
|
<view class="formBox"> |
|
|
|
<uni-forms ref="form" :modelValue="formData" :rules="rules" labelWidth="85px"> |
|
|
|
<uni-forms-item label="图片" name="productPicture"> |
|
|
|
<uni-forms-item label="问题图片" name="productPicture"> |
|
|
|
<view v-if="formData.productPicture !=''"> |
|
|
|
<img :src="formData.productPicture" alt="" class="upload-img"> |
|
|
|
</view> |
|
|
|
<u-upload :fileList="formData.productPicture" @afterRead="afterRead" @delete="deletePic" name="1" multiple |
|
|
|
:maxCount="1"></u-upload> |
|
|
|
</uni-forms-item> |
|
|
|
<uni-forms-item label="描述" name="productIntro"> |
|
|
|
<uni-easyinput type="textarea" autoHeight v-model="formData.productIntro" placeholder="请简要说明问题" |
|
|
|
<uni-forms-item label="问题说明" name="productIntro"> |
|
|
|
<uni-easyinput type="textarea" autoHeight v-model="formData.productIntro" placeholder="请简要描述问题" |
|
|
|
trim="all" /> |
|
|
|
</uni-forms-item> |
|
|
|
</uni-forms> |
|
|
|
@ -19,6 +19,7 @@ |
|
|
|
<u-button type="primary" @tap.stop="submit()">保存</u-button> |
|
|
|
|
|
|
|
</view> |
|
|
|
<!-- <u-modal v-model="show" :content="content"></u-modal> --> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
@ -26,11 +27,28 @@ |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
fileList1: [], |
|
|
|
formData: { |
|
|
|
productPicture: [], |
|
|
|
productIntro: '' |
|
|
|
}, |
|
|
|
categoryList: [], |
|
|
|
productId:'', |
|
|
|
arrtList: [], |
|
|
|
arrtChange: [], |
|
|
|
dataList:[], |
|
|
|
rules: { |
|
|
|
productIntro: { |
|
|
|
rules: [{ |
|
|
|
required: true, |
|
|
|
errorMessage: '请简要描述问题', |
|
|
|
}, ], |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(option) { |
|
|
|
|
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// 删除图片 |
|
|
|
@ -42,7 +60,8 @@ |
|
|
|
|
|
|
|
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式 |
|
|
|
let lists = [].concat(event.file) |
|
|
|
if (this.formData.productPicture == undefined) this.formData.productPicture = []; |
|
|
|
if (this.formData.productPicture == undefined) this.formData.productPicture = []; |
|
|
|
console.log(this[`fileList${event.name}`]) |
|
|
|
let fileListLen = this[`fileList${event.name}`].length |
|
|
|
|
|
|
|
lists.map((item) => { |
|
|
|
@ -84,22 +103,22 @@ |
|
|
|
} |
|
|
|
}); |
|
|
|
}) |
|
|
|
}, |
|
|
|
categoryChange(e) { |
|
|
|
|
|
|
|
}, |
|
|
|
// 触发提交表单 |
|
|
|
submit() { |
|
|
|
let that = this; |
|
|
|
let url = '' |
|
|
|
this.$refs.form.validate().then(res => { |
|
|
|
if(that.dataList !=''){ |
|
|
|
url = '/app/product/edit' |
|
|
|
res.id = that.dataList.id |
|
|
|
}else{ |
|
|
|
url = '/app/product/save' |
|
|
|
} |
|
|
|
that.tui.request(url, "post", res, false, false).then((res1) => { |
|
|
|
this.$refs.form.validate().then(res => { |
|
|
|
that.tui.request('/app/problemFeedback/saveOrUpdateProblemFeedback', "post", { |
|
|
|
problemPicture:that.formData.productPicture, |
|
|
|
problemContent:that.formData.productIntro |
|
|
|
}, false, false).then((res1) => { |
|
|
|
if (res1.code == 200) { |
|
|
|
uni.navigateBack({ |
|
|
|
delta: 2 |
|
|
|
delta: 2 |
|
|
|
}) |
|
|
|
} else { |
|
|
|
uni.showToast({ |
|
|
|
@ -123,6 +142,26 @@ |
|
|
|
border-radius: 14rpx; |
|
|
|
box-shadow: 0px 1px 10px 2px #e2e2e2; |
|
|
|
background-color: #fff; |
|
|
|
|
|
|
|
.uni-data-select { |
|
|
|
width: 100%; |
|
|
|
} |
|
|
|
|
|
|
|
.attrs { |
|
|
|
text { |
|
|
|
display: inline-block; |
|
|
|
border: 1px solid $u-primary; |
|
|
|
padding: 7px 20rpx; |
|
|
|
margin: 20rpx; |
|
|
|
background-color: #fff; |
|
|
|
color: $u-primary; |
|
|
|
} |
|
|
|
|
|
|
|
.checkedText { |
|
|
|
background-color: $u-primary; |
|
|
|
color: #fff; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.upload-img{ |
|
|
|
width: 160rpx; |
|
|
|
|