index.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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 v-show="productDetail.image" :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. console.log(this.productDetail.image)
  71. this.productDetail.detail = unescape(this.productDetail.detail);
  72. },
  73. mounted() {
  74. console.log(this.pType);
  75. console.log(this.type);
  76. this.isPhone = isMediaView(0,1024);
  77. this.type = this.pType;
  78. },
  79. methods:{
  80. getLangText(str) {
  81. return langMap.getText(this.lang, str);
  82. },
  83. getAbbrText(str) {
  84. return langMap.getAbbrText(this.lang, str);
  85. },
  86. async loadProductDetail(){
  87. let err,res;
  88. let url = apiMap.productInfo.path;
  89. url += `/${this.productId}`
  90. [err,res] = await handle(this.$axios.get(url));
  91. if(err){
  92. console.error(err);
  93. return alert(err.message);
  94. }
  95. let result = res.data;
  96. if(result.code === 1){
  97. this.productDetail = result.data;
  98. console.log(this.productDetail.detail)
  99. this.productDetail.detail = unescape(this.productDetail.detail);
  100. console.log(this.productDetail.detail)
  101. }else{
  102. console.log('not match result');
  103. console.log(result);
  104. return alert('加载产品失败!!!');
  105. }
  106. },
  107. }
  108. }
  109. </script>
  110. <style scoped>
  111. .big-title {
  112. margin: 5px auto;
  113. justify-content: left;
  114. }
  115. .product-view{
  116. height: auto;
  117. min-height: 680px;
  118. /*width: 100%;*/
  119. border-top: 1px solid #dedede;
  120. display: flex;
  121. }
  122. .product-view .left{
  123. width: 320px;
  124. height: auto;
  125. }
  126. .product-view .left .imgView{
  127. width: 300px;
  128. height: 300px;
  129. margin: 10px;
  130. position: relative;
  131. }
  132. .product-view .left .imgView img{
  133. display: block;
  134. width: 100%;
  135. height: 100%;
  136. }
  137. .product-view .right{
  138. width: calc(100% - 320px);
  139. height: auto;
  140. }
  141. .product-view .right .remark{
  142. padding: 10px 5px;
  143. border-left: 1px solid #b6b6b6;
  144. margin-top: 5px;
  145. box-sizing: border-box;
  146. }
  147. .product-view .left .concatUs{
  148. width: 100%;
  149. height: auto;
  150. border-top: 1px solid gray;
  151. }
  152. .product-view .left .concatUs .chunk{
  153. width: 90%;
  154. margin: 5px auto;
  155. display: flex;
  156. padding: 5px 15px;
  157. justify-content: center;
  158. font-size: 1.4rem;
  159. border-radius: 3px;
  160. box-shadow: 0 0 5px gainsboro;
  161. cursor: pointer;
  162. }
  163. .product-view .left .concatUs .chunk:hover{
  164. background-color: skyblue;
  165. color: white;
  166. }
  167. .product-detail{
  168. margin-top: 20px;
  169. border-top: 1px solid gainsboro;
  170. }
  171. .tab-header{
  172. display: flex;
  173. }
  174. .tab-header .header-title{
  175. }
  176. </style>