index.vue 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084
  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'}" @change="swiperChange" 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. swiperChange(e) {
  320. this.swiperIndex = e.detail.current;
  321. this.haveNextMonth = false;
  322. this.havePreviousMonth = false;
  323. if (this.swiperIndex > 0) {
  324. this.havePreviousMonth = true;
  325. }
  326. if (this.swiperIndex < this.swiperList.length - 1) {
  327. this.haveNextMonth = true;
  328. }
  329. },
  330. dealMonth(isFirst) {
  331. //初始化
  332. if(isFirst) {
  333. if (this.listItem != null) {
  334. this.swiperList = [];
  335. this.swiperIndex = 0;
  336. for (let i = 0; i < this.listItem.calendarStudyVo.length; i++) {
  337. let item = this.listItem.calendarStudyVo[i];
  338. let firstItem = item.dayStudyList[0]
  339. for (let j = 0; j < firstItem.studyDay; j++) {
  340. //补齐1号前的日数凑满一周
  341. item.dayStudyList.unshift({ date: 0 });
  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. let date = new Date();
  352. let currentMonth = date.getMonth() + 1;
  353. for(let i = 0; i < this.swiperList.length; i++) {
  354. if(this.swiperList[i].month == currentMonth) {
  355. this.swiperIndex = i;
  356. if (i > 0) {
  357. this.havePreviousMonth = true;
  358. }
  359. if (i < this.swiperList.length - 1) {
  360. this.haveNextMonth = true;
  361. }
  362. break;
  363. }
  364. }
  365. this.dealDayList()
  366. }
  367. } else { //非初始化
  368. if(this.isOpen) { //点击展开日历
  369. this.haveNextMonth = false;
  370. this.havePreviousMonth = false;
  371. let currentMonth = this.listItem.calendarStudyVo.find(item => item.month == this.swiperList[this.swiperIndex].month).month;
  372. this.swiperList = []
  373. // this.swiperList = [];
  374. if (this.listItem != null) {
  375. for (let i = 0; i < this.listItem.calendarStudyVo.length; i++) {
  376. let item = this.listItem.calendarStudyVo[i];
  377. let firstItem = item.dayStudyList[0]
  378. for (let j = 0; j < firstItem.studyDay; j++) {
  379. //补齐1号前的日数凑满一周
  380. item.dayStudyList.unshift({ date: 0 });
  381. }
  382. console.log(currentMonth)
  383. if (item.month == currentMonth) {
  384. this.swiperIndex = i;
  385. if (i > 0) {
  386. this.havePreviousMonth = true;
  387. }
  388. if (i < this.listItem.calendarStudyVo.length - 1) {
  389. this.haveNextMonth = true;
  390. }
  391. }
  392. this.swiperList.push(this.listItem.calendarStudyVo[i])
  393. }
  394. this.dealDayList();
  395. }
  396. } else { //点击收起日历
  397. let currentMonth = this.listItem.calendarStudyVo.find(item => item.month == this.swiperList[this.swiperIndex].month).month;
  398. this.swiperList = [];
  399. for (let i = 0; i < this.listItem.calendarStudyVo.length; i++) {
  400. let item = this.listItem.calendarStudyVo[i];
  401. let firstItem = item.dayStudyList[0]
  402. for (let j = 0; j < firstItem.studyDay; j++) {
  403. //补齐1号前的日数凑满一周
  404. item.dayStudyList.unshift({ date: 0 });
  405. }
  406. //构建日历表
  407. for(let k = 0; k < item.dayStudyList.length; k += 7) {
  408. this.swiperList.push({
  409. dayStudyList:item.dayStudyList.slice(k,k+7),
  410. year: item.year,
  411. month: item.month
  412. })
  413. }
  414. }
  415. for(let i = 0; i < this.swiperList.length; i++) {
  416. if(this.swiperList[i].month == currentMonth) {
  417. this.swiperIndex = i;
  418. if (i > 0) {
  419. this.havePreviousMonth = true;
  420. }
  421. if (i < this.swiperList.length - 1) {
  422. this.haveNextMonth = true;
  423. }
  424. break;
  425. }
  426. }
  427. console.log(this.swiperIndex,'this.swiperIndex')
  428. this.dealDayList()
  429. }
  430. }
  431. },
  432. openEdit(item) {
  433. this.activeDate = '';
  434. this.listItem = item;
  435. this.swiperIndex = 0;
  436. this.isOpen = false;
  437. this.dealMonth(true);
  438. },
  439. dealDayList() {
  440. this.swiperList.forEach((swiper,index) => {
  441. // let firstItem = swiper.dayStudyList[0]
  442. // for (let i = 0; i < firstItem.studyDay; i++) {
  443. // //补齐1号前的日数凑满一周
  444. // swiper.dayStudyList.unshift({ date: 0 });
  445. // }
  446. let date = new Date();
  447. let num = date.getDate();
  448. //如果不是当前月,默认显示第一周
  449. if ((date.getMonth() + 1) != swiper.month) {
  450. num = 1;
  451. }
  452. let todayIndex;
  453. let todayItem;
  454. for (let i = 0; i < swiper.dayStudyList.length; i++) {
  455. let item = swiper.dayStudyList[i];
  456. item.color = 0;
  457. if (item.date == num) {
  458. if (date.getMonth() + 1 == swiper.month) {
  459. item.color = 3;
  460. }
  461. todayIndex = i;
  462. todayItem = item;
  463. }
  464. if (item.perform == 1) {
  465. item.color = 1;
  466. }
  467. if (item.perform == 2) {
  468. item.color = 2;
  469. }
  470. let today = this.$method.getDate(); //获取当前日期
  471. let currentTime = this.$method.TimeTotimestamp(today.replace('-','/'))
  472. let dateTime = this.$method.TimeTotimestamp(`${swiper.year}/${swiper.month}/${item.date}`)
  473. item.note = item.studyCourseKnob;
  474. if ((item.note > 0) && (dateTime >= currentTime)) {
  475. item.dot = true;
  476. }
  477. }
  478. for (let i = 0; i < swiper.dayStudyList.length; i++) {
  479. let item = swiper.dayStudyList[i];
  480. if (item.note > 0) {
  481. item.note = 0;
  482. swiper.dayStudyList.forEach(day => {
  483. if(day.date == item.date) {
  484. if(day.daySectionList) {
  485. day.daySectionList.forEach(section => {
  486. this.listItem.goodsVos.forEach(vos => {
  487. if(vos.goodsId == section.goodsId) {
  488. item.note += vos.classHours
  489. }
  490. })
  491. })
  492. }
  493. }
  494. })
  495. }
  496. }
  497. })
  498. // let firstItem = this.calendarStudyVo.dayStudyList[0];
  499. // this.calendarStudyVo.miniDayStudyList = []; //创建缩放的数组
  500. // let date = new Date();
  501. // let num = date.getDate();
  502. // //如果不是当前月,默认显示第一周
  503. // if ((date.getMonth() + 1) != this.calendarStudyVo.month) {
  504. // num = 1;
  505. // }
  506. // for (let i = 0; i < firstItem.studyDay; i++) {
  507. // //补齐1号前的日数凑满一周
  508. // this.calendarStudyVo.dayStudyList.unshift({ date: 0 });
  509. // }
  510. // let todayIndex;
  511. // let todayItem;
  512. // for (let i = 0; i < this.calendarStudyVo.dayStudyList.length; i++) {
  513. // let item = this.calendarStudyVo.dayStudyList[i];
  514. // item.color = 0;
  515. // if (item.date == num) {
  516. // if (date.getMonth() + 1 == this.calendarStudyVo.month) {
  517. // item.color = 3;
  518. // }
  519. // todayIndex = i;
  520. // todayItem = item;
  521. // }
  522. // if (item.perform == 1) {
  523. // item.color = 1;
  524. // }
  525. // if (item.perform == 2) {
  526. // item.color = 2;
  527. // }
  528. // item.note = item.studyCourseKnob;
  529. // if (item.note > 0) {
  530. // item.dot = true;
  531. // }
  532. // }
  533. // let start
  534. // start = todayIndex - todayItem.studyDay;
  535. // /* if(todayItem){
  536. // }else{
  537. // //今天在下个月不存在,例如31号
  538. // todayIndex = this.calendarStudyVo.dayStudyList.length-1
  539. // todayItem = this.calendarStudyVo.dayStudyList[todayIndex]
  540. // start = todayIndex - todayItem.studyDay;
  541. // } */
  542. // /* if ((date.getMonth() + 1) != this.calendarStudyVo.month) {
  543. // todayIndex = 0
  544. // todayItem = this.calendarStudyVo.dayStudyList[todayIndex]
  545. // start = 0;
  546. // } */
  547. // console.log(start,689)
  548. // /* this.calendarStudyVo.miniDayStudyList = []
  549. // for(let i=start;i<start + 7;i++){
  550. // this.calendarStudyVo.miniDayStudyList.push(this.calendarStudyVo.dayStudyList[i])
  551. // } */
  552. // console.log(this.calendarStudyVo.miniDayStudyList,789)
  553. // this.calendarStudyVo.miniDayStudyList = this.calendarStudyVo.dayStudyList.slice(start, start + 7);
  554. // this.showDayList = this.calendarStudyVo.miniDayStudyList;
  555. // console.log(this.showDayList)
  556. // for (let i = 0; i < this.calendarStudyVo.dayStudyList.length; i++) {
  557. // let item = this.calendarStudyVo.dayStudyList[i];
  558. // if (item.note > 0) {
  559. // item.note = 0;
  560. // this.showDayList.forEach(day => {
  561. // if(day.date == item.date) {
  562. // if(day.daySectionList) {
  563. // day.daySectionList.forEach(section => {
  564. // this.listItem.goodsVos.forEach(vos => {
  565. // if(vos.goodsId == section.goodsId) {
  566. // item.note += vos.classHours
  567. // }
  568. // })
  569. // })
  570. // }
  571. // }
  572. // })
  573. // }
  574. // }
  575. },
  576. async jumpDetail(item) {
  577. let currentTime = this.$method.timest();
  578. if(currentTime < item.studyStartTime || currentTime > item.studyEndTime) {
  579. uni.showToast({
  580. title:'不在学习有效期,不可以学习了哦',
  581. icon:'none'
  582. })
  583. return;
  584. }
  585. if( (item.classStartTime && currentTime <= item.classStartTime) || (item.classEndTime && currentTime >= item.classEndTime) ) {
  586. uni.showToast({
  587. title:'不在班级有效期,不能进入学习',
  588. icon:'none'
  589. })
  590. return;
  591. }
  592. if(item.learningStatus == 2) {
  593. uni.showToast({
  594. title:'开放学习时间待定,不能进入学习',
  595. icon:'none'
  596. })
  597. return;
  598. }
  599. if(item.classStatus == 0 ) {
  600. uni.showToast({
  601. title:'尚未开班,不能进入学习',
  602. icon:'none'
  603. })
  604. return;
  605. }
  606. if(item.learningStatus == 3 && (currentTime < item.learningTimeStart) ) {
  607. uni.showToast({
  608. title:'不在开放学习时间,不能进入学习',
  609. icon:'none'
  610. })
  611. return;
  612. }
  613. if(item.gradeStatus == 1 && item.status == 1 && (item.studyEndTime > currentTime) && (item.classEndTime && (item.classEndTime < currentTime)) && (item.periodStatus == 0 || item.periodStatus == -1) && item.studyCount > 0) {
  614. uni.showModal({
  615. title:'提示',
  616. content:'班级已过期,需要重新选班',
  617. showCancel:false,
  618. success:() => {
  619. uni.navigateTo({
  620. url:"/pages2/wd/class"
  621. })
  622. }
  623. })
  624. return;
  625. }
  626. let rebuildStatus = await this.courseGoodsRebuildStatus(item.goodsId,item.gradeId);
  627. if(rebuildStatus == 0) {
  628. this.$navTo.togo('/pages2/learn/details', {
  629. gradeId:item.gradeId,
  630. goodsId: item.goodsId
  631. })
  632. return;
  633. }
  634. if(item.courseNum == 1 ) {
  635. this.$api.courseCourseList({
  636. pageNum:1,
  637. pageSize:1,
  638. goodsId:item.goodsId,
  639. gradeId:item.gradeId
  640. }).then(res => {
  641. if(res.data.code == 200) {
  642. uni.navigateTo({
  643. url:`/pages3/polyv/detail?id=${res.data.rows[0].courseId}&goodsId=${item.goodsId}&gradeId=${item.gradeId}`
  644. })
  645. }
  646. });
  647. return;
  648. }
  649. // this.$navTo.togo('/pages2/wd/course', {
  650. // id: item.goodsId,
  651. // gid:item.gradeId
  652. // });
  653. uni.navigateTo({
  654. url: `/pages3/polyv/detail?id=''&goodsId=${item.goodsId}&gradeId=${item.gradeId}`
  655. })
  656. return;
  657. },
  658. /**
  659. * @param {Object} goodsId 商品id
  660. * 查询商品重修状态
  661. */
  662. courseGoodsRebuildStatus(goodsId,gradeId) {
  663. return new Promise(resolve => {
  664. this.$api.courseGoodsRebuildStatus({
  665. goodsId:goodsId,
  666. gradeId:gradeId
  667. }).then(res => {
  668. resolve(res.data.data)
  669. })
  670. })
  671. },
  672. replay(index) {
  673. if (index == 0) {
  674. return '日';
  675. }
  676. if (index == 1) {
  677. return '一';
  678. }
  679. if (index == 2) {
  680. return '二';
  681. }
  682. if (index == 3) {
  683. return '三';
  684. }
  685. if (index == 4) {
  686. return '四';
  687. }
  688. if (index == 5) {
  689. return '五';
  690. }
  691. if (index == 6) {
  692. return '六';
  693. }
  694. },
  695. getList() {
  696. let self = this;
  697. this.$api.getsystemplanlist({ status: 1 }).then(result => {
  698. result.data.rows.forEach((item, index) => {
  699. item.show = 'none';
  700. item.studyNum = 0;
  701. item.pitchNum = 0;
  702. item.goodsVos.forEach(vos => {
  703. item.pitchNum += vos.secAllNum
  704. item.studyNum += vos.stuAllNum
  705. })
  706. });
  707. self.list = result.data.rows;
  708. if (result.data.rows.length > 0) {
  709. self.listItem = self.list[0];
  710. self.dealMonth(true);
  711. self.havePlan = true;
  712. // if (self.list.length > 0) {
  713. // self.listItem = self.list[0];
  714. // self.dealMonth();
  715. // self.havePlan = true;
  716. // }
  717. } else {
  718. self.havePlan = false;
  719. }
  720. self.updateHomePlan();
  721. });
  722. },
  723. updateHomePlan() {
  724. /* const pages = getCurrentPages(); //获取页面栈
  725. const beforePage = pages[pages.length - 2]; //前一个页面
  726. beforePage.$vm.updateHomePlan(); */
  727. },
  728. newPlan() {
  729. this.$navTo.togo('/pages2/plan/create');
  730. },
  731. edit(item) {
  732. this.$navTo.togo('/pages2/plan/edit', {
  733. id: item.planId
  734. });
  735. },
  736. swipeChange(e, item) {
  737. item.show = e;
  738. },
  739. openShow(item) {
  740. if (item.show == 'none') {
  741. item.show = 'right';
  742. } else {
  743. item.show = 'none';
  744. }
  745. },
  746. updateHomePlan() {
  747. const pages = getCurrentPages(); //获取页面栈
  748. const beforePage = pages[pages.length - 2]; //前一个页面
  749. // beforePage.$vm.updateHomePlan();
  750. },
  751. close_calendar() {
  752. this.isOpen = false;
  753. this.dealMonth();
  754. this.showDayList = this.calendarStudyVo.miniDayStudyList;
  755. },
  756. oepn_calendar() {
  757. this.isOpen = true;
  758. this.dealMonth();
  759. this.showDayList = this.calendarStudyVo.dayStudyList;
  760. },
  761. random(min, max) {
  762. return Math.floor(Math.random() * (max - min)) + min;
  763. }
  764. }
  765. };
  766. </script>
  767. <style scope lang="scss">
  768. .dis_ffs {
  769. display: flex;
  770. flex-direction: column;
  771. align-items: center;
  772. justify-content: center;
  773. }
  774. .tipBtn {
  775. width: 160rpx;
  776. height: 56rpx;
  777. background: #007aff;
  778. border-radius: 16rpx;
  779. color: #ffffff;
  780. text-align: center;
  781. line-height: 56rpx;
  782. margin-top: 30rpx;
  783. }
  784. .tipBox {
  785. display: flex;
  786. align-items: center; /*垂直居中*/
  787. justify-content: center; /*水平居中*/
  788. flex-direction: column;
  789. margin-top: 40%;
  790. }
  791. .tip {
  792. color: #999999;
  793. font-size: 32rpx;
  794. }
  795. .newPlan {
  796. width: 200rpx;
  797. height: 64rpx;
  798. background: #ffffff;
  799. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(47, 67, 121, 0.15);
  800. border-radius: 32rpx;
  801. font-size: 24rpx;
  802. font-family: PingFang SC;
  803. font-weight: bold;
  804. color: #32467b;
  805. text-align: center;
  806. line-height: 64rpx;
  807. position: fixed;
  808. bottom: 60rpx;
  809. left: 50%;
  810. transform: translateX(-50%);
  811. }
  812. .operate_img3 {
  813. background: #3478f6;
  814. }
  815. .operate_img2 {
  816. background: #f09a37;
  817. }
  818. .operate_img1 {
  819. background: #eb4d3d;
  820. }
  821. .operate_img {
  822. width: 64rpx;
  823. height: 64rpx;
  824. border-radius: 50%;
  825. padding:14rpx;
  826. box-sizing: border-box;
  827. margin: 10rpx 0;
  828. }
  829. .operate {
  830. margin-top:16rpx;
  831. width: 80rpx;
  832. display: flex;
  833. flex-direction: column;
  834. align-items: center;
  835. justify-content: center;
  836. }
  837. .item_t2 {
  838. font-size: 23rpx;
  839. color: #32467b;
  840. }
  841. .item_date {
  842. width: 26rpx;
  843. height: 26rpx;
  844. background: #007AFF;
  845. border-radius: 50%;
  846. margin-left: 20rpx;
  847. font-size: 18rpx;
  848. color: #fefeff;
  849. text-align: center;
  850. }
  851. .r_t2 {
  852. font-size: 20rpx;
  853. font-family: PingFang SC;
  854. font-weight: 400;
  855. color: #0c141f;
  856. white-space: pre-wrap;
  857. }
  858. .r_image {
  859. width: 278rpx;
  860. height: 134rpx;
  861. border-radius: 16rpx;
  862. }
  863. .img_more {
  864. width: 26rpx;
  865. height: 26rpx;
  866. }
  867. .item_t1 {
  868. font-size: 30rpx;
  869. font-family: PingFang SC;
  870. font-weight: 500;
  871. color: #32467b;
  872. }
  873. .list_item_bac1 {
  874. background: linear-gradient(45deg, rgba(172, 203, 238, 0.2), rgba(231, 240, 253, 0.2));
  875. }
  876. .list_item_bac2 {
  877. background: linear-gradient(45deg, rgba(255, 232, 206, 0.3), rgba(251, 184, 160, 0.3));
  878. }
  879. .list_item {
  880. width: 100%;
  881. min-height: 418rpx;
  882. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(47, 67, 121, 0.05);
  883. border-radius: 24rpx;
  884. margin-top: 16rpx;
  885. padding: 15rpx;
  886. background:#fff;
  887. }
  888. .date_dot {
  889. width: 6rpx;
  890. height: 6rpx;
  891. background: #ffcc00;
  892. border-radius: 50%;
  893. margin: 0 auto;
  894. }
  895. .date_note {
  896. border-radius: 15rpx;
  897. padding:0 5rpx;
  898. min-width:50rpx;
  899. height: 29rpx;
  900. line-height: 25rpx;
  901. border: 1px solid #ffcc00;
  902. font-size: 18rpx;
  903. color: #ffcc00;
  904. text-align: center;
  905. display: inline-block;
  906. position: absolute;
  907. top: -19rpx;
  908. left: 80%;
  909. }
  910. .circle_num {
  911. border-radius: 15rpx;
  912. padding:0 5rpx;
  913. min-width:50rpx;
  914. height: 29rpx;
  915. border: 1px solid #ffcc00;
  916. font-size: 18rpx;
  917. color: #ffcc00;
  918. text-align: center;
  919. display: inline-block;
  920. margin: 5rpx;
  921. }
  922. .date_t2 {
  923. font-size: 30rpx;
  924. font-family: PingFang SC;
  925. font-weight: 500;
  926. color: #2f4379;
  927. }
  928. .date_line_close {
  929. width: 40rpx;
  930. height: 20rpx;
  931. }
  932. .date_line {
  933. width: 40rpx;
  934. height: 6rpx;
  935. background: #7f8caf;
  936. border-radius: 2rpx;
  937. }
  938. .date_num {
  939. width: 14%;
  940. text-align: center;
  941. position: relative;
  942. display: inline-block;
  943. margin-top: 20rpx;
  944. }
  945. .date_num_color0 {
  946. position:relative;
  947. display: inline-block;
  948. width: 48rpx;
  949. height: 48rpx;
  950. line-height: 48rpx;
  951. text-align: center;
  952. color: #32467b;
  953. }
  954. .date_num_color1 {
  955. position:relative;
  956. display: inline-block;
  957. width: 48rpx;
  958. height: 48rpx;
  959. line-height: 48rpx;
  960. text-align: center;
  961. color: #34c759;
  962. }
  963. .date_num_color2 {
  964. position:relative;
  965. display: inline-block;
  966. width: 48rpx;
  967. height: 48rpx;
  968. line-height: 48rpx;
  969. text-align: center;
  970. color: #ff3b30;
  971. }
  972. .date_num_color3 {
  973. position:relative;
  974. color: #007AFF;
  975. background-color: rgba(229,241,255,1);
  976. border-radius: 50%;
  977. width: 48rpx;
  978. height: 48rpx;
  979. line-height: 48rpx;
  980. text-align: center;
  981. display: inline-block;
  982. }
  983. .active_color{
  984. color: #fff;
  985. background-color: #007AFF;
  986. border-radius: 50%;
  987. width: 48rpx;
  988. height: 48rpx;
  989. line-height: 48rpx;
  990. text-align: center;
  991. display: inline-block;
  992. }
  993. .card_date {
  994. width: 14%;
  995. text-align: center;
  996. color: #7f8caf;
  997. position: relative;
  998. display: inline-block;
  999. }
  1000. .date_t1 {
  1001. font-size: 24rpx;
  1002. font-family: PingFang SC;
  1003. font-weight: bold;
  1004. color: #2f4379;
  1005. width: 100%;
  1006. text-align: center;
  1007. padding: 20rpx 0;
  1008. }
  1009. .card {
  1010. width: 100%;
  1011. background: #ffffff;
  1012. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(47, 67, 121, 0.05);
  1013. border-radius: 24rpx;
  1014. padding-bottom:20rpx;
  1015. .swiper {
  1016. height:550rpx;
  1017. }
  1018. }
  1019. page {
  1020. background: rgba(234,238,241,1);
  1021. }
  1022. </style>