detail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. <template>
  2. <view style="padding: 30rpx;" >
  3. <view class="card">
  4. <view class="date_t1">
  5. 2021年 6月
  6. </view>
  7. <view style="width: 100%;display: flex;justify-content:center;margin-top: 20rpx;">
  8. <view v-for="(item,index) in date" :key="index" class="card_date">{{item}}</view>
  9. </view>
  10. <view style="width: 100%;margin-top: 20rpx;">
  11. <view v-for="(item,index) in date_use" :key="index" class='date_num'>
  12. <view v-if="item.color==0" class="date_num_color0">
  13. {{item.num}}
  14. <view v-if="item.note>0" class="date_note">
  15. {{item.note}}
  16. </view>
  17. <view v-if="item.dot" class="date_dot">
  18. </view>
  19. </view>
  20. <view v-if="item.color==1" class="date_num_color1">
  21. {{item.num}}
  22. <view v-if="item.note>0" class="date_note">
  23. {{item.note}}
  24. </view>
  25. <view v-if="item.dot" class="date_dot">
  26. </view>
  27. </view>
  28. <view v-if="item.color==2" class="date_num_color2">
  29. {{item.num}}
  30. <view v-if="item.note>0" class="date_note">
  31. {{item.note}}
  32. </view>
  33. <view v-if="item.dot" class="date_dot">
  34. </view>
  35. </view>
  36. <view v-if="item.color==3" class="date_num_color3">
  37. {{item.num}}
  38. <view v-if="item.note>0" class="date_note">
  39. {{item.note}}
  40. </view>
  41. <view v-if="item.dot" class="date_dot">
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <view style="width: 100%;display: flex;justify-content: center;" v-if="isOpen==false">
  47. <view @click="oepn_calendar" style="height: 20rpx;width: 40rpx;padding:20rpx 0;">
  48. <view class="date_line" ></view>
  49. </view>
  50. </view>
  51. <view style="width: 100%;display: flex;justify-content: center;" v-else>
  52. <image class="date_line_close" @click="close_calendar" src="/static/close_card.png"></image>
  53. </view>
  54. <view v-for="(item,index) in workList">
  55. <view style="margin-left: 30rpx;margin-top: 10rpx;" @click="jumpDetail(item)">
  56. <text class="date_t2">{{item.courseName}}</text>
  57. <view class="circle_num" style="margin-left: 20rpx;">{{item.chapterNum}}</view>
  58. </view>
  59. </view>
  60. </view>
  61. <!-- 列表-->
  62. <view >
  63. <uni-swipe-action >
  64. <uni-swipe-action-item :autoClose="false" @change="swipeChange($event, item)" :show="item.show" v-for="(item,index) in list" :key="index">
  65. <view class="list_item" :class="index%2==0?'list_item_bac1':'list_item_bac2'">
  66. <u-row>
  67. <u-col span="11">
  68. <text class="item_t1">{{item.coursePlanVo[0].categoryName}}:{{$method.timestampToTime(item.endTime)}}截止</text>
  69. </u-col>
  70. <u-col span="1">
  71. <image src="/static/more.png" class="img_more" @click.stop="openShow(item)"></image>
  72. </u-col>
  73. </u-row>
  74. <view style="margin-top: 30rpx;">
  75. <image :src="$method.splitImgHost(item.coursePlanVo[0].coverUrl)" class="r_image"></image>
  76. <view class="r_t2">
  77. {{item.coursePlanVo[0].courseName}}
  78. </view>
  79. </view>
  80. <view style="display: flex;margin-top: 30rpx;">
  81. <text class="item_t2">学习频率:</text>
  82. <view style="display: flex;justify-content:center;">
  83. <view v-for="(item1,index) in item.studyCount" :key="index" class="item_date">{{replay(item1)}}</view>
  84. </view>
  85. </view>
  86. <view style="display: flex;margin-top: 20rpx;">
  87. <text class="item_t2">学习进度:60/120</text>
  88. </view>
  89. </view>
  90. <template v-slot:right >
  91. <view class="operate">
  92. <image src="/static/operate_1.png" class="operate_img operate_img1"></image>
  93. <image src="/static/operate_2.png" class="operate_img operate_img2"></image>
  94. <image @click="edit(item)" src="/static/operate_3.png" class="operate_img operate_img3"></image>
  95. </view>
  96. </template>
  97. </uni-swipe-action-item>
  98. </uni-swipe-action>
  99. </view>
  100. <view class="newPlan" @click="newPlan()">
  101. 新建计划
  102. </view>
  103. </view>
  104. </template>
  105. <script>
  106. export default {
  107. data() {
  108. return {
  109. workList:[],
  110. dayLisy:[],
  111. index:0,
  112. date:['日','一','二','三','四','五','六'],
  113. list:[
  114. {
  115. show:'right',
  116. id:1,
  117. coursePlanVo:{}
  118. },
  119. {
  120. show:'none',
  121. id:2
  122. },
  123. {
  124. show:'none',
  125. id:3
  126. },
  127. {
  128. show:'none',
  129. id:4
  130. },
  131. {
  132. show:'none',
  133. id:5
  134. }
  135. ],
  136. isOpen:false,
  137. date_num:[
  138. {
  139. num:20,
  140. color:0,
  141. note:0,
  142. dot:false,
  143. },{
  144. num:21,
  145. color:1,
  146. note:0,
  147. dot:false,
  148. },{
  149. num:22,
  150. color:0,
  151. note:0,
  152. dot:true,
  153. },{
  154. num:23,
  155. color:2,
  156. note:0,
  157. dot:false,
  158. },{
  159. num:24,
  160. color:1,
  161. note:0,
  162. dot:false,
  163. },{
  164. num:25,
  165. color:3,
  166. note:2,
  167. dot:false,
  168. },{
  169. num:26,
  170. color:0,
  171. note:1,
  172. dot:true,
  173. }],
  174. date_use:[],
  175. options:[
  176. {
  177. text: '取消',
  178. style: {
  179. backgroundColor: '#007aff'
  180. }
  181. }, {
  182. text: '确认',
  183. style: {
  184. backgroundColor: '#dd524d'
  185. }
  186. }]
  187. }
  188. },
  189. onLoad(option) {
  190. this.date_use = this.date_num
  191. let date = new Date()
  192. let num = date.getDate()
  193. for(let i=0;i<this.date_num.length;i++){
  194. let item = this.date_num[i]
  195. if(item.num ==num ){
  196. item.color = 3
  197. }
  198. }
  199. this.getList()
  200. },
  201. onShow(){
  202. },
  203. methods: {
  204. jumpDetail(item) {
  205. this.$navTo.togo('/pages2/course/detail', {
  206. id: item.courseId
  207. });
  208. return;
  209. },
  210. replay(index){
  211. if(index==0){
  212. return '日'
  213. }
  214. if(index==1){
  215. return '一'
  216. }
  217. if(index==2){
  218. return '二'
  219. }
  220. if(index==3){
  221. return '三'
  222. }
  223. if(index==4){
  224. return '四'
  225. }
  226. if(index==5){
  227. return '五'
  228. }
  229. if(index==6){
  230. return '六'
  231. }
  232. },
  233. getList(){
  234. let self = this
  235. this.$api.planUserPlan().then(result => {
  236. self.list = result.data.data
  237. self.dayLisy = result.data.data[0].calendarStudyVo[0].dayStudyList
  238. let start = self.dayLisy[0].studyDay
  239. self.workList = result.data.data[0].coursePlanVo
  240. console.log(self.workList)
  241. });
  242. },
  243. newPlan(){
  244. this.$navTo.togo('/pages2/plan/create')
  245. },
  246. edit(item){
  247. this.$navTo.togo('/pages2/plan/edit', {
  248. id:item.id
  249. })
  250. },
  251. swipeChange(e, item){
  252. item.show = e;
  253. },
  254. openShow(item){
  255. if(item.show=='none'){
  256. item.show = 'right'
  257. }else{
  258. item.show = 'none'
  259. }
  260. },
  261. close_calendar(){
  262. this.isOpen = false
  263. this.date_use = this.date_num
  264. },
  265. oepn_calendar(){
  266. this.isOpen = true
  267. this.date_use = []
  268. for(let i =1;i<=30;i++){
  269. let item={}
  270. item.num = i
  271. item.color = this.random(0, 3)
  272. let note = this.random(0, 20)
  273. item.note = note>17?note-15:0
  274. item.dot = this.random(0, 3)<2?false:true
  275. let date = new Date()
  276. let num = date.getDate()
  277. if(num==i){
  278. item.color = 3
  279. }
  280. this.date_use.push(item)
  281. }
  282. },
  283. random(min, max) {
  284. return Math.floor(Math.random() * (max - min)) + min;
  285. }
  286. },
  287. }
  288. </script>
  289. <style scope>
  290. .newPlan{
  291. width: 200rpx;
  292. height: 64rpx;
  293. background: #FFFFFF;
  294. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(47, 67, 121, 0.15);
  295. border-radius: 32rpx;
  296. font-size: 24rpx;
  297. font-family: PingFang SC;
  298. font-weight: bold;
  299. color: #32467B;
  300. text-align: center;
  301. line-height: 64rpx;
  302. position: fixed;
  303. bottom: 60rpx;
  304. left: 40%;
  305. }
  306. .operate_img3{
  307. background: #3478F6;
  308. }
  309. .operate_img2{
  310. background: #F09A37;
  311. }
  312. .operate_img1{
  313. background: #EB4D3D;
  314. }
  315. .operate_img{
  316. width: 45rpx;
  317. height: 45rpx;
  318. border-radius: 50%;
  319. padding: 20rpx;
  320. margin: 10rpx 0;
  321. }
  322. .operate{
  323. height: 418rpx;
  324. width: 90rpx;
  325. display: flex;
  326. flex-direction: column;
  327. align-items: center;
  328. justify-content: center;
  329. }
  330. .item_t2{
  331. font-size: 23rpx;
  332. color: #32467B;
  333. }
  334. .item_date{
  335. width: 26rpx;
  336. height: 26rpx;
  337. background: #32467B;
  338. border-radius: 50%;
  339. margin-left: 20rpx;
  340. font-size: 18rpx;
  341. color: #FEFEFF;
  342. text-align: center;
  343. }
  344. .r_t2{
  345. font-size: 20rpx;
  346. font-family: PingFang SC;
  347. font-weight: 400;
  348. color: #0C141F;
  349. }
  350. .r_image{
  351. width: 278rpx;
  352. height: 134rpx;
  353. }
  354. .img_more{
  355. width: 26rpx;
  356. height: 26rpx;
  357. }
  358. .item_t1{
  359. font-size: 30rpx;
  360. font-family: PingFang SC;
  361. font-weight: 500;
  362. color: #32467B;
  363. }
  364. .list_item_bac1{
  365. background: linear-gradient(45deg, rgba(172, 203, 238, 0.2), rgba(231, 240, 253, 0.2));
  366. }
  367. .list_item_bac2{
  368. background: linear-gradient(45deg, rgba(255, 232, 206, 0.3), rgba(251, 184, 160, 0.3));
  369. }
  370. .list_item{
  371. width: 100%;
  372. height: 418rpx;
  373. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(47, 67, 121, 0.05);
  374. border-radius: 24rpx;
  375. margin-top: 20rpx;
  376. padding: 15rpx;
  377. }
  378. .date_dot{
  379. width: 6rpx;
  380. height: 6rpx;
  381. background: #FFCC00;
  382. border-radius: 50%;
  383. margin:0 auto
  384. }
  385. .date_note{
  386. border-radius: 50%;
  387. width: 29rpx;
  388. height: 29rpx;
  389. border: 1px solid #FFCC00;
  390. font-size: 18rpx;
  391. color: #FFCC00;
  392. text-align: center;
  393. display: inline-block;
  394. position: absolute;
  395. top: -19rpx;
  396. right: 9rpx;
  397. }
  398. .circle_num {
  399. border-radius: 50%;
  400. width: 29rpx;
  401. height: 29rpx;
  402. border: 1px solid #FFCC00;
  403. font-size: 18rpx;
  404. color: #FFCC00;
  405. text-align: center;
  406. display: inline-block;
  407. margin: 5rpx;
  408. }
  409. .date_t2{
  410. font-size: 30rpx;
  411. font-family: PingFang SC;
  412. font-weight: 500;
  413. color: #2F4379;
  414. }
  415. .date_line_close{
  416. width: 40rpx;
  417. height: 20rpx;
  418. }
  419. .date_line{
  420. width: 40rpx;
  421. height: 6rpx;
  422. background: #7F8CAF;
  423. border-radius: 2rpx;
  424. }
  425. .date_num{
  426. width: 14%;
  427. text-align: center;
  428. position: relative;
  429. display: inline-block;
  430. margin-top: 20rpx;
  431. }
  432. .date_num_color0{
  433. color: #32467B;
  434. }
  435. .date_num_color1{
  436. color: #34C759;
  437. }
  438. .date_num_color2{
  439. color: #FF3B30;
  440. }
  441. .date_num_color3{
  442. color: #FFFFFF;
  443. background-color: #FFCC00;
  444. border-radius: 50%;
  445. width: 40rpx;
  446. height: 40rpx;
  447. display: inline-block;
  448. }
  449. .card_date{
  450. width: 14%;
  451. text-align: center;
  452. color: #7F8CAF;
  453. }
  454. .date_t1{
  455. font-size: 24rpx;
  456. font-family: PingFang SC;
  457. font-weight: bold;
  458. color: #2F4379;
  459. width: 100%;
  460. text-align: center;
  461. padding: 20rpx 0;
  462. }
  463. .card{
  464. width: 100%;
  465. background: #FFFFFF;
  466. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(47, 67, 121, 0.05);
  467. border-radius: 24rpx;
  468. padding-bottom: 20rpx;
  469. }
  470. page {
  471. background: #FDFDFD;
  472. }
  473. </style>