| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <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 {handle} from "~/until/handle";
- import axios from "axios";
- import qs from "qs";
- import SolutionIndex from "@/pages/solution/index";
- import {apiMap, baseUrl} from "~/map/apiMap";
- import {isEmpty} from "@/until/typeTool";
- 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;
- // 获取页面的seo优化关键字
- let types = ctx.store.getters.pTypes;
- let title = "合方圆-解决方案"
- let seo_key = "合方圆,合方圆科技,深圳合方圆";
- let seoDescription = "合方圆科技产品中心,定制化需求, 电网解决方案, 国标应用";
- // 判断是否有数据
- if(!isEmpty(types)){
- // console.log(`已经获取到类型数据`);
- // 获取当前类型的数据
- let typeData = types.find(item=>item.type_key === type);
- // console.log(typeData);
- if(typeData){
- seo_key += `,合方圆${typeData.type_name},${typeData.type_name},${typeData.seo_key}`;
- seoDescription = `深圳市合方圆科技${typeData.type_name}`;
- title = `合方圆-${typeData.type_name}`;
- }
- }
- if(result.code === 1){
- let pageData = {
- limit: result.limit,
- page: result.page,
- total: result.total,
- count: result.count,
- }
- return {
- solutions: result.data,
- basePageData: pageData,
- title,
- seo_key,
- seoDescription
- }
- }else{
- return {
- solutions:[],
- title,
- seo_key,
- seoDescription
- }
- }
- },
- head(){
- return {
- title: this.title,
- meta: [
- {
- hid: 'description',
- name: 'description',
- content: this.seoDescription
- },
- {
- hid: 'keywords',
- name: 'keywords',
- content: this.seo_key
- },
- ]
- }
- },
- data(){
- return {
- title: "",
- seo_key: "合方圆,合方圆科技",
- seoDescription: "合方圆科技,合天地方圆,解决方案",
- type: 'all',
- basePageData: {},
- solutions: []
- }
- },
- beforeMount() {
- this.type = this.$route.params.type?this.$route.params.type:'all';
- },
- components:{
- SolutionIndex,
- }
- }
- </script>
- <style scoped>
- </style>
|