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.
 
 
 
 
 
 

386 lines
8.2 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">{{ 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. margin-right: 2px;
  269. }
  270. .tSec1Box text:after {
  271. display: none;
  272. }
  273. .timeTable_sec2 {
  274. margin-bottom: 30px;
  275. }
  276. .tSec2Top {
  277. padding: 0 12px;
  278. background: #0075c4;
  279. height: 55px;
  280. text-align: center;
  281. overflow: hidden;
  282. }
  283. .tSec2TopLi {
  284. width: 14.285714%;
  285. float: left;
  286. line-height: 18px;
  287. padding: 9px 0 9px;
  288. color: #fff;
  289. font-size: 13px;
  290. border-right: 1px solid #1084d2;
  291. border-top: 1px solid #1084d2;
  292. }
  293. .tSec2TopLi:first-child {
  294. border-left: 1px solid #1084d2;
  295. }
  296. .tSec2TopLi.active {
  297. color: #0075c4;
  298. background: #fff;
  299. border-color: #fff;
  300. }
  301. .tSec2TopLi text {
  302. display: block;
  303. }
  304. .tSec2TopLi text:first-child {
  305. letter-spacing: 2px;
  306. text-transform: uppercase;
  307. }
  308. .tSec2Box {
  309. padding: 0 12px;
  310. margin-top: 10px;
  311. }
  312. .tSec2Con {
  313. border-left: 1px solid #d5eaf7;
  314. border-right: 1px solid #d5eaf7;
  315. border-top: 1px solid #d5eaf7;
  316. // display: none;
  317. }
  318. .tSec2Con:first-child {
  319. display: block;
  320. }
  321. .tSec2List {
  322. margin-top: 10px;
  323. }
  324. .tSec2List:first-child {
  325. margin-top: 0;
  326. }
  327. .tSec2ListLi {
  328. border-bottom: 1px solid #d5eaf7;
  329. overflow: hidden;
  330. height: 64px;
  331. }
  332. .tSec2ListL {
  333. float: left;
  334. background: #e8f6ff;
  335. height: 100%;
  336. width: 25%;
  337. text-align: center;
  338. line-height: 36px;
  339. padding: 11px 0;
  340. font-size: 14px;
  341. color: #646464;
  342. }
  343. .tSec2ListR {
  344. float: left;
  345. width: 75%;
  346. height: 100%;
  347. line-height: 18px;
  348. padding: 4px 0;
  349. overflow: hidden;
  350. }
  351. .tSec2ListBox {
  352. width: 70%;
  353. float: left;
  354. padding-left: 5px;
  355. }
  356. .tSec2ListT {
  357. color: #3e3e3e;
  358. font-size: 15px;
  359. margin: 2px 0;
  360. overflow: hidden;
  361. white-space: nowrap;
  362. text-overflow: ellipsis;
  363. }
  364. .tSec2ListTxt {
  365. color: #888888;
  366. font-size: 13px;
  367. }
  368. .tSec2Location {
  369. width: 30%;
  370. float: left;
  371. line-height: 44px;
  372. font-size: 13px;
  373. color: #888888;
  374. }
  375. .noHtml {
  376. height: 100%;
  377. line-height: 60px;
  378. text-align: center;
  379. font-size: 14px;
  380. }
  381. </style>