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.
 
 
 
 
 
 

473 lines
9.8 KiB

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