detail.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <!--
  2. 广告宣传 - 广告详情页面
  3. http://localhost:5173/card/#/pages/ad/detail
  4. https://oss-mbh5.colormaprun.com/card/#/pages/ad/detail
  5. -->
  6. <template>
  7. <view class="body">
  8. <view class="content uni-column">
  9. <view class="uni-column uni-jcc top">
  10. <my-topbar class="topbar-color" :mcName="title" :showRule="false" @btnBackClick="btnBack"></my-topbar>
  11. <view class="top-content uni-row">
  12. </view>
  13. </view>
  14. <view class="main uni-column">
  15. <web-view class="webView" :fullscreen="false" :src="adUrl"></web-view>
  16. </view>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. import tools from '/common/tools';
  22. import cardfunc from '/common/cardfunc';
  23. import {
  24. localCardConfig
  25. } from "./cardconfig/test.js";
  26. import {
  27. token
  28. } from '/common/api';
  29. export default {
  30. data() {
  31. return {
  32. cardConfigData: cardfunc.cardConfigData,
  33. pageReady: false,
  34. pageName: "detail",
  35. queryObj: {},
  36. queryString: "",
  37. token: "",
  38. cardconfig: {}, // 卡片配置
  39. title: "",
  40. adUrl: "", // 广告页面url
  41. }
  42. },
  43. onLoad(query) {
  44. // console.log(query);
  45. this.queryObj = query;
  46. this.queryString = tools.objectToQueryString(this.queryObj);
  47. // console.log(queryString);
  48. this.token = query["token"] ?? token;
  49. this.ecId = query["id"] ?? 0;
  50. cardfunc.init(this, this.token, this.ecId);
  51. cardfunc.getCardConfig(this.cardConfigQueryCallback, localCardConfig);
  52. },
  53. methods: {
  54. cardConfigQueryCallback(cardconfig) {
  55. this.cardconfig = cardconfig;
  56. this.loadCardConfig(this.cardconfig);
  57. this.pageReady = true;
  58. },
  59. loadCardConfig(cardconfig) {
  60. cardconfig = cardfunc.parseCardConfig(cardconfig);
  61. // console.log("[loadCardConfig] cardconfig:", cardconfig);
  62. // 加载卡片通用配置
  63. if (cardconfig.common != undefined) {
  64. cardfunc.loadCardCommonConfig(cardconfig.common);
  65. }
  66. // -------- 加载当前页面的配置 --------
  67. const config = cardfunc.parseCardConfig(cardconfig[this.pageName]);
  68. // console.log("[loadConfig] config_page:", config);
  69. if (config == undefined || config == null) {
  70. return;
  71. }
  72. // 加载CSS样式
  73. const css = config.css;
  74. if (css != undefined && css.length > 0) {
  75. tools.loadCssCode(css);
  76. }
  77. // 加载广告页面标题
  78. const title = config.title;
  79. // console.log("[loadConfig] title:", title);
  80. if (title != undefined && title.length > 0) {
  81. this.title = title;
  82. }
  83. // 加载广告页面url
  84. const adUrl = config.adUrl;
  85. // console.log("[loadConfig] adUrl:", adUrl);
  86. if (adUrl != undefined && adUrl.length > 0) {
  87. this.adUrl = adUrl;
  88. }
  89. },
  90. btnBack() {
  91. const url = `action://to_home/`;
  92. tools.appAction(url);
  93. },
  94. }
  95. }
  96. </script>
  97. <style scoped>
  98. .top {
  99. width: 100%;
  100. height: 36px;
  101. padding-top: 36px;
  102. flex-shrink: 0;
  103. background: rgb(255, 195, 0, 0);
  104. }
  105. .main {
  106. }
  107. /deep/ iframe {
  108. width: 100vw !important;
  109. height: calc(100vh - 72px) !important;
  110. border: 0 !important;
  111. }
  112. </style>