detail.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <template>
  2. <view>
  3. <view v-if="detail != null" class="page-bottom-fixed">
  4. <!-- 封面图片 -->
  5. <image v-if="(detail || null) != null && (detail.share_img || null) != null" class="banner wh-auto dis-block" :src="detail.share_img" mode="widthFix" @tap="detail_images_view_event" :data-value="detail.share_img"></image>
  6. <!-- 标题 -->
  7. <view class="text-size fw-b padding-main">{{detail.name}}</view>
  8. <!-- 基础信息 -->
  9. <view class="padding-horizontal-main">
  10. <view class="base padding-horizontal-main border-radius-main bg-white oh pr">
  11. <view class="item padding-vertical-main">
  12. <image class="item-icon va-m margin-right-sm" :src="static_url+'detail-status-icon.png'" mode="widthFix"></image>
  13. <text class="cr-gray va-m">直播状态</text>
  14. <view :class="'fr status status-' + detail.status">{{detail.status_name}}</view>
  15. </view>
  16. <view class="item padding-vertical-main br-t oh">
  17. <view class="fl margin-top-lg">
  18. <image class="item-icon va-m margin-right-sm" :src="static_url+'detail-time-icon.png'" mode="widthFix"></image>
  19. <text class="cr-gray va-m">开播时间</text>
  20. </view>
  21. <view class="fr">
  22. <view class="cr-green">{{detail.start_time}}</view>
  23. <view class="cr-red">{{detail.end_time}}</view>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. <!-- 导航 -->
  29. <view class="nav wh-auto oh bottom-line-exclude">
  30. <button class="share-friend-submit fl cr-white text-size-sm round margin-left-main" type="default" hover-class="none" open-type="share">
  31. <image class="item-icon va-m margin-right-sm" :src="static_url+'nav-share-friend-icon.png'" mode="widthFix"></image>
  32. <text class="va-m">分享</text>
  33. </button>
  34. <button class="share-poster-submit fl cr-white text-size-sm round margin-left-main" type="default" hover-class="none" @tap="share_poster_event">
  35. <image class="item-icon va-m margin-right-sm" :src="static_url+'nav-share-poster-icon.png'" mode="widthFix"></image>
  36. <text class="va-m">海报</text>
  37. </button>
  38. <button class="player-submit fr cr-white text-size-sm round margin-horizontal-main" type="default" hover-class="none" @tap="player_event">
  39. <image class="item-icon va-m margin-right-sm" :src="static_url+'nav-player-icon.png'" mode="widthFix"></image>
  40. <text class="va-m">进入直播</text>
  41. </button>
  42. </view>
  43. <!-- 结尾 -->
  44. <component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
  45. </view>
  46. <view v-else>
  47. <!-- 提示信息 -->
  48. <component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. const app = getApp();
  54. import componentNoData from "../../../../components/no-data/no-data";
  55. import componentBottomLine from "../../../../components/bottom-line/bottom-line";
  56. var static_url = app.globalData.get_static_url('weixinliveplayer', true);
  57. export default {
  58. data() {
  59. return {
  60. static_url: static_url+'app/',
  61. params: null,
  62. data_list_loding_status: 1,
  63. data_list_loding_msg: '',
  64. data_bottom_line_status: false,
  65. detail: null,
  66. // 自定义分享信息
  67. share_info: {}
  68. };
  69. },
  70. components: {
  71. componentNoData,
  72. componentBottomLine
  73. },
  74. props: {},
  75. onLoad(params) {
  76. this.setData({
  77. params: app.globalData.launch_params_handle(params)
  78. });
  79. this.init();
  80. },
  81. onShow() {},
  82. // 下拉刷新
  83. onPullDownRefresh() {
  84. this.init();
  85. },
  86. methods: {
  87. init() {
  88. uni.showLoading({
  89. title: '加载中...'
  90. });
  91. this.setData({
  92. data_list_loding_status: 1
  93. });
  94. uni.request({
  95. url: app.globalData.get_request_url("detail", "search", "weixinliveplayer"),
  96. method: 'POST',
  97. data: {
  98. id: this.params.id
  99. },
  100. dataType: 'json',
  101. success: res => {
  102. uni.hideLoading();
  103. uni.stopPullDownRefresh();
  104. if (res.data.code == 0) {
  105. var data = res.data.data;
  106. this.setData({
  107. detail: data.data || null,
  108. data_list_loding_status: 3,
  109. data_bottom_line_status: true,
  110. data_list_loding_msg: ''
  111. });
  112. if ((this.detail || null) != null) {
  113. // 基础自定义分享
  114. this.setData({
  115. share_info: {
  116. title: this.detail.seo_title || this.detail.name,
  117. desc: this.detail.seo_desc,
  118. path: '/pages/plugins/weixinliveplayer/detail/detail',
  119. query: 'id='+this.detail.id,
  120. img: this.detail.share_img
  121. }
  122. });
  123. // 标题
  124. uni.setNavigationBarTitle({
  125. title: this.detail.name
  126. });
  127. }
  128. } else {
  129. this.setData({
  130. data_list_loding_status: 2,
  131. data_bottom_line_status: false,
  132. data_list_loding_msg: res.data.msg
  133. });
  134. app.globalData.showToast(res.data.msg);
  135. }
  136. // 分享菜单处理
  137. app.globalData.page_share_handle(this.share_info);
  138. },
  139. fail: () => {
  140. uni.hideLoading();
  141. uni.stopPullDownRefresh();
  142. this.setData({
  143. data_list_loding_status: 2,
  144. data_bottom_line_status: false,
  145. data_list_loding_msg: '服务器请求出错'
  146. });
  147. app.globalData.showToast('服务器请求出错');
  148. }
  149. });
  150. },
  151. // 详情图片查看
  152. detail_images_view_event(e) {
  153. var value = e.currentTarget.dataset.value || null;
  154. if (value != null) {
  155. uni.previewImage({
  156. current: value,
  157. urls: [value]
  158. });
  159. }
  160. },
  161. // 进入直播
  162. player_event(e) {
  163. var params = encodeURIComponent(JSON.stringify({
  164. type: 'detail'
  165. }));
  166. uni.navigateTo({
  167. url: `plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${this.detail.roomid}&custom_params=${params}`
  168. });
  169. },
  170. // 海报分享
  171. share_poster_event() {
  172. uni.showLoading({
  173. title: '生成中...'
  174. });
  175. uni.request({
  176. url: app.globalData.get_request_url('poster', 'index', 'weixinliveplayer'),
  177. method: 'POST',
  178. data: {
  179. "id": this.detail.id
  180. },
  181. dataType: 'json',
  182. success: res => {
  183. uni.hideLoading();
  184. if (res.data.code == 0) {
  185. uni.previewImage({
  186. current: res.data.data,
  187. urls: [res.data.data]
  188. });
  189. } else {
  190. app.globalData.showToast(res.data.msg);
  191. }
  192. },
  193. fail: () => {
  194. uni.hideLoading();
  195. app.globalData.showToast('服务器请求出错');
  196. }
  197. });
  198. }
  199. }
  200. };
  201. </script>
  202. <style>
  203. @import './detail.css';
  204. </style>