index.vue 29 KB

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