qiweiUrgeCourse.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <template>
  2. <view class="column " style="height: 100%;">
  3. <view class="bgf justify-between pb16 flex-1" style="z-index:2;">
  4. <dropdownPanel :filterData='filterData' @confirm="confirm" @reset="reset" @onChange="onChange"
  5. style="flex: 1;">
  6. <view class="p20 fs28 column flex-1 scrolly hb hidden" v-if="searchbarNav == 0">
  7. <scroll-view scroll-y="true" class="hb" :refresher-enabled="isEnabledC"
  8. :refresher-triggered="triggeredC" refresher-background="rgba(0,0,0,0)"
  9. @refresherrefresh="pullDownRefreshC" @refresherrestore="triggeredC = false"
  10. :upper-threshold="100" :lower-threshold="100" @refresherabort="triggeredC = false"
  11. @scrolltolower="reachBottomC">
  12. <view v-for="(item,index) in qiweilist" :key="item.index" class="m10 p10 center"
  13. :class="qiweiuser.dictLabel==item.dictLabel?'select':''"
  14. style="border-bottom: 2rpx solid #eee;" @click="getCourseOne(item)">
  15. {{item.dictLabel}}
  16. </view>
  17. <u-loadmore :status="statusC" />
  18. </scroll-view>
  19. </view>
  20. </dropdownPanel>
  21. </view>
  22. <view class="bgf p20 justify-between align-center ">
  23. <view style="color: #666;font-size: 24rpx;" @click="showtime=!showtime">{{date||"请选择时间"}}</view>
  24. <view class="justify-between">
  25. <view :class="timeact==index?'tabtime selecttime':'tabtime'" v-for="(item,index) in timeTab"
  26. :key="index" @click="seltime(index)">
  27. {{item}}
  28. </view>
  29. </view>
  30. </view>
  31. <view class="justify-between align-center p20 ">
  32. <view class="fs24">共{{list.length}}条数据</view>
  33. </view>
  34. <view class="column hb hidden">
  35. <scroll-view scroll-y="true" class="hb" :refresher-enabled="isEnableds"
  36. style="height: calc(100vh - 300rpx);" :refresher-triggered="triggereds"
  37. refresher-background="rgba(0,0,0,0)" @refresherrefresh="pullDownRefreshs"
  38. @refresherrestore="triggereds = false" :upper-threshold="100" :lower-threshold="100"
  39. @refresherabort="triggereds = false" @scrolltolower="reachBottoms">
  40. <view class="list-box" v-for="(item,index) in list" :key="index">
  41. <view class="justify-between align-center ptb40">
  42. <view>{{item.title}}</view>
  43. <view class="justify-start align-center">
  44. <u-icon name="file-text" color="#999999" size="20" class="mr10"></u-icon>
  45. <u-icon name="more-circle" color="#999999" size="16"></u-icon>
  46. </view>
  47. </view>
  48. </view>
  49. <u-loadmore :status="statusA" />
  50. </scroll-view>
  51. </view>
  52. <view class="">
  53. <u-calendar :show="showtime" :maxDate='maxDate' :minDate='minDate' @confirm="confirmData"
  54. :closeOnClickOverlay='true' @close="closedata"></u-calendar>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. import {
  60. geturgeCourse,
  61. geturgeqiwei
  62. } from "@/api/courseManage.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: '',
  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. //企微分页
  98. triggeredC: false,
  99. isEnabledC: true,
  100. statusC: 'nomore',
  101. pageNumC: 1,
  102. pageSizeC: 6,
  103. }
  104. },
  105. mounted() {
  106. this.getCourselist()
  107. this.getqiweilist()
  108. this.gettimeDate()
  109. },
  110. methods: {
  111. getCourseOne(e) {
  112. this.qiweiuser = e
  113. console.log(e)
  114. },
  115. reachBottomC() {
  116. // status这个是加载状态
  117. console.log(12345)
  118. if (this.statusC === 'loadmore') {
  119. this.statusC = 'loading'
  120. uni.showNavigationBarLoading()
  121. setTimeout(() => {
  122. this.pageNumC++
  123. this.getqiweilist() //触底 不穿执行else
  124. uni.hideNavigationBarLoading()
  125. }, 1000);
  126. }
  127. },
  128. //列表展示下拉
  129. pullDownRefreshC() {
  130. // 下拉
  131. console.log(12345)
  132. this.triggeredC = true; //下拉了状态为true
  133. setTimeout(() => {
  134. this.triggeredC = false;
  135. uni.stopPullDownRefresh()
  136. this.pageNumC = 1;
  137. this.getqiweilist('refresh') //触底 不穿执行else
  138. // 请求接口里面需要判断是不是最后一页 是最后一页 status赋值为‘loadmore’没有更多了
  139. // 请求接口
  140. }, 1000)
  141. },
  142. confirm() {
  143. this.filterData[0].name = this.qiweiuser.dictLabel
  144. this.getCourselist()
  145. },
  146. reset() {
  147. this.qiweiuser = []
  148. this.filterData[0].name = '请选择企微账号'
  149. this.getCourselist()
  150. },
  151. onChange(index) {
  152. this.searchbarNav = index
  153. },
  154. reachBottoms() {
  155. // status这个是加载状态
  156. if (this.statusA === 'loadmore') {
  157. this.statusA = 'loading'
  158. uni.showNavigationBarLoading()
  159. setTimeout(() => {
  160. this.pageNum++
  161. this.getCourselist() //触底 不穿执行else
  162. uni.hideNavigationBarLoading()
  163. }, 1000);
  164. }
  165. },
  166. //列表展示下拉
  167. pullDownRefreshs() {
  168. // 下拉
  169. this.triggereds = true; //下拉了状态为true
  170. setTimeout(() => {
  171. this.triggereds = false;
  172. uni.stopPullDownRefresh()
  173. this.pageNum = 1;
  174. this.getCourselist('refresh') //触底 不穿执行else
  175. // 请求接口里面需要判断是不是最后一页 是最后一页 status赋值为‘loadmore’没有更多了
  176. // 请求接口
  177. }, 1000)
  178. },
  179. confirmData(e) {
  180. this.showtime = !this.showtime
  181. this.date = e[0]
  182. this.pageNum = 1
  183. this.getCourselist()
  184. },
  185. gettimeDate() {
  186. // 获取当前时间
  187. const currentDate = new Date();
  188. // 获取一个月前的时间
  189. const oneMonthAgo = new Date(currentDate);
  190. oneMonthAgo.setMonth(oneMonthAgo.getMonth() - 1);
  191. this.minDate = oneMonthAgo.getTime();
  192. // 获取一个月后的时间
  193. const oneMonthLater = new Date(currentDate);
  194. oneMonthLater.setMonth(oneMonthLater.getMonth() + 1);
  195. this.maxDate = oneMonthLater.getTime();
  196. },
  197. selcourse() {
  198. this.showsel = !this.showsel
  199. },
  200. close() {
  201. this.showsel = !this.showsel
  202. },
  203. seltime(index) {
  204. this.timeact = index
  205. this.pageNum = 1
  206. if (index == 0) {
  207. this.date = this.todayday
  208. } else {
  209. let yesterday = new Date();
  210. yesterday.setDate(yesterday.getDate() - 1);
  211. this.date = uni.$u.timeFormat(yesterday, 'yyyy-mm-dd')
  212. }
  213. this.getCourselist()
  214. },
  215. handleget() {
  216. this.isAgreement = !this.isAgreement
  217. },
  218. getCourselist(type) {
  219. // console.log(this.qiweiuser.dictValue)
  220. if (this.qiweiuser.dictValue == undefined) {
  221. uni.showToast({
  222. icon: 'none',
  223. title: '请选择企微账号'
  224. })
  225. return
  226. }
  227. const parmas = {
  228. qwUserId: this.qiweiuser.dictValue,
  229. corpId: this.qiweiuser.corpId,
  230. date: this.date,
  231. pageNum: this.pageNum,
  232. pageSize: this.pageSize
  233. }
  234. geturgeCourse(parmas).then(res => {
  235. if (res.code == 200) {
  236. const dataList = res.data.list
  237. if (type == 'refresh') {
  238. this.list = dataList
  239. } else {
  240. this.list = [...this.list, ...dataList]
  241. }
  242. this.statusC = res.data.isLastPage ? 'nomore' : 'loadmore';
  243. console.log(this.list)
  244. } else {
  245. uni.showToast({
  246. icon: 'none',
  247. title: res.msg
  248. })
  249. }
  250. })
  251. },
  252. getqiweilist(type) {
  253. const data = {
  254. pageNum: this.pageNumC,
  255. pageSize: this.pageSizeC
  256. }
  257. geturgeqiwei(data).then(res => {
  258. if (res.code == 200) {
  259. if (type == 'refresh') {
  260. this.qiweilist = res.data.list
  261. } else {
  262. this.qiweilist = [...this.qiweilist, ...res.data.list]
  263. }
  264. if (res.data.isLastPage) {
  265. this.statusC = 'nomore'
  266. } else {
  267. this.statusC = 'loadmore'
  268. }
  269. } else {
  270. uni.showToast({
  271. icon: 'none',
  272. title: res.msg
  273. })
  274. }
  275. })
  276. },
  277. confirmuser(e) {
  278. this.showsel = !this.showsel
  279. this.qiweiuser = e.value[0]
  280. this.pageNum = 1
  281. this.getCourselist()
  282. },
  283. canceluser() {
  284. this.showsel = !this.showsel
  285. },
  286. closeuser() {
  287. this.showsel = !this.showsel
  288. },
  289. closedata() {
  290. this.showtime = !this.showtime
  291. }
  292. }
  293. }
  294. </script>
  295. <style lang="scss" scoped>
  296. .icon-triangle {
  297. width: 16rpx;
  298. height: 16rpx;
  299. margin-left: 10rpx;
  300. }
  301. .select {
  302. color: #1773ff;
  303. background-color: #e6ecff;
  304. }
  305. .tabtime {
  306. background-color: #f0f0f0;
  307. text-align: center;
  308. width: 140rpx;
  309. padding: 12rpx 0;
  310. border-radius: 200rpx;
  311. margin-left: 20rpx;
  312. font-size: 24rpx;
  313. }
  314. .selecttime {
  315. color: #fff;
  316. background-color: #1773ff;
  317. }
  318. /deep/ .uni-checkbox-input {
  319. border-radius: 50% !important;
  320. }
  321. .timelitle {
  322. background-color: #c2c2c2;
  323. color: #fff;
  324. border-radius: 50%;
  325. width: 40rpx;
  326. text-align: center;
  327. line-height: 40rpx;
  328. height: 40rpx;
  329. margin-right: 6rpx;
  330. }
  331. .list-box {
  332. background-color: #fff;
  333. padding: 28rpx;
  334. margin-bottom: 12rpx;
  335. }
  336. </style>