courseItem.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <template>
  2. <view class="courselist-item">
  3. <view class="courselist-con x-start">
  4. <view class="courselist-img">
  5. <!-- <view class="status">进行中</view> -->
  6. <image :src="info.thumbnail" mode="aspectFill"></image>
  7. </view>
  8. <view class="courselist-con-r">
  9. <view>
  10. <text class="more-t">{{info.title}}</text>
  11. <view class="btn_icon" style="margin-left: 5px;" @click="copyId">ID
  12. <image src="@/static/images/copy_icon.png" mode="aspectFill"></image>
  13. </view>
  14. </view>
  15. <view class="courselist-desc one-t" v-show="from != 'course'">{{info.courseName}}</view>
  16. <view :class="from == 'course' ? 'courselist-con-timebox ':'courselist-con-timebox x-f'">
  17. <view class="x-f acea-row"><u-icon class="icon" name="file-text" color="#999" size="20"></u-icon>{{info.createTime}}</view>
  18. <view class="x-f acea-row"><u-icon class="icon" name="clock" color="#999" size="16"></u-icon>{{$formatSeconds(info.duration,1)}}</view>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="courselist-footer x-f">
  23. <view class="courselist-footer-item x-c" v-show="activeTab !=2" @click="handleShare"><u-icon name="share-square" color="#1677ff" size="18"></u-icon>分享课程</view>
  24. <view class="courselist-footer-item x-c shishi" v-show="activeTab == 1" @click="handleStatistics"><u-icon name="share-square" color="#1677ff" size="18"></u-icon>实时统计</view>
  25. <view class="courselist-footer-item x-c shuju" v-show="activeTab == 2" @click="handleStatistics"><u-icon name="share-square" color="#1677ff" size="18"></u-icon>数据统计</view>
  26. </view>
  27. <!-- 分享弹窗 -->
  28. <u-popup :show="showShare" :closeOnClickOverlay="true" :round='20' @close="closeShare" @open="openShare">
  29. <view class="sharePop x-ac">
  30. <view class="sharePop-item y-f">
  31. <image src="@/static/images/poster_icon.png" mode="aspectFill"></image>
  32. <view style="font-weight: bold;margin-bottom: 4px;">生成海报</view>
  33. <view style="font-size: 12px;color: #888;">保存海报美观宣传</view>
  34. </view>
  35. <view class="sharePop-item y-f" @click="copyLink">
  36. <image src="@/static/images/link_icon.png" mode="aspectFill"></image>
  37. <view style="font-weight: bold;margin-bottom: 4px;">复制链接</view>
  38. <view style="font-size: 12px;color: #888;">生成链接一键复制</view>
  39. </view>
  40. </view>
  41. </u-popup>
  42. <!-- 设置链接有效时长弹窗 -->
  43. <u-modal :show="setTimeShow" content='content' class="model" @confirm="confirmTime">
  44. <view class="setTimebox">
  45. <view class="timetip">不传默认以系统参数为准</view>
  46. <view class="x-f">
  47. <text style="margin-right: 20px;">链接有效时长(分钟)</text>
  48. <u-input
  49. fontSize="14px"
  50. placeholder="链接有效时长"
  51. border="none"
  52. v-model="time"
  53. maxlength="5"
  54. ></u-input>
  55. </view>
  56. </view>
  57. </u-modal>
  58. <u-notify ref="uNotify" message=""></u-notify>
  59. </view>
  60. </template>
  61. <script>
  62. export default {
  63. props: {
  64. activeTab: {
  65. type: [Number,String],
  66. default: 0
  67. },
  68. // 来源
  69. from: {
  70. type: String,
  71. default: 'live'
  72. },
  73. info: {
  74. type: Object,
  75. default: ()=>{
  76. return {}
  77. }
  78. },
  79. },
  80. data() {
  81. return {
  82. showShare: false,
  83. setTimeShow: false,
  84. time: "",
  85. }
  86. },
  87. methods: {
  88. handleShare() {
  89. this.showShare = true
  90. },
  91. closeShare() {
  92. this.showShare = false
  93. // console.log('open');
  94. },
  95. openShare() {
  96. // this.showShare = false
  97. // console.log('close');
  98. },
  99. copyLink(){
  100. this.setTimeShow = true
  101. },
  102. confirmTime() {
  103. this.setTimeShow = false
  104. this.showShare = false
  105. },
  106. handleStatistics() {
  107. const info = {
  108. courseId: this.info.courseId,
  109. title: this.info.title,
  110. thumbnail: this.info.thumbnail,
  111. createTime: this.info.createTime,
  112. duration: this.info.duration,
  113. fileId: this.info.fileId,
  114. courseName: this.info.courseName,
  115. }
  116. uni.navigateTo({
  117. url: '/pages/courseManage/statistics?info='+JSON.stringify(info)
  118. })
  119. },
  120. copyId() {
  121. uni.setClipboardData({
  122. data: this.info.fileId,
  123. success: ()=> {
  124. this.$refs.uNotify.show({
  125. top: 0,
  126. type: 'success',
  127. // color: '#000',
  128. // bgColor: '#e8e8e8',
  129. message: '复制课程ID成功',
  130. duration: 1000 * 2,
  131. fontSize: 20,
  132. safeAreaInsetTop:true
  133. })
  134. }
  135. });
  136. }
  137. }
  138. }
  139. </script>
  140. <style scoped lang="scss">
  141. ::v-deep {
  142. .model .u-fade-enter-active {
  143. z-index: 10075 !important;
  144. }
  145. }
  146. .sharePop{
  147. background-color: #fff;
  148. padding: 50px 0;
  149. border-radius: 20px 20px 0 0;
  150. &-item {
  151. padding: 0 10px;
  152. box-sizing: border-box;
  153. font-family: PingFang SC, PingFang SC;
  154. font-weight: 400;
  155. font-size: 14px;
  156. display: inline-flex !important;
  157. image {
  158. height: 48px;
  159. width: 48px;
  160. margin-bottom: 10px;
  161. }
  162. }
  163. }
  164. .setTimebox {
  165. font-family: PingFang SC, PingFang SC;
  166. font-weight: 400;
  167. font-size: 14px;
  168. }
  169. .timetip {
  170. font-family: PingFang SC, PingFang SC;
  171. font-weight: 400;
  172. font-size: 14px;
  173. color: #2979ff;
  174. text-align: center;
  175. margin-bottom: 5px;
  176. }
  177. .courselist{
  178. font-family: PingFang SC, PingFang SC;
  179. font-weight: 400;
  180. font-size: 14px;
  181. &-item {
  182. width: 100%;
  183. border-radius: 14px;
  184. background-color: #fff;
  185. overflow: hidden;
  186. margin-bottom: 10px;
  187. }
  188. &-con {
  189. padding: 10px 10px 5px 10px;
  190. font-size: 12px;
  191. color: #777;
  192. }
  193. &-con-r{
  194. flex: 1;
  195. overflow: hidden;
  196. .more-t {
  197. flex: 1;
  198. font-size: 14px;
  199. color: #222;
  200. display: inline;
  201. }
  202. image {
  203. width: 20px;
  204. height: 20px;
  205. }
  206. .btn_icon {
  207. font-size: 14px;
  208. color: #1677ff;
  209. display: inline-flex;
  210. align-items: center;
  211. }
  212. }
  213. &-img {
  214. width: 110px;
  215. height: 70px;
  216. border-radius: 10px;
  217. overflow: hidden;
  218. flex-shrink: 0;
  219. margin-right: 10px;
  220. position: relative;
  221. image {
  222. height: 100%;
  223. width: 100%;
  224. }
  225. .status {
  226. position: absolute;
  227. top: 0;
  228. left: 0;
  229. z-index: 2;
  230. height: 21px;
  231. padding: 0 5px;
  232. box-sizing: border-box;
  233. line-height: 21px;
  234. border-radius: 10px 0 10px 0;
  235. text-align: center;
  236. color: #fff;
  237. background-color: #08ce36;
  238. }
  239. }
  240. &-desc {
  241. flex: 1;
  242. margin-top: 7px;
  243. }
  244. &-con-timebox {
  245. margin-top: 7px;
  246. flex-wrap: wrap;
  247. .acea-row {
  248. margin-right: 12px;
  249. margin-bottom: 5px;
  250. flex-wrap: nowrap;
  251. }
  252. .icon {
  253. margin-right: 5px;
  254. }
  255. }
  256. &-footer {
  257. padding: 5px;
  258. font-size: 14px;
  259. &-item {
  260. flex: 1;
  261. text-align: center;
  262. color: #1677ff;
  263. padding: 6px;
  264. box-sizing: border-box;
  265. }
  266. .shishi {
  267. border-left: 1px solid #f5f5f5;
  268. }
  269. .shuju {
  270. border-radius: 5px;
  271. border: 1px solid #1677ff;
  272. }
  273. }
  274. }
  275. </style>