Commit 0f5e287b authored by Davve's avatar Davve

增加标签等级

parent d444cb22
......@@ -46,8 +46,9 @@ class UserSearchView(APIView):
class TagSearchView(APIView):
def get(self, request):
name = request.GET.get('name')
platform = request.GET.get('platform')
try:
data = self.rpc['venus/sun/tag/search'](name=name).unwrap()
data = self.rpc['venus/sun/tag/search'](name=name, platform=platform).unwrap()
except Exception as e:
raise e
return {
......
......@@ -63,7 +63,8 @@ class TagUpdateOrCreateView(APIView):
'down_tags': down_tags,
'up_tags': up_tags,
'tagtypes': tagtypes,
'icon_url': request.POST.get('icon_url', '')[:-2]
'icon_url': request.POST.get('icon_url', '')[:-2],
'platform': request.POST.get('platform')
}
try:
data = self.rpc['venus/sun/tag/edit'](id=id, data=data).unwrap()
......
var api = require('./api')
//
// const target = 'http://doctor.test.env'
// const target = 'http://172.30.8.231:8000'
const target = 'http://172.30.8.156:10000'
const target = 'http://172.30.8.131:8000'
// const target = 'http://172.30.8.156:10000'
// const target = 'http://192.168.1.9:8000'
......
......@@ -24,11 +24,11 @@ export function countrySearch(name) {
})
}
export function tagSearch(name) {
export function tagSearch(query) {
return request({
url: '/api/search/tag',
method: 'get',
params: { name }
params: query
})
}
......
......@@ -150,7 +150,8 @@ export default {
{ 'key': 2, 'display_name': '女' }
],
uploadType: -99,
isdisabledFn: false
isdisabledFn: false,
query: {}
}
},
computed: {
......@@ -227,7 +228,8 @@ export default {
})
},
getRemoteTagList(query) {
tagSearch(query).then(response => {
this.query['name'] = query
tagSearch(this.query).then(response => {
if (!response.data.data.data) return
this.tagListOptions = response.data.data.data
})
......
......@@ -82,6 +82,18 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label-width="75px" label="标签等级:" class="postInfo-container-item">
<el-select v-model="postForm.platform" :placeholder="'标签等级:'" clearable
class="postInfo-container-item"
style="width: 70%"
:disabled="this.isEdit"
>
<el-option v-for="item in TagLevelOptions" :key="item.key" :label="item.display_name"
:value="item.key"/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item style="margin-bottom: 40px;" label-width="75px" label="标签简介:" prop="desc">
<el-input :rows="1" v-model="postForm.description" type="textarea" class="article-textarea" autosize
......@@ -90,11 +102,11 @@
</el-form-item>
<div style="margin-bottom: 20px">
<el-form-item style="margin-bottom: 40px;" label-width="75px" label="帖子图片:" prop="icon_url">
<span v-model="uploadType"></span>
<Upload v-model="postForm.icon_url" :uploadType="uploadType"/>
</el-form-item>
</div>
<el-form-item style="margin-bottom: 40px;" label-width="75px" label="帖子图片:" prop="icon_url">
<span v-model="uploadType"></span>
<Upload v-model="postForm.icon_url" :uploadType="uploadType"/>
</el-form-item>
</div>
</div>
</el-form>
......@@ -118,6 +130,7 @@
down_tags: [],
tagtypes: [],
icon_url: '',
platform: 0
}
export default {
......@@ -155,6 +168,11 @@
name: [{validator: validateRequire, trigger: 'blur'}],
},
tempRoute: {},
TagLevelOptions: [
{'key': 0, 'display_name': '系统级'},
{'key': 1, 'display_name': '用户级'},
],
query: {}
}
},
computed: {
......@@ -183,7 +201,7 @@
for (let i = 0; i < rep.down_tags.length; i++) {
this.down_tags.push(rep.down_tags[i]['id'] + ':' + rep.down_tags[i]['name'])
}
for (let i = 0;i < rep.tagtypes.length; i++){
for (let i = 0; i < rep.tagtypes.length; i++) {
this.tagtypes.push(rep.tagtypes[i]['id'] + ':' + rep.tagtypes[i]['name'])
}
this.postForm = rep
......@@ -252,7 +270,9 @@
})
},
getRemoteTagList(query) {
tagSearch(query).then(response => {
this.query['name'] = query
this.query['platform'] = this.postForm.platform
tagSearch(this.query).then(response => {
if (!response.data.data.data) return
this.TagListOptions = response.data.data.data
})
......
......@@ -434,6 +434,7 @@
},
dialogFormVisible: false,
dialogStatus: '',
query: {}
}
},
computed: {
......@@ -570,7 +571,8 @@
})
},
getRemoteTagList(query) {
tagSearch(query).then(response => {
this.query['name'] = query
tagSearch(this.query).then(response => {
if (!response.data.data.data) return
this.tagListOptions = response.data.data.data
})
......
......@@ -209,7 +209,8 @@
regionListOptions: [],
tagListOptions: [],
uploadType: 99,
isdisabledFn: false
isdisabledFn: false,
query: {}
}
},
computed: {
......@@ -300,7 +301,8 @@
})
},
getRemoteTagList(query) {
tagSearch(query).then(response => {
this.query['name'] = query
tagSearch(this.query).then(response => {
if (!response.data.data.data) return
this.tagListOptions = response.data.data.data
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment