UrgeClasses.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <template>
  2. <view class="column " style="height: 100%;">
  3. <view class="bgf p20 justify-between align-center ">
  4. <view style="color: #666;font-size: 24rpx;" @click="showtime=!showtime">{{date||"请选择时间"}}</view>
  5. <view class="justify-between">
  6. <view :class="timeact==index?'tabtime selecttime':'tabtime'" v-for="(item,index) in timeTab"
  7. :key="index" @click="seltime(index)">
  8. {{item}}
  9. </view>
  10. </view>
  11. </view>
  12. <view class="justify-between align-center p20 ">
  13. <view class="fs24">共{{list.length}}条数据</view>
  14. </view>
  15. <view class="justify-start ">
  16. <view v-for="(item,index) in titname" :key="index" class="justify-start align-center ml28">
  17. <view :style="{ backgroundColor: statusColors[index] || '#CCCCCC' }"
  18. class="w24 h24 radius4"></view>
  19. <view class="fs24 mr6 ml10">{{item}}</view>
  20. </view>
  21. </view>
  22. <view class="column hb hidden">
  23. <scroll-view scroll-y="true" class="hb" :refresher-enabled="isEnableds"
  24. style="height: calc(100vh - 300rpx);" :refresher-triggered="triggereds"
  25. refresher-background="rgba(0,0,0,0)" @refresherrefresh="pullDownRefreshs"
  26. @refresherrestore="triggereds = false" :upper-threshold="100" :lower-threshold="100"
  27. @refresherabort="triggereds = false" @scrolltolower="reachBottoms">
  28. <view class="list-box" v-for="(item,index) in list" :key="index">
  29. <view class="justify-between align-center ptb20">
  30. <view class="justify-start align-center">
  31. <u-avatar :src="item.avatar"></u-avatar>
  32. <view class="column ml20">
  33. <view class="ml20 mr20">{{item.name}}</view>
  34. <view class="base-color-red fs24">{{item.title}}</view>
  35. </view>
  36. </view>
  37. <view class="column align-center" >
  38. <view class="fs24 base-color-6">过往7天看课记录</view>
  39. <view class="justify-start align-center mt12" >
  40. <view class="w24 h24 mr10 radius4" v-for="(item,index) in item.logs" :key="index"
  41. :style="{ backgroundColor: statusColors[item] || '#CCCCCC' }"></view>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="justify-start">
  46. <view class="mr20 fs24">最晚看课时间</view>
  47. <view class="base-color-6 fs24">{{item.lastWatchDate?item.lastWatchDate:'暂无'}}</view>
  48. </view>
  49. </view>
  50. <u-loadmore :status="statusA" />
  51. </scroll-view>
  52. </view>
  53. <view class="">
  54. <u-calendar :show="showtime" :maxDate='maxDate' :minDate='minDate' @confirm="confirmData"
  55. :closeOnClickOverlay='true' @close="closedata"></u-calendar>
  56. </view>
  57. </view>
  58. </template>
  59. <script>
  60. import {
  61. getUrgeClasses,
  62. } from "@/api/user.js";
  63. import dropdownPanel from "@/components/dropdownPanel.vue"
  64. export default {
  65. name: "qiweiUrgeCourse",
  66. components: {
  67. dropdownPanel
  68. },
  69. data() {
  70. return {
  71. actnav: 0,
  72. showsel: false,
  73. timeTab: ['今天', '昨天'],
  74. timeact: 0,
  75. isAgreement: false,
  76. littleTime: ['01', '02', '03', '04', '05', '06', '07'],
  77. qiweilist: [],
  78. qiweiuser: [],
  79. valuetime: '',
  80. showtime: false,
  81. todayday: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
  82. maxDate: '',
  83. minDate: '',
  84. date: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
  85. list: [],
  86. //分页
  87. triggereds: false,
  88. isEnableds: true,
  89. statusA: 'nomore',
  90. pageNum: 1,
  91. pageSize: 8,
  92. filterData: [{
  93. name: '选择企微账号',
  94. value: 0,
  95. }, ],
  96. searchbarNav: 0,
  97. qwUserId:uni.getStorageSync('qwUserId'),
  98. statusColors: {
  99. 0: '#909399',
  100. 1: '#0bc6ff',
  101. 2: '#67c23a',
  102. 3: '#f55a4f',
  103. 4: '#ffd700',
  104. },
  105. titname:['未看课','看课中','完课','待看课','看课中断',]
  106. }
  107. },
  108. mounted() {
  109. this.getCourselist()
  110. // this.getqiweilist()
  111. this.gettimeDate()
  112. },
  113. methods: {
  114. checkdetail(){
  115. uni.navigateTo({
  116. url:'/pages/course/urgeclassDetail'
  117. })
  118. },
  119. getCourseOne(e) {
  120. this.qiweiuser = e
  121. },
  122. onChange(index) {
  123. this.searchbarNav = index
  124. },
  125. reachBottoms() {
  126. // status这个是加载状态
  127. if (this.statusA === 'loadmore') {
  128. this.statusA = 'loading'
  129. uni.showNavigationBarLoading()
  130. setTimeout(() => {
  131. this.pageNum++
  132. this.getCourselist() //触底 不穿执行else
  133. uni.hideNavigationBarLoading()
  134. }, 1000);
  135. }
  136. },
  137. //列表展示下拉
  138. pullDownRefreshs() {
  139. // 下拉
  140. this.triggereds = true; //下拉了状态为true
  141. setTimeout(() => {
  142. this.triggereds = false;
  143. uni.stopPullDownRefresh()
  144. this.pageNum = 1;
  145. this.getCourselist('refresh') //触底 不穿执行else
  146. }, 1000)
  147. },
  148. confirmData(e) {
  149. this.showtime = !this.showtime
  150. this.date = e[0]
  151. this.pageNum = 1
  152. this.getCourselist()
  153. },
  154. gettimeDate() {
  155. // 获取当前时间
  156. const currentDate = new Date();
  157. // 获取一个月前的时间
  158. const oneMonthAgo = new Date(currentDate);
  159. oneMonthAgo.setMonth(oneMonthAgo.getMonth() - 1);
  160. this.minDate = oneMonthAgo.getTime();
  161. // 获取一个月后的时间
  162. const oneMonthLater = new Date(currentDate);
  163. oneMonthLater.setMonth(oneMonthLater.getMonth() + 1);
  164. this.maxDate = oneMonthLater.getTime();
  165. },
  166. selcourse() {
  167. this.showsel = !this.showsel
  168. },
  169. close() {
  170. this.showsel = !this.showsel
  171. },
  172. seltime(index) {
  173. this.timeact = index
  174. this.pageNum = 1
  175. this.list=[]
  176. if (index == 0) {
  177. this.date = this.todayday
  178. } else {
  179. let yesterday = new Date();
  180. yesterday.setDate(yesterday.getDate() - 1);
  181. this.date = uni.$u.timeFormat(yesterday, 'yyyy-mm-dd')
  182. }
  183. this.getCourselist()
  184. },
  185. handleget() {
  186. this.isAgreement = !this.isAgreement
  187. },
  188. getCourselist(type) {
  189. const parmas = {
  190. qwUserId: this.qwUserId,
  191. date: this.date,
  192. pageNum: this.pageNum,
  193. pageSize: this.pageSize,
  194. companyUserId: 8584,
  195. companyId: 11,
  196. }
  197. getUrgeClasses(parmas).then(res => {
  198. if (res.code == 200) {
  199. const dataList = res.data.list
  200. if (type == 'refresh') {
  201. this.list = dataList
  202. } else {
  203. this.list = [...this.list, ...dataList]
  204. }
  205. this.statusA = res.data.isLastPage ? 'nomore' : 'loadmore';
  206. } else {
  207. uni.showToast({
  208. icon: 'none',
  209. title: res.msg
  210. })
  211. }
  212. })
  213. },
  214. confirmuser(e) {
  215. this.showsel = !this.showsel
  216. this.qiweiuser = e.value[0]
  217. this.pageNum = 1
  218. this.getCourselist()
  219. },
  220. canceluser() {
  221. this.showsel = !this.showsel
  222. },
  223. closeuser() {
  224. this.showsel = !this.showsel
  225. },
  226. closedata() {
  227. this.showtime = !this.showtime
  228. }
  229. }
  230. }
  231. </script>
  232. <style lang="scss" scoped>
  233. .icon-triangle {
  234. width: 16rpx;
  235. height: 16rpx;
  236. margin-left: 10rpx;
  237. }
  238. .select {
  239. color: #1773ff;
  240. background-color: #e6ecff;
  241. }
  242. .tabtime {
  243. background-color: #f0f0f0;
  244. text-align: center;
  245. width: 140rpx;
  246. padding: 12rpx 0;
  247. border-radius: 200rpx;
  248. margin-left: 20rpx;
  249. font-size: 24rpx;
  250. }
  251. .selecttime {
  252. color: #fff;
  253. background-color: #1773ff;
  254. }
  255. /deep/ .uni-checkbox-input {
  256. border-radius: 50% !important;
  257. }
  258. .timelitle {
  259. background-color: #c2c2c2;
  260. color: #fff;
  261. border-radius: 50%;
  262. width: 40rpx;
  263. text-align: center;
  264. line-height: 40rpx;
  265. height: 40rpx;
  266. margin-right: 6rpx;
  267. }
  268. .list-box {
  269. background-color: #fff;
  270. padding: 28rpx;
  271. margin-bottom: 12rpx;
  272. margin:18rpx 20rpx;
  273. border-radius: 12rpx;
  274. }
  275. </style>