index.vue 26 KB

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