product_detail.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <div class="content">
  3. <div class="title">
  4. <div class="logo">
  5. <img :src="logo" alt="" mode="aspectFit" />
  6. </div>
  7. <div class="name">
  8. {{ name }}
  9. </div>
  10. </div>
  11. <div class="fwb" v-html="company"></div>
  12. <!-- <div style="width: 100%">
  13. <footer-share
  14. style="width: 100%"
  15. :isCollection="true"
  16. @collectionPages="collectionPage"
  17. @sharePages="sharePage"
  18. ></footer-share>
  19. </div> -->
  20. </div>
  21. </template>
  22. <script>
  23. export default {
  24. onLoad(option) {
  25. this.getRich(option.id);
  26. },
  27. data() {
  28. return {
  29. company: "",
  30. logo: getApp().globalData.company_logo,
  31. name: getApp().globalData.company_name,
  32. };
  33. },
  34. methods: {
  35. replaceImg(html) {
  36. let result = html.replace(
  37. /<img [^>]*src=['"]([^'"]+)[^>]*>/gi,
  38. function (match, capture) {
  39. return (
  40. "<img src=" +
  41. getApp().globalData.shareUrl +
  42. capture +
  43. ' style="max-width:100%;height:auto;display:block;margin:10px 0;"/>'
  44. );
  45. }
  46. );
  47. return result;
  48. },
  49. getRich(ids) {
  50. uni.request({
  51. url: `https://kiq.xazhima.com/content/company_product/${Math.floor(
  52. ids / 1000
  53. )}/${ids}.html`,
  54. method: "GET",
  55. header: {
  56. "content-type": "application/x-www-form-urlencoded",
  57. },
  58. success: (res) => {
  59. if (res.statusCode === 200) {
  60. this.company = this.replaceImg(res.data);
  61. }
  62. },
  63. fail: () => {
  64. console.log("连接失败");
  65. },
  66. });
  67. },
  68. },
  69. };
  70. </script>
  71. <style lang="scss">
  72. .content {
  73. padding: 4%;
  74. font-size: 30rpx;
  75. .title {
  76. display: flex;
  77. align-items: center;
  78. border-radius: 10rpx;
  79. margin-bottom: 50rpx;
  80. box-shadow: rgba(0, 0, 0, 0.35) 0rpx 5rpx 15rpx;
  81. .logo {
  82. image {
  83. width: 150rpx;
  84. height: 100rpx;
  85. margin: 0 30rpx;
  86. }
  87. }
  88. }
  89. }
  90. </style>