|
@@ -121,120 +121,120 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-//这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
|
|
|
|
-//例如:import 《组件名称》 from '《组件路径》';
|
|
|
|
-import Paging from "@/components/pagination";
|
|
|
|
|
|
+// 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
|
|
|
|
+// 例如:import 《组件名称》 from '《组件路径》';
|
|
|
|
+import Paging from '@/components/pagination'
|
|
export default {
|
|
export default {
|
|
- name: "survey",
|
|
|
|
- //import引入的组件需要注入到对象中才能使用
|
|
|
|
|
|
+ name: 'survey',
|
|
|
|
+ // import引入的组件需要注入到对象中才能使用
|
|
components: {
|
|
components: {
|
|
- Paging,
|
|
|
|
|
|
+ Paging
|
|
},
|
|
},
|
|
- data() {
|
|
|
|
- //这里存放数据
|
|
|
|
|
|
+ data () {
|
|
|
|
+ // 这里存放数据
|
|
return {
|
|
return {
|
|
- informationType: "recentNews",
|
|
|
|
|
|
+ informationType: 'recentNews',
|
|
dataList: [],
|
|
dataList: [],
|
|
paging: {
|
|
paging: {
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
total: 0,
|
|
total: 0,
|
|
showSize: 10,
|
|
showSize: 10,
|
|
- current: 1,
|
|
|
|
|
|
+ current: 1
|
|
},
|
|
},
|
|
params: {
|
|
params: {
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
- type: "",
|
|
|
|
|
|
+ type: ''
|
|
},
|
|
},
|
|
typeChange: {
|
|
typeChange: {
|
|
- recentNews: "news",
|
|
|
|
- infor: "info",
|
|
|
|
- activity: "activity",
|
|
|
|
- book: "book",
|
|
|
|
- },
|
|
|
|
- };
|
|
|
|
|
|
+ recentNews: 'news',
|
|
|
|
+ infor: 'info',
|
|
|
|
+ activity: 'activity',
|
|
|
|
+ book: 'book'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
},
|
|
},
|
|
- //监听属性 类似于data概念
|
|
|
|
|
|
+ // 监听属性 类似于data概念
|
|
computed: {},
|
|
computed: {},
|
|
- //监控data中的数据变化
|
|
|
|
|
|
+ // 监控data中的数据变化
|
|
watch: {
|
|
watch: {
|
|
paging: {
|
|
paging: {
|
|
deep: true,
|
|
deep: true,
|
|
handler: function () {
|
|
handler: function () {
|
|
// this.getCollection()
|
|
// this.getCollection()
|
|
- },
|
|
|
|
- },
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
},
|
|
},
|
|
- //方法集合
|
|
|
|
|
|
+ // 方法集合
|
|
methods: {
|
|
methods: {
|
|
- async getList() {
|
|
|
|
|
|
+ async getList () {
|
|
let result = await this.$http({
|
|
let result = await this.$http({
|
|
- method: "post",
|
|
|
|
- url: "/api/web/news/list",
|
|
|
|
- data: this.params,
|
|
|
|
- });
|
|
|
|
- this.dataList = result.data.list;
|
|
|
|
- this.paging.total = result.data.total;
|
|
|
|
|
|
+ method: 'post',
|
|
|
|
+ url: '/api/web/news/list',
|
|
|
|
+ data: this.params
|
|
|
|
+ })
|
|
|
|
+ this.dataList = result.data.list
|
|
|
|
+ this.paging.total = result.data.total
|
|
},
|
|
},
|
|
- async getBookList() {
|
|
|
|
|
|
+ async getBookList () {
|
|
let result = await this.$http({
|
|
let result = await this.$http({
|
|
- method: "post",
|
|
|
|
- url: "/api/web/book/list",
|
|
|
|
- data: this.params,
|
|
|
|
- });
|
|
|
|
- this.dataList = result.data.list;
|
|
|
|
- this.paging.total = result.data.total;
|
|
|
|
|
|
+ method: 'post',
|
|
|
|
+ url: '/api/web/book/list',
|
|
|
|
+ data: this.params
|
|
|
|
+ })
|
|
|
|
+ this.dataList = result.data.list
|
|
|
|
+ this.paging.total = result.data.total
|
|
},
|
|
},
|
|
- switchType(type) {
|
|
|
|
- this.informationType = type;
|
|
|
|
- this.params["type"] = this.typeChange[this.informationType];
|
|
|
|
- this.params["pageNum"] = 1;
|
|
|
|
- this.paging.current = 1;
|
|
|
|
- if(type === 'book') {
|
|
|
|
- this.getBookList();
|
|
|
|
- return;
|
|
|
|
|
|
+ switchType (type) {
|
|
|
|
+ this.informationType = type
|
|
|
|
+ this.params['type'] = this.typeChange[this.informationType]
|
|
|
|
+ this.params['pageNum'] = 1
|
|
|
|
+ this.paging.current = 1
|
|
|
|
+ if (type === 'book') {
|
|
|
|
+ this.getBookList()
|
|
|
|
+ return
|
|
}
|
|
}
|
|
- this.getList();
|
|
|
|
|
|
+ this.getList()
|
|
},
|
|
},
|
|
- back() {
|
|
|
|
- this.$router.push({ path: "/information" });
|
|
|
|
|
|
+ back () {
|
|
|
|
+ this.$router.push({ path: '/information' })
|
|
},
|
|
},
|
|
- pageChange(val) {
|
|
|
|
- console.log(val);
|
|
|
|
- this.paging.current = val;
|
|
|
|
- this.params.pageNum = val;
|
|
|
|
- this.getList();
|
|
|
|
|
|
+ pageChange (val) {
|
|
|
|
+ console.log(val)
|
|
|
|
+ this.paging.current = val
|
|
|
|
+ this.params.pageNum = val
|
|
|
|
+ this.getList()
|
|
},
|
|
},
|
|
- toDetail(item) {
|
|
|
|
|
|
+ toDetail (item) {
|
|
// console.log('item',item)
|
|
// console.log('item',item)
|
|
this.$router.push({
|
|
this.$router.push({
|
|
- path: "/information-detail",
|
|
|
|
- query: { ...item, navType: this.informationType },
|
|
|
|
- });
|
|
|
|
- },
|
|
|
|
|
|
+ path: '/information-detail',
|
|
|
|
+ query: { ...item, navType: this.informationType }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
},
|
|
},
|
|
- //生命周期 - 创建完成(可以访问当前this实例)
|
|
|
|
- created() {
|
|
|
|
|
|
+ // 生命周期 - 创建完成(可以访问当前this实例)
|
|
|
|
+ created () {
|
|
this.informationType =
|
|
this.informationType =
|
|
- (this.$route.query && this.$route.query["type"]) || "recentNews";
|
|
|
|
- this.params["type"] = this.typeChange[this.informationType];
|
|
|
|
- if (this.params["type"] === "book") {
|
|
|
|
- this.getBookList();
|
|
|
|
- return;
|
|
|
|
|
|
+ (this.$route.query && this.$route.query['type']) || 'recentNews'
|
|
|
|
+ this.params['type'] = this.typeChange[this.informationType]
|
|
|
|
+ if (this.params['type'] === 'book') {
|
|
|
|
+ this.getBookList()
|
|
|
|
+ return
|
|
}
|
|
}
|
|
- this.getList();
|
|
|
|
|
|
+ this.getList()
|
|
},
|
|
},
|
|
- //生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
|
- mounted() {},
|
|
|
|
- beforeCreate() {}, //生命周期 - 创建之前
|
|
|
|
- beforeMount() {}, //生命周期 - 挂载之前
|
|
|
|
- beforeUpdate() {}, //生命周期 - 更新之前
|
|
|
|
- updated() {}, //生命周期 - 更新之后
|
|
|
|
- beforeDestroy() {}, //生命周期 - 销毁之前
|
|
|
|
- destroyed() {}, //生命周期 - 销毁完成
|
|
|
|
- activated() {}, //如果页面有keep-alive缓存功能,这个函数会触发
|
|
|
|
-};
|
|
|
|
|
|
+ // 生命周期 - 挂载完成(可以访问DOM元素)
|
|
|
|
+ mounted () {},
|
|
|
|
+ beforeCreate () {}, // 生命周期 - 创建之前
|
|
|
|
+ beforeMount () {}, // 生命周期 - 挂载之前
|
|
|
|
+ beforeUpdate () {}, // 生命周期 - 更新之前
|
|
|
|
+ updated () {}, // 生命周期 - 更新之后
|
|
|
|
+ beforeDestroy () {}, // 生命周期 - 销毁之前
|
|
|
|
+ destroyed () {}, // 生命周期 - 销毁完成
|
|
|
|
+ activated () {} // 如果页面有keep-alive缓存功能,这个函数会触发
|
|
|
|
+}
|
|
</script>
|
|
</script>
|
|
<style lang='less' scoped>
|
|
<style lang='less' scoped>
|
|
.bg {
|
|
.bg {
|