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.
 
 
 
 
 
 

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