| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <template>
- <!-- <product-index :p-type="type" :p-product="products"/>-->
- <solution-index :p-type="type" :p-solution="solutions"></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";
- const pageLimit = 5;
- export default {
- name: "typeSolutionPage",
- props:[],
- async asyncData(ctx){
- // ctx.searchProduct();
- const queryData = {};
- // console.log(ctx)
- queryData['key']=ctx.key;
- queryData['type']=ctx.params.type?ctx.params.type:'all';
- queryData['page']=1;
- queryData['limit']=pageLimit;
- // 获取数据
- let url = 'http://szhfy.com.cn/api/searchSolution.php';
- let [err,res] = await handle(axios.post(
- url,
- qs.stringify(queryData)
- ));
- if(err){
- console.log(err);
- return {};
- }
- let result = res.data;
- if(result.rcode === 1){
- return {solutions:result.data}
- }else{
- console.error(result.msg);
- console.log(result);
- return {solutions:[]}
- }
- },
- data(){
- return {
- type: 'all',
- solutions: []
- }
- },
- beforeMount() {
- // console.log('动态页面执行');
- this.type = this.$route.params.type?this.$route.params.type:'all';
- // console.log(this.type);
- },
- components:{
- SolutionIndex,
- }
- }
- </script>
- <style scoped>
- </style>
|