courseItem.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <template>
  2. <view class="courselist-item">
  3. <view class="courselist-con x-start" @click="toCourseDetail(info)">
  4. <view class="courselist-img">
  5. <image :src="info.thumbnail" mode="aspectFill"></image>
  6. </view>
  7. <view class="courselist-con-r">
  8. <view @click.passive.stop>
  9. <text class="more-t">{{info.title}}</text>
  10. </view>
  11. <view class="courselist-desc one-t" v-show="from != 'course'">{{info.courseName}}</view>
  12. <view :class="from == 'course' ? 'courselist-con-timebox ':'courselist-con-timebox x-f'">
  13. <view class="x-f acea-row"><u-icon class="icon" name="file-text" color="#999"
  14. size="20"></u-icon>{{info.createTime}}</view>
  15. </view>
  16. </view>
  17. </view>
  18. <view class="courselist-footer x-f">
  19. <view class="courselist-footer-item x-c" @click="openShare"><u-icon
  20. name="share-square" color="#1677ff" size="18"></u-icon>分享课程</view>
  21. </view>
  22. <!-- 分享弹窗 -->
  23. <u-popup :show="showShare" :closeOnClickOverlay="true" :round='20' @close="closeShare" @open="openShare">
  24. <view class="sharePop x-ac">
  25. <view class="sharePop-item y-f" @click="sendInput()">
  26. <image src="@/static/images/link_icon.png" mode="aspectFill"></image>
  27. <view style="font-weight: bold;margin-bottom: 4px;">发送课程</view>
  28. <view style="font-size: 12px;color: #888;">一键发送到输入框</view>
  29. </view>
  30. </view>
  31. </u-popup>
  32. </view>
  33. </template>
  34. <script>
  35. import {
  36. createRoomLink,createPhoneLink
  37. } from '@/api/courseManage'
  38. export default {
  39. props: {
  40. activeTab: {
  41. type: [Number, String],
  42. default: 0
  43. },
  44. // 来源
  45. from: {
  46. type: String,
  47. default: 'live'
  48. },
  49. info: {
  50. type: Object,
  51. default: () => {
  52. return {}
  53. }
  54. },
  55. config:{
  56. type: Object,
  57. default: () => {
  58. return {}
  59. }
  60. }
  61. },
  62. data() {
  63. return {
  64. showShare: false,
  65. type: 1,
  66. }
  67. },
  68. mounted() {
  69. },
  70. methods: {
  71. toCourseDetail(info) {
  72. uni.navigateTo({
  73. url:'/pages/course/courseVideo?videoId='+info.videoId
  74. })
  75. },
  76. openShare() {
  77. if(this.isDesktopQyWechat()){
  78. this.showShare = true
  79. }
  80. console.log(this.info)
  81. this.$emit('child-click', { show: true, list: this.info })
  82. //this.getlink('preload'); // 提前加载链接
  83. },
  84. closeShare() {
  85. this.showShare = false
  86. // console.log('open');
  87. },
  88. sendInput(){
  89. this.setupwindowsShare(); // 电脑端分享
  90. // if (this.isDesktopQyWechat()) {
  91. // }
  92. },
  93. setupwindowsShare(){
  94. uni.showLoading({
  95. title: '加载中'
  96. });
  97. var corpId=uni.getStorageSync("corpId");
  98. var qwUserId=uni.getStorageSync("qwUserId");
  99. var qwarrid=uni.getStorageSync("qwarrid");
  100. var fsUserId=uni.getStorageSync("fsUserId");
  101. const param = {
  102. videoId:this.info.videoId,
  103. corpId:corpId,
  104. qwUserId:qwUserId,
  105. courseId:this.info.courseId,
  106. title:this.info.title,
  107. externalUserId:qwarrid,
  108. fsUserId:fsUserId
  109. }
  110. createRoomLink(param).then(res => {
  111. console.log(res)
  112. if(res.code==200){
  113. uni.hideLoading();
  114. jWeixin.invoke('sendChatMessage', {
  115. msgtype:"miniprogram", //消息类型,必填
  116. enterChat: true,
  117. miniprogram:
  118. {
  119. appid: res.data.miniprogramAppid,
  120. title: res.data.miniprogramTitle,
  121. imgUrl: res.data.miniprogramPicUrl,
  122. page: res.data.miniprogramPage
  123. }
  124. }, function(res) {
  125. console.log("发送成功")
  126. console.log(res)
  127. uni.showToast({
  128. title: "发送成功",
  129. });
  130. })
  131. }
  132. else{
  133. uni.showToast({
  134. title: res.msg,
  135. });
  136. }
  137. })
  138. },
  139. // 判断是否为电脑端企业微信
  140. isDesktopQyWechat() {
  141. const ua = navigator.userAgent.toLowerCase();
  142. return ua.indexOf('windows') > -1 || ua.indexOf('macintosh') > -1;
  143. }
  144. }
  145. }
  146. </script>
  147. <style scoped lang="scss">
  148. .imgshe {
  149. display: flex;
  150. flex-direction: row-reverse
  151. }
  152. .point-box {
  153. height: 100%;
  154. width: 100%;
  155. .xu-box {
  156. border: #f5f5f5 4rpx dashed;
  157. padding: 20rpx 20rpx;
  158. }
  159. }
  160. .codeimg {
  161. position: absolute;
  162. z-index: 99999;
  163. left: 40rpx;
  164. top: 40rpx;
  165. }
  166. #codeurl {
  167. position: relative;
  168. }
  169. ::v-deep {
  170. .model .u-fade-enter-active {
  171. z-index: 10075 !important;
  172. }
  173. }
  174. .sharePop {
  175. background-color: #fff;
  176. padding: 20px 0;
  177. // padding-bottom: 100px;
  178. border-radius: 20px 20px 0 0;
  179. &-item {
  180. padding: 0 10px;
  181. box-sizing: border-box;
  182. font-family: PingFang SC, PingFang SC;
  183. font-weight: 400;
  184. font-size: 14px;
  185. display: inline-flex !important;
  186. image {
  187. height: 48px;
  188. width: 48px;
  189. margin-bottom: 10px;
  190. }
  191. }
  192. }
  193. .setTimebox {
  194. font-family: PingFang SC, PingFang SC;
  195. font-weight: 400;
  196. font-size: 14px;
  197. }
  198. .timetip {
  199. font-family: PingFang SC, PingFang SC;
  200. font-weight: 400;
  201. font-size: 14px;
  202. color: #2979ff;
  203. text-align: center;
  204. margin-bottom: 5px;
  205. }
  206. .courselist {
  207. font-family: PingFang SC, PingFang SC;
  208. font-weight: 400;
  209. font-size: 14px;
  210. &-item {
  211. width: 100%;
  212. border-radius: 14px;
  213. background-color: #fff;
  214. overflow: hidden;
  215. margin-bottom: 10px;
  216. }
  217. &-con {
  218. padding: 10px 10px 5px 10px;
  219. font-size: 12px;
  220. color: #777;
  221. }
  222. &-con-r {
  223. flex: 1;
  224. overflow: hidden;
  225. .more-t {
  226. flex: 1;
  227. font-size: 14px;
  228. color: #222;
  229. display: inline;
  230. }
  231. image {
  232. width: 20px;
  233. height: 20px;
  234. }
  235. .btn_icon {
  236. font-size: 14px;
  237. color: #1677ff;
  238. display: inline-flex;
  239. align-items: center;
  240. }
  241. }
  242. &-img {
  243. width: 110px;
  244. height: 70px;
  245. border-radius: 10px;
  246. overflow: hidden;
  247. flex-shrink: 0;
  248. margin-right: 10px;
  249. position: relative;
  250. image {
  251. height: 100%;
  252. width: 100%;
  253. }
  254. .status {
  255. position: absolute;
  256. top: 0;
  257. left: 0;
  258. z-index: 2;
  259. height: 21px;
  260. padding: 0 5px;
  261. box-sizing: border-box;
  262. line-height: 21px;
  263. border-radius: 10px 0 10px 0;
  264. text-align: center;
  265. color: #fff;
  266. background-color: #08ce36;
  267. }
  268. }
  269. &-desc {
  270. flex: 1;
  271. margin-top: 7px;
  272. }
  273. &-con-timebox {
  274. margin-top: 7px;
  275. flex-wrap: wrap;
  276. .acea-row {
  277. margin-right: 12px;
  278. margin-bottom: 5px;
  279. flex-wrap: nowrap;
  280. }
  281. .icon {
  282. margin-right: 5px;
  283. }
  284. }
  285. &-footer {
  286. padding: 5px;
  287. font-size: 14px;
  288. &-item {
  289. flex: 1;
  290. text-align: center;
  291. color: #1677ff;
  292. padding: 6px;
  293. box-sizing: border-box;
  294. }
  295. .shishi {
  296. border-left: 1px solid #f5f5f5;
  297. }
  298. .shuju {
  299. border-radius: 5px;
  300. border: 1px solid #1677ff;
  301. }
  302. }
  303. }
  304. </style>