courseManage.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544
  1. <template>
  2. <view class="container">
  3. <view class="headbox">
  4. <dropdownPanel :filterData='filterData' @onChange="onChange" @confirm="confirm" @reset="reset">
  5. <scroll-view scroll-y="true" class="hb" :refresher-enabled="isEnableds"
  6. :refresher-triggered="triggereds" refresher-background="rgba(0,0,0,0)"
  7. @refresherrefresh="pullDownRefreshs" @refresherrestore="triggereds = false"
  8. :upper-threshold="100" :lower-threshold="100" @refresherabort="triggereds = false"
  9. @scrolltolower="reachBottoms">
  10. <view class="justify-between align-center mb20 mlr20 ">
  11. <!-- <u-search placeholder="请输入课程名称" v-model="keyword" :showAction="false" height="30px"
  12. @search='searchKeyword'></u-search> -->
  13. </view>
  14. <view v-if="searchbarNav == 0">
  15. <view class="boxnav x-bc">
  16. <view class="boxnav-item" v-for="(item,index) in courseList" :key="index">
  17. <view class="boxnav-item-info one-t "
  18. :class="courserIndex == index ? 'boxnav-active':''"
  19. @click="handleCourse(item,index)">{{item.courseName}}</view>
  20. </view>
  21. </view>
  22. </view>
  23. <u-loadmore :status="status" />
  24. </scroll-view>
  25. </dropdownPanel>
  26. </view>
  27. <view class="justify-between align-center mb20 mlr20 mt20 ">
  28. <u-search placeholder="请输入课程小节名称" v-model="keywordlist" :showAction="false" height="30px"
  29. @search='searchKeywordlist' bgColor='#fff'></u-search>
  30. </view>
  31. <view class="container-right" >
  32. <!-- <view>首次进入页面{{msg122}}</view>
  33. <view>课程接口{{msg123}}</view>
  34. <view>课程小节接口{{msg124}}</view> -->
  35. <scroll-view style="height:100%" :scroll-y="true" :refresher-enabled="true" :refresher-triggered="triggered"
  36. refresher-background="rgba(0,0,0,0)" @refresherrefresh="pullDownRefresh" :scroll-top='scrollTop'
  37. @refresherrestore="triggered = false" :upper-threshold="100" :lower-threshold="100"
  38. @refresherabort="triggered = false" @scrolltolower="reachBottom" @scroll="scroll">
  39. <view class="list">
  40. <courseItem :from="'course'" :activeTab="1" v-for="(item,index) in dataList" :key="index"
  41. :info="item" :parent-method="parentMethod" :config="configadk" @child-click="handleChildClick"/>
  42. <u-loadmore :status="loadStatus" />
  43. </view>
  44. </scroll-view>
  45. <u-popup :show="showShare" :closeOnClickOverlay="true" :round='20' @close="closeShare">
  46. <view class="sharePop x-ac">
  47. <view class="sharePop-item y-f" @click="sendInput()">
  48. <image src="@/static/images/link_icon.png" mode="aspectFill"></image>
  49. <view style="font-weight: bold;margin-bottom: 4px;">发送课程</view>
  50. <view style="font-size: 12px;color: #888;">一键发送到输入框</view>
  51. </view>
  52. </view>
  53. </u-popup>
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. import {
  59. getFsCourseList,
  60. createPhoneLink
  61. } from "@/api/courseManage.js"
  62. import {
  63. getOperationlist,
  64. getcourselist
  65. } from "@/api/user.js";
  66. import dropdownPanel from "@/components/dropdownPanel.vue"
  67. import courseItem from "@/components/courseItem.vue"
  68. export default {
  69. name:"liveCourse",
  70. components: {
  71. courseItem,
  72. dropdownPanel
  73. },
  74. props: ['parentMethod'],
  75. data() {
  76. return {
  77. user: {},
  78. filterData: [{
  79. name: '请点击选择课程',
  80. value: 0,
  81. },
  82. ],
  83. contentH: 0,
  84. activeTab: 1,
  85. courseList: [],
  86. courseId: '',
  87. searchbarNav: 0,
  88. courserIndex: '',
  89. searchbar: [{
  90. name: '训练营-营期'
  91. },
  92. {
  93. name: '课程状态'
  94. }
  95. ],
  96. mescroll: null,
  97. downOption: {
  98. use: true,
  99. auto: false
  100. },
  101. dataList: [],
  102. params: {
  103. pageNum: 1,
  104. pageSize: 10
  105. },
  106. triggered: false,
  107. loadStatus: 'loadmore',
  108. pageNum:1,
  109. pageSize: 10,
  110. triggereds: false,
  111. status: 'loadmore',
  112. keyword:'',
  113. isEnableds:true,
  114. keywordlist:'',
  115. actid:'',
  116. scrollTop: 0,
  117. old: {
  118. scrollTop: 0
  119. },
  120. shareConfig:'',
  121. selname:'',
  122. qwUserId:'',
  123. url:'',
  124. configadk:{},
  125. showShare:false,
  126. agentConfigSignature:'',
  127. configSignature:"",
  128. configSignature:'',
  129. nonceStr:'',
  130. corpId:'',
  131. timestamp:"",
  132. agentId:"",
  133. code:"",
  134. info:{},
  135. msg122:'',
  136. msg123:'',
  137. msg124:''
  138. }
  139. },
  140. onLoad(options) {
  141. this.qwUserId=options.userId
  142. this.url=window.location.href;
  143. this.code=options.code;
  144. this.msg122=uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM:ss')
  145. },
  146. mounted() {
  147. const windowHeight = uni.getSystemInfoSync().windowHeight
  148. this.contentH = `calc(${windowHeight}px - 132px - 56px)`
  149. this.user = uni.getStorageSync("companyUserInfo") ? JSON.parse(uni.getStorageSync("companyUserInfo")) : {}
  150. this.getFsCourseList()
  151. },
  152. methods: {
  153. // 判断是否为手机端企业微信
  154. isMobileQyWechat() {
  155. const ua = navigator.userAgent.toLowerCase();
  156. return ua.indexOf('mobile') > -1;
  157. },
  158. sendInput(){
  159. this.setupMobileShare()
  160. },
  161. setupMobileShare() {
  162. uni.showLoading({
  163. title: '加载中'
  164. });
  165. var corpId=uni.getStorageSync("corpId");
  166. var qwUserId=uni.getStorageSync("qwUserId");
  167. var qwarrid=uni.getStorageSync("qwarrid");
  168. var fsUserId=uni.getStorageSync("fsUserId");
  169. const param = {
  170. videoId:this.info.videoId,
  171. corpId:corpId,
  172. qwUserId:qwUserId,
  173. courseId:this.info.courseId,
  174. title:this.info.title,
  175. externalUserId:qwarrid,
  176. fsUserId:fsUserId,
  177. }
  178. createPhoneLink(param).then(res=>{
  179. if(res.code==200){
  180. uni.hideLoading()
  181. setTimeout(() => {
  182. uni.$emit('course', res.data);
  183. // uni.$emit('course', this.configadk);
  184. uni.navigateBack({
  185. delta: 1
  186. });
  187. }, 200);
  188. }
  189. // wx.shareAppMessage({
  190. // // title: res.data.linkTitle,
  191. // // desc: res.data.linkDescribe,
  192. // // link: res.data.linkUrl,
  193. // // imgUrl: res.data.linkImageUrl,
  194. // })
  195. })
  196. },
  197. handleChildClick(params) { // 接收子组件传递的参数
  198. if (this.isMobileQyWechat()) {
  199. // console.log(11111122222)
  200. // this.setupMobileShare(); // 手机端调用 JS-SDK 分享
  201. // console.log('父组件方法被调用了', params);
  202. this.showShare=params.show
  203. this.info=params.list
  204. }
  205. },
  206. closeShare() {
  207. this.showShare = false
  208. },
  209. scroll: function(e) {
  210. this.old.scrollTop = e.detail.scrollTop
  211. },
  212. onChange(index) {
  213. this.searchbarNav = index
  214. },
  215. reset() {
  216. this.courseId = ''
  217. this.keyword=''
  218. this.courseList=[]
  219. this.getFsCourseList()
  220. },
  221. handleCourse(item,index) {
  222. console.log(index)
  223. this.courserIndex = index
  224. this.actid=item.courseId
  225. this.selname=item.courseName
  226. },
  227. confirm() {
  228. if(this.actid==''){
  229. }else{
  230. this.courseId = this.actid
  231. }
  232. this.params.pageNum=1
  233. this.filterData[0].name=this.selname
  234. this.dataList=[]
  235. this.getListData()
  236. },
  237. searchKeyword(value){
  238. this.courseList=[]
  239. this.keyword = value
  240. this.getFsCourseList()
  241. },
  242. searchKeywordlist(value){
  243. this.dataList=[]
  244. this.keywordlist = value
  245. this.getListData()
  246. },
  247. pullDownRefreshs() {
  248. this.triggereds = true; //下拉了状态为true
  249. setTimeout(() => {
  250. this.triggereds = false;
  251. uni.stopPullDownRefresh()
  252. this.pageNum = 1;
  253. this.getFsCourseList('refresh') //触底 不穿执行else
  254. }, 1000)
  255. },
  256. reachBottoms() {
  257. if (this.status === 'loadmore') {
  258. this.status = 'loading'
  259. uni.showNavigationBarLoading()
  260. setTimeout(() => {
  261. this.pageNum++
  262. this.getFsCourseList() //触底 不穿执行else
  263. uni.hideNavigationBarLoading()
  264. }, 1000);
  265. }
  266. },
  267. getFsCourseList(type) {
  268. const day = uni.$u.timeFormat(new Date(), 'yyyy-mm-dd')
  269. const param = {
  270. pageNum:this.pageNum,
  271. pageSize:this.pageSize,
  272. keyword:this.keyword,
  273. // companyId: 11,
  274. corpId:uni.getStorageSync("corpId"),
  275. qwUserId:uni.getStorageSync('qwUserId'),
  276. // corpId:'ww44239b22628b206c',
  277. // qwUserId:'ZhaoGuangDong_3',
  278. }
  279. getOperationlist(param).then(res => {
  280. if (res.code == 200) {
  281. this.msg123=uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM:ss')
  282. if (type == 'refresh') {
  283. this.courseList = res.data.list
  284. } else {
  285. this.courseList = [...this.courseList, ...res.data.list]
  286. }
  287. if ( res.data.isLastPage) {
  288. this.status = 'nomore'
  289. } else {
  290. this.status = 'loadmore'
  291. // this.filterData[0].name=this.courseList[0].courseName
  292. }
  293. this.selname=this.courseList[0].courseName
  294. this.courseId=this.courseList[0].courseId
  295. console.log(this.courseId)
  296. setTimeout(()=>{
  297. this.getListInit()
  298. },100)
  299. } else {
  300. uni.showToast({
  301. icon: 'none',
  302. title: res.msg,
  303. });
  304. }
  305. })
  306. },
  307. handleNav(type) {
  308. this.activeTab = type
  309. },
  310. clickSearchbar(type) {
  311. this.searchbarNav = type == this.searchbarNav ? 'colse' : type
  312. },
  313. mescrollInit(mescroll) {
  314. this.mescroll = mescroll;
  315. },
  316. getListInit() {
  317. this.params.pageNum = 1
  318. this.getListData('refresh')
  319. },
  320. getListData(type) {
  321. uni.showLoading({
  322. title: "加载中..."
  323. })
  324. this.loadStatus = 'loading'
  325. console.log(this.courseId)
  326. const param ={
  327. keyword:this.keywordlist,
  328. corpId:uni.getStorageSync("corpId"),
  329. qwUserId:uni.getStorageSync('qwUserId'),
  330. // corpId:'ww44239b22628b206c',
  331. // qwUserId:"ZhaoGuangDong_3",
  332. courseId:this.courseId,
  333. ...this.params
  334. }
  335. getcourselist(param).then(res => {
  336. uni.hideLoading()
  337. if(res.code==200){
  338. this.msg124=uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM:ss')
  339. if (type == 'refresh') {
  340. this.dataList = res.data.list
  341. } else {
  342. this.dataList = [...this.dataList, ...res.data.list]
  343. }
  344. if (res.data.isLastPage) {
  345. this.loadStatus = 'nomore';
  346. } else {
  347. this.loadStatus = 'loadmore';
  348. }
  349. if (this.params.pageNum === 1) {
  350. this.scrollTop = this.old.scrollTop
  351. this.$nextTick(function() {
  352. this.scrollTop = 0
  353. });
  354. }
  355. }else{
  356. uni.showToast({
  357. icon: 'none',
  358. title: res.msg,
  359. });
  360. }
  361. })
  362. },
  363. reachBottom(options) {
  364. if (this.loadStatus === 'loadmore') {
  365. this.loadStatus = 'loading'
  366. uni.showNavigationBarLoading()
  367. setTimeout(() => {
  368. this.params.pageNum += 1;
  369. this.getListData('more')
  370. uni.hideNavigationBarLoading()
  371. }, 500);
  372. }
  373. },
  374. pullDownRefresh(options) {
  375. this.triggered = true;
  376. setTimeout(() => {
  377. this.triggered = false;
  378. uni.stopPullDownRefresh()
  379. this.params.pageNum = 1;
  380. this.getListData('refresh')
  381. }, 500)
  382. }
  383. }
  384. }
  385. </script>
  386. <style lang="scss">
  387. page{
  388. background-color: #F5F7FA;
  389. }
  390. .container {
  391. font-family: PingFang SC, PingFang SC;
  392. font-weight: 400;
  393. font-size: 14px;
  394. color: #222;
  395. display: flex;
  396. flex-direction: column;
  397. /* #ifdef MP-WEIXIN */
  398. height: 100vh;
  399. /* #endif */
  400. }
  401. .sharePop {
  402. background-color: #fff;
  403. padding: 20px 0;
  404. // padding-bottom: 100px;
  405. border-radius: 20px 20px 0 0;
  406. &-item {
  407. padding: 0 10px;
  408. box-sizing: border-box;
  409. font-family: PingFang SC, PingFang SC;
  410. font-weight: 400;
  411. font-size: 14px;
  412. display: inline-flex !important;
  413. image {
  414. height: 48px;
  415. width: 48px;
  416. margin-bottom: 10px;
  417. }
  418. }
  419. }
  420. .boxnav {
  421. flex-wrap: wrap;
  422. padding: 0 0 0 10px;
  423. &-item {
  424. width: 100%;
  425. overflow: hidden;
  426. }
  427. &-item-info {
  428. border: 1px solid #f5f5f5;
  429. text-align: center;
  430. color: #222;
  431. background-color: #f5f5f5;
  432. border-radius: 3px;
  433. padding: 5px;
  434. margin: 0 10px 10px 0;
  435. }
  436. &-active {
  437. border: 1px solid #1677ff !important;
  438. color: #1677ff !important;
  439. background-color: #e7f1fe !important;
  440. }
  441. }
  442. .headbox {
  443. background-color: #fff;
  444. }
  445. .headnav {
  446. padding: 15px 12px;
  447. margin: 0 -10px -10px 0;
  448. box-sizing: border-box;
  449. image {
  450. height: 60px;
  451. width: 50px;
  452. position: absolute;
  453. z-index: 0;
  454. bottom: 0;
  455. right: 0;
  456. display: none;
  457. }
  458. &-item {
  459. flex: 1;
  460. font-size: 16px;
  461. padding: 10px;
  462. border-radius: 10px;
  463. background: #f5f5f5;
  464. margin: 0 10px 10px 0;
  465. position: relative;
  466. z-index: 1;
  467. overflow: hidden;
  468. color: #555;
  469. }
  470. &-active {
  471. background-color: rgb(231, 241, 255) !important;
  472. .headnav-num {
  473. color: #1677ff !important;
  474. }
  475. image {
  476. display: block !important;
  477. }
  478. }
  479. &-num {
  480. font-family: DIN, DIN;
  481. font-weight: bold;
  482. font-size: 25px;
  483. margin: 5px 0;
  484. }
  485. }
  486. .searchbar {
  487. flex: 1;
  488. padding-bottom: 10px;
  489. .arrow-down {
  490. margin-left: 5px;
  491. }
  492. &-active {
  493. color: #1677ff !important;
  494. .arrow-down {
  495. transform: rotate(180deg);
  496. }
  497. }
  498. }
  499. .coursebox {
  500. position: relative;
  501. overflow-y: auto;
  502. box-sizing: border-box;
  503. }
  504. .courselist {
  505. padding: 12px;
  506. box-sizing: border-box;
  507. }
  508. .container-right {
  509. flex: 1;
  510. height: calc(100% - 80rpx);
  511. overflow-y: scroll;
  512. // padding-bottom: 80rpx;
  513. .list {
  514. padding: 10px;
  515. box-sizing: border-box;
  516. width: 100%;
  517. }
  518. }
  519. </style>