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

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

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

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

@ -1,31 +1,31 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form <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"> <div class="filter-container">
<el-button <el-button
class="filter-item el-button el-button--primary el-button--mini" class="filter-item el-button el-button--primary el-button--mini"
@ -164,7 +164,6 @@
<i class="el-icon-plus" /> <i class="el-icon-plus" />
</el-upload> </el-upload>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="drawer__footer"> <div class="drawer__footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
@ -231,12 +230,12 @@ export default {
methods: { methods: {
// //
async validationImg(file) { async validationImg(file) {
let res = await this.$getImgWidth(file, 'subjectCover');
let res = await this.$getImgWidth(file, "subjectCover");
this.validation = res; this.validation = res;
return res; return res;
}, },
async validationImages(file) { async validationImages(file) {
let res = await this.$getImgWidth(file, 'subjectBanner');
let res = await this.$getImgWidth(file, "subjectBanner");
this.validation = res; this.validation = res;
return res; return res;
}, },
@ -307,9 +306,9 @@ export default {
// fetchAdDetails({special_id}).then(res => { // fetchAdDetails({special_id}).then(res => {
var that = this; var that = this;
that.temp = row;
this.dialogStatus = "update";
this.dialogFormVisible = true;
that.temp = row;
this.dialogStatus = "update";
this.dialogFormVisible = true;
}, },
updateData() { updateData() {
// this.$refs['dataForm'].validate((valid) => { // this.$refs['dataForm'].validate((valid) => {
@ -373,7 +372,8 @@ export default {
if (this.listObj[objKeyArr[i]].uid === uid) { if (this.listObj[objKeyArr[i]].uid === uid) {
delete this.listObj[objKeyArr[i]]; delete this.listObj[objKeyArr[i]];
return; return;
}0
}
0;
} }
}, },
uploadError(err) { uploadError(err) {

Loading…
Cancel
Save