index.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <div class="content">
  3. <lucency-header :lang="lang" page-key="product" :is-phone="isPhone" />
  4. <item-banner :title="productTypeText" :sub-title="productTypeSubText"></item-banner>
  5. <big-title>{{productDetail.name}}</big-title>
  6. <div class="conBox product-view">
  7. <div class="left">
  8. <div class="imgView">
  9. <img :src="'/public/'+productDetail.image" alt=""/>
  10. </div>
  11. <div class="concatUs">
  12. <!-- 联系销售 -->
  13. <span class="chunk">联系购买</span>
  14. <div class="imgView">
  15. <img src="/image/wechat.jpg" alt="">
  16. </div>
  17. </div>
  18. </div>
  19. <div class="right">
  20. <div class="remark">
  21. {{productDetail.remark}}
  22. </div>
  23. <div class="detail" v-html="productDetail.detail">
  24. </div>
  25. </div>
  26. </div>
  27. <!-- 更多数据页面 -->
  28. <div class="conBox product-detail">
  29. <q-tab></q-tab>
  30. </div>
  31. <!-- 页脚 -->
  32. <default-footer :lang="lang"/>
  33. <site-bar wechat-src="/image/wechat.jpg"></site-bar>
  34. </div>
  35. </template>
  36. <script>
  37. import axios from "axios";
  38. import langMap from "~/map/langMap";
  39. import { getTypeText,getTypeSubText, pTypes} from "~/map/productMap";
  40. import handle from "~/until/handle";
  41. import {unescape} from "~/until/unescapeHtml";
  42. import qTab from "../../../components/qTab";
  43. import DefaultFooter from "../../../components/footer/defaultFooter";
  44. import LucencyHeader from "../../../components/header/lucencyHeader";
  45. import ItemBanner from "../../../components/banner/itemBanner";
  46. import {isMediaView} from "@/until/mediaView";
  47. import {apiMap, baseUrl} from "~/map/apiMap";
  48. import BigTitle from "~/components/public/bigTitle.vue";
  49. export default {
  50. name: "itemIndex",
  51. components: {BigTitle, ItemBanner, LucencyHeader, DefaultFooter, qTab},
  52. props:['uLang','pType', 'pInfo'],
  53. data(){
  54. return {
  55. langType: langMap.lang,
  56. lang: this.uLang?this.uLang:langMap.lang.cn,
  57. productId: null,
  58. types: pTypes,
  59. type: '',
  60. productTypeText: getTypeText(this.pType),
  61. productTypeSubText: getTypeSubText(this.pType),
  62. productDetail: {},
  63. isPhone: false,
  64. }
  65. },
  66. beforeMount() {
  67. console.log(this.pInfo);
  68. this.productDetail = this.pInfo;
  69. console.log(this.productDetail.detail)
  70. this.productDetail.detail = unescape(this.productDetail.detail);
  71. },
  72. mounted() {
  73. console.log(this.pType);
  74. console.log(this.type);
  75. this.isPhone = isMediaView(0,1024);
  76. this.type = this.pType;
  77. },
  78. methods:{
  79. getLangText(str) {
  80. return langMap.getText(this.lang, str);
  81. },
  82. getAbbrText(str) {
  83. return langMap.getAbbrText(this.lang, str);
  84. },
  85. async loadProductDetail(){
  86. let err,res;
  87. let url = apiMap.productInfo.path;
  88. url += `/${this.productId}`
  89. [err,res] = await handle(this.$axios.get(url));
  90. if(err){
  91. console.error(err);
  92. return alert(err.message);
  93. }
  94. let result = res.data;
  95. if(result.code === 1){
  96. this.productDetail = result.data;
  97. console.log(this.productDetail.detail)
  98. this.productDetail.detail = unescape(this.productDetail.detail);
  99. console.log(this.productDetail.detail)
  100. }else{
  101. console.log('not match result');
  102. console.log(result);
  103. return alert('加载产品失败!!!');
  104. }
  105. },
  106. }
  107. }
  108. </script>
  109. <style scoped>
  110. .big-title {
  111. margin: 5px auto;
  112. justify-content: left;
  113. }
  114. .product-view{
  115. height: auto;
  116. min-height: 680px;
  117. /*width: 100%;*/
  118. border-top: 1px solid #dedede;
  119. display: flex;
  120. }
  121. .product-view .left{
  122. width: 320px;
  123. height: auto;
  124. }
  125. .product-view .left .imgView{
  126. width: 300px;
  127. height: 300px;
  128. margin: 10px;
  129. position: relative;
  130. }
  131. .product-view .left .imgView img{
  132. display: block;
  133. width: 100%;
  134. height: 100%;
  135. }
  136. .product-view .right{
  137. width: calc(100% - 320px);
  138. height: auto;
  139. }
  140. .product-view .right .remark{
  141. padding: 10px 5px;
  142. border-left: 1px solid #b6b6b6;
  143. margin-top: 5px;
  144. box-sizing: border-box;
  145. }
  146. .product-view .left .concatUs{
  147. width: 100%;
  148. height: auto;
  149. border-top: 1px solid gray;
  150. }
  151. .product-view .left .concatUs .chunk{
  152. width: 90%;
  153. margin: 5px auto;
  154. display: flex;
  155. padding: 5px 15px;
  156. justify-content: center;
  157. font-size: 1.4rem;
  158. border-radius: 3px;
  159. box-shadow: 0 0 5px gainsboro;
  160. cursor: pointer;
  161. }
  162. .product-view .left .concatUs .chunk:hover{
  163. background-color: skyblue;
  164. color: white;
  165. }
  166. .product-detail{
  167. margin-top: 20px;
  168. border-top: 1px solid gainsboro;
  169. }
  170. .tab-header{
  171. display: flex;
  172. }
  173. .tab-header .header-title{
  174. }
  175. </style>