index.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <div class="content">
  3. <lucency-header :lang="lang" page-key="product" />
  4. <item-banner :title="productTypeText" :sub-title="productTypeSubText"></item-banner>
  5. <div class="conBox big-title">
  6. <span >
  7. {{}}
  8. </span>
  9. <div class="hr"></div>
  10. </div>
  11. <!-- 产品展示页面 -->
  12. <!-- 页脚 -->
  13. <default-footer :lang="lang"/>
  14. </div>
  15. </template>
  16. <script>
  17. import langMap from "~/map/langMap";
  18. import { getTypeText,getTypeSubText, pTypes} from "~/map/productMap";
  19. export default {
  20. name: "itemIndex",
  21. props:['uLang','pType'],
  22. data(){
  23. return {
  24. langType: langMap.lang,
  25. lang: this.uLang?this.uLang:langMap.lang.cn,
  26. productId: null,
  27. types: pTypes,
  28. type: '',
  29. productTypeText: getTypeText(this.pType),
  30. productTypeSubText: getTypeSubText(this.pType),
  31. productDetail: {},
  32. }
  33. },
  34. beforeMount() {
  35. const queryString = window.location.search;
  36. const params = new URLSearchParams(queryString);
  37. if(params&&params.get('id')){
  38. this.productId = params.get('id');
  39. }else{
  40. window.location.href = '/product'
  41. }
  42. },
  43. mounted() {
  44. console.log(this.pType);
  45. console.log(this.type);
  46. this.type = this.pType;
  47. },
  48. methods:{
  49. getLangText(str) {
  50. return langMap.getText(this.lang, str);
  51. },
  52. getAbbrText(str) {
  53. return langMap.getAbbrText(this.lang, str);
  54. },
  55. async loadProductDetail(){
  56. let err,res;
  57. let url = `/api/getProduct?id=${this.productId}`
  58. [err,res] = await handle(this.$axios.$get(url));
  59. if(err){
  60. console.error(err);
  61. return alert(err.message);
  62. }
  63. let result = res.data;
  64. if(result.rcode === 1){
  65. }else{
  66. console.log('not match result');
  67. console.log(result);
  68. return alert('加载产品失败!!!');
  69. }
  70. }
  71. }
  72. }
  73. </script>
  74. <style scoped>
  75. .big-title {
  76. margin: 5px auto;
  77. justify-content: left;
  78. }
  79. </style>