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.
 
 
 
 
 
 

431 lines
9.0 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 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. };
  111. },
  112. onUnload() {
  113. this.OFF('timeTable');
  114. },
  115. methods: {
  116. // 初始化数据
  117. async init() {
  118. let _this = this;
  119. // _this.todayWeek = common.weekday2();
  120. _this.weekDayTime = 14 * common.oneDayTime();
  121. _this.noClassTime = 4 * common.oneDayTime();
  122. _this.loadData();
  123. },
  124. liTap(ind) {
  125. this.num = ind;
  126. },
  127. // 切换时间
  128. timeTap(num) {
  129. let _this = this;
  130. if (num == 1) {
  131. _this.todayWeek.MondayTime = _this.todayWeek.MondayTime - _this.weekDayTime ;
  132. _this.todayWeek.SundayTime = _this.todayWeek.SundayTime - _this.weekDayTime;
  133. } else {
  134. _this.todayWeek.MondayTime = _this.todayWeek.MondayTime + _this.weekDayTime;
  135. _this.todayWeek.SundayTime = _this.todayWeek.SundayTime + _this.weekDayTime;
  136. }
  137. _this.num = 0;
  138. // console.log(_this.todayWeek.MondayTime)
  139. _this.todayWeek.Monday = common.fmtDate(_this.todayWeek.MondayTime);
  140. _this.todayWeek.Sunday = common.fmtDate(_this.todayWeek.SundayTime);
  141. _this.loadData(_this.todayWeek.Monday, _this.todayWeek.Sunday);
  142. },
  143. // 获取数据
  144. loadData(start, end) {
  145. if(!this.user) return
  146. let {
  147. Description,
  148. account: Account
  149. } = this.user
  150. let param = {
  151. StartDate: start,
  152. EndDate: end,
  153. Description,
  154. Account,
  155. };
  156. let _this = this;
  157. _this.LOADING('加载数据中…');
  158. _this.HTTP_GET('learun/adms/timetable/TenDay', param, '加载数据时出错').then(res => {
  159. this.HIDE_LOADING();
  160. _this.semester = res.semester
  161. _this.dataArr = _this.ProcessingData(res.weekList);
  162. // console.log(res)
  163. if (!start) {
  164. _this.todayWeek.MondayTime = new Date(res.startDate).valueOf();
  165. _this.todayWeek.SundayTime = new Date(res.endDate).valueOf();
  166. _this.num = 0;
  167. _this.todayWeek.Monday = common.fmtDate(_this.todayWeek.MondayTime);
  168. _this.todayWeek.Sunday = common.fmtDate(_this.todayWeek.SundayTime);
  169. }
  170. // // 回显日期
  171. // if (!start) {
  172. // _this.todayWeek.MondayTime = new Date(res.startDate).valueOf();
  173. // _this.todayWeek.SundayTime = new Date(res.endDate).valueOf() + _this.noClassTime;
  174. // _this.num = 0;
  175. // _this.todayWeek.Monday = common.fmtDate(_this.todayWeek.MondayTime);
  176. // _this.todayWeek.Sunday = common.fmtDate(_this.todayWeek.SundayTime);
  177. // }
  178. });
  179. },
  180. // 处理课程数据
  181. ProcessingData(res) {
  182. let courseCateByDay = {}
  183. for (let i = 1; i < 11; i++) {
  184. courseCateByDay[i] = []
  185. }
  186. res.forEach((item) => {
  187. item.list.sort((a, b) => {
  188. return a.jc - b.jc
  189. })
  190. courseCateByDay[item.time] = item.list
  191. })
  192. return courseCateByDay;
  193. },
  194. classTap(data) {
  195. // return ""
  196. // console.log(data)
  197. let _this = this;
  198. // console.log(_this.user)
  199. if (_this.user.Description == "教师") {
  200. //console.log("教师");
  201. } else if (_this.user.Description == "学生") {
  202. let LeaveType = data.LeaveType;
  203. //console.log(LeaveType);
  204. let IsCheck = data.IsCheck;
  205. //console.log(IsCheck);
  206. if (LeaveType == "1") {
  207. let msg = "请假申请中";
  208. if (IsCheck == "1") {
  209. msg = "请假通过";
  210. }
  211. if (IsCheck == "2") {
  212. msg = "请假未通过";
  213. }
  214. _this.TOAST(msg);
  215. } else {
  216. // var param = {
  217. // AcademicYearNo: data.AcademicYear,
  218. // ClassRoomNo: data.ClassRoomNo,
  219. // EmpNo: data.EmpNo,
  220. // LessonDate: data.LessonDate,
  221. // LessonNo: data.LessonNo,
  222. // LessonSortNo: data.LessonSortNo,
  223. // LessonTime: data.LessonTime,
  224. // Semester: data.Semester
  225. // };
  226. this.NAV_TO('./leaveFrom', data, true);
  227. }
  228. }
  229. }
  230. },
  231. created() {
  232. this.ON('timeTable', this.init);
  233. this.user = this.GET_GLOBAL('loginUser');
  234. this.init()
  235. }
  236. };
  237. </script>
  238. <style lang="less" scoped>
  239. .page {
  240. background: #fff;
  241. }
  242. .timeTable_sec1 {
  243. padding: 14px 12px;
  244. text-align: center;
  245. background: #0075c4;
  246. color: #94d4ff;
  247. font-size: 0;
  248. }
  249. .tSec1Box>* {
  250. display: inline-block;
  251. vertical-align: middle;
  252. }
  253. .tSec1Line {
  254. height: 13px;
  255. width: 1px;
  256. background: #94d4ff;
  257. margin: 0 10px;
  258. }
  259. .tSec1Box {
  260. font-size: 15px;
  261. overflow: hidden;
  262. white-space: nowrap;
  263. text-overflow: ellipsis;
  264. }
  265. #semester {
  266. margin-bottom: 10px;
  267. }
  268. #weekTime {}
  269. #weekTime text {
  270. margin: 0 10px;
  271. }
  272. .tSec1Box>text {
  273. width: auto;
  274. text-align: center;
  275. line-height: 22px;
  276. }
  277. .tSec1Box image {
  278. width: 15px;
  279. margin-right: 2px;
  280. }
  281. .tSec1Box text:after {
  282. display: none;
  283. }
  284. .timeTable_sec2 {
  285. margin-bottom: 30px;
  286. }
  287. .tSec2Top {
  288. padding: 0 12px;
  289. background: #0075c4;
  290. height: 55px;
  291. text-align: center;
  292. overflow: auto;
  293. }
  294. .tSec2TopUl {
  295. width: 800px;
  296. }
  297. .tSec2TopLi {
  298. width: 10%;
  299. float: left;
  300. line-height: 18px;
  301. padding: 9px 0 9px;
  302. color: #fff;
  303. font-size: 13px;
  304. border-right: 1px solid #1084d2;
  305. border-top: 1px solid #1084d2;
  306. }
  307. .tSec2TopLi:first-child {
  308. border-left: 1px solid #1084d2;
  309. }
  310. .tSec2TopLi.active {
  311. color: #0075c4;
  312. background: #fff;
  313. border-color: #fff;
  314. }
  315. .tSec2TopLi text {
  316. display: block;
  317. }
  318. .tSec2TopLi text:first-child {
  319. letter-spacing: 2px;
  320. text-transform: uppercase;
  321. }
  322. .tSec2Box {
  323. padding: 0 12px;
  324. margin-top: 10px;
  325. }
  326. .tSec2Con {
  327. border-left: 1px solid #d5eaf7;
  328. border-right: 1px solid #d5eaf7;
  329. border-top: 1px solid #d5eaf7;
  330. // display: none;
  331. }
  332. .tSec2Con:first-child {
  333. display: block;
  334. }
  335. .tSec2List {
  336. margin-top: 10px;
  337. }
  338. .tSec2List:first-child {
  339. margin-top: 0;
  340. }
  341. .tSec2ListLi {
  342. border-bottom: 1px solid #d5eaf7;
  343. overflow: hidden;
  344. height: 60px;
  345. }
  346. .tSec2ListL {
  347. float: left;
  348. background: #e8f6ff;
  349. height: 100%;
  350. width: 20%;
  351. text-align: center;
  352. line-height: 36px;
  353. padding: 11px 0;
  354. font-size: 14px;
  355. color: #646464;
  356. }
  357. .tSec2ListR {
  358. float: left;
  359. width: 80%;
  360. height: 100%;
  361. line-height: 18px;
  362. padding: 4px 0;
  363. overflow: hidden;
  364. }
  365. .tSec2ListBox {
  366. width: 62%;
  367. float: left;
  368. padding-left: 5px;
  369. }
  370. .tSec2ListT {
  371. color: #3e3e3e;
  372. font-size: 15px;
  373. margin: 5px 0;
  374. overflow: hidden;
  375. white-space: nowrap;
  376. text-overflow: ellipsis;
  377. }
  378. .tSec2ListTxt {
  379. color: #888888;
  380. font-size: 13px;
  381. }
  382. .tSec2Location {
  383. width: 38%;
  384. float: left;
  385. line-height: 44px;
  386. font-size: 13px;
  387. color: #888888;
  388. }
  389. .noHtml {
  390. height: 100%;
  391. line-height: 60px;
  392. text-align: center;
  393. font-size: 14px;
  394. }
  395. </style>