Browse Source

专题文章搜索

master
pzy 3 years ago
parent
commit
82b5e37d82
  1. 9
      src/views/article/index.vue
  2. 26
      src/views/article/subject/article.vue
  3. 64
      src/views/article/subject/index.vue

9
src/views/article/index.vue

@ -208,7 +208,7 @@
:options="categoryOptions"
:normalizer="normalizer"
:show-count="true"
:disabled="dialogStatus=='create'"
:disabled="dialogStatus == 'create'"
placeholder="选择分类"
/>
</el-form-item>
@ -236,6 +236,12 @@
<el-form-item label="标题" prop="title">
<el-input v-model="temp.title" />
</el-form-item>
<el-form-item label="作者" prop="title">
<el-input
v-model="temp.author"
placeholder="请上传视频时填写作者"
/>
</el-form-item>
<el-form-item label="日期" prop="time">
<el-date-picker
v-model="temp.time"
@ -367,6 +373,7 @@ export default {
title: "",
label_name: "",
category_id: undefined,
author: "", //
},
// accountRules: {
// phone: [{ required: true, trigger: 'blur', validator: RulePhone }],

26
src/views/article/subject/article.vue

@ -22,7 +22,7 @@
<el-form>
<el-form-item label="文章标题" prop="title">
<el-input
v-model="article_title"
v-model="listQuery.article_title"
placeholder="请输入文章标题"
clearable
size="small"
@ -33,6 +33,7 @@
class="filter-item el-button el-button--primary el-button--mini"
type="primary"
icon="el-icon-edit"
@click="getList('search')"
>搜索</el-button
>
</el-form-item>
@ -62,7 +63,7 @@
</el-table-column>
<el-table-column label="专题" align="center">
<template slot-scope="{ row }">
<span>{{ row.special_id | getSubjectName(subject) }}</span>
<span>{{ row.title }}</span>
</template>
</el-table-column>
<el-table-column label="标题" align="center">
@ -106,6 +107,7 @@
:limit.sync="listQuery.limit"
@pagination="getList"
/>
<div style="display: block; height: 20px"></div>
<!-- 添加或修改分类对话框 -->
<el-drawer
ref="drawer"
@ -182,6 +184,7 @@ export default {
page: 1,
limit: 20,
special_id: undefined,
article_title: "",
},
subject: [],
temp: {
@ -206,20 +209,11 @@ export default {
this.getSubjectList();
this.getList();
},
filters: {
getSubjectName(id, subject) {
for (var i = 0; i < subject.length; i++) {
if (id == subject[i].special_id) {
return subject[i].title;
}
}
return "";
},
},
methods: {
//
handleNodeClick(data) {
this.listQuery.special_id = data.id;
this.listQuery.article_title = "";
this.defaultProps = data;
this.getList();
},
@ -239,12 +233,14 @@ export default {
});
});
},
getList() {
getList(id) {
if (id == "search") {
this.listQuery.page = 1;
}
this.listLoading = true;
listSubjectArticle(this.listQuery).then((response) => {
this.list = response.data.list;
this.total = response.data.count;
// Just to simulate the time of the request
setTimeout(() => {
this.listLoading = false;
@ -332,8 +328,6 @@ export default {
},
handleSelectBranch(item) {
console.log("远程搜索选中后返回的item:::::即value的值");
console.log(item);
// id item
this.$set(this.temp, "article_id", item);
},

64
src/views/article/subject/index.vue

@ -1,31 +1,31 @@
<template>
<div class="app-container">
<el-form
ref="queryForm"
:model="listQuery"
:inline="true"
label-width="68px"
>
<el-form-item label="专题名称" prop="title">
<el-input
v-model="listQuery.title"
placeholder="请输入专题名称"
clearable
size="small"
style="width: 160px"
@keyup.enter.native="getList"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="getList"
>搜索</el-button
>
</el-form-item>
</el-form>
ref="queryForm"
:model="listQuery"
:inline="true"
label-width="68px"
>
<el-form-item label="专题名称" prop="title">
<el-input
v-model="listQuery.title"
placeholder="请输入专题名称"
clearable
size="small"
style="width: 160px"
@keyup.enter.native="getList"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="getList"
>搜索</el-button
>
</el-form-item>
</el-form>
<div class="filter-container">
<el-button
class="filter-item el-button el-button--primary el-button--mini"
@ -164,7 +164,6 @@
<i class="el-icon-plus" />
</el-upload>
</el-form-item>
</el-form>
<div class="drawer__footer">
<el-button type="primary" @click="submitForm"> </el-button>
@ -231,12 +230,12 @@ export default {
methods: {
//
async validationImg(file) {
let res = await this.$getImgWidth(file, 'subjectCover');
let res = await this.$getImgWidth(file, "subjectCover");
this.validation = res;
return res;
},
async validationImages(file) {
let res = await this.$getImgWidth(file, 'subjectBanner');
let res = await this.$getImgWidth(file, "subjectBanner");
this.validation = res;
return res;
},
@ -307,9 +306,9 @@ export default {
// fetchAdDetails({special_id}).then(res => {
var that = this;
that.temp = row;
this.dialogStatus = "update";
this.dialogFormVisible = true;
that.temp = row;
this.dialogStatus = "update";
this.dialogFormVisible = true;
},
updateData() {
// this.$refs['dataForm'].validate((valid) => {
@ -373,7 +372,8 @@ export default {
if (this.listObj[objKeyArr[i]].uid === uid) {
delete this.listObj[objKeyArr[i]];
return;
}0
}
0;
}
},
uploadError(err) {

Loading…
Cancel
Save