| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <template>
- <!-- <product-index :p-type="type" :p-product="products"/>-->
- <solution-index :p-type="type" :p-solution="solutions" :p-page-data="basePageData"></solution-index>
- </template>
- <script>
- import productIndex from '@/pages/product/index.vue'
- import {handle} from "~/until/handle";
- import axios from "axios";
- import qs from "qs";
- import SolutionIndex from "@/pages/solution/index";
- import {apiMap, baseUrl} from "~/map/apiMap";
- const pageLimit = 5;
- export default {
- name: "typeSolutionPage",
- props:[],
- async asyncData(ctx){
- // 获取数据
- let url = baseUrl + apiMap.searchSolution.path;
- let type = ctx.params.type?ctx.params.type:'all';
- url += `?type=${type}&p=1&l=5`
- 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 {
- solutions: result.data,
- basePageData: pageData,
- }
- }else{
- return {solutions:[]}
- }
- },
- data(){
- return {
- type: 'all',
- basePageData: {},
- solutions: []
- }
- },
- beforeMount() {
- this.type = this.$route.params.type?this.$route.params.type:'all';
- },
- components:{
- SolutionIndex,
- }
- }
- </script>
- <style scoped>
- </style>
|