You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

list.vue 10 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. <template>
  2. <view class="page">
  3. <view class="timeTable_sec1">
  4. <view class="tSec1Box" id="semester">
  5. <image src="~@/common/images/timeT1-1.png" mode="widthFix"></image>
  6. <text>{{ semester }}</text>
  7. </view>
  8. <!--<span class="tSec1Line"></span>-->
  9. <view class="tSec1Box" id="weekTime">
  10. <text class="text-xxl cuIcon cuIcon-back" @click="timeTap(1)"></text>
  11. <text>{{todayWeek.Monday}}</text>
  12. -
  13. <text>{{todayWeek.Sunday}}</text>
  14. <text class="text-xxl cuIcon cuIcon-right" @click="timeTap(2)"></text>
  15. </view>
  16. </view>
  17. <view class="timeTable_sec2">
  18. <view class="tSec2Top">
  19. <view class="tSec2TopUl">
  20. <view class="tSec2TopLi" v-for="(item, ind) in weekArr" :key="item.en" @click="liTap(ind)"
  21. :class="ind == num? 'active' : ''">
  22. <text>{{ item.en }}</text>
  23. <text>{{ item.cn }}</text>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="tSec2Box">
  28. <view class="tSec2Con" v-for="(items, i) in weekArr" :key="items.num" v-show="i == num">
  29. <view class="tSec2List">
  30. <view v-if="dataArr[i+1]&&dataArr[i+1].length <= 0" class="tSec2ListLi">
  31. <view class="noHtml">该时间段没有课程</view>
  32. </view>
  33. <view v-if="dataArr[i+1]&&dataArr[i+1].length > 0">
  34. <view class="tSec2ListLi" v-for="(k, j) in dataArr[i+1]" :key="j" @click="classTap(k)">
  35. <view class="tSec2ListL">第 {{ k.jc }} 节</view>
  36. <view class="tSec2ListR">
  37. <view class="tSec2ListBox">
  38. <view class="tSec2ListT">{{ k.curriculum }}</view>
  39. <view class="tSec2ListTxt">
  40. <text class="text-xxl cuIcon cuIcon-profile"></text>
  41. {{ k.teacher }}
  42. </view>
  43. </view>
  44. <view class="tSec2Location">
  45. <text class="text-xxl cuIcon cuIcon-location"></text>
  46. {{ k.className }}
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. import common from '@/common/js/common.js'
  59. export default {
  60. data() {
  61. return {
  62. semester: '',
  63. num: 0,
  64. user: null,
  65. weekDayTime: 0,
  66. noClassTime:0,
  67. todayWeek: {},
  68. dataArr: [],
  69. weekArr: [{
  70. en: 'ONE',
  71. cn: '星期一'
  72. },
  73. {
  74. en: 'TWO',
  75. cn: '星期二'
  76. },
  77. {
  78. en: 'THREE',
  79. cn: '星期三'
  80. },
  81. {
  82. en: 'FOUR',
  83. cn: '星期四'
  84. },
  85. {
  86. en: 'FIVE',
  87. cn: '星期五'
  88. },
  89. {
  90. en: 'SIX',
  91. cn: '星期六'
  92. },
  93. {
  94. en: 'SEVEN',
  95. cn: '星期七'
  96. },
  97. {
  98. en: 'EIGHT',
  99. cn: '星期八'
  100. },
  101. {
  102. en: 'NINE',
  103. cn: '星期九'
  104. },
  105. {
  106. en: 'TEN',
  107. cn: '星期十'
  108. }
  109. ]
  110. // weekArr: [
  111. // {
  112. // en: 'MON',
  113. // cn: '星期一'
  114. // },
  115. // {
  116. // en: 'TUE',
  117. // cn: '星期二'
  118. // },
  119. // {
  120. // en: 'WED',
  121. // cn: '星期三'
  122. // },
  123. // {
  124. // en: 'THU',
  125. // cn: '星期四'
  126. // },
  127. // {
  128. // en: 'FRI',
  129. // cn: '星期五'
  130. // },
  131. // {
  132. // en: 'SAT',
  133. // cn: '星期六'
  134. // },
  135. // {
  136. // en: 'SUN',
  137. // cn: '星期日'
  138. // }
  139. // ]
  140. };
  141. },
  142. onUnload() {
  143. this.OFF('timeTable');
  144. },
  145. methods: {
  146. async init() {
  147. let _this = this;
  148. // _this.todayWeek = common.weekday();
  149. // _this.semester = common.judgeDate();
  150. // _this.weekDayTime = 7 * common.oneDayTime();
  151. _this.weekDayTime = 14 * common.oneDayTime();
  152. _this.noClassTime = 4 * common.oneDayTime();
  153. _this.user = _this.GET_GLOBAL('loginUser');
  154. _this.loadData(_this.todayWeek.Monday, _this.todayWeek.Sunday);
  155. },
  156. liTap(ind) {
  157. this.num = ind;
  158. },
  159. timeTap(num) {
  160. let _this = this;
  161. if (num == 1) {
  162. _this.todayWeek.MondayTime = _this.todayWeek.MondayTime - _this.weekDayTime;
  163. _this.todayWeek.SundayTime = _this.todayWeek.SundayTime - _this.weekDayTime;
  164. } else {
  165. _this.todayWeek.MondayTime = _this.todayWeek.MondayTime + _this.weekDayTime;
  166. _this.todayWeek.SundayTime = _this.todayWeek.SundayTime + _this.weekDayTime;
  167. }
  168. _this.num = 0;
  169. _this.todayWeek.Monday = common.fmtDate(_this.todayWeek.MondayTime);
  170. _this.todayWeek.Sunday = common.fmtDate(_this.todayWeek.SundayTime);
  171. // _this.semester = common.judgeDate(_this.todayWeek.SundayTime);
  172. _this.loadData(_this.todayWeek.Monday, _this.todayWeek.Sunday);
  173. },
  174. loadData(start, end) {
  175. if(!this.user) return
  176. let {
  177. Description,
  178. account: Account
  179. } = this.user
  180. let param = {
  181. StartDate: start,
  182. EndDate: end,
  183. Description,
  184. Account,
  185. };
  186. // var param = {
  187. // StartDate: start,
  188. // EndDate: end
  189. // };
  190. let _this = this;
  191. _this.LOADING('加载数据中…');
  192. _this.HTTP_GET('learun/adms/timetable/TenDay', param, '加载数据时出错').then(res => {
  193. this.HIDE_LOADING();
  194. _this.semester = res.semester
  195. _this.dataArr = _this.ProcessingData(res.weekList);
  196. // console.log(_this.dataArr)
  197. // 回显日期
  198. if (!start) {
  199. _this.todayWeek.MondayTime = new Date(res.startDate).valueOf();
  200. _this.todayWeek.SundayTime = new Date(res.endDate).valueOf()
  201. _this.num = 0;
  202. _this.todayWeek.Monday = common.fmtDate(_this.todayWeek.MondayTime);
  203. _this.todayWeek.Sunday = common.fmtDate(_this.todayWeek.SundayTime);
  204. }
  205. // if (!start) {
  206. // _this.todayWeek.MondayTime = new Date(res.startDate).valueOf();
  207. // _this.todayWeek.SundayTime = new Date(res.endDate).valueOf() + _this.noClassTime;
  208. // _this.num = 0;
  209. // _this.todayWeek.Monday = common.fmtDate(_this.todayWeek.MondayTime);
  210. // _this.todayWeek.Sunday = common.fmtDate(_this.todayWeek.SundayTime);
  211. // }
  212. });
  213. },
  214. ProcessingData(data) {
  215. let courseCateByDay = {}
  216. for (let i = 1; i < 11; i++) {
  217. courseCateByDay[i] = []
  218. }
  219. data.forEach((item) => {
  220. item.list.sort((a, b) => {
  221. return a.jc - b.jc
  222. })
  223. courseCateByDay[item.time] = item.list
  224. })
  225. return courseCateByDay;
  226. // let dataM = [{
  227. // weekTime: 1,
  228. // num: Math.floor(Math.random() * 100000000),
  229. // lessonData: []
  230. // },
  231. // {
  232. // weekTime: 2,
  233. // num: Math.floor(Math.random() * 100000000),
  234. // lessonData: []
  235. // },
  236. // {
  237. // weekTime: 3,
  238. // num: Math.floor(Math.random() * 100000000),
  239. // lessonData: []
  240. // },
  241. // {
  242. // weekTime: 4,
  243. // num: Math.floor(Math.random() * 100000000),
  244. // lessonData: []
  245. // },
  246. // {
  247. // weekTime: 5,
  248. // num: Math.floor(Math.random() * 100000000),
  249. // lessonData: []
  250. // },
  251. // {
  252. // weekTime: 6,
  253. // num: Math.floor(Math.random() * 100000000),
  254. // lessonData: []
  255. // },
  256. // {
  257. // weekTime: 7,
  258. // num: Math.floor(Math.random() * 100000000),
  259. // lessonData: []
  260. // }
  261. // ];
  262. // data.forEach((n, i) => {
  263. // n.sectionTime = n.LessonTime.slice(1);
  264. // dataM.forEach((k, j) => {
  265. // if (k.weekTime == n.LessonTime.slice(0, 1)) {
  266. // k.lessonData.push(n);
  267. // }
  268. // });
  269. // });
  270. // dataM.forEach((n, i) => {
  271. // n.lessonData.sort(common.compare('sectionTime'));
  272. // });
  273. // this.dataArr = dataM;
  274. },
  275. classTap(data) {
  276. let _this = this;
  277. // console.log(data)
  278. // console.log(_this.user)
  279. this.NAV_TO('./single', data, true);
  280. }
  281. },
  282. created() {
  283. this.ON('timeTable', this.init);
  284. this.user = this.GET_GLOBAL('loginUser');
  285. this.init()
  286. }
  287. };
  288. </script>
  289. <style lang="less" scoped>
  290. .page {
  291. background: #fff;
  292. }
  293. .timeTable_sec1 {
  294. padding: 14px 12px;
  295. text-align: center;
  296. background: #0075c4;
  297. color: #94d4ff;
  298. font-size: 0;
  299. }
  300. .tSec1Box>* {
  301. display: inline-block;
  302. vertical-align: middle;
  303. }
  304. .tSec1Line {
  305. height: 13px;
  306. width: 1px;
  307. background: #94d4ff;
  308. margin: 0 10px;
  309. }
  310. .tSec1Box {
  311. font-size: 15px;
  312. overflow: hidden;
  313. white-space: nowrap;
  314. text-overflow: ellipsis;
  315. }
  316. #semester {
  317. margin-bottom: 10px;
  318. }
  319. #weekTime {}
  320. #weekTime text {
  321. margin: 0 10px;
  322. }
  323. .tSec1Box>text {
  324. width: auto;
  325. text-align: center;
  326. line-height: 22px;
  327. }
  328. .tSec1Box image {
  329. width: 15px;
  330. margin-right: 2px;
  331. }
  332. .tSec1Box text:after {
  333. display: none;
  334. }
  335. .timeTable_sec2 {
  336. margin-bottom: 30px;
  337. }
  338. .tSec2Top {
  339. padding: 0 12px;
  340. background: #0075c4;
  341. height: 55px;
  342. text-align: center;
  343. overflow: auto;
  344. }
  345. .tSec2TopUl {
  346. width: 800px;
  347. }
  348. .tSec2TopLi {
  349. width: 10%;
  350. float: left;
  351. line-height: 18px;
  352. padding: 9px 0 9px;
  353. color: #fff;
  354. font-size: 13px;
  355. border-right: 1px solid #1084d2;
  356. border-top: 1px solid #1084d2;
  357. }
  358. .tSec2TopLi:first-child {
  359. border-left: 1px solid #1084d2;
  360. }
  361. .tSec2TopLi.active {
  362. color: #0075c4;
  363. background: #fff;
  364. border-color: #fff;
  365. }
  366. .tSec2TopLi text {
  367. display: block;
  368. }
  369. .tSec2TopLi text:first-child {
  370. letter-spacing: 2px;
  371. text-transform: uppercase;
  372. }
  373. .tSec2Box {
  374. padding: 0 12px;
  375. margin-top: 10px;
  376. }
  377. .tSec2Con {
  378. border-left: 1px solid #d5eaf7;
  379. border-right: 1px solid #d5eaf7;
  380. border-top: 1px solid #d5eaf7;
  381. // display: none;
  382. }
  383. .tSec2Con:first-child {
  384. display: block;
  385. }
  386. .tSec2List {
  387. margin-top: 10px;
  388. }
  389. .tSec2List:first-child {
  390. margin-top: 0;
  391. }
  392. .tSec2ListLi {
  393. border-bottom: 1px solid #d5eaf7;
  394. overflow: hidden;
  395. height: 60px;
  396. }
  397. .tSec2ListL {
  398. float: left;
  399. background: #e8f6ff;
  400. height: 100%;
  401. width: 25%;
  402. text-align: center;
  403. line-height: 36px;
  404. padding: 11px 0;
  405. font-size: 14px;
  406. color: #646464;
  407. }
  408. .tSec2ListR {
  409. float: left;
  410. width: 75%;
  411. height: 100%;
  412. line-height: 18px;
  413. padding: 4px 0;
  414. overflow: hidden;
  415. }
  416. .tSec2ListBox {
  417. width: 70%;
  418. float: left;
  419. padding-left: 5px;
  420. }
  421. .tSec2ListT {
  422. color: #3e3e3e;
  423. font-size: 15px;
  424. margin: 5px 0;
  425. overflow: hidden;
  426. white-space: nowrap;
  427. text-overflow: ellipsis;
  428. }
  429. .tSec2ListTxt {
  430. color: #888888;
  431. font-size: 13px;
  432. }
  433. .tSec2Location {
  434. width: 30%;
  435. float: left;
  436. line-height: 44px;
  437. font-size: 13px;
  438. color: #888888;
  439. }
  440. .noHtml {
  441. height: 100%;
  442. line-height: 60px;
  443. text-align: center;
  444. font-size: 14px;
  445. }
  446. </style>