This commit is contained in:
yanran200730
2023-03-17 14:31:34 +08:00
parent c276a3f908
commit cf996ed83d
3 changed files with 65 additions and 12 deletions

View File

@@ -3,11 +3,11 @@
<div class="add-content"> <div class="add-content">
<div class="top"> <div class="top">
<!-- <image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-edit.png" /> --> <!-- <image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-edit.png" /> -->
<textarea placeholder="发布内容" :maxlength="500"></textarea> <textarea placeholder="发布内容" v-model="form.content" :maxlength="500"></textarea>
<div class="bottom"> <div class="bottom">
<div></div> <div></div>
<div> <div>
<i>6</i> <i>{{ form.content.length }}</i>
<span>/500</span> <span>/500</span>
</div> </div>
</div> </div>
@@ -15,12 +15,12 @@
<div class="bottom"> <div class="bottom">
<h2>最多上传9张</h2> <h2>最多上传9张</h2>
<div class="img"> <div class="img">
<AiUploader v-model="form.images" :limit="9" multiple/> <AiUploader v-model="form.files" :limit="9" multiple/>
</div> </div>
<div class="topic"> <div class="topic">
<h3 @click="isShow = true">#绑定话题</h3> <h3 v-if="!form.themeId" @click="isShow = true">#绑定话题</h3>
<div class="choosed"> <div class="choosed" v-else>
<span>#闲置物品交易</span> <span>#{{ form.themeTitle }}</span>
</div> </div>
<p>绑定一个与您发布内容相关很高的话题会被更多人看到哦</p> <p>绑定一个与您发布内容相关很高的话题会被更多人看到哦</p>
</div> </div>
@@ -28,7 +28,7 @@
</div> </div>
<div class="bottom"> <div class="bottom">
<h2>仅本社区可见</h2> <h2>仅本社区可见</h2>
<switch color="#2D7DFF" checked></switch> <switch color="#2D7DFF" @change="onSwitchChange"></switch>
</div> </div>
<div class="btn-wrapper"> <div class="btn-wrapper">
<div class="btn" hover-class="text-hover" @click="submit">发布服务</div> <div class="btn" hover-class="text-hover" @click="submit">发布服务</div>
@@ -37,7 +37,13 @@
<div class="popup"> <div class="popup">
<h2>请选择</h2> <h2>请选择</h2>
<scroll-view class="popup-list" scroll-y> <scroll-view class="popup-list" scroll-y>
<div v-for="(item, index) in 20" :key="index">#闲置物品交易</div> <div
v-for="(item, index) in topicList"
:class="[form.themeId === item.id ? 'active' : '']"
:key="index"
@click="form.themeId = item.id, form.themeTitle = item.title, isShow = false">
#{{ item.title }}
</div>
</scroll-view> </scroll-view>
</div> </div>
</u-popup> </u-popup>
@@ -51,16 +57,61 @@
data () { data () {
return { return {
form: { form: {
images: [] files: [],
themeId: '',
themeTitle: '',
source: 0,
content: '',
visibleRange: 0
}, },
topicList: [],
isShow: false isShow: false
} }
}, },
onLoad() { onLoad () {
this.getTopicList()
}, },
methods: { methods: {
submit () {
if (!this.form.content) {
return this.$toast(`内容不能为空`)
}
this.$instance.post(`/app/appneighborhoodassistance/addOrUpdate`, {
...this.form
}).then(res => {
uni.hideLoading()
if (res.code === 0) {
this.$dialog.alert({
title: '温馨提示',
content: '提交成功'
}).then(() => {
uni.navigateBack()
uni.$emit('updateList')
}).catch(() => {})
}
})
},
onSwitchChange (e) {
this.form.visibleRange = e.detail.value ? 1 : 0
},
getTopicList () {
this.$instance.post(`/app/appneighborhoodassistancetheme/list`, null, {
withoutToken: true,
params: {
current: 1,
size: 100
}
}).then(res => {
if (res.code === 0) {
this.topicList = res.data.records
}
})
},
} }
} }
</script> </script>
@@ -93,6 +144,10 @@
padding: 20px 48px; padding: 20px 48px;
color: #333333; color: #333333;
font-size: 30px; font-size: 30px;
&.active {
color: #2D7DFF;
}
} }
} }
} }

View File

@@ -126,7 +126,6 @@
params: { params: {
current: this.current, current: this.current,
size: 10, size: 10,
source: 0,
visibleRange: this.currIndex === 0 ? 1 : 0 visibleRange: this.currIndex === 0 ? 1 : 0
} }
}).then(res => { }).then(res => {

View File

@@ -99,7 +99,6 @@
params: { params: {
current: this.current, current: this.current,
size: 10, size: 10,
source: 0,
themeId: this.themeId, themeId: this.themeId,
visibleRange: this.currIndex === 0 ? 1 : 0 visibleRange: this.currIndex === 0 ? 1 : 0
} }