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.
 
 
 
 
 
 

390 lines
8.4 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="tSec2TopLi" v-for="(item, ind) in weekArr" :key="item.en" @click="liTap(ind)" :class="ind == num? 'active' : ''">
  20. <text>{{ item.en }}</text>
  21. <text>{{ item.cn }}</text>
  22. </view>
  23. </view>
  24. <view class="tSec2Box">
  25. <view class="tSec2Con" v-for="(items, i) in dataArr" :key="items.num" v-show="i == num">
  26. <view class="tSec2List">
  27. <view v-if="items.lessonData.length <= 0" class="tSec2ListLi"><view class="noHtml">该时间段没有课表</view></view>
  28. <view v-if="items.lessonData.length > 0">
  29. <view class="tSec2ListLi" v-for="(k, j) in items.lessonData" :key="j" @click="classTap(k)">
  30. <view class="tSec2ListL">第 {{ k.sectionTime }} 节</view>
  31. <view class="tSec2ListR">
  32. <view class="tSec2ListBox">
  33. <view class="tSec2ListT">{{ k.LessonName }}</view>
  34. <view class="tSec2ListTxt">
  35. <text class="text-xxl cuIcon cuIcon-profile"></text>
  36. {{ k.EmpName }}
  37. </view>
  38. </view>
  39. <view class="tSec2Location">
  40. <text class="text-xxl cuIcon cuIcon-location"></text>
  41. {{ k.ClassroomName }}
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import common from '@/common/js/common.js'
  54. export default {
  55. data() {
  56. return {
  57. semester: '',
  58. num: 0,
  59. user: null,
  60. weekDayTime: 0,
  61. todayWeek: {},
  62. dataArr: [],
  63. weekArr: [
  64. {
  65. en: 'MON',
  66. cn: '星期一'
  67. },
  68. {
  69. en: 'TUE',
  70. cn: '星期二'
  71. },
  72. {
  73. en: 'WED',
  74. cn: '星期三'
  75. },
  76. {
  77. en: 'THU',
  78. cn: '星期四'
  79. },
  80. {
  81. en: 'FRI',
  82. cn: '星期五'
  83. },
  84. {
  85. en: 'SAT',
  86. cn: '星期六'
  87. },
  88. {
  89. en: 'SUN',
  90. cn: '星期日'
  91. }
  92. ]
  93. };
  94. },
  95. onUnload() {
  96. this.OFF('timeTable');
  97. },
  98. methods: {
  99. async init() {
  100. // console.log(555)
  101. let _this = this;
  102. _this.todayWeek = common.weekday();
  103. _this.semester = common.judgeDate();
  104. _this.weekDayTime = 7 * common.oneDayTime();
  105. _this.user = _this.GET_GLOBAL('loginUser');
  106. _this.loadData(_this.todayWeek.Monday, _this.todayWeek.Sunday);
  107. },
  108. liTap(ind) {
  109. this.num = ind;
  110. },
  111. timeTap(num) {
  112. let _this = this;
  113. if (num == 1) {
  114. _this.todayWeek.MondayTime = _this.todayWeek.MondayTime - _this.weekDayTime;
  115. _this.todayWeek.SundayTime = _this.todayWeek.SundayTime - _this.weekDayTime;
  116. } else {
  117. _this.todayWeek.MondayTime = _this.todayWeek.MondayTime + _this.weekDayTime;
  118. _this.todayWeek.SundayTime = _this.todayWeek.SundayTime + _this.weekDayTime;
  119. }
  120. _this.num = 0;
  121. _this.todayWeek.Monday = common.fmtDate(_this.todayWeek.MondayTime);
  122. _this.todayWeek.Sunday = common.fmtDate(_this.todayWeek.SundayTime);
  123. _this.semester = common.judgeDate(_this.todayWeek.SundayTime);
  124. _this.loadData(_this.todayWeek.Monday, _this.todayWeek.Sunday);
  125. },
  126. loadData(start, end) {
  127. let param = { StartDate: start, EndDate: end };
  128. // let param = { StartDate: '2018-11-05', EndDate: '2018-11-11' };
  129. let _this = this;
  130. _this.LOADING('加载数据中…');
  131. _this.HTTP_GET('learun/adms/timetable/list', param, '加载数据时出错').then(res => {
  132. this.HIDE_LOADING();
  133. // console.log(res);
  134. _this.ProcessingData(res);
  135. });
  136. },
  137. ProcessingData(data) {
  138. let dataM = [
  139. {
  140. weekTime: 1,
  141. num: Math.floor(Math.random() * 100000000),
  142. lessonData: []
  143. },
  144. {
  145. weekTime: 2,
  146. num: Math.floor(Math.random() * 100000000),
  147. lessonData: []
  148. },
  149. {
  150. weekTime: 3,
  151. num: Math.floor(Math.random() * 100000000),
  152. lessonData: []
  153. },
  154. {
  155. weekTime: 4,
  156. num: Math.floor(Math.random() * 100000000),
  157. lessonData: []
  158. },
  159. {
  160. weekTime: 5,
  161. num: Math.floor(Math.random() * 100000000),
  162. lessonData: []
  163. },
  164. {
  165. weekTime: 6,
  166. num: Math.floor(Math.random() * 100000000),
  167. lessonData: []
  168. },
  169. {
  170. weekTime: 7,
  171. num: Math.floor(Math.random() * 100000000),
  172. lessonData: []
  173. }
  174. ];
  175. data.forEach((n, i) => {
  176. n.sectionTime = n.LessonTime.slice(1);
  177. dataM.forEach((k, j) => {
  178. if (k.weekTime == n.LessonTime.slice(0, 1)) {
  179. k.lessonData.push(n);
  180. }
  181. });
  182. });
  183. dataM.forEach((n, i) => {
  184. n.lessonData.sort(common.compare('sectionTime'));
  185. });
  186. this.dataArr = dataM;
  187. },
  188. classTap(data) {
  189. let _this = this;
  190. // console.log(_this.user)
  191. if (_this.user.Description == "教师") {
  192. //console.log("教师");
  193. } else if (_this.user.Description == "学生") {
  194. let LeaveType = data.LeaveType;
  195. //console.log(LeaveType);
  196. let IsCheck = data.IsCheck;
  197. //console.log(IsCheck);
  198. if (LeaveType == "1") {
  199. let msg = "请假申请中";
  200. if (IsCheck == "1") {
  201. msg = "请假通过";
  202. }
  203. if (IsCheck == "2") {
  204. msg = "请假未通过";
  205. }
  206. _this.TOAST(msg);
  207. }
  208. else {
  209. // var param = {
  210. // AcademicYearNo: data.AcademicYear,
  211. // ClassRoomNo: data.ClassRoomNo,
  212. // EmpNo: data.EmpNo,
  213. // LessonDate: data.LessonDate,
  214. // LessonNo: data.LessonNo,
  215. // LessonSortNo: data.LessonSortNo,
  216. // LessonTime: data.LessonTime,
  217. // Semester: data.Semester
  218. // };
  219. this.NAV_TO('./leaveFrom', data, true);
  220. }
  221. }
  222. }
  223. },
  224. created() {
  225. this.ON('timeTable', this.init);
  226. this.init()
  227. }
  228. };
  229. </script>
  230. <style lang="less" scoped>
  231. .page{
  232. background: #fff;
  233. }
  234. .timeTable_sec1 {
  235. padding: 14px 12px;
  236. text-align: center;
  237. background: #0075c4;
  238. color: #94d4ff;
  239. font-size: 0;
  240. }
  241. .tSec1Box > * {
  242. display: inline-block;
  243. vertical-align: middle;
  244. }
  245. .tSec1Line {
  246. height: 13px;
  247. width: 1px;
  248. background: #94d4ff;
  249. margin: 0 10px;
  250. }
  251. .tSec1Box {
  252. font-size: 15px;
  253. overflow: hidden;
  254. white-space: nowrap;
  255. text-overflow: ellipsis;
  256. }
  257. #semester {
  258. margin-bottom: 10px;
  259. }
  260. #weekTime {
  261. }
  262. #weekTime text {
  263. margin: 0 10px;
  264. }
  265. .tSec1Box > text {
  266. width: auto;
  267. text-align: center;
  268. line-height: 22px;
  269. }
  270. .tSec1Box image {
  271. width: 15px;
  272. margin-right: 2px;
  273. }
  274. .tSec1Box text:after {
  275. display: none;
  276. }
  277. .timeTable_sec2 {
  278. margin-bottom: 30px;
  279. }
  280. .tSec2Top {
  281. padding: 0 12px;
  282. background: #0075c4;
  283. height: 55px;
  284. text-align: center;
  285. overflow: hidden;
  286. }
  287. .tSec2TopLi {
  288. width: 14.285714%;
  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: 25%;
  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: 75%;
  350. height: 100%;
  351. line-height: 18px;
  352. padding: 4px 0;
  353. overflow: hidden;
  354. }
  355. .tSec2ListBox {
  356. width: 70%;
  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: 30%;
  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>