学员端小程序
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.

200 lines
4.8 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <view class="pageBgImg">
  3. <view class="videoBox">
  4. <view class="back">
  5. <topNavbar title=""></topNavbar>
  6. </view>
  7. <video :src="vdoDetail.videoUrl" :poster="vdoDetail.videoCover" v-if="vdoDetail.videoUrl"></video>
  8. </view>
  9. <view class="pad">
  10. <view class="card" style="margin: 28rpx 0 24rpx 0;">
  11. <view class="info">
  12. <view class="name">{{vdoDetail.title}}</view>
  13. <view class="date">{{ $u.timeFormat(vdoDetail.createTime, 'yyyy/mm/dd') }}</view>
  14. </view>
  15. </view>
  16. <view class="operate">
  17. <view class="operateWith">
  18. <view class="operateItem" @click="likeFn">
  19. <view class="icon">
  20. <image src="/static/images/index/dianzan_nor.png" mode="" v-if="!operateInfo.upvote"></image>
  21. <image src="/static/images/index/dianzan_cli.png" mode="" v-else></image>
  22. </view>
  23. <view class="txt">点赞</view>
  24. </view>
  25. </view>
  26. <view class="operateWith">
  27. <view class="operateItem" @click="createCollectFn">
  28. <view class="icon">
  29. <image src="/static/images/index/shoucang_nor.png" mode="" v-if="!operateInfo.collect"></image>
  30. <image src="/static/images/index/shoucang_cli.png" mode="" v-else></image>
  31. </view>
  32. <view class="txt">收藏</view>
  33. </view>
  34. </view>
  35. <view class="operateWith">
  36. <!-- #ifdef MP-WEIXIN -->
  37. <view class="operateItem" @click="createRetransmissionFn">
  38. <view class="icon">
  39. <image src="/static/images/index/fenxiang_nor.png" mode=""></image>
  40. </view>
  41. <view class="txt">分享</view>
  42. </view>
  43. <!-- #endif -->
  44. </view>
  45. </view>
  46. <!-- <view class="videolist">
  47. <view class="flex-b">
  48. <view class="h1">相关推荐</view>
  49. <moreRight text="更多"></moreRight>
  50. </view>
  51. <view class="ul">
  52. <view class="li" v-for="(item,index) in 10" :key="index" @click="$goPage('/pages/indexEntry/publicVideo/videoDetail/videoDetail')">
  53. <videoItem></videoItem>
  54. </view>
  55. </view>
  56. </view> -->
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. import videoItem from '../comp/videoItem'
  62. import { publicGetvideo, createUpvote, getlikesCollection, createCollect, createRetransmission, deleteUpvote, deleteRetransmission } from '@/config/api.js'
  63. export default {
  64. components: { videoItem },
  65. data() {
  66. return {
  67. operateInfo: {},
  68. id: '',
  69. vdoDetail: {},
  70. params: {}
  71. }
  72. },
  73. onLoad(options) {
  74. this.id = options.id
  75. this.params = {knowledge: this.id, mobile: this.vuex_userInfo.mobile}
  76. this.publicGetvideoFn()
  77. },
  78. methods: {
  79. async publicGetvideoFn() {
  80. const {data: res} = await publicGetvideo({id: this.id})
  81. this.vdoDetail = res
  82. this.getlikesCollection()
  83. console.log(res)
  84. },
  85. // 查否点赞收藏
  86. async getlikesCollection() {
  87. const {data: res} = await getlikesCollection(this.params)
  88. this.operateInfo = res
  89. },
  90. // 点赞
  91. async likeFn() {
  92. if(this.operateInfo.upvote) {
  93. await deleteUpvote({upvoteId: this.operateInfo.upvoteId,mobile: this.vuex_userInfo.mobile})
  94. }else {
  95. await createUpvote(this.params)
  96. }
  97. this.getlikesCollection()
  98. },
  99. // 收藏
  100. async createCollectFn() {
  101. if(this.operateInfo.collect) {
  102. await deleteRetransmission({mobile: this.vuex_userInfo.mobile, CollectId: this.operateInfo.collectId})
  103. }else {
  104. await createCollect(this.params)
  105. }
  106. this.getlikesCollection()
  107. },
  108. // 转发
  109. async createRetransmissionFn() {
  110. const {data: res} = await createRetransmission(this.params)
  111. this.getlikesCollection()
  112. },
  113. }
  114. }
  115. </script>
  116. <style lang="scss" scoped>
  117. .h1 {
  118. line-height: 100rpx;
  119. }
  120. .info {
  121. padding: 28rpx;
  122. .name {
  123. font-size: 34rpx;
  124. color: #363A44;
  125. font-weight: 500;
  126. }
  127. .date {
  128. font-size: 28rpx;
  129. color: #686B73;
  130. margin-top: 4rpx;
  131. }
  132. }
  133. .operate {
  134. display: flex;
  135. // justify-content: space-between;
  136. .operateWith {
  137. flex: 1;
  138. }
  139. .operateItem {
  140. width: 188rpx;
  141. height: 132rpx;
  142. margin: 0 auto;
  143. background: #FFFFFF;
  144. border-radius: 16rpx;
  145. display: flex;
  146. flex-direction: column;
  147. align-items: center;
  148. justify-content: center;
  149. .icon {
  150. width: 48rpx;
  151. height: 48rpx;
  152. }
  153. .txt {
  154. font-size: 24rpx;
  155. color: #333;
  156. font-weight: 500;
  157. }
  158. }
  159. }
  160. .videoBox {
  161. width: 100%;
  162. height: 492rpx;
  163. position: relative;
  164. .back {
  165. position: absolute;
  166. left: 0;
  167. top: 0;
  168. }
  169. video {
  170. width: 100%;
  171. height: 100%;
  172. display: block;
  173. }
  174. }
  175. .ul {
  176. width: 100%;
  177. display: flex;
  178. justify-content: space-between;
  179. flex-wrap: wrap;
  180. .li {
  181. width: 100%;
  182. width: 48%;
  183. height: 260rpx;
  184. background: #FFFFFF;
  185. box-shadow: 0px 8rpx 20rpx 0px rgba(0,0,0,0.04), 2rpx 2rpx 8rpx 0px rgba(0,0,0,0.06);
  186. border-radius: 16rpx;
  187. margin-bottom: 24rpx;
  188. padding: 16rpx;
  189. }
  190. }
  191. </style>