| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <template>
- <!-- <product-index :p-type="type" :p-product="products"/>-->
- <!-- <solution-index :p-type="type" :p-solution="solutions"></solution-index>-->
- <news-index :p-type="type" :p-news="solutions" :p-page-data="basePageData"></news-index>
- </template>
- <script>
- import productIndex from '@/pages/product/index.vue'
- import {handle} from "~/until/handle";
- import axios from "axios";
- import SolutionIndex from "@/pages/solution/index";
- import {apiMap, baseUrl} from "~/map/apiMap";
- export default {
- name: "typeNewsPage",
- props:[],
- async asyncData(ctx){
- // 获取数据
- let url = baseUrl + apiMap.searchNews.path;
- let type = ctx.params.type?ctx.params.type:'all';
- url += `?type=${type}&p=1`
- let [err,res] = await handle(axios.get( url));
- if(err){
- console.log(err);
- return {};
- }
- let result = res.data;
- if(result.code === 1){
- let pageData = {
- limit: result.limit,
- page: result.page,
- total: result.total,
- count: result.count,
- }
- return {
- news: result.data,
- basePageData: pageData,
- }
- }else{
- return {products:[]}
- }
- },
- data(){
- return {
- type: 'all',
- basePageData: {},
- news: []
- }
- },
- beforeMount() {
- this.type = this.$route.params.type?this.$route.params.type:'all';
- },
- components:{
- SolutionIndex,
- }
- }
- </script>
- <style scoped>
- </style>
|