裂变星小程序-25.03.04
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

168 lines
5.1 KiB

  1. <template>
  2. <view>
  3. <view class="content">
  4. <view class="title">{{ detail.title || '' }}</view>
  5. <view class="desc">{{ detail.publishTime ? `发布于${detail.publishTime}` : '' }}</view>
  6. <editor id="editor" class="editor"
  7. :read-only="true"
  8. @ready="onEditorReady"
  9. ></editor>
  10. </view>
  11. <uv-overlay :show="true" :opacity="0">
  12. <navbar leftClick @leftClick="$utils.navigateBack" />
  13. <button class="btn" type="success" @click="openPopup">查看更多</button>
  14. <popupUnlock ref="popupUnlock" src="../static/sharing/unlock-article.png"></popupUnlock>
  15. <popupQrCode ref="popupQrCode" :src="detail.qrCode"></popupQrCode>
  16. </uv-overlay>
  17. </view>
  18. </template>
  19. <script>
  20. import popupUnlock from '../components/popupUnlock.vue'
  21. import popupQrCode from '../components/popupQrCode.vue'
  22. export default {
  23. components: {
  24. popupUnlock,
  25. popupQrCode,
  26. },
  27. data() {
  28. return {
  29. detail: {
  30. id: null,
  31. groupName: null,
  32. imageUrl: null,
  33. times: null,
  34. qrCode: null,
  35. title: null,
  36. description: null,
  37. auditStatus: null,
  38. createTime: null,
  39. publishTime: null,
  40. state: null,
  41. },
  42. isLocked: true,
  43. }
  44. },
  45. async onLoad(option) {
  46. const { id } = option
  47. await this.fetchSharingDetail(id)
  48. this.initEditor(this.detail.description)
  49. },
  50. onShareAppMessage(res) {
  51. const {
  52. title,
  53. imageUrl,
  54. } = this.detail
  55. // todo: check
  56. let o = {
  57. title : title,
  58. imageUrl: imageUrl,
  59. query: `id=${this.detail.id}`,
  60. }
  61. // todo: check callback? settimeout?
  62. // todo: get times and check is unlocked
  63. this.isLocked = false
  64. this.$refs.popupQrCode.open()
  65. return o
  66. },
  67. methods: {
  68. onEditorReady() {
  69. uni.createSelectorQuery().select('#editor').context((res) => {
  70. this.editorCtx = res.context
  71. }).exec()
  72. },
  73. initEditor(html) {
  74. if (!this.editorCtx) {
  75. setTimeout(() => {
  76. this.initEditor(html)
  77. }, 200)
  78. return
  79. }
  80. this.editorCtx.setContents({ html })
  81. },
  82. async fetchSharingDetail(id) {
  83. // todo: init data by id
  84. this.detail = {
  85. id: '001',
  86. groupName: '裂变星创业服务交流群',
  87. imageUrl: 'http://gips3.baidu.com/it/u=70459541,3412285454&fm=3028&app=3028&f=JPEG&fmt=auto?w=960&h=1280',
  88. times: 10,
  89. qrCode: '../static/temp-qrcode.png',
  90. title: '裂变星轻松获客',
  91. description: '<p>文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本</p><p><br></p><p>aaaaaaaaa</p><p><br></p><p><br></p><p>bbbbbbb</p><p>文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本</p><p>文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本</p><p>文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本</p><p>文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本</p><p><br></p><p>aaaaaaaaa</p><p><br></p><p><br></p><p>bbbbbbb</p><p>文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本</p><p>文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本</p><p>文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本内容文本</p>',
  92. auditStatus: 2,
  93. createTime: '2025年2月1日',
  94. publishTime: '2024年11月13日 11:29',
  95. state: 2,
  96. }
  97. },
  98. openPopup() {
  99. if (this.isLocked) {
  100. this.$refs.popupUnlock.open();
  101. } else {
  102. this.$refs.popupQrCode.open()
  103. }
  104. }
  105. }
  106. }
  107. </script>
  108. <style scoped lang="scss">
  109. .content {
  110. padding: 40rpx 20rpx;
  111. padding-top: calc(#{$navbar-height} + var(--status-bar-height) + 20rpx + 40rpx);
  112. }
  113. .title {
  114. color: #474747;
  115. font-size: 36rpx;
  116. font-weight: 700;
  117. }
  118. .desc {
  119. color: #A2A2A2;
  120. font-size: 24rpx;
  121. margin-top: 6rpx;
  122. }
  123. .editor {
  124. margin-top: 22rpx;
  125. height: 40vh;
  126. }
  127. .btn {
  128. position: absolute;
  129. width: calc(100% - 60rpx*2);
  130. height: auto;
  131. left: 60rpx;
  132. bottom: 292rpx;
  133. background-color: #07C160;
  134. border: none;
  135. color: #FFFFFF;
  136. font-size: 28rpx;
  137. line-height: 1;
  138. border-radius: 45rpx;
  139. padding: 25rpx 0;
  140. box-sizing: border-box;
  141. }
  142. </style>