index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <!-- <view></view> -->
  3. <view class="body body-radius">
  4. <view class="content uni-column" :class="contentBg" @click="btnClick">
  5. <view class="main uni-column">
  6. <image mode="aspectFit" class="logo" :src="logoSrc"></image>
  7. <view class="uni-row" style="position: relative;">
  8. <text class="type mod-text">{{type}}</text>
  9. </view>
  10. <view class="name mod-text">{{name}}</view>
  11. <button class="button mod-button">{{btnText}}</button>
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. import tools from '../../common/tools';
  18. import Bridge from '../../sdk/bridge';
  19. import cardfunc from '../../common/cardfunc';
  20. import {
  21. token,
  22. ossUrl
  23. } from '../../common/api';
  24. export default {
  25. data() {
  26. return {
  27. queryObj: {},
  28. queryString: "",
  29. token: "",
  30. ecId: 0, // 卡片id
  31. // Card UI Data
  32. contentBg: "content-bg-blue",
  33. logoSrc: "/static/logo.png",
  34. type: "示例卡片",
  35. name: "点击查看详情",
  36. btnText: "立即查看",
  37. }
  38. },
  39. onLoad(query) { // 类型非必填,可自动推导
  40. console.log("onLoad");
  41. console.log(query);
  42. this.queryObj = query;
  43. this.queryString = tools.objectToQueryString(this.queryObj);
  44. // console.log(this.queryString);
  45. this.token = query["token"] ?? token;
  46. this.ecId = query["id"] ?? 0;
  47. // --- Original Logic Commented Out for Demo ---
  48. /*
  49. cardfunc.init(this, this.token, this.ecId);
  50. cardfunc.userConfigQuery(this.userConfigQueryCallback);
  51. */
  52. },
  53. methods: {
  54. /*
  55. userConfigQueryCallback(userconfig) {
  56. // console.log("[userConfigQueryCallback] userconfig:", userconfig);
  57. userconfig = cardfunc.parseCardConfig(userconfig);
  58. const tplTypeId = userconfig.tplInfo.tplTypeId; // 模板类型ID
  59. const ssctId = userconfig.tplInfo.ssctId; // 模板ID
  60. // const styleId = userconfig.tplInfo.styleId; // 模板样式ID
  61. let tplType = ""; // 模板类型
  62. let tpl = ""; // 模板
  63. if (tplTypeId == 1) {
  64. tplType = "tpl";
  65. if (ssctId > 0) {
  66. tpl = "style" + ssctId;
  67. }
  68. }
  69. if (tplType != "" && tpl != "") {
  70. const url = `/pages/${tplType}/${tpl}/index?${this.queryString}`;
  71. uni.reLaunch({
  72. url: url
  73. });
  74. } else {
  75. uni.showToast({
  76. title: `模板参数错误`,
  77. icon: 'none',
  78. duration: 3000
  79. });
  80. }
  81. },
  82. */
  83. btnClick() {
  84. // 构造目标 URL,通常是部署后的完整路径
  85. // 注意:这里为了演示使用了 ossUrl,实际开发中请根据环境调整
  86. // full=true 是给 Flutter 端拦截的信号(约定俗成)
  87. const url = `${ossUrl}#/pages/index/detail?${this.queryString}&full=true`;
  88. console.log("Navigating to:", url);
  89. // 使用 Bridge 触发跳转
  90. Bridge.appAction(url);
  91. }
  92. }
  93. }
  94. </script>
  95. <style scoped>
  96. .content {
  97. width: 100vw;
  98. height: 100vh;
  99. justify-content: center;
  100. align-items: center;
  101. }
  102. .content-bg-blue {
  103. background: linear-gradient(180deg,#178bff 0%,#004d9b 100%);
  104. }
  105. .main {
  106. width: 100%;
  107. height: 600rpx;
  108. justify-content: space-evenly;
  109. align-items: center;
  110. }
  111. .logo {
  112. width: 200rpx;
  113. height: 200rpx;
  114. background-color: white;
  115. border-radius: 20rpx;
  116. }
  117. .type {
  118. opacity: 0.8;
  119. font-family: Roboto;
  120. color: #ffffff;
  121. font-size: 36rpx;
  122. text-align: center;
  123. }
  124. .name {
  125. font-family: Roboto;
  126. color: #ffffff;
  127. font-size: 48rpx;
  128. text-align: center;
  129. font-weight: bold;
  130. }
  131. .button {
  132. width: 320rpx;
  133. height: 86rpx;
  134. color: #0458ad;
  135. background: #ffffff;
  136. border-radius: 56rpx;
  137. font-size: 40rpx;
  138. line-height: 86rpx;
  139. text-align: center;
  140. }
  141. </style>