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

204 lines
4.9 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 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. this.operateInfo.upvote = 0
  94. await deleteUpvote({upvoteId: this.operateInfo.upvoteId,mobile: this.vuex_userInfo.phone})
  95. }else {
  96. this.operateInfo.upvote = 1
  97. await createUpvote(this.params)
  98. }
  99. this.getlikesCollection()
  100. },
  101. // 收藏
  102. async createCollectFn() {
  103. if(this.operateInfo.collect) {
  104. this.operateInfo.collect = 0
  105. await deleteRetransmission({mobile: this.vuex_userInfo.mobile, CollectId: this.operateInfo.collectId})
  106. }else {
  107. this.operateInfo.collect = 1
  108. await createCollect(this.params)
  109. }
  110. this.getlikesCollection()
  111. },
  112. // 转发
  113. async createRetransmissionFn() {
  114. const {data: res} = await createRetransmission(this.params)
  115. this.getlikesCollection()
  116. },
  117. }
  118. }
  119. </script>
  120. <style lang="scss" scoped>
  121. .h1 {
  122. line-height: 100rpx;
  123. }
  124. .info {
  125. padding: 28rpx;
  126. .name {
  127. font-size: 34rpx;
  128. color: #363A44;
  129. font-weight: 500;
  130. }
  131. .date {
  132. font-size: 28rpx;
  133. color: #686B73;
  134. margin-top: 4rpx;
  135. }
  136. }
  137. .operate {
  138. display: flex;
  139. // justify-content: space-between;
  140. .operateWith {
  141. flex: 1;
  142. }
  143. .operateItem {
  144. width: 188rpx;
  145. height: 132rpx;
  146. margin: 0 auto;
  147. background: #FFFFFF;
  148. border-radius: 16rpx;
  149. display: flex;
  150. flex-direction: column;
  151. align-items: center;
  152. justify-content: center;
  153. .icon {
  154. width: 48rpx;
  155. height: 48rpx;
  156. }
  157. .txt {
  158. font-size: 24rpx;
  159. color: #333;
  160. font-weight: 500;
  161. }
  162. }
  163. }
  164. .videoBox {
  165. width: 100%;
  166. height: 492rpx;
  167. position: relative;
  168. .back {
  169. position: absolute;
  170. left: 0;
  171. top: 0;
  172. }
  173. video {
  174. width: 100%;
  175. height: 100%;
  176. display: block;
  177. }
  178. }
  179. .ul {
  180. width: 100%;
  181. display: flex;
  182. justify-content: space-between;
  183. flex-wrap: wrap;
  184. .li {
  185. width: 100%;
  186. width: 48%;
  187. height: 260rpx;
  188. background: #FFFFFF;
  189. box-shadow: 0px 8rpx 20rpx 0px rgba(0,0,0,0.04), 2rpx 2rpx 8rpx 0px rgba(0,0,0,0.06);
  190. border-radius: 16rpx;
  191. margin-bottom: 24rpx;
  192. padding: 16rpx;
  193. }
  194. }
  195. </style>