This commit is contained in:
liuye
2021-12-23 15:49:49 +08:00
parent 074500710e
commit d02c703838
2 changed files with 27 additions and 15 deletions

View File

@@ -8,11 +8,11 @@
<u-form-item label="类别" prop="status" required>
<div class="right" @click="showStstus=true">
<span v-if="forms.showIndex === ''" class="color-999">请选择类别</span>
<span v-else>{{selectList[forms.showIndex].categoryName}}</span>
<span v-if="forms.selectIndex === ''" class="color-999">请选择类别</span>
<span v-else>{{selectList[forms.selectIndex].categoryName}}</span>
<u-icon name="arrow-right" color="#CCCCCC" class="right-icon"></u-icon>
</div>
<u-select v-model="showStstus" :list="selectList" value-name="showIndex" label-name="categoryName" @confirm="selectStatus"></u-select>
<u-select v-model="showStstus" :list="selectList" value-name="selectIndex" label-name="categoryName" @confirm="selectStatus"></u-select>
</u-form-item>
<u-form-item label="发布地区" prop="areaId" required >
@@ -31,6 +31,7 @@
</u-form-item>
</u-form>
</div>
<div class="pad-b112"></div>
<div class="btn" @click="submit">保存</div>
@@ -53,7 +54,7 @@ export default {
content: '',
fileIds: [],
areaId: '',
showIndex: '',
selectIndex: '',
},
showStstus: false,
flag: false,
@@ -82,7 +83,7 @@ export default {
if(this.selectList.length) {
this.selectList.map((item, index) => {
if(item.id == res.data.categoryId) {
this.forms.showIndex = index
this.forms.selectIndex = index
}
})
}
@@ -97,6 +98,9 @@ export default {
if (res.code == 0) {
if(res.data && res.data[0].categoryList.length) {
this.selectList = res.data[0].categoryList
this.selectList.map((item, index) => {
item.selectIndex = index
})
if(this.id) {
this.getDetail()
}
@@ -116,7 +120,7 @@ export default {
return this.$u.toast('请输入正文')
}
if(this.selectList.length && this.forms.showIndex === '') {
if(this.selectList.length && this.forms.selectIndex === '') {
return this.$u.toast('请选择类别')
}
@@ -135,14 +139,17 @@ export default {
files: imgs || [],
id: this.id,
moduleId: this.moduleId,
categoryId: this.selectList[this.forms.showIndex].id,
categoryName: this.selectList[this.forms.showIndex].categoryName,
categoryId: this.selectList[this.forms.selectIndex].id,
categoryName: this.selectList[this.forms.selectIndex].categoryName,
})
.then((res) => {
if (res.code == 0) {
uni.$emit('update')
this.$u.toast('发布成功')
this.flag = false
uni.navigateBack()
setTimeout(() => {
uni.navigateBack()
}, 600)
}
})
} else {
@@ -156,7 +163,7 @@ export default {
},
selectStatus(e) {
this.forms.showIndex = e[0].value
this.forms.selectIndex = e[0].value
},
},
}
@@ -165,8 +172,6 @@ export default {
<style lang="scss" scoped>
.add {
height: 100%;
padding-bottom: 112px;
.header-description {
::v-deep .u-form {
.u-form-item {
@@ -192,6 +197,9 @@ export default {
}
}
}
.pad-b112{
padding-bottom: 224px;
}
.btn {
position: fixed;
@@ -204,6 +212,7 @@ export default {
font-size: 32px;
font-weight: 500;
color: #ffffff;
z-index: 999;
}
.right{