|
@@ -1,32 +1,139 @@
|
|
|
<template>
|
|
|
<div id="index">
|
|
|
<el-row>
|
|
|
- <el-col :span="24">
|
|
|
- <p>新闻资讯</p>
|
|
|
+ <el-col :span="24" class="style">
|
|
|
+ <el-col :span="24" class="top">
|
|
|
+ <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="down">
|
|
|
+ <el-col :span="24" class="search">
|
|
|
+ <van-search v-model="name" @search="onSearch" placeholder="请输入信息标题" />
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="data">
|
|
|
+ <el-col :span="24" class="list" v-for="(item, index) in list" :key="index" @click.native="show(item)">
|
|
|
+ <el-col :span="18" class="title textOver">
|
|
|
+ {{ item.title }}
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6" class="date">
|
|
|
+ {{ item.publish_time }}
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" class="other">
|
|
|
+ <p class="textOver">
|
|
|
+ 作者:<span>{{ item.publish || '系统管理员' }}</span>
|
|
|
+ </p>
|
|
|
+ <p class="textOver">
|
|
|
+ 信息来源:<span>{{ item.orgin }}</span>
|
|
|
+ </p>
|
|
|
+ </el-col>
|
|
|
+ </el-col>
|
|
|
+ </el-col>
|
|
|
+ </el-col>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import NavBar from '@/layout/common/topInfo.vue';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: scienceNews } = createNamespacedHelpers('scienceNews');
|
|
|
export default {
|
|
|
metaInfo() {
|
|
|
return { title: this.$route.meta.title };
|
|
|
},
|
|
|
name: 'index',
|
|
|
props: {},
|
|
|
- components: {},
|
|
|
+ components: {
|
|
|
+ NavBar,
|
|
|
+ },
|
|
|
data: function() {
|
|
|
- return {};
|
|
|
+ return {
|
|
|
+ // 头部标题
|
|
|
+ title: '',
|
|
|
+ // meta为true
|
|
|
+ isleftarrow: '',
|
|
|
+ // 返回
|
|
|
+ navShow: true,
|
|
|
+ list: [],
|
|
|
+ name: '',
|
|
|
+ };
|
|
|
+ },
|
|
|
+ async created() {
|
|
|
+ await this.search();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...scienceNews(['query']),
|
|
|
+ async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
+ if (this.name) info.title = this.name;
|
|
|
+ let res = await this.query({ skip, ...info });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `list`, res.data);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ show(data) {
|
|
|
+ this.$router.push({ path: '/viewTwo/news/detail', query: { id: data.id } });
|
|
|
+ },
|
|
|
+ onSearch() {
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
},
|
|
|
- created() {},
|
|
|
- methods: {},
|
|
|
- computed: {
|
|
|
- ...mapState(['user']),
|
|
|
+ mounted() {
|
|
|
+ this.title = this.$route.meta.title;
|
|
|
+ this.isleftarrow = this.$route.meta.isleftarrow;
|
|
|
},
|
|
|
watch: {},
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
-<style lang="less" scoped></style>
|
|
|
+<style lang="less" scoped>
|
|
|
+.style {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ position: relative;
|
|
|
+ background-color: #f9fafc;
|
|
|
+ .top {
|
|
|
+ height: 46px;
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+ .down {
|
|
|
+ position: relative;
|
|
|
+ .search {
|
|
|
+ position: fixed;
|
|
|
+ width: 100%;
|
|
|
+ z-index: 999;
|
|
|
+ }
|
|
|
+ .data {
|
|
|
+ position: absolute;
|
|
|
+ width: 100%;
|
|
|
+ top: 54px;
|
|
|
+ padding: 10px;
|
|
|
+ background: #f9fafc;
|
|
|
+ .list {
|
|
|
+ background-color: #fff;
|
|
|
+ border-radius: 5px;
|
|
|
+ margin: 0 0 10px 0;
|
|
|
+ padding: 5px;
|
|
|
+ .title {
|
|
|
+ font-size: 18px;
|
|
|
+ font-weight: bold;
|
|
|
+ }
|
|
|
+ .date {
|
|
|
+ text-align: right;
|
|
|
+ font-size: 16px;
|
|
|
+ padding: 6px 0 0 0;
|
|
|
+ }
|
|
|
+ .other {
|
|
|
+ margin: 5px 0 0 0;
|
|
|
+ p {
|
|
|
+ font-size: 16px;
|
|
|
+ padding: 5px 0;
|
|
|
+ span {
|
|
|
+ color: #666;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|