index.vue 29 KB

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