poster.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <view>
  3. <view v-if="user_share_poster != null || user_share_qrode != null || user_share_url != null" class="padding-main">
  4. <!-- 海报 -->
  5. <view v-if="user_share_poster != null" class="share qrcode padding-main border-radius-main bg-white spacing-mb">
  6. <view class="title border-color-main padding-left-lg text-size fw-b">海报分享</view>
  7. <view class="cr-gray br-b padding-vertical-main">
  8. 保存海报后,发送给微信好友/群、QQ好友/群,分享到分朋友圈,微博等进行推广,轻轻松松赚返利!
  9. </view>
  10. <view class="margin-top-lg">
  11. <image :src="user_share_poster" class="wh-auto dis-block radius" mode="widthFix"></image>
  12. </view>
  13. <view class="submit-double oh margin-top-lg">
  14. <button class="fl bg-white cr-green br-green round" type="default" hover-class="none" size="mini" :data-value="user_share_poster" @tap="images_show_event">查看长按保存</button>
  15. <button class="fr bg-white cr-main br-main round" type="default" hover-class="none" size="mini" @tap="poster_refresh_event">重新生成</button>
  16. </view>
  17. </view>
  18. <!-- 二维码 -->
  19. <view v-if="user_share_qrode != null" class="share qrcode padding-main border-radius-main bg-white spacing-mb">
  20. <view class="title border-color-main padding-left-lg text-size fw-b">二维码分享</view>
  21. <view class="cr-gray br-b padding-vertical-main">
  22. 保存二维码后,发送给微信好友/群、QQ好友/群,分享到分朋友圈,微博等进行推广,轻轻松松赚返利!
  23. </view>
  24. <view class="margin-top-lg">
  25. <image :src="user_share_qrode" class="wh-auto dis-block radius" mode="widthFix"></image>
  26. </view>
  27. <view class="margin-top-lg">
  28. <button class="dis-block wh-auto bg-white cr-green br-green round" type="default" size="mini" hover-class="none" @tap="images_show_event" :data-value="user_share_qrode">查看二维码长按保存</button>
  29. </view>
  30. </view>
  31. <!-- 链接 -->
  32. <view v-if="user_share_url != null" class="share url padding-main border-radius-main bg-white spacing-mb">
  33. <view class="title border-color-main padding-left-lg text-size fw-b">链接分享</view>
  34. <view class="cr-gray br-b padding-vertical-main">
  35. 复制以下链接,发送给微信好友/群、QQ好友/群,分享到分朋友圈,微博等进行推广,轻轻松松赚返利!
  36. </view>
  37. <view class="cr-main text-size margin-top-lg">{{user_share_url}}</view>
  38. <view class="margin-top-lg">
  39. <button class="dis-block wh-auto bg-white cr-green br-green round" type="default" size="mini" hover-class="none" @tap="url_event" :data-value="user_share_url">点击复制链接地址</button>
  40. </view>
  41. </view>
  42. <!-- 结尾 -->
  43. <component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
  44. </view>
  45. <view v-else>
  46. <!-- 提示信息 -->
  47. <component-no-data :propStatus="data_list_loding_status"></component-no-data>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. const app = getApp();
  53. import componentNoData from "../../../../components/no-data/no-data";
  54. import componentBottomLine from "../../../../components/bottom-line/bottom-line";
  55. export default {
  56. data() {
  57. return {
  58. data_list_loding_status: 1,
  59. data_list_loding_msg: '加载中...',
  60. data_bottom_line_status: false,
  61. user_share_poster: null,
  62. user_share_qrode: null,
  63. user_share_url: null
  64. };
  65. },
  66. components: {
  67. componentNoData,
  68. componentBottomLine
  69. },
  70. props: {},
  71. onLoad() {
  72. this.init();
  73. },
  74. onShow() {
  75. // 分享菜单处理
  76. app.globalData.page_share_handle();
  77. },
  78. // 下拉刷新
  79. onPullDownRefresh() {
  80. this.init();
  81. },
  82. methods: {
  83. init() {
  84. uni.showLoading({
  85. title: '加载中...'
  86. });
  87. this.setData({
  88. data_list_loding_status: 1
  89. });
  90. uni.request({
  91. url: app.globalData.get_request_url("index", "poster", "distribution"),
  92. method: 'POST',
  93. data: {},
  94. dataType: 'json',
  95. success: res => {
  96. uni.hideLoading();
  97. uni.stopPullDownRefresh();
  98. if (res.data.code == 0) {
  99. var data = res.data.data;
  100. this.setData({
  101. user_share_poster: data.user_share_poster || null,
  102. user_share_qrode: data.user_share_qrode || null,
  103. user_share_url: data.user_share_url || null,
  104. data_list_loding_status: 3,
  105. data_bottom_line_status: true,
  106. data_list_loding_msg: ''
  107. });
  108. // 是否全部没数据
  109. if (this.user_share_poster == null && this.user_share_qrode == null && this.user_share_url == null) {
  110. this.setData({
  111. data_list_loding_status: 0,
  112. data_bottom_line_status: false
  113. });
  114. }
  115. } else {
  116. this.setData({
  117. data_list_loding_status: 2,
  118. data_bottom_line_status: false,
  119. data_list_loding_msg: res.data.msg
  120. });
  121. if (app.globalData.is_login_check(res.data, this, 'init')) {
  122. app.globalData.showToast(res.data.msg);
  123. }
  124. }
  125. },
  126. fail: () => {
  127. uni.hideLoading();
  128. uni.stopPullDownRefresh();
  129. this.setData({
  130. data_list_loding_status: 2,
  131. data_bottom_line_status: false,
  132. data_list_loding_msg: '服务器请求出错'
  133. });
  134. app.globalData.showToast('服务器请求出错');
  135. }
  136. });
  137. },
  138. // 刷新海报
  139. poster_refresh_event(e) {
  140. uni.showLoading({
  141. title: '处理中...'
  142. });
  143. uni.request({
  144. url: app.globalData.get_request_url("refresh", "poster", "distribution"),
  145. method: 'POST',
  146. data: {},
  147. dataType: 'json',
  148. success: res => {
  149. uni.hideLoading();
  150. if (res.data.code == 0) {
  151. this.setData({
  152. user_share_poster: res.data.data
  153. });
  154. app.globalData.showToast(res.data.msg, 'success');
  155. } else {
  156. if (app.globalData.is_login_check(res.data, self, 'init')) {
  157. app.globalData.showToast(res.data.msg);
  158. }
  159. }
  160. },
  161. fail: () => {
  162. uni.hideLoading();
  163. app.globalData.showToast('服务器请求出错');
  164. }
  165. });
  166. },
  167. // 图片查看事件
  168. images_show_event(e) {
  169. var value = e.currentTarget.dataset.value || null;
  170. if (value != null) {
  171. uni.previewImage({
  172. current: value,
  173. urls: [value]
  174. });
  175. } else {
  176. app.globalData.showToast('宣传图片地址有误');
  177. }
  178. },
  179. // url事件
  180. url_event(e) {
  181. app.globalData.text_copy_event(e);
  182. }
  183. }
  184. };
  185. </script>
  186. <style>
  187. @import './poster.css';
  188. </style>