UrgeClasses.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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 { getConfigSignature,getQwExternalContactDetails } from '@/api/common.js'
  64. import dropdownPanel from "@/components/dropdownPanel.vue"
  65. export default {
  66. name: "qiweiUrgeCourse",
  67. components: {
  68. dropdownPanel
  69. },
  70. data() {
  71. return {
  72. actnav: 0,
  73. showsel: false,
  74. timeTab: ['今天', '昨天'],
  75. timeact: 0,
  76. isAgreement: false,
  77. littleTime: ['01', '02', '03', '04', '05', '06', '07'],
  78. qiweilist: [],
  79. qiweiuser: [],
  80. valuetime: '',
  81. showtime: false,
  82. todayday: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
  83. maxDate: '',
  84. minDate: '',
  85. date: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
  86. list: [],
  87. //分页
  88. triggereds: false,
  89. isEnableds: true,
  90. statusA: 'nomore',
  91. pageNum: 1,
  92. pageSize: 8,
  93. filterData: [{
  94. name: '选择企微账号',
  95. value: 0,
  96. }, ],
  97. searchbarNav: 0,
  98. qwUserId:uni.getStorageSync('qwUserId'),
  99. statusColors: {
  100. 0: '#909399',
  101. 1: '#0bc6ff',
  102. 2: '#67c23a',
  103. 3: '#f55a4f',
  104. 4: '#ffd700',
  105. },
  106. titname:['未看课','看课中','完课','待看课','看课中断',],
  107. }
  108. },
  109. mounted() {
  110. this.getCourselist()
  111. // this.getqiweilist()
  112. this.gettimeDate()
  113. },
  114. onLoad(options) {
  115. this.qwUserId=options.userId
  116. },
  117. methods: {
  118. checkdetail(){
  119. uni.navigateTo({
  120. url:'/pages/course/urgeclassDetail'
  121. })
  122. },
  123. getCourseOne(e) {
  124. this.qiweiuser = e
  125. },
  126. onChange(index) {
  127. this.searchbarNav = index
  128. },
  129. reachBottoms() {
  130. // status这个是加载状态
  131. if (this.statusA === 'loadmore') {
  132. this.statusA = 'loading'
  133. uni.showNavigationBarLoading()
  134. setTimeout(() => {
  135. this.pageNum++
  136. this.getCourselist() //触底 不穿执行else
  137. uni.hideNavigationBarLoading()
  138. }, 1000);
  139. }
  140. },
  141. //列表展示下拉
  142. pullDownRefreshs() {
  143. // 下拉
  144. this.triggereds = true; //下拉了状态为true
  145. setTimeout(() => {
  146. this.triggereds = false;
  147. uni.stopPullDownRefresh()
  148. this.pageNum = 1;
  149. this.getCourselist('refresh') //触底 不穿执行else
  150. }, 1000)
  151. },
  152. confirmData(e) {
  153. this.showtime = !this.showtime
  154. this.date = e[0]
  155. this.pageNum = 1
  156. this.getCourselist()
  157. },
  158. gettimeDate() {
  159. // 获取当前时间
  160. const currentDate = new Date();
  161. // 获取一个月前的时间
  162. const oneMonthAgo = new Date(currentDate);
  163. oneMonthAgo.setMonth(oneMonthAgo.getMonth() - 1);
  164. this.minDate = oneMonthAgo.getTime();
  165. // 获取一个月后的时间
  166. const oneMonthLater = new Date(currentDate);
  167. oneMonthLater.setMonth(oneMonthLater.getMonth() + 1);
  168. this.maxDate = oneMonthLater.getTime();
  169. },
  170. selcourse() {
  171. this.showsel = !this.showsel
  172. },
  173. close() {
  174. this.showsel = !this.showsel
  175. },
  176. seltime(index) {
  177. this.timeact = index
  178. this.pageNum = 1
  179. this.list=[]
  180. if (index == 0) {
  181. this.date = this.todayday
  182. } else {
  183. let yesterday = new Date();
  184. yesterday.setDate(yesterday.getDate() - 1);
  185. this.date = uni.$u.timeFormat(yesterday, 'yyyy-mm-dd')
  186. }
  187. this.getCourselist()
  188. },
  189. handleget() {
  190. this.isAgreement = !this.isAgreement
  191. },
  192. getCourselist(type) {
  193. const parmas = {
  194. qwUserId: this.qwUserId,
  195. date: this.date,
  196. pageNum: this.pageNum,
  197. pageSize: this.pageSize,
  198. companyUserId: 8584,
  199. companyId: 11,
  200. }
  201. getUrgeClasses(parmas).then(res => {
  202. if (res.code == 200) {
  203. const dataList = res.data.list
  204. if (type == 'refresh') {
  205. this.list = dataList
  206. } else {
  207. this.list = [...this.list, ...dataList]
  208. }
  209. this.statusA = res.data.isLastPage ? 'nomore' : 'loadmore';
  210. } else {
  211. uni.showToast({
  212. icon: 'none',
  213. title: res.msg
  214. })
  215. }
  216. })
  217. },
  218. confirmuser(e) {
  219. this.showsel = !this.showsel
  220. this.qiweiuser = e.value[0]
  221. this.pageNum = 1
  222. this.getCourselist()
  223. },
  224. canceluser() {
  225. this.showsel = !this.showsel
  226. },
  227. closeuser() {
  228. this.showsel = !this.showsel
  229. },
  230. closedata() {
  231. this.showtime = !this.showtime
  232. }
  233. }
  234. }
  235. </script>
  236. <style lang="scss" scoped>
  237. .icon-triangle {
  238. width: 16rpx;
  239. height: 16rpx;
  240. margin-left: 10rpx;
  241. }
  242. .select {
  243. color: #1773ff;
  244. background-color: #e6ecff;
  245. }
  246. .tabtime {
  247. background-color: #f0f0f0;
  248. text-align: center;
  249. width: 140rpx;
  250. padding: 12rpx 0;
  251. border-radius: 200rpx;
  252. margin-left: 20rpx;
  253. font-size: 24rpx;
  254. }
  255. .selecttime {
  256. color: #fff;
  257. background-color: #1773ff;
  258. }
  259. /deep/ .uni-checkbox-input {
  260. border-radius: 50% !important;
  261. }
  262. .timelitle {
  263. background-color: #c2c2c2;
  264. color: #fff;
  265. border-radius: 50%;
  266. width: 40rpx;
  267. text-align: center;
  268. line-height: 40rpx;
  269. height: 40rpx;
  270. margin-right: 6rpx;
  271. }
  272. .list-box {
  273. background-color: #fff;
  274. padding: 28rpx;
  275. margin-bottom: 12rpx;
  276. margin:18rpx 20rpx;
  277. border-radius: 12rpx;
  278. }
  279. </style>