poster.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <view class="container">
  3. <view class="notice-item1">
  4. <scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll-Y notice_content1" @scroll="scroll">
  5. <rich-text @click="navTo('/pages/shareQrCode/index')" class="notice_img" :nodes="description"></rich-text>
  6. </scroll-view>
  7. </view>
  8. </view>
  9. </template>
  10. <script>
  11. import { details } from '@/api/notice.js';
  12. import { saveUrl } from '@/utils/loginUtils.js';
  13. export default {
  14. data() {
  15. return {
  16. id:'',
  17. list:"",
  18. spread:"",
  19. show:false,
  20. scrollTop: 0,
  21. description:'',
  22. old: {
  23. scrollTop: 0
  24. }
  25. };
  26. },
  27. async onLoad(options) {
  28. this.id = options.id;
  29. // 判断有无邀请人
  30. if (options.spread) {
  31. uni.setStorageSync('spread', options.spread);
  32. }
  33. saveUrl();
  34. this.loadDate();
  35. },
  36. methods: {
  37. loadDate(){
  38. let obj = this;
  39. details({},obj.id).then(function(e) {
  40. obj.list = e.data;
  41. if(obj.list.content != null){
  42. obj.description =obj.list.content.replace(/\<img/gi,'<img class="rich-img"');
  43. }//小程序商品详情图超出屏幕问题
  44. });
  45. },
  46. //分享
  47. // #ifdef MP
  48. onShareAppMessage: function(res) {
  49. let userInfo = uni.getStorageSync('userInfo');
  50. let GetInfo = uni.getStorageSync('GetInfo');
  51. // 来自页面内分享按钮
  52. let pages = getCurrentPages();
  53. // 获取当前页面
  54. let page = pages[pages.length - 1];
  55. let path = '/pages/notice/poster?id='+this.id;
  56. // 保存邀请人
  57. path += '&spread=' + userInfo.uid;
  58. let data = {
  59. path: path,
  60. imageUrl: GetInfo.img,
  61. title: GetInfo.title
  62. };
  63. console.log(data)
  64. return data;
  65. },
  66. // #endif
  67. //返回顶部
  68. handleScrollTop(){
  69. window.scrollTo(0, 0);
  70. },
  71. scroll: function(e) {
  72. console.log(e)
  73. this.old.scrollTop = e.detail.scrollTop
  74. },
  75. goTop: function(e) {
  76. this.scrollTop = this.old.scrollTop;
  77. console.log(this.scrollTop)
  78. console.log(this.old.scrollTop)
  79. this.$nextTick(function() {
  80. this.scrollTop = 0
  81. });
  82. },
  83. //显示弹窗
  84. open(){
  85. this.show = true;
  86. },
  87. //随意点击隐藏弹窗
  88. onTap() {
  89. if (!this.open) return
  90. this.close()
  91. },
  92. close() {
  93. this.show = false;
  94. },
  95. //跳转接口
  96. navTo(url) {
  97. uni.navigateTo({
  98. url
  99. });
  100. },
  101. }
  102. };
  103. </script>
  104. <style lang="scss">
  105. page {
  106. min-height: 100%;
  107. background:#FFFFFF;
  108. }
  109. .notice_name {
  110. font-size: 35rpx !important;
  111. color: #303133;
  112. }
  113. .rich-img {
  114. width: 100% !important;
  115. height: auto ;
  116. }
  117. .notice-item {
  118. width: 100%;
  119. height: 100%;
  120. color: #666666;
  121. padding: 35rpx 35rpx;
  122. font-size: 23rpx;
  123. padding-bottom: 30rpx;
  124. }
  125. .notice-item1{
  126. width: 100%;
  127. }
  128. .notice_text {
  129. border-bottom: 1px solid #F0F0F0;
  130. padding: 30rpx 0rpx;
  131. }
  132. .notice_content {
  133. font-size: 28rpx;
  134. padding: 25rpx 0rpx;
  135. line-height: 45rpx;
  136. .image{
  137. width: 100%;
  138. height: 100rpx;
  139. image{
  140. width: 100%;
  141. height: 100%;
  142. }
  143. }
  144. }
  145. .notice_img{
  146. width: 100%;
  147. }
  148. .notice_content1{
  149. // background-color: #00B500;
  150. .image{
  151. width: 100%;
  152. height: 100rpx;
  153. image{
  154. width: 100%;
  155. height: 100%;
  156. }
  157. }
  158. }
  159. .share{
  160. text-align: center;
  161. background-color: #e93323!important;
  162. color: #FFFFFF !important;
  163. padding: 20rpx 0rpx;
  164. border-radius: 35rpx;
  165. margin-bottom: 20rpx;
  166. }
  167. .mask{
  168. z-index: 999;
  169. width: 750rpx;
  170. height: 100%;
  171. position: fixed;
  172. top: 0;
  173. left: 0;
  174. image{
  175. width: 100%;
  176. height: 100%;
  177. opacity: 0.8;
  178. }
  179. }
  180. </style>