UrgeClasses.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  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. <!-- <view>时间id{{date}}</view>
  24. <view>首次请求参数{{msg111}}</view> -->
  25. <!-- <view>copid{{corpId}}</view> -->
  26. <scroll-view scroll-y="true" class="hb" :refresher-enabled="isEnableds"
  27. style="height: calc(100vh - 300rpx);" :refresher-triggered="triggereds"
  28. refresher-background="rgba(0,0,0,0)" @refresherrefresh="pullDownRefreshs"
  29. @refresherrestore="triggereds = false" :upper-threshold="100" :lower-threshold="100"
  30. @refresherabort="triggereds = false" @scrolltolower="reachBottoms">
  31. <view class="list-box" v-for="(item,index) in list" :key="index" @click="inputget(item.externalContactId)">
  32. <view class="justify-between align-center ptb20">
  33. <view class="justify-start align-center">
  34. <u-avatar :src="item.avatar"></u-avatar>
  35. <view class="column ml20">
  36. <view class="ml20 mr20">{{item.name}}</view>
  37. <view class="base-color-red fs24">{{item.title}}</view>
  38. </view>
  39. </view>
  40. <view class="column align-center" >
  41. <view class="fs24 base-color-6">过往7天看课记录</view>
  42. <view class="justify-start align-center mt12" >
  43. <view class="w24 h24 mr10 radius4" v-for="(item,index) in item.logs" :key="index"
  44. :style="{ backgroundColor: statusColors[item] || '#CCCCCC' }"></view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="justify-between align-center" @click.passive.stop>
  49. <view class="justify-start">
  50. <view class="mr20 fs24">最晚看课时间</view>
  51. <view class="base-color-6 fs24">{{item.lastWatchDate?item.lastWatchDate:'暂无'}}</view>
  52. </view>
  53. <view class="justify-start align-center" @click="chulinew(item)">
  54. <u-icon name="edit-pen" size="20"></u-icon>
  55. <view class="fs24">处理</view>
  56. </view>
  57. </view>
  58. </view>
  59. <u-loadmore :status="statusA" />
  60. </scroll-view>
  61. </view>
  62. <u-modal :show="chulishow" title="温馨提示" :content='content' :showCancelButton='true' @close='chulishow=!chulishow'
  63. :closeOnClickOverlay='true' @confirm='confirmchuli' @cancel='chulishow=!chulishow'></u-modal>
  64. <view class="">
  65. <u-calendar :show="showtime" :maxDate='maxDate' :minDate='minDate' @confirm="confirmData"
  66. :closeOnClickOverlay='true' @close="closedata"></u-calendar>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. import {
  72. getUrgeClasses,
  73. updataUrgeClasses
  74. } from "@/api/user.js";
  75. import { getConfigSignature,getQwExternalContactDetails } from '@/api/common.js'
  76. import dropdownPanel from "@/components/dropdownPanel.vue"
  77. export default {
  78. name: "qiweiUrgeCourse",
  79. components: {
  80. dropdownPanel
  81. },
  82. data() {
  83. return {
  84. actnav: 0,
  85. showsel: false,
  86. timeTab: ['今天', '昨天'],
  87. timeact: 0,
  88. isAgreement: false,
  89. littleTime: ['01', '02', '03', '04', '05', '06', '07'],
  90. qiweilist: [],
  91. qiweiuser: [],
  92. valuetime: '',
  93. showtime: false,
  94. todayday: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
  95. maxDate: '',
  96. minDate: '',
  97. date: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
  98. list: [],
  99. //分页
  100. triggereds: false,
  101. isEnableds: true,
  102. statusA: 'nomore',
  103. pageNum: 1,
  104. pageSize: 8,
  105. filterData: [{
  106. name: '选择企微账号',
  107. value: 0,
  108. }, ],
  109. searchbarNav: 0,
  110. qwUserId:uni.getStorageSync('qwUserId'),
  111. corpId:null,
  112. statusColors: {
  113. 0: '#909399',
  114. 1: '#0bc6ff',
  115. 2: '#67c23a',
  116. 3: '#f55a4f',
  117. 4: '#ffd700',
  118. },
  119. titname:['未看课','看课中','完课','待看课','看课中断',],
  120. msg111:'',
  121. chulishow:false,
  122. selectitem:{},
  123. content:''
  124. }
  125. },
  126. mounted() {
  127. this.date=uni.$u.timeFormat(new Date(), 'yyyy-mm-dd'),
  128. this.$nextTick(()=>{
  129. this.getCourselist()
  130. this.gettimeDate()
  131. })
  132. // this.getqiweilist()
  133. },
  134. onLoad(options) {
  135. this.qwUserId=options.userId
  136. this.date=options.data
  137. this.corpId=options.corpId
  138. },
  139. methods: {
  140. chulinew(item){
  141. this.chulishow=!this.chulishow
  142. this.selectitem=item
  143. console.log(this.selectitem)
  144. this.content=`是否确认处理${item.name}的催课数据`
  145. },
  146. confirmchuli(){
  147. this.chulishow=!this.chulishow
  148. const data={
  149. id:this.selectitem.id
  150. }
  151. uni.showLoading({
  152. title: "加载中..."
  153. })
  154. updataUrgeClasses(data).then(res=>{
  155. if(res.code==200){
  156. this.list=[]
  157. this.pageNum = 1;
  158. this.getCourselist()
  159. uni.hideLoading()
  160. uni.showToast({
  161. title: '处理成功',
  162. icon: 'none',
  163. duration: 2000,
  164. })
  165. }else{
  166. uni.hideLoading()
  167. uni.showToast({
  168. title: res.msg,
  169. icon: 'none',
  170. duration: 2000,
  171. })
  172. }
  173. })
  174. },
  175. isMobileQyWechat() {
  176. const ua = navigator.userAgent.toLowerCase();
  177. return ua.indexOf('mobile') > -1;
  178. },
  179. inputget(nextExternalUserId){
  180. if(this.isMobileQyWechat()){
  181. // uni.$emit('urgeUser', nextExternalUserId);
  182. uni.$emit('urgeUser', { pageurl: "/pages/user/UrgeClasses?userId="+this.qwUserId+'&data='+this.date+'&corpId='+this.corpId,
  183. nextExternalUserIds: nextExternalUserId });
  184. uni.navigateBack({
  185. delta: 1
  186. });
  187. }else{
  188. jWeixin.openEnterpriseChat({
  189. // 注意:userIds和externalUserIds至少选填一个。内部群最多2000人;外部群最多500人;如果有微信联系人,最多40人
  190. externalUserIds: nextExternalUserId, // 参与会话的外部联系人列表,格式为userId1;userId2;…,用分号隔开。
  191. groupName: '', // 会话名称。单聊时该参数传入空字符串""即可。
  192. chatId: "", // 若要打开已有会话,需指定此参数。如果是新建会话,chatId必须为空串
  193. success: function(res) {
  194. console.log(res);
  195. console.log("切换成功")
  196. uni.showToast({
  197. title: "切换成功",
  198. icon: 'none',
  199. });
  200. var data={cmd:"switchPage"};
  201. uni.$emit('sendMsg',data);
  202. },
  203. fail: function(res) {
  204. console.log(res);
  205. console.log("切换失败")
  206. uni.showToast({
  207. title: "切换失败",
  208. icon: 'none',
  209. });
  210. var data={cmd:"switchPage"};
  211. uni.$emit('sendMsg',data);
  212. }
  213. });
  214. }
  215. },
  216. checkdetail(){
  217. uni.navigateTo({
  218. url:'/pages/course/urgeclassDetail'
  219. })
  220. },
  221. getCourseOne(e) {
  222. this.qiweiuser = e
  223. },
  224. onChange(index) {
  225. this.searchbarNav = index
  226. },
  227. reachBottoms() {
  228. // status这个是加载状态
  229. if (this.statusA === 'loadmore') {
  230. this.statusA = 'loading'
  231. uni.showNavigationBarLoading()
  232. setTimeout(() => {
  233. this.pageNum++
  234. this.getCourselist() //触底 不穿执行else
  235. uni.hideNavigationBarLoading()
  236. }, 1000);
  237. }
  238. },
  239. //列表展示下拉
  240. pullDownRefreshs() {
  241. // 下拉
  242. this.triggereds = true; //下拉了状态为true
  243. setTimeout(() => {
  244. this.triggereds = false;
  245. uni.stopPullDownRefresh()
  246. this.pageNum = 1;
  247. this.getCourselist('refresh') //触底 不穿执行else
  248. }, 1000)
  249. },
  250. confirmData(e) {
  251. this.showtime = !this.showtime
  252. this.date = e[0]
  253. this.pageNum = 1
  254. this.getCourselist()
  255. },
  256. gettimeDate() {
  257. // 获取当前时间
  258. const currentDate = new Date();
  259. // 获取一个月前的时间
  260. const oneMonthAgo = new Date(currentDate);
  261. oneMonthAgo.setMonth(oneMonthAgo.getMonth() - 1);
  262. this.minDate = oneMonthAgo.getTime();
  263. // 获取一个月后的时间
  264. const oneMonthLater = new Date(currentDate);
  265. oneMonthLater.setMonth(oneMonthLater.getMonth() + 1);
  266. this.maxDate = oneMonthLater.getTime();
  267. },
  268. selcourse() {
  269. this.showsel = !this.showsel
  270. },
  271. close() {
  272. this.showsel = !this.showsel
  273. },
  274. seltime(index) {
  275. this.timeact = index
  276. this.pageNum = 1
  277. this.list=[]
  278. if (index == 0) {
  279. this.date = this.todayday
  280. } else {
  281. console.log(index)
  282. let yesterday = new Date();
  283. yesterday.setDate(yesterday.getDate() - 1);
  284. this.date = uni.$u.timeFormat(yesterday, 'yyyy-mm-dd')
  285. // uni.$emit('urgeUser', { pageurl: "/pages/user/UrgeClasses?userId="+this.qwUserId+'&data='+this.date,
  286. // nextExternalUserId: 'nextExternalUserId' });
  287. // uni.navigateBack({
  288. // delta: 1
  289. // });
  290. }
  291. this.getCourselist()
  292. },
  293. handleget() {
  294. this.isAgreement = !this.isAgreement
  295. },
  296. getCourselist(type) {
  297. uni.showLoading({
  298. title: "加载中..."
  299. })
  300. const parmas = {
  301. date: this.date,
  302. pageNum: this.pageNum,
  303. pageSize: this.pageSize,
  304. corpId:this.corpId,
  305. qwUserId: this.qwUserId,
  306. // corpId:'ww44239b22628b206c',
  307. // qwUserId:"ZhaoGuangDong_3",
  308. }
  309. this.msg111=parmas
  310. getUrgeClasses(parmas).then(res => {
  311. if (res.code == 200) {
  312. uni.hideLoading()
  313. const dataList = res.data.list
  314. if (type == 'refresh') {
  315. this.list = dataList
  316. } else {
  317. this.list = [...this.list, ...dataList]
  318. }
  319. this.statusA = res.data.isLastPage ? 'nomore' : 'loadmore';
  320. } else {
  321. uni.showToast({
  322. icon: 'none',
  323. title: res.msg
  324. })
  325. }
  326. })
  327. },
  328. confirmuser(e) {
  329. this.showsel = !this.showsel
  330. this.qiweiuser = e.value[0]
  331. this.pageNum = 1
  332. this.getCourselist()
  333. },
  334. canceluser() {
  335. this.showsel = !this.showsel
  336. },
  337. closeuser() {
  338. this.showsel = !this.showsel
  339. },
  340. closedata() {
  341. this.showtime = !this.showtime
  342. }
  343. }
  344. }
  345. </script>
  346. <style lang="scss" scoped>
  347. page{
  348. background-color: #F5F7FA;
  349. }
  350. .icon-triangle {
  351. width: 16rpx;
  352. height: 16rpx;
  353. margin-left: 10rpx;
  354. }
  355. .select {
  356. color: #1773ff;
  357. background-color: #e6ecff;
  358. }
  359. .tabtime {
  360. background-color: #f0f0f0;
  361. text-align: center;
  362. width: 140rpx;
  363. padding: 12rpx 0;
  364. border-radius: 200rpx;
  365. margin-left: 20rpx;
  366. font-size: 24rpx;
  367. }
  368. .selecttime {
  369. color: #fff;
  370. background-color: #1773ff;
  371. }
  372. /deep/ .uni-checkbox-input {
  373. border-radius: 50% !important;
  374. }
  375. .timelitle {
  376. background-color: #c2c2c2;
  377. color: #fff;
  378. border-radius: 50%;
  379. width: 40rpx;
  380. text-align: center;
  381. line-height: 40rpx;
  382. height: 40rpx;
  383. margin-right: 6rpx;
  384. }
  385. .list-box {
  386. background-color: #fff;
  387. padding: 28rpx;
  388. margin-bottom: 12rpx;
  389. margin:18rpx 20rpx;
  390. border-radius: 12rpx;
  391. }
  392. </style>