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.
 
 
 
 
 
 

387 lines
8.2 KiB

  1. <template>
  2. <view class="page">
  3. <view class="timeTable_sec1">
  4. <view class="tSec1Box" id="semester">
  5. <image src="@/static/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">{{ k.ClassName }}</view>
  35. <view class="tSec2ListTxt">
  36. <text class="text-xxl cuIcon cuIcon-profile"></text>
  37. {{ k.EmpName }}
  38. </view>
  39. </view>
  40. <view class="tSec2Location">
  41. <text class="text-xxl cuIcon cuIcon-location"></text>
  42. {{ k.ClassroomName }}
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. import common from '@/common/js/common.js'
  55. export default {
  56. data() {
  57. return {
  58. semester: '',
  59. num: 0,
  60. user: null,
  61. weekDayTime: 0,
  62. todayWeek: {},
  63. dataArr: [],
  64. weekArr: [
  65. {
  66. en: 'MON',
  67. cn: '星期一'
  68. },
  69. {
  70. en: 'TUE',
  71. cn: '星期二'
  72. },
  73. {
  74. en: 'WED',
  75. cn: '星期三'
  76. },
  77. {
  78. en: 'THU',
  79. cn: '星期四'
  80. },
  81. {
  82. en: 'FRI',
  83. cn: '星期五'
  84. },
  85. {
  86. en: 'SAT',
  87. cn: '星期六'
  88. },
  89. {
  90. en: 'SUN',
  91. cn: '星期日'
  92. }
  93. ]
  94. };
  95. },
  96. onUnload() {
  97. this.OFF('timeTable');
  98. },
  99. methods: {
  100. async init(obj) {
  101. //console.log(obj)
  102. let _this = this;
  103. _this.todayWeek = common.weekday(obj);
  104. //console.log(_this.todayWeek)
  105. _this.semester = common.judgeDate(obj);
  106. _this.weekDayTime = 7 * common.oneDayTime();
  107. _this.user = _this.GET_GLOBAL('loginUser');
  108. _this.loadData(_this.todayWeek.Monday, _this.todayWeek.Sunday);
  109. },
  110. liTap(ind) {
  111. this.num = ind;
  112. },
  113. timeTap(num) {
  114. let _this = this;
  115. if (num == 1) {
  116. _this.todayWeek.MondayTime = _this.todayWeek.MondayTime - _this.weekDayTime;
  117. _this.todayWeek.SundayTime = _this.todayWeek.SundayTime - _this.weekDayTime;
  118. } else {
  119. _this.todayWeek.MondayTime = _this.todayWeek.MondayTime + _this.weekDayTime;
  120. _this.todayWeek.SundayTime = _this.todayWeek.SundayTime + _this.weekDayTime;
  121. }
  122. _this.num = 0;
  123. _this.todayWeek.Monday = common.fmtDate(_this.todayWeek.MondayTime);
  124. _this.todayWeek.Sunday = common.fmtDate(_this.todayWeek.SundayTime);
  125. _this.semester = common.judgeDate(_this.todayWeek.SundayTime);
  126. _this.loadData(_this.todayWeek.Monday, _this.todayWeek.Sunday);
  127. },
  128. loadData(start, end) {
  129. let param = { StartDate: start, EndDate: end };
  130. // let param = { StartDate: '2018-11-05', EndDate: '2018-11-11' };
  131. let _this = this;
  132. _this.LOADING('加载数据中…');
  133. _this.HTTP_GET('learun/adms/timetable/list', param, '加载数据时出错').then(res => {
  134. this.HIDE_LOADING();
  135. // console.log(res);
  136. _this.ProcessingData(res);
  137. });
  138. },
  139. ProcessingData(data) {
  140. let dataM = [
  141. {
  142. weekTime: 1,
  143. num: Math.floor(Math.random() * 100000000),
  144. lessonData: []
  145. },
  146. {
  147. weekTime: 2,
  148. num: Math.floor(Math.random() * 100000000),
  149. lessonData: []
  150. },
  151. {
  152. weekTime: 3,
  153. num: Math.floor(Math.random() * 100000000),
  154. lessonData: []
  155. },
  156. {
  157. weekTime: 4,
  158. num: Math.floor(Math.random() * 100000000),
  159. lessonData: []
  160. },
  161. {
  162. weekTime: 5,
  163. num: Math.floor(Math.random() * 100000000),
  164. lessonData: []
  165. },
  166. {
  167. weekTime: 6,
  168. num: Math.floor(Math.random() * 100000000),
  169. lessonData: []
  170. },
  171. {
  172. weekTime: 7,
  173. num: Math.floor(Math.random() * 100000000),
  174. lessonData: []
  175. }
  176. ];
  177. data.forEach((n, i) => {
  178. n.sectionTime = n.LessonTime.slice(1);
  179. dataM.forEach((k, j) => {
  180. if (k.weekTime == n.LessonTime.slice(0, 1)) {
  181. k.lessonData.push(n);
  182. }
  183. });
  184. });
  185. dataM.forEach((n, i) => {
  186. n.lessonData.sort(common.compare('sectionTime'));
  187. });
  188. this.dataArr = dataM;
  189. },
  190. classTap(data) {
  191. let _this = this;
  192. // console.log(_this.user)
  193. if (_this.user.Description == "教师") {
  194. //console.log("教师");
  195. } else if (_this.user.Description == "学生") {
  196. let LeaveType = data.LeaveType;
  197. //console.log(LeaveType);
  198. let IsCheck = data.IsCheck;
  199. //console.log(IsCheck);
  200. if (LeaveType == "1") {
  201. let msg = "请假申请中";
  202. if (IsCheck == "1") {
  203. msg = "请假通过";
  204. }
  205. if (IsCheck == "2") {
  206. msg = "请假未通过";
  207. }
  208. _this.TOAST(msg);
  209. }
  210. else {
  211. this.NAV_TO('./leaveFrom', data, true);
  212. }
  213. }
  214. },
  215. onfun(obj){
  216. this.init(obj);
  217. }
  218. },
  219. created() {
  220. //this.ON('timeTable', this.init);
  221. this.ON('timeTable', this.onfun);
  222. this.init()
  223. }
  224. };
  225. </script>
  226. <style lang="less" scoped>
  227. .page{
  228. background: #fff;
  229. }
  230. .timeTable_sec1 {
  231. padding: 14px 12px;
  232. text-align: center;
  233. background: #0075c4;
  234. color: #94d4ff;
  235. font-size: 0;
  236. }
  237. .tSec1Box > * {
  238. display: inline-block;
  239. vertical-align: middle;
  240. }
  241. .tSec1Line {
  242. height: 13px;
  243. width: 1px;
  244. background: #94d4ff;
  245. margin: 0 10px;
  246. }
  247. .tSec1Box {
  248. font-size: 15px;
  249. overflow: hidden;
  250. white-space: nowrap;
  251. text-overflow: ellipsis;
  252. }
  253. #semester {
  254. margin-bottom: 10px;
  255. }
  256. #weekTime {
  257. }
  258. #weekTime text {
  259. margin: 0 10px;
  260. }
  261. .tSec1Box > text {
  262. width: auto;
  263. text-align: center;
  264. line-height: 22px;
  265. }
  266. .tSec1Box image {
  267. width: 15px;
  268. height: 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: hidden;
  283. }
  284. .tSec2TopLi {
  285. width: 14.285714%;
  286. float: left;
  287. line-height: 18px;
  288. padding: 9px 0 9px;
  289. color: #fff;
  290. font-size: 13px;
  291. border-right: 1px solid #1084d2;
  292. border-top: 1px solid #1084d2;
  293. }
  294. .tSec2TopLi:first-child {
  295. border-left: 1px solid #1084d2;
  296. }
  297. .tSec2TopLi.active {
  298. color: #0075c4;
  299. background: #fff;
  300. border-color: #fff;
  301. }
  302. .tSec2TopLi text {
  303. display: block;
  304. }
  305. .tSec2TopLi text:first-child {
  306. letter-spacing: 2px;
  307. text-transform: uppercase;
  308. }
  309. .tSec2Box {
  310. padding: 0 12px;
  311. margin-top: 10px;
  312. }
  313. .tSec2Con {
  314. border-left: 1px solid #d5eaf7;
  315. border-right: 1px solid #d5eaf7;
  316. border-top: 1px solid #d5eaf7;
  317. // display: none;
  318. }
  319. .tSec2Con:first-child {
  320. display: block;
  321. }
  322. .tSec2List {
  323. margin-top: 10px;
  324. }
  325. .tSec2List:first-child {
  326. margin-top: 0;
  327. }
  328. .tSec2ListLi {
  329. border-bottom: 1px solid #d5eaf7;
  330. overflow: hidden;
  331. height: 64px;
  332. }
  333. .tSec2ListL {
  334. float: left;
  335. background: #e8f6ff;
  336. height: 100%;
  337. width: 25%;
  338. text-align: center;
  339. line-height: 36px;
  340. padding: 11px 0;
  341. font-size: 14px;
  342. color: #646464;
  343. }
  344. .tSec2ListR {
  345. float: left;
  346. width: 75%;
  347. height: 100%;
  348. line-height: 18px;
  349. padding: 4px 0;
  350. overflow: hidden;
  351. }
  352. .tSec2ListBox {
  353. width: 70%;
  354. float: left;
  355. padding-left: 5px;
  356. }
  357. .tSec2ListT {
  358. color: #3e3e3e;
  359. font-size: 15px;
  360. margin: 2px 0;
  361. overflow: hidden;
  362. white-space: nowrap;
  363. text-overflow: ellipsis;
  364. }
  365. .tSec2ListTxt {
  366. color: #888888;
  367. font-size: 13px;
  368. }
  369. .tSec2Location {
  370. width: 30%;
  371. float: left;
  372. line-height: 44px;
  373. font-size: 13px;
  374. color: #888888;
  375. }
  376. .noHtml {
  377. height: 100%;
  378. line-height: 60px;
  379. text-align: center;
  380. font-size: 14px;
  381. }
  382. </style>