details.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <view class="container">
  3. <view class="notice-item">
  4. <view class="notice_name">{{list.title}}</view>
  5. <view class="flex notice_text">
  6. <text class="">作者:新零售</text>
  7. <text class="">{{list.add_time}}</text>
  8. </view>
  9. <view class="notice_content"><rich-text :nodes="list.content"></rich-text></view>
  10. </view>
  11. <view class="mask" v-show="show"><image @click="onTap" src="/static/img/shareimg.png"></image></view>
  12. </view>
  13. </template>
  14. <script>
  15. import { details } from '@/api/moments.js';
  16. import { mapState } from 'vuex';
  17. import { saveUrl } from '@/utils/loginUtils.js';
  18. // #ifdef H5
  19. import { weixindata } from '@/utils/wxAuthorized';
  20. // #endif
  21. export default {
  22. data() {
  23. return {
  24. id:'',
  25. list:"",
  26. spread:"",
  27. show:false
  28. };
  29. },
  30. async onLoad(options) {
  31. this.id = options.id;
  32. if(options.spread){
  33. // 存储邀请人
  34. this.spread = options.spread;
  35. uni.setStorageSync('spread', options.spread);
  36. }
  37. let obj = this;
  38. details({},obj.id).then(function(e) {
  39. obj.list = e.data;
  40. // #ifdef H5
  41. obj.shareDate();
  42. // #endif
  43. });
  44. saveUrl();
  45. },
  46. onShow() {
  47. },
  48. computed: {
  49. ...mapState(['userInfo', 'baseURL'])
  50. },
  51. methods: {
  52. shareDate() {
  53. let obj = this;
  54. let url = window.location.href.replace(/[\?,&]{0,1}from=singlemessage/g, '')+ '&spread=' + this.userInfo.uid;
  55. let bool = uni.getStorageSync('weichatBrowser') || '';
  56. // 判断是否微信浏览器
  57. if (bool) {
  58. let data = {
  59. link: url, // 分享链接
  60. imgUrl: obj.list.image_input[0], // 分享图标
  61. desc: obj.list.synopsis,
  62. title: obj.list.title,
  63. success: function() {}
  64. };
  65. // #ifdef H5
  66. // 判断是否为微信浏览器
  67. if (uni.getStorageSync('weichatBrowser')) {
  68. // 加载微信注册信息
  69. weixindata(data);
  70. }
  71. // #endif
  72. }
  73. },
  74. //显示弹窗
  75. open(){
  76. this.show = true;
  77. },
  78. //随意点击隐藏弹窗
  79. onTap() {
  80. if (!this.open) return
  81. this.close()
  82. },
  83. close() {
  84. this.show = false;
  85. },
  86. }
  87. };
  88. </script>
  89. <style lang="scss">
  90. page {
  91. min-height: 100%;
  92. background:#FFFFFF;
  93. padding-bottom: 30rpx;
  94. }
  95. .notice_name {
  96. font-size: 35rpx !important;
  97. color: #303133;
  98. }
  99. .notice-item {
  100. width: 100%;
  101. height: 100%;
  102. color: #666666;
  103. padding: 35rpx 35rpx;
  104. font-size: 23rpx;
  105. }
  106. .notice_text {
  107. border-bottom: 1px solid #F0F0F0;
  108. padding: 30rpx 0rpx;
  109. }
  110. .notice_content {
  111. font-size: 28rpx;
  112. padding: 25rpx 0rpx;
  113. line-height: 45rpx;
  114. }
  115. .share{
  116. text-align: center;
  117. background-color: #e93323!important;
  118. color: #FFFFFF !important;
  119. padding: 20rpx 0rpx;
  120. border-radius: 35rpx;
  121. margin-bottom: 20rpx;
  122. }
  123. .mask{
  124. z-index: 999;
  125. width: 750rpx;
  126. height: 100%;
  127. position: fixed;
  128. top: 0;
  129. left: 0;
  130. image{
  131. width: 100%;
  132. height: 100%;
  133. opacity: 0.9;
  134. }
  135. }
  136. </style>