@@ -0,0 +1,23 @@ | |||
import { getCompanyNewsList } from "@api/company"; | |||
// 导出对象 | |||
export const questionList = { | |||
methods: { | |||
getData() { | |||
this.pageLoading = true; | |||
getCompanyNewsList(this.queryParams) | |||
.then(res => { | |||
console.log(res.data); | |||
if (res.data.status == 0) { | |||
this.dataList = res.data.data.list; | |||
this.total = res.data.data.total; | |||
} else { | |||
this.$message.error(`获取数据失败,请刷新重试!`); | |||
} | |||
this.pageLoading = false; | |||
}) | |||
.catch(err => { | |||
this.$message.error(`获取数据失败,失败原因${err},请刷新重试!`); | |||
}); | |||
}, | |||
}, | |||
}; |
@@ -1,50 +1,58 @@ | |||
<!-- 园区公告--> | |||
<template> | |||
<div class="notice"> | |||
<div class="notice" v-loading="pageLoading"> | |||
<div class="title_box"> | |||
<div class="title"> | |||
<span class="chinese">园区公告</span> | |||
<span class="english">park announcement</span> | |||
</div> | |||
<div class="more pointer" v-if="lists.length < 5"> | |||
<div class="more pointer" v-if="dataList.length < 5" @click="goList"> | |||
<img src="@assets/image/index/icon_more.png" alt="更多" /> | |||
</div> | |||
</div> | |||
<template v-if="lists.length >= 5"> | |||
<template v-if="dataList.length >= 5"> | |||
<section class="content"> | |||
<div class="main_notice pointer"> | |||
<div class="notice_title">国务院关于推进物联网有序健康发展指导者</div> | |||
<div class="main_notice pointer" @click="goDetail(dataList[0].companyNewsId)"> | |||
<div class="notice_title">{{ dataList[0].newsName }}</div> | |||
<div class="notice_content"> | |||
小昆山园区经过不断改革发展,园区已经具备大规模开发建设的总体框架,形成了良性循环的软硬投资环境,吸引了多地区企业的投资。园区地理交通条件优越,区内交通四通八达,道路宽敞平坦。 | |||
小昆山园区经过不断改革发展,园区已经具备大规模开发建设的总体框架,形成了良性循环的软硬投资环境,吸引了多地区企业的投资。园区地理交通条件优越,区内交通四通八达,道路宽敞平坦。 | |||
{{ dataList[0].text }} | |||
</div> | |||
</div> | |||
<ul class="notice_ul"> | |||
<li class="notice_item pointer" v-for="item in lists" :key="item"> | |||
<li | |||
class="notice_item pointer" | |||
v-for="item in otherList" | |||
:key="item.companyNewsId" | |||
@click="goDetail(item.companyNewsId)" | |||
> | |||
<div class="notice_detail"> | |||
<div> | |||
{{ item }} | |||
{{ item.newsName }} | |||
</div> | |||
</div> | |||
<div>2022.09.17</div> | |||
<div>{{ item.createdOn | formatDate("YYYY.MM.DD") }}</div> | |||
</li> | |||
</ul> | |||
</section> | |||
<div class="more width_100 pointer"> | |||
<div class="more width_100 pointer" @click="goList"> | |||
<img src="@assets/image/index/icon_more.png" alt="更多" /> | |||
</div> | |||
</template> | |||
<template v-else> | |||
<div class="notice_box"> | |||
<ul :class="['notice_list', animate ? 'content_top' : '']"> | |||
<li class="notice_item " v-for="item in lists" :key="item"> | |||
<li | |||
class="notice_item " | |||
v-for="item in dataList" | |||
:key="item.companyNewsId" | |||
@click="goDetail(item.companyNewsId)" | |||
> | |||
<div class="notice_detail"> | |||
<div> | |||
{{ item }} | |||
{{ item.newsName }} | |||
</div> | |||
</div> | |||
<div>2022.09.17</div> | |||
<div>{{ item.createdOn | formatDate("YYYY.MM.DD") }}</div> | |||
</li> | |||
</ul> | |||
</div> | |||
@@ -55,20 +63,35 @@ | |||
<script> | |||
//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等) | |||
//例如:import 《组件名称》 from '《组件路径》'; | |||
import { questionList } from "@mixin/questionMixin"; | |||
import { routerOpenInNewWindow } from "@/utils/common.js"; | |||
export default { | |||
//import引入的组件需要注入到对象中才能使用 | |||
components: {}, | |||
props: ["lists"], | |||
mixins: [questionList], | |||
data() { | |||
//这里存放数据 | |||
return { | |||
animate: false, | |||
pageLoading: false, | |||
queryParams: { | |||
page: 1, | |||
pageSize: 7, | |||
search: "", | |||
type: "", | |||
}, | |||
total: 0, | |||
dataList: [], | |||
}; | |||
}, | |||
//监听属性 类似于data概念 | |||
computed: {}, | |||
computed: { | |||
otherList() { | |||
return this.dataList.slice(1, 7); | |||
}, | |||
}, | |||
//监控data中的数据变化 | |||
watch: {}, | |||
//方法集合 | |||
@@ -84,10 +107,24 @@ export default { | |||
}, 1000); | |||
} | |||
}, | |||
goDetail(companyNewsId) { | |||
routerOpenInNewWindow({ | |||
path: "/park-information/question-detail", | |||
query: { | |||
companyNewsId, | |||
}, | |||
}); | |||
}, | |||
goList() { | |||
routerOpenInNewWindow({ | |||
path: "/park-information/question-list", | |||
}); | |||
}, | |||
}, | |||
//生命周期 - 创建完成(可以访问当前this实例) | |||
created() { | |||
setInterval(this.scroll, 5000); | |||
this.getData(); | |||
}, | |||
//生命周期 - 挂载完成(可以访问DOM元素) | |||
mounted() {}, |
@@ -363,13 +363,6 @@ export default { | |||
created() {}, | |||
//生命周期 - 挂载完成(可以访问DOM元素) | |||
mounted() {}, | |||
beforeCreate() {}, //生命周期 - 创建之前 | |||
beforeMount() {}, //生命周期 - 挂载之前 | |||
beforeUpdate() {}, //生命周期 - 更新之前 | |||
updated() {}, //生命周期 - 更新之后 | |||
beforeDestroy() {}, //生命周期 - 销毁之前 | |||
destroyed() {}, //生命周期 - 销毁完成 | |||
activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发 | |||
}; | |||
</script> | |||
<style lang="scss" scoped> |
@@ -2,7 +2,7 @@ | |||
<template> | |||
<div class="detail_container"> | |||
<search-box></search-box> | |||
<section class="detail_box" v-loading="pageLoading"> | |||
<section class="detail_box" v-loading="pageLoading" v-if="companyInfo"> | |||
<div class="title_box"> | |||
{{ companyInfo.type.text }} | |||
</div> |
@@ -32,14 +32,15 @@ | |||
import SearchBox from "./components/SearchBox.vue"; | |||
import QuestionList from "./components/QuestionList.vue"; | |||
import Pagination from "@components/Pagination.vue"; | |||
import { getCompanyNewsList } from "@api/company"; | |||
// import { getCompanyNewsList } from "@api/company"; | |||
import { handlePageNation } from "@mixin/pageNationMixin"; | |||
import { questionList } from "@mixin/questionMixin"; | |||
import { mapState } from "vuex"; | |||
export default { | |||
//import引入的组件需要注入到对象中才能使用 | |||
components: { SearchBox, QuestionList, Pagination }, | |||
mixins: [handlePageNation], | |||
mixins: [handlePageNation, questionList], | |||
data() { | |||
//这里存放数据 | |||
return { | |||
@@ -69,23 +70,23 @@ export default { | |||
this.queryParams.type = this.tabs[index].itemId; | |||
this.getData(); | |||
}, | |||
getData() { | |||
this.pageLoading = true; | |||
getCompanyNewsList(this.queryParams) | |||
.then(res => { | |||
console.log(res.data); | |||
if (res.data.status == 0) { | |||
this.dataList = res.data.data.list; | |||
this.total = res.data.data.total; | |||
} else { | |||
this.$message.error(`获取数据失败,请刷新重试!`); | |||
} | |||
this.pageLoading = false; | |||
}) | |||
.catch(err => { | |||
this.$message.error(`获取数据失败,失败原因${err},请刷新重试!`); | |||
}); | |||
}, | |||
// getData() { | |||
// this.pageLoading = true; | |||
// getCompanyNewsList(this.queryParams) | |||
// .then(res => { | |||
// console.log(res.data); | |||
// if (res.data.status == 0) { | |||
// this.dataList = res.data.data.list; | |||
// this.total = res.data.data.total; | |||
// } else { | |||
// this.$message.error(`获取数据失败,请刷新重试!`); | |||
// } | |||
// this.pageLoading = false; | |||
// }) | |||
// .catch(err => { | |||
// this.$message.error(`获取数据失败,失败原因${err},请刷新重试!`); | |||
// }); | |||
// }, | |||
//搜索 | |||
searchData(val) { | |||
this.queryParams.search = val; | |||
@@ -109,7 +110,6 @@ export default { | |||
this.tabs = this.tabList.yuanquzixun_zixunleixing8; | |||
this.queryParams.type = this.tabs[0].itemId; | |||
this.getData(); | |||
console.log(this.tabList); | |||
}, | |||
//生命周期 - 挂载完成(可以访问DOM元素) | |||
mounted() {}, |
@@ -25,13 +25,13 @@ | |||
import SearchBox from "./components/SearchBox.vue"; | |||
import Pagination from "@components/Pagination.vue"; | |||
import QuestionList from "./components/QuestionList.vue"; | |||
import { getCompanyNewsList } from "@api/company"; | |||
import { handlePageNation } from "@mixin/pageNationMixin"; | |||
import { questionList } from "@mixin/questionMixin"; | |||
export default { | |||
//import引入的组件需要注入到对象中才能使用 | |||
components: { SearchBox, Pagination, QuestionList }, | |||
mixins: [handlePageNation], | |||
mixins: [handlePageNation, questionList], | |||
data() { | |||
//这里存放数据 | |||
return { | |||
@@ -51,7 +51,7 @@ export default { | |||
//监控data中的数据变化 | |||
watch: { | |||
"$route.query.searchWord": { | |||
handler(newVal, oldVal) { | |||
handler(newVal) { | |||
this.queryParams.search = newVal; | |||
this.getData(); | |||
}, | |||
@@ -59,25 +59,7 @@ export default { | |||
deep: true, | |||
}, | |||
//方法集合 | |||
methods: { | |||
getData() { | |||
this.pageLoading = true; | |||
getCompanyNewsList(this.queryParams) | |||
.then(res => { | |||
console.log(res.data); | |||
if (res.data.status == 0) { | |||
this.dataList = res.data.data.list; | |||
this.total = res.data.data.total; | |||
} else { | |||
this.$message.error(`获取数据失败,请刷新重试!`); | |||
} | |||
this.pageLoading = false; | |||
}) | |||
.catch(err => { | |||
this.$message.error(`获取数据失败,失败原因${err},请刷新重试!`); | |||
}); | |||
}, | |||
}, | |||
methods: {}, | |||
//生命周期 - 创建完成(可以访问当前this实例) | |||
created() { | |||
this.queryParams.search = this.$route.query.searchWord; |