index.vue 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081
  1. <template>
  2. <view >
  3. <nav-bar title="学习计划"></nav-bar>
  4. <view v-if="havePlan">
  5. <view class="card" v-if="havePlan">
  6. <swiper :style="{height:isOpen?'550rpx':'260rpx'}" class="swiper" :current="swiperIndex" :duration="300">
  7. <swiper-item v-for="(swiperItem,swiperIndex) in swiperList" :key="swiperIndex">
  8. <view class="date_t1">
  9. <u-icon name="arrow-left" size="28" v-if="havePreviousMonth" @click="swipeMonth(-1)"></u-icon>
  10. <text style="padding: 0 15rpx;">{{ swiperItem.year }}年 {{ swiperItem.month }}月</text>
  11. <u-icon name="arrow-right" size="28" v-if="haveNextMonth" @click="swipeMonth(1)"></u-icon>
  12. </view>
  13. <view style="width: 100%;margin-top: 20rpx;">
  14. <view v-for="(item, index) in date" :key="index" class="card_date">{{ item }}</view>
  15. </view>
  16. <view style="width: 100%;margin-top: 20rpx;">
  17. <view v-for="(item, index) in swiperItem.dayStudyList" :key="index" class="date_num">
  18. <view v-if="item.color == 0" @click="itemClick(item,index,swiperItem)" class="date_num_color0" :class="{active_color:(swiperItem.year+'-'+swiperItem.month+'-'+item.date) == activeDate}" v-show="item.date > 0">
  19. {{ item.date }}
  20. <view v-if="item.note > 0" class="date_note">{{ item.note }}</view>
  21. <view v-if="item.dot" class="date_dot"></view>
  22. </view>
  23. <view v-if="item.color == 1" @click="itemClick(item,index,swiperItem)" class="date_num_color1" :class="{active_color:(swiperItem.year+'-'+swiperItem.month+'-'+item.date) == activeDate}">
  24. {{ item.date }}
  25. <view v-if="item.note > 0" class="date_note">{{ item.note }}</view>
  26. <view v-if="item.dot" class="date_dot"></view>
  27. </view>
  28. <view v-if="item.color == 2" @click="itemClick(item,index,swiperItem)" class="date_num_color2" :class="{active_color:(swiperItem.year+'-'+swiperItem.month+'-'+item.date) == activeDate}">
  29. {{ item.date }}
  30. <view v-if="item.note > 0" class="date_note">{{ item.note }}</view>
  31. <view v-if="item.dot" class="date_dot"></view>
  32. </view>
  33. <view v-if="item.color == 3" @click="itemClick(item,index,swiperItem)" class="date_num_color3" :class="{active_color:(swiperItem.year+'-'+swiperItem.month+'-'+item.date) == activeDate}">
  34. {{ item.date }}
  35. <view v-if="item.note > 0" class="date_note">{{ item.note }}</view>
  36. <view v-if="item.dot" class="date_dot"></view>
  37. </view>
  38. </view>
  39. </view>
  40. <view style="width: 100%;display: flex;justify-content: center;" v-if="isOpen == false">
  41. <view @click="oepn_calendar(swiperItem)" style="height: 20rpx;width: 40rpx;padding:20rpx 0;"><view class="date_line"></view></view>
  42. </view>
  43. <view style="width: 100%;display: flex;justify-content: center;" v-else>
  44. <image class="date_line_close" @click="close_calendar(swiperItem)" src="/static/close_card.png"></image>
  45. </view>
  46. </swiper-item>
  47. </swiper>
  48. <!-- <view class="date_t1">
  49. <u-icon name="arrow-left" size="28" v-if="havePreviousMonth" @click="swipeMonth(-1)"></u-icon>
  50. <text style="padding: 0 15rpx;">{{ calendarStudyVo.year }}年 {{ calendarStudyVo.month }}月</text>
  51. <u-icon name="arrow-right" size="28" v-if="haveNextMonth" @click="swipeMonth(1)"></u-icon>
  52. </view>
  53. <view style="width: 100%;margin-top: 20rpx;">
  54. <view v-for="(item, index) in date" :key="index" class="card_date">{{ item }}</view>
  55. </view>
  56. <view style="width: 100%;margin-top: 20rpx;">
  57. <view v-for="(item, index) in showDayList" :key="index" class="date_num">
  58. <view v-if="item.color == 0" @click="itemClick(item,index)" class="date_num_color0" :class="{active_color:item.date == activeDate}" v-show="item.date > 0">
  59. {{ item.date }}
  60. <view v-if="item.note > 0" class="date_note">{{ item.note }}</view>
  61. <view v-if="item.dot" class="date_dot"></view>
  62. </view>
  63. <view v-if="item.color == 1" @click="itemClick(item,index)" class="date_num_color1" :class="{active_color:item.date == activeDate}">
  64. {{ item.date }}
  65. <view v-if="item.note > 0" class="date_note">{{ item.note }}</view>
  66. <view v-if="item.dot" class="date_dot"></view>
  67. </view>
  68. <view v-if="item.color == 2" @click="itemClick(item,index)" class="date_num_color2" :class="{active_color:item.date == activeDate}">
  69. {{ item.date }}
  70. <view v-if="item.note > 0" class="date_note">{{ item.note }}</view>
  71. <view v-if="item.dot" class="date_dot"></view>
  72. </view>
  73. <view v-if="item.color == 3" @click="itemClick(item,index)" class="date_num_color3" :class="{active_color:item.date == activeDate}">
  74. {{ item.date }}
  75. <view v-if="item.note > 0" class="date_note">{{ item.note }}</view>
  76. <view v-if="item.dot" class="date_dot"></view>
  77. </view>
  78. </view>
  79. </view>
  80. <view style="width: 100%;display: flex;justify-content: center;" v-if="isOpen == false">
  81. <view @click="oepn_calendar" style="height: 20rpx;width: 40rpx;padding:20rpx 0;"><view class="date_line"></view></view>
  82. </view>
  83. <view style="width: 100%;display: flex;justify-content: center;" v-else>
  84. <image class="date_line_close" @click="close_calendar" src="/static/close_card.png"></image>
  85. </view> -->
  86. <view v-for="(item, index) in workList" :key="index">
  87. <view style="padding-left: 30rpx;padding-top: 10rpx;display: flex;align-items: center;background:#fff;" @click="jumpDetail(item)">
  88. <text class="date_t2">{{ item.goodsName }}</text>
  89. <view class="circle_num" style="margin-left: 20rpx;">{{ item.classHours }}</view>
  90. </view>
  91. </view>
  92. </view>
  93. <!-- 列表-->
  94. <view>
  95. <uni-swipe-action>
  96. <uni-swipe-action-item :autoClose="false" @change="swipeChange($event, item)" :show="item.show" v-for="(item, index) in list" :key="index">
  97. <view class="list_item" :class="index % 2 == 0 ? 'list_item_bac1' : 'list_item_bac2'" @click.stop="openEdit(item)">
  98. <u-row>
  99. <u-col span="11">
  100. <text class="item_t1">
  101. {{ item.goodsVos[0].educationName + '-' + item.goodsVos[0].projectName + '-' + item.goodsVos[0].businessName }}:{{
  102. $method.timestampToTime(item.endTime)
  103. }}截止
  104. </text>
  105. </u-col>
  106. <u-col span="1"><image style="transform: rotate(180deg);" src="/static/icon/openSwith.png" class="img_more" @click.stop="openShow(item)"></image></u-col>
  107. </u-row>
  108. <scroll-view style="white-space: nowrap" class="scroll-view_H" scroll-x="true">
  109. <view style="margin-top: 30rpx;display: inline-block;width:296rpx;margin-right: 30rpx;" v-for="(items, indexs) in item.goodsVos" :key="indexs">
  110. <image :src="$method.splitImgHost(items.coverUrl)" class="r_image"></image>
  111. <view class="r_t2">{{ items.goodsName }}</view>
  112. </view>
  113. </scroll-view>
  114. <view style="display: flex;margin-top: 30rpx;">
  115. <text class="item_t2">学习频率:</text>
  116. <view style="display: flex;justify-content:center;">
  117. <view v-for="(item1, index) in item.studyCount" :key="index" class="item_date">{{ replay(item1) }}</view>
  118. </view>
  119. </view>
  120. <view style="display: flex;margin-top: 20rpx;">
  121. <text class="item_t2">学习进度:{{ item.studyNum }}/{{ item.pitchNum }}</text>
  122. </view>
  123. </view>
  124. <template v-slot:right>
  125. <view class="operate">
  126. <image src="/static/operate_1.png" class="operate_img operate_img1" @click="delWorker(item)"></image>
  127. <!-- <image src="/static/operate_2.png" class="operate_img operate_img2"></image> -->
  128. <image @click="edit(item)" src="/static/operate_3.png" class="operate_img operate_img3"></image>
  129. </view>
  130. </template>
  131. </uni-swipe-action-item>
  132. </uni-swipe-action>
  133. </view>
  134. <view class="newPlan" @click="newPlan()">新建计划</view>
  135. </view>
  136. <view v-else class="tipBox">
  137. <template v-if="isLoaded">
  138. <view class="dis_ffs" v-if="goodsList.length">
  139. <view class="tip">您暂无相关计划哦~</view>
  140. <view class="tipBtn" @click="newPlan()">马上制定</view>
  141. </view>
  142. <view class="dis_ffs" v-else>
  143. <view class="tip">您暂无课程可以制定计划哦~</view>
  144. <view class="tipBtn" @click="planNow()">马上选课</view>
  145. </view>
  146. </template>
  147. </view>
  148. </view>
  149. </template>
  150. <script>
  151. export default {
  152. data() {
  153. return {
  154. swiperIndex:0,
  155. isLoaded:false, //是否请求完毕
  156. monthIndex: 0,
  157. haveNextMonth: false,
  158. havePreviousMonth: false,
  159. showDayList: [],
  160. workList: [],
  161. swiperList:[],
  162. calendarStudyVo: {},
  163. index: 0,
  164. date: ['日', '一', '二', '三', '四', '五', '六'],
  165. list: [],
  166. isOpen: false,
  167. date_num: [
  168. {
  169. num: 20,
  170. color: 0,
  171. note: 0,
  172. dot: false
  173. },
  174. {
  175. num: 21,
  176. color: 1,
  177. note: 0,
  178. dot: false
  179. },
  180. {
  181. num: 22,
  182. color: 0,
  183. note: 0,
  184. dot: true
  185. },
  186. {
  187. num: 23,
  188. color: 2,
  189. note: 0,
  190. dot: false
  191. },
  192. {
  193. num: 24,
  194. color: 1,
  195. note: 0,
  196. dot: false
  197. },
  198. {
  199. num: 25,
  200. color: 3,
  201. note: 2,
  202. dot: false
  203. },
  204. {
  205. num: 26,
  206. color: 0,
  207. note: 1,
  208. dot: true
  209. }
  210. ],
  211. date_use: [],
  212. options: [
  213. {
  214. text: '取消',
  215. style: {
  216. backgroundColor: '#007aff'
  217. }
  218. },
  219. {
  220. text: '确认',
  221. style: {
  222. backgroundColor: '#dd524d'
  223. }
  224. }
  225. ],
  226. activeDate:'',
  227. dayStudyList: [],
  228. listItem: null,
  229. currentMonth: 0,
  230. havePlan: false,
  231. goodsList: [] //用户拥有的商品
  232. };
  233. },
  234. onLoad(option) {
  235. this.date_use = this.date_num;
  236. this.getUserGoodsList();
  237. },
  238. onShow() {
  239. this.workList = [];
  240. this.showDayList = [];
  241. // this.calendarStudyVo = {};
  242. this.isOpen = false;
  243. this.getList();
  244. },
  245. methods: {
  246. itemClick(item,index,swiperItem) {
  247. // console.log(item)
  248. this.activeDate = `${swiperItem.year}-${swiperItem.month}-${item.date}`;
  249. this.workList = this.getStudyCourseByDay(swiperItem);
  250. },
  251. /**
  252. * 根据选中日期获取需要学习的课程
  253. */
  254. getStudyCourseByDay(swiperItem) {
  255. let courseList = [];
  256. swiperItem.dayStudyList.forEach(day => {
  257. if(`${swiperItem.year}-${swiperItem.month}-${day.date}` == this.activeDate) {
  258. if(day.daySectionList) {
  259. day.daySectionList.forEach(section => {
  260. this.listItem.goodsVos.forEach(vos => {
  261. if(vos.goodsId == section.goodsId) {
  262. courseList.push(vos)
  263. }
  264. })
  265. })
  266. }
  267. }
  268. })
  269. console.log(courseList)
  270. return courseList;
  271. },
  272. planNow(){
  273. uni.switchTab({
  274. url: '/pages/course/index'
  275. });
  276. },
  277. getUserGoodsList() {
  278. this.$api.courseGoodsList().then(res => {
  279. if (res.data.code === 200) {
  280. this.isLoaded = true;
  281. this.goodsList = res.data.rows;
  282. }
  283. });
  284. },
  285. //删除计划
  286. delWorker(option) {
  287. var data = {
  288. planId: option.planId,
  289. status: -1
  290. };
  291. let self = this;
  292. this.$api.editsystemplan(data).then(res => {
  293. uni.setStorageSync('updateHome', 1);
  294. self.getList();
  295. });
  296. },
  297. swipeMonth(index) {
  298. this.swiperIndex = this.swiperIndex + index
  299. console.log(this.swiperIndex)
  300. // console.log(index,198)
  301. // this.isOpen = false;
  302. this.haveNextMonth = false;
  303. this.havePreviousMonth = false;
  304. // this.monthIndex = this.monthIndex + index;
  305. // this.currentMonth = this.currentMonth + index;
  306. // let item = this.listItem.calendarStudyVo[this.monthIndex];
  307. // this.calendarStudyVo = item;
  308. // this.activeDate = '';
  309. // // this.workList = this.calendarStudyVo.goodsVos;
  310. // this.workList = this.getStudyCourseByDay();
  311. if (this.swiperIndex > 0) {
  312. this.havePreviousMonth = true;
  313. }
  314. if (this.swiperIndex < this.swiperList.length - 1) {
  315. this.haveNextMonth = true;
  316. }
  317. // this.dealDayList();
  318. },
  319. dealMonth(isFirst) {
  320. this.swiperList = []
  321. let date = new Date();
  322. let currentMonth = date.getMonth() + 1;
  323. //初始化
  324. if(isFirst) {
  325. if (this.listItem != null) {
  326. this.swiperList = [];
  327. for (let i = 0; i < this.listItem.calendarStudyVo.length; i++) {
  328. let item = this.listItem.calendarStudyVo[i];
  329. let firstItem = item.dayStudyList[0]
  330. for (let j = 0; j < firstItem.studyDay; j++) {
  331. //补齐1号前的日数凑满一周
  332. item.dayStudyList.unshift({ date: 0 });
  333. }
  334. if (item.month == currentMonth) {
  335. this.swiperIndex = i;
  336. if (i > 0) {
  337. this.havePreviousMonth = true;
  338. }
  339. if (i < this.listItem.calendarStudyVo.length - 1) {
  340. this.haveNextMonth = true;
  341. }
  342. }
  343. for(let k = 0; k < item.dayStudyList.length; k += 7) {
  344. this.swiperList.push({
  345. dayStudyList:item.dayStudyList.slice(k,k+7),
  346. year: item.year,
  347. month: item.month
  348. })
  349. }
  350. }
  351. if(!this.calendarStudyVo.dayStudyList) { //计划没有当前月
  352. this.swiperIndex = 0;
  353. // this.calendarStudyVo = this.listItem.calendarStudyVo[0];
  354. if(this.swiperList.length > 1) {
  355. console.log('len')
  356. this.haveNextMonth = true;
  357. }
  358. }
  359. this.dealDayList()
  360. }
  361. } else { //非初始化
  362. if(this.isOpen) { //点击展开日历
  363. this.haveNextMonth = false;
  364. this.havePreviousMonth = false;
  365. this.swiperList = []
  366. if (this.listItem != null) {
  367. for (let i = 0; i < this.listItem.calendarStudyVo.length; i++) {
  368. let item = this.listItem.calendarStudyVo[i];
  369. let firstItem = item.dayStudyList[0]
  370. for (let i = 0; i < firstItem.studyDay; i++) {
  371. //补齐1号前的日数凑满一周
  372. item.dayStudyList.unshift({ date: 0 });
  373. }
  374. if (item.month == currentMonth) {
  375. this.swiperIndex = i;
  376. if (i > 0) {
  377. this.havePreviousMonth = true;
  378. }
  379. if (i < this.swiperList.length - 1) {
  380. this.haveNextMonth = true;
  381. }
  382. }
  383. this.swiperList.push(this.listItem.calendarStudyVo[i])
  384. }
  385. if(!this.calendarStudyVo.dayStudyList) { //计划没有当前月
  386. this.monthIndex = 0;
  387. // this.calendarStudyVo = this.listItem.calendarStudyVo[0];
  388. if(this.swiperList.length > 1) {
  389. console.log('len')
  390. this.haveNextMonth = true;
  391. }
  392. }
  393. console.log(this.swiperList)
  394. this.dealDayList();
  395. }
  396. } else { //点击收起日历
  397. this.swiperList = [];
  398. for (let i = 0; i < this.listItem.calendarStudyVo.length; i++) {
  399. let item = this.listItem.calendarStudyVo[i];
  400. let firstItem = item.dayStudyList[0]
  401. for (let j = 0; j < firstItem.studyDay; j++) {
  402. //补齐1号前的日数凑满一周
  403. item.dayStudyList.unshift({ date: 0 });
  404. }
  405. if (item.month == currentMonth) {
  406. this.swiperIndex = i;
  407. if (i > 0) {
  408. this.havePreviousMonth = true;
  409. }
  410. if (i < this.swiperList.length - 1) {
  411. this.haveNextMonth = true;
  412. }
  413. }
  414. for(let k = 0; k < item.dayStudyList.length; k += 7) {
  415. this.swiperList.push({
  416. dayStudyList:item.dayStudyList.slice(k,k+7),
  417. year: item.year,
  418. month: item.month
  419. })
  420. }
  421. }
  422. if(!this.calendarStudyVo.dayStudyList) { //计划没有当前月
  423. this.swiperIndex = 0;
  424. // this.calendarStudyVo = this.listItem.calendarStudyVo[0];
  425. if(this.swiperList.length > 1) {
  426. console.log('len')
  427. this.haveNextMonth = true;
  428. }
  429. }
  430. this.dealDayList()
  431. }
  432. }
  433. },
  434. openEdit(item) {
  435. this.activeDate = '';
  436. this.listItem = item;
  437. this.swiperIndex = 0;
  438. this.isOpen = false;
  439. this.dealMonth();
  440. },
  441. dealDayList() {
  442. this.swiperList.forEach((swiper,index) => {
  443. // let firstItem = swiper.dayStudyList[0]
  444. // for (let i = 0; i < firstItem.studyDay; i++) {
  445. // //补齐1号前的日数凑满一周
  446. // swiper.dayStudyList.unshift({ date: 0 });
  447. // }
  448. let date = new Date();
  449. let num = date.getDate();
  450. //如果不是当前月,默认显示第一周
  451. if ((date.getMonth() + 1) != swiper.month) {
  452. num = 1;
  453. }
  454. let todayIndex;
  455. let todayItem;
  456. for (let i = 0; i < swiper.dayStudyList.length; i++) {
  457. let item = swiper.dayStudyList[i];
  458. item.color = 0;
  459. if (item.date == num) {
  460. if (date.getMonth() + 1 == swiper.month) {
  461. item.color = 3;
  462. }
  463. todayIndex = i;
  464. todayItem = item;
  465. }
  466. if (item.perform == 1) {
  467. item.color = 1;
  468. }
  469. if (item.perform == 2) {
  470. item.color = 2;
  471. }
  472. let today = this.$method.getDate(); //获取当前日期
  473. let currentTime = this.$method.TimeTotimestamp(today.replace('-','/'))
  474. let dateTime = this.$method.TimeTotimestamp(`${swiper.year}/${swiper.month}/${item.date}`)
  475. item.note = item.studyCourseKnob;
  476. if ((item.note > 0) && (dateTime >= currentTime)) {
  477. item.dot = true;
  478. }
  479. }
  480. for (let i = 0; i < swiper.dayStudyList.length; i++) {
  481. let item = swiper.dayStudyList[i];
  482. if (item.note > 0) {
  483. item.note = 0;
  484. swiper.dayStudyList.forEach(day => {
  485. if(day.date == item.date) {
  486. if(day.daySectionList) {
  487. day.daySectionList.forEach(section => {
  488. this.listItem.goodsVos.forEach(vos => {
  489. if(vos.goodsId == section.goodsId) {
  490. item.note += vos.classHours
  491. }
  492. })
  493. })
  494. }
  495. }
  496. })
  497. }
  498. }
  499. })
  500. // let firstItem = this.calendarStudyVo.dayStudyList[0];
  501. // this.calendarStudyVo.miniDayStudyList = []; //创建缩放的数组
  502. // let date = new Date();
  503. // let num = date.getDate();
  504. // //如果不是当前月,默认显示第一周
  505. // if ((date.getMonth() + 1) != this.calendarStudyVo.month) {
  506. // num = 1;
  507. // }
  508. // for (let i = 0; i < firstItem.studyDay; i++) {
  509. // //补齐1号前的日数凑满一周
  510. // this.calendarStudyVo.dayStudyList.unshift({ date: 0 });
  511. // }
  512. // let todayIndex;
  513. // let todayItem;
  514. // for (let i = 0; i < this.calendarStudyVo.dayStudyList.length; i++) {
  515. // let item = this.calendarStudyVo.dayStudyList[i];
  516. // item.color = 0;
  517. // if (item.date == num) {
  518. // if (date.getMonth() + 1 == this.calendarStudyVo.month) {
  519. // item.color = 3;
  520. // }
  521. // todayIndex = i;
  522. // todayItem = item;
  523. // }
  524. // if (item.perform == 1) {
  525. // item.color = 1;
  526. // }
  527. // if (item.perform == 2) {
  528. // item.color = 2;
  529. // }
  530. // item.note = item.studyCourseKnob;
  531. // if (item.note > 0) {
  532. // item.dot = true;
  533. // }
  534. // }
  535. // let start
  536. // start = todayIndex - todayItem.studyDay;
  537. // /* if(todayItem){
  538. // }else{
  539. // //今天在下个月不存在,例如31号
  540. // todayIndex = this.calendarStudyVo.dayStudyList.length-1
  541. // todayItem = this.calendarStudyVo.dayStudyList[todayIndex]
  542. // start = todayIndex - todayItem.studyDay;
  543. // } */
  544. // /* if ((date.getMonth() + 1) != this.calendarStudyVo.month) {
  545. // todayIndex = 0
  546. // todayItem = this.calendarStudyVo.dayStudyList[todayIndex]
  547. // start = 0;
  548. // } */
  549. // console.log(start,689)
  550. // /* this.calendarStudyVo.miniDayStudyList = []
  551. // for(let i=start;i<start + 7;i++){
  552. // this.calendarStudyVo.miniDayStudyList.push(this.calendarStudyVo.dayStudyList[i])
  553. // } */
  554. // console.log(this.calendarStudyVo.miniDayStudyList,789)
  555. // this.calendarStudyVo.miniDayStudyList = this.calendarStudyVo.dayStudyList.slice(start, start + 7);
  556. // this.showDayList = this.calendarStudyVo.miniDayStudyList;
  557. // console.log(this.showDayList)
  558. // for (let i = 0; i < this.calendarStudyVo.dayStudyList.length; i++) {
  559. // let item = this.calendarStudyVo.dayStudyList[i];
  560. // if (item.note > 0) {
  561. // item.note = 0;
  562. // this.showDayList.forEach(day => {
  563. // if(day.date == item.date) {
  564. // if(day.daySectionList) {
  565. // day.daySectionList.forEach(section => {
  566. // this.listItem.goodsVos.forEach(vos => {
  567. // if(vos.goodsId == section.goodsId) {
  568. // item.note += vos.classHours
  569. // }
  570. // })
  571. // })
  572. // }
  573. // }
  574. // })
  575. // }
  576. // }
  577. },
  578. async jumpDetail(item) {
  579. let currentTime = this.$method.timest();
  580. if(currentTime < item.studyStartTime || currentTime > item.studyEndTime) {
  581. uni.showToast({
  582. title:'不在学习有效期,不可以学习了哦',
  583. icon:'none'
  584. })
  585. return;
  586. }
  587. if( (item.classStartTime && currentTime <= item.classStartTime) || (item.classEndTime && currentTime >= item.classEndTime) ) {
  588. uni.showToast({
  589. title:'不在班级有效期,不能进入学习',
  590. icon:'none'
  591. })
  592. return;
  593. }
  594. if(item.learningStatus == 2) {
  595. uni.showToast({
  596. title:'开放学习时间待定,不能进入学习',
  597. icon:'none'
  598. })
  599. return;
  600. }
  601. if(item.classStatus == 0 ) {
  602. uni.showToast({
  603. title:'尚未开班,不能进入学习',
  604. icon:'none'
  605. })
  606. return;
  607. }
  608. if(item.learningStatus == 3 && (currentTime < item.learningTimeStart) ) {
  609. uni.showToast({
  610. title:'不在开放学习时间,不能进入学习',
  611. icon:'none'
  612. })
  613. return;
  614. }
  615. if(item.gradeStatus == 1 && item.status == 1 && (item.studyEndTime > currentTime) && (item.classEndTime && (item.classEndTime < currentTime)) && (item.periodStatus == 0 || item.periodStatus == -1) && item.studyCount > 0) {
  616. uni.showModal({
  617. title:'提示',
  618. content:'班级已过期,需要重新选班',
  619. showCancel:false,
  620. success:() => {
  621. uni.navigateTo({
  622. url:"/pages2/wd/class"
  623. })
  624. }
  625. })
  626. return;
  627. }
  628. let rebuildStatus = await this.courseGoodsRebuildStatus(item.goodsId,item.gradeId);
  629. if(rebuildStatus == 0) {
  630. this.$navTo.togo('/pages2/learn/details', {
  631. gradeId:item.gradeId,
  632. goodsId: item.goodsId
  633. })
  634. return;
  635. }
  636. if(item.courseNum == 1 ) {
  637. this.$api.courseCourseList({
  638. pageNum:1,
  639. pageSize:1,
  640. goodsId:item.goodsId,
  641. gradeId:item.gradeId
  642. }).then(res => {
  643. if(res.data.code == 200) {
  644. uni.navigateTo({
  645. url:`/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${item.goodsId}`
  646. })
  647. }
  648. });
  649. return;
  650. }
  651. this.$navTo.togo('/pages2/wd/course', {
  652. id: item.goodsId,
  653. gid:item.gradeId
  654. });
  655. return;
  656. },
  657. /**
  658. * @param {Object} goodsId 商品id
  659. * 查询商品重修状态
  660. */
  661. courseGoodsRebuildStatus(goodsId,gradeId) {
  662. return new Promise(resolve => {
  663. this.$api.courseGoodsRebuildStatus({
  664. goodsId:goodsId,
  665. gradeId:gradeId
  666. }).then(res => {
  667. resolve(res.data.data)
  668. })
  669. })
  670. },
  671. replay(index) {
  672. if (index == 0) {
  673. return '日';
  674. }
  675. if (index == 1) {
  676. return '一';
  677. }
  678. if (index == 2) {
  679. return '二';
  680. }
  681. if (index == 3) {
  682. return '三';
  683. }
  684. if (index == 4) {
  685. return '四';
  686. }
  687. if (index == 5) {
  688. return '五';
  689. }
  690. if (index == 6) {
  691. return '六';
  692. }
  693. },
  694. getList() {
  695. let self = this;
  696. this.$api.getsystemplanlist({ status: 1 }).then(result => {
  697. result.data.rows.forEach((item, index) => {
  698. item.show = 'none';
  699. item.studyNum = 0;
  700. item.pitchNum = 0;
  701. item.goodsVos.forEach(vos => {
  702. item.pitchNum += vos.secAllNum
  703. item.studyNum += vos.stuAllNum
  704. })
  705. });
  706. self.list = result.data.rows;
  707. if (result.data.rows.length > 0) {
  708. self.listItem = self.list[0];
  709. self.dealMonth(true);
  710. self.havePlan = true;
  711. // if (self.list.length > 0) {
  712. // self.listItem = self.list[0];
  713. // self.dealMonth();
  714. // self.havePlan = true;
  715. // }
  716. } else {
  717. self.havePlan = false;
  718. }
  719. self.updateHomePlan();
  720. });
  721. },
  722. updateHomePlan() {
  723. /* const pages = getCurrentPages(); //获取页面栈
  724. const beforePage = pages[pages.length - 2]; //前一个页面
  725. beforePage.$vm.updateHomePlan(); */
  726. },
  727. newPlan() {
  728. this.$navTo.togo('/pages2/plan/create');
  729. },
  730. edit(item) {
  731. this.$navTo.togo('/pages2/plan/edit', {
  732. id: item.planId
  733. });
  734. },
  735. swipeChange(e, item) {
  736. item.show = e;
  737. },
  738. openShow(item) {
  739. if (item.show == 'none') {
  740. item.show = 'right';
  741. } else {
  742. item.show = 'none';
  743. }
  744. },
  745. updateHomePlan() {
  746. const pages = getCurrentPages(); //获取页面栈
  747. const beforePage = pages[pages.length - 2]; //前一个页面
  748. // beforePage.$vm.updateHomePlan();
  749. },
  750. close_calendar() {
  751. this.isOpen = false;
  752. this.dealMonth();
  753. this.showDayList = this.calendarStudyVo.miniDayStudyList;
  754. },
  755. oepn_calendar() {
  756. this.isOpen = true;
  757. this.dealMonth();
  758. this.showDayList = this.calendarStudyVo.dayStudyList;
  759. },
  760. random(min, max) {
  761. return Math.floor(Math.random() * (max - min)) + min;
  762. }
  763. }
  764. };
  765. </script>
  766. <style scope lang="scss">
  767. .dis_ffs {
  768. display: flex;
  769. flex-direction: column;
  770. align-items: center;
  771. justify-content: center;
  772. }
  773. .tipBtn {
  774. width: 160rpx;
  775. height: 56rpx;
  776. background: #007aff;
  777. border-radius: 16rpx;
  778. color: #ffffff;
  779. text-align: center;
  780. line-height: 56rpx;
  781. margin-top: 30rpx;
  782. }
  783. .tipBox {
  784. display: flex;
  785. align-items: center; /*垂直居中*/
  786. justify-content: center; /*水平居中*/
  787. flex-direction: column;
  788. margin-top: 40%;
  789. }
  790. .tip {
  791. color: #999999;
  792. font-size: 32rpx;
  793. }
  794. .newPlan {
  795. width: 200rpx;
  796. height: 64rpx;
  797. background: #ffffff;
  798. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(47, 67, 121, 0.15);
  799. border-radius: 32rpx;
  800. font-size: 24rpx;
  801. font-family: PingFang SC;
  802. font-weight: bold;
  803. color: #32467b;
  804. text-align: center;
  805. line-height: 64rpx;
  806. position: fixed;
  807. bottom: 60rpx;
  808. left: 50%;
  809. transform: translateX(-50%);
  810. }
  811. .operate_img3 {
  812. background: #3478f6;
  813. }
  814. .operate_img2 {
  815. background: #f09a37;
  816. }
  817. .operate_img1 {
  818. background: #eb4d3d;
  819. }
  820. .operate_img {
  821. width: 64rpx;
  822. height: 64rpx;
  823. border-radius: 50%;
  824. padding:14rpx;
  825. box-sizing: border-box;
  826. margin: 10rpx 0;
  827. }
  828. .operate {
  829. margin-top:16rpx;
  830. width: 80rpx;
  831. display: flex;
  832. flex-direction: column;
  833. align-items: center;
  834. justify-content: center;
  835. }
  836. .item_t2 {
  837. font-size: 23rpx;
  838. color: #32467b;
  839. }
  840. .item_date {
  841. width: 26rpx;
  842. height: 26rpx;
  843. background: #007AFF;
  844. border-radius: 50%;
  845. margin-left: 20rpx;
  846. font-size: 18rpx;
  847. color: #fefeff;
  848. text-align: center;
  849. }
  850. .r_t2 {
  851. font-size: 20rpx;
  852. font-family: PingFang SC;
  853. font-weight: 400;
  854. color: #0c141f;
  855. white-space: pre-wrap;
  856. }
  857. .r_image {
  858. width: 278rpx;
  859. height: 134rpx;
  860. border-radius: 16rpx;
  861. }
  862. .img_more {
  863. width: 26rpx;
  864. height: 26rpx;
  865. }
  866. .item_t1 {
  867. font-size: 30rpx;
  868. font-family: PingFang SC;
  869. font-weight: 500;
  870. color: #32467b;
  871. }
  872. .list_item_bac1 {
  873. background: linear-gradient(45deg, rgba(172, 203, 238, 0.2), rgba(231, 240, 253, 0.2));
  874. }
  875. .list_item_bac2 {
  876. background: linear-gradient(45deg, rgba(255, 232, 206, 0.3), rgba(251, 184, 160, 0.3));
  877. }
  878. .list_item {
  879. width: 100%;
  880. min-height: 418rpx;
  881. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(47, 67, 121, 0.05);
  882. border-radius: 24rpx;
  883. margin-top: 16rpx;
  884. padding: 15rpx;
  885. background:#fff;
  886. }
  887. .date_dot {
  888. width: 6rpx;
  889. height: 6rpx;
  890. background: #ffcc00;
  891. border-radius: 50%;
  892. margin: 0 auto;
  893. }
  894. .date_note {
  895. border-radius: 15rpx;
  896. padding:0 5rpx;
  897. min-width:50rpx;
  898. height: 29rpx;
  899. line-height: 25rpx;
  900. border: 1px solid #ffcc00;
  901. font-size: 18rpx;
  902. color: #ffcc00;
  903. text-align: center;
  904. display: inline-block;
  905. position: absolute;
  906. top: -19rpx;
  907. left: 80%;
  908. }
  909. .circle_num {
  910. border-radius: 15rpx;
  911. padding:0 5rpx;
  912. min-width:50rpx;
  913. height: 29rpx;
  914. border: 1px solid #ffcc00;
  915. font-size: 18rpx;
  916. color: #ffcc00;
  917. text-align: center;
  918. display: inline-block;
  919. margin: 5rpx;
  920. }
  921. .date_t2 {
  922. font-size: 30rpx;
  923. font-family: PingFang SC;
  924. font-weight: 500;
  925. color: #2f4379;
  926. }
  927. .date_line_close {
  928. width: 40rpx;
  929. height: 20rpx;
  930. }
  931. .date_line {
  932. width: 40rpx;
  933. height: 6rpx;
  934. background: #7f8caf;
  935. border-radius: 2rpx;
  936. }
  937. .date_num {
  938. width: 14%;
  939. text-align: center;
  940. position: relative;
  941. display: inline-block;
  942. margin-top: 20rpx;
  943. }
  944. .date_num_color0 {
  945. position:relative;
  946. display: inline-block;
  947. width: 48rpx;
  948. height: 48rpx;
  949. line-height: 48rpx;
  950. text-align: center;
  951. color: #32467b;
  952. }
  953. .date_num_color1 {
  954. position:relative;
  955. display: inline-block;
  956. width: 48rpx;
  957. height: 48rpx;
  958. line-height: 48rpx;
  959. text-align: center;
  960. color: #34c759;
  961. }
  962. .date_num_color2 {
  963. position:relative;
  964. display: inline-block;
  965. width: 48rpx;
  966. height: 48rpx;
  967. line-height: 48rpx;
  968. text-align: center;
  969. color: #ff3b30;
  970. }
  971. .date_num_color3 {
  972. position:relative;
  973. color: #007AFF;
  974. background-color: rgba(229,241,255,1);
  975. border-radius: 50%;
  976. width: 48rpx;
  977. height: 48rpx;
  978. line-height: 48rpx;
  979. text-align: center;
  980. display: inline-block;
  981. }
  982. .active_color{
  983. color: #fff;
  984. background-color: #007AFF;
  985. border-radius: 50%;
  986. width: 48rpx;
  987. height: 48rpx;
  988. line-height: 48rpx;
  989. text-align: center;
  990. display: inline-block;
  991. }
  992. .card_date {
  993. width: 14%;
  994. text-align: center;
  995. color: #7f8caf;
  996. position: relative;
  997. display: inline-block;
  998. }
  999. .date_t1 {
  1000. font-size: 24rpx;
  1001. font-family: PingFang SC;
  1002. font-weight: bold;
  1003. color: #2f4379;
  1004. width: 100%;
  1005. text-align: center;
  1006. padding: 20rpx 0;
  1007. }
  1008. .card {
  1009. width: 100%;
  1010. background: #ffffff;
  1011. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(47, 67, 121, 0.05);
  1012. border-radius: 24rpx;
  1013. padding-bottom:20rpx;
  1014. .swiper {
  1015. height:550rpx;
  1016. }
  1017. }
  1018. page {
  1019. background: rgba(234,238,241,1);
  1020. }
  1021. </style>