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.
 
 
 
 
 
 

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