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

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