index.vue 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195
  1. <template>
  2. <view>
  3. <view>
  4. <view class="home_top" :style="'background-color:'+backgroundColor+';padding-top:'+tops+'px;'">
  5. <!-- <view class="home_adr">
  6. <image :src="adrimg"></image>
  7. <view class="overtwo">{{address}}</view>
  8. </view> -->
  9. <!-- #ifdef MP-WEIXIN -->
  10. <view class="home_check flexcj" style="padding-right: 160rpx;">
  11. <!-- #endif -->
  12. <!-- #ifndef MP-WEIXIN -->
  13. <view class="home_check flexcj">
  14. <!-- #endif -->
  15. <!-- 欢迎您登录智能校管家 -->
  16. <!-- 判断有几种角色 -->
  17. <block v-for="(ite,idx) in userrolesarr" :key="idx">
  18. <view class="check_btn" v-if="ite=='school'&&rolesidx==idx" @click="getRoleFn('school',idx)"><image :src="checimg"></image>切换学校</view>
  19. <view class="check_btn" v-if="ite=='teacher'&&rolesidx==idx" @click="getRoleFn('teacher',idx)"><image :src="checimg"></image>切换老师</view>
  20. <view class="check_btn" v-if="ite=='parents'&&rolesidx==idx" @click="getRoleFn('parents',idx)"><image :src="checimg"></image>切换家长</view>
  21. </block>
  22. <!-- 选择学校 -->
  23. <!-- -->
  24. <view style="flex: 0 1 auto;overflow: hidden;">
  25. <picker range-key='dictLabel' v-if="roles&&roles=='parents'" :value="voindex" :range="voList" @change='bindDateChangea'>
  26. <view class="pay_btn flexcc" >
  27. <view class="f15 cofe f500 over" :class="companyName?'co16':''">
  28. {{companyName||"请选择学校"}}</view>
  29. <image :src="upimg" class="rimgs"></image>
  30. </view>
  31. </picker>
  32. </view>
  33. </view>
  34. </view>
  35. <image :src="abg" class="abg"></image>
  36. <view style="margin-top: -460rpx;position: relative;padding-bottom: 20rpx;">
  37. <!-- <block v-if="dataflag"> -->
  38. <!-- 老师 -->
  39. <view class="hatop" v-if="roles=='teacher'">
  40. <image :src="bbg" class="bbg"></image>
  41. <view class="hatopa">
  42. <view class="hatime mb20">{{kaTime}}</view>
  43. <view class="flex1">
  44. <block v-for="(ite,idx) in teacherClass" :key="idx">
  45. <block v-if="idx==checkclassidx">
  46. <view class="hatit w200 mb12"><text>学校名称:</text>{{ite.schoolName}}</view>
  47. <view class="flexcj w200 mb12">
  48. <view class="hatit"><text>上课班级:</text>{{ite.className}}</view>
  49. <view class="checkimg" @click="getcheckClass(idx)" v-if="teacherClass.length>1">
  50. <image :src="hcheck"></image>
  51. </view>
  52. </view>
  53. </block>
  54. </block>
  55. <view class="flex mb12">
  56. <view class="hatit w50"><text>当前授课老师:</text>{{tablenow.teacher}}</view>
  57. <view class="hatit w50"><text>课程名称:</text>{{tablenow.subject}}</view>
  58. </view>
  59. </view>
  60. <view class="flex0 mb8" v-if="tablenow.time">
  61. <view class="hatit"><text>下课时间:</text>{{tablenow.time}}</view>
  62. </view>
  63. <view class="flex0 flexcj">
  64. <view class="haftime">
  65. <image :src="htime"></image>
  66. <!-- @click="handleTime" -->
  67. <view>还有<text>{{timetit}}</text>分钟
  68. <block v-if="checkidx==1">延迟放学</block>
  69. <block v-if="checkidx==2">准备放学</block>
  70. </view>
  71. </view>
  72. <!-- 未放学 -->
  73. <view class="hafbtn">
  74. <view :class="checkidx==1?'act':''" @click="getcheck(1)">
  75. <image :src="hbaga"></image>延迟放学
  76. </view>
  77. <view :class="checkidx==2?'act':''" @click="getcheck(2)">
  78. <image :src="hbag"></image>准备放学
  79. </view>
  80. </view>
  81. <!-- 已放学 -->
  82. <!-- <view class="hafbtn ">
  83. <view class="acts"><image :src="hbaga"></image>已延迟</view>
  84. <view class="acts">
  85. <image :src="hbag"></image>已放学
  86. </view>
  87. </view> -->
  88. </view>
  89. </view>
  90. </view>
  91. <!-- 家长 列表全展示-->
  92. <block v-if="roles=='parents'">
  93. <view class="hatop" style="min-height: 489rpx;" v-for="(ite,idx) in parentsStudent" :key="idx">
  94. <image :src="cbg" class="bbg"></image>
  95. <view class="hatopa" style="padding-top: 120rpx;">
  96. <view class="hatime mb20">{{kaTime}}</view>
  97. <view class="flex1">
  98. <view class="hatit w200 mb12"><text>学校名称:</text>{{ite.schoolName}}</view>
  99. <view class="flexcj w200 mb12">
  100. <view class="hatit"><text>上课班级:</text>{{ite.className}}</view>
  101. </view>
  102. <view class="flex mb12">
  103. <view class="hatit w50"><text>当前授课老师:</text>{{ite.teacher}}</view>
  104. <view class="hatit w50"><text>课程名称:</text>{{ite.subject}}</view>
  105. </view>
  106. </view>
  107. <view class="flex0 flexcj">
  108. <view class="haftime">
  109. <image :src="htime"></image>
  110. <view v-if="ite.time&&ite.time!='time'">
  111. 将于<text>{{ite.time}}</text>放学,请您于校门口等待孩子。</view>
  112. <view v-else>暂无放学信息,请耐心等待</view>
  113. </view>
  114. </view>
  115. </view>
  116. </view>
  117. </block>
  118. <!-- tab -->
  119. <view class="itab">
  120. <view class="tlist" @click="getStuFn" v-if="checkPermi(['student:info:list'])">
  121. <view class="image"><image :src="itaba" class="ico1"></image></view>
  122. <view>学生档案</view>
  123. </view>
  124. <!-- <view class="tlist" @click="getStuFn"><image :src="itaba"></image><view>成长档案</view></view> -->
  125. <view class="tlist" @click="getTeaFn" v-if="checkPermi(['teacher:info:list'])">
  126. <view class="image"><image :src="itabb" class="ico1"></image></view>
  127. <view>职工档案</view>
  128. </view>
  129. <!-- 家长 -->
  130. <view class="tlist" @click="getScoreFn" v-if="checkPermi(['score:data:list'])">
  131. <view class="image"><image :src="itabc" class="ico2"></image></view>
  132. <view>学生成绩</view>
  133. </view>
  134. <view class="tlist" @click="getSecoreFn(1)" v-if="checkPermi(['xiaoYuanInfo:xiaoYuanInfo:list'])">
  135. <view class="image"><image :src="itabd" class="ico2"></image></view>
  136. <view>校园广播</view>
  137. </view>
  138. <view class="tlist" @click="getSecoreFn(2)" v-if="checkPermi(['xiaoYuanInfo:xiaoYuanInfo:list'])">
  139. <view class="image"><image :src="itabe" class="ico3"></image></view>
  140. <view>校园安全</view>
  141. </view>
  142. <view class="tlist" @click="getLeaveFn" v-if="checkPermi(['system:leave:list'])">
  143. <view class="image"><image :src="itabl" class="ico4"></image></view>
  144. <view>在线请假</view>
  145. </view>
  146. <view class="tlist" @click="getMindFn" v-if="checkPermi(['mind:old:list'])&&roles=='parents'">
  147. <view class="image"><image :src="itabf" class="ico5"></image></view>
  148. <view>心理健康</view>
  149. </view>
  150. <!-- 家长 -->
  151. <view class="tlist" @click="getHeighFn" v-if="checkPermi(['live:old:list'])&&roles=='parents'">
  152. <view class="image"><image :src="itabk" class="ico1"></image></view>
  153. <view>身高体重</view>
  154. </view>
  155. <view class="tlist" @click="getTiaoFn" v-if="checkPermi(['course:change:reply'])">
  156. <view class="image"><image :src="itabg" class="ico5"></image></view>
  157. <view>调课审核</view>
  158. </view>
  159. <view class="tlist" @click="getFanFn">
  160. <view class="image"><image :src="itabi" class="ico5"></image></view>
  161. <view>防溺水</view>
  162. </view>
  163. <view class="tlist" @click="getPay" v-if="checkPermi(['xiaoYuan:pay:list'])">
  164. <view class="image"><image :src="itabo" class="ico6"></image></view>
  165. <view>工资条</view>
  166. </view>
  167. <view class="tlist" @click="getYuyueFn" v-if="checkPermi(['system:reservat:list'])">
  168. <view class="cirbox image">
  169. <image :src="itabm" class="ico2"></image>
  170. <view class="cir"></view>
  171. </view>
  172. <view>预约拜访</view>
  173. </view>
  174. <view class="tlist" @click="getMenuFn" v-if="checkPermi(['system:recipe:list'])">
  175. <view class="cirbox image">
  176. <image :src="itabq" class="ico1"></image>
  177. </view>
  178. <view>每日食谱</view>
  179. </view>
  180. <view class="tlist" @click="getopinion" v-if="checkPermi(['system:opinion:add'])">
  181. <view class="image"><image :src="itabp" class="ico8"></image></view>
  182. <view>意见反馈</view>
  183. </view>
  184. <view class="tlist" @click="getWebview">
  185. <view class="image"><image :src="itabn" class="ico2"></image></view>
  186. <view>问一问</view>
  187. </view>
  188. <!-- <view class="tlist" @click="getTiaoFn" ><image :src="itabj"></image><view>使用指南</view></view> -->
  189. <!-- v-if="roles=='parents'" -->
  190. <!-- <view class="tlist" @click="gettoStuFn" >
  191. <view class="image"><image :src="itabh" class="ico7"></image></view>
  192. <view>敬请期待</view>
  193. </view> -->
  194. </view>
  195. <!-- 路况 公共的-->
  196. <lu-swiper ></lu-swiper>
  197. <!-- 视频 -->
  198. <view class="mt15" v-if="videoflag=='true'">
  199. <luVideo></luVideo>
  200. </view>
  201. <!-- 放学状态 -->
  202. <view class="hsta" v-if="roles&&roles!='parents'">
  203. <view class="hsta_t flexcj">
  204. <view class="hsta_tl f17 ">
  205. 放学状态
  206. <image :src="hline" class="hline"></image>
  207. </view>
  208. <view class="f15 co6 fw5">共计 {{allinfo.all||0}}个班级</view>
  209. </view>
  210. <view class="bgf hsta_tm">
  211. <view class="flexcj pb15">
  212. <view class="hsta_tmt bg1">
  213. <view class="hsta_tmta">
  214. <view class="tit co33">已放学</view>
  215. <view><text class="co33 f18">{{allinfo.y||0}}</text>个班级</view>
  216. </view>
  217. <image :src="habag"></image>
  218. </view>
  219. <view class="hsta_tmt bg2">
  220. <view class="hsta_tmta">
  221. <view class="tit coed">未放学</view>
  222. <view><text class="coed f18">{{allinfo.n||0}}</text>个班级</view>
  223. </view>
  224. <image :src="haclass"></image>
  225. </view>
  226. </view>
  227. <block v-if="list.length>0">
  228. <view class="htlist" v-for="(ite,idx) in list" :key="idx">
  229. <view class="htlistl f15 fw5"><text class="co16">{{ite.className}}</text><text
  230. class="line">|</text>
  231. <block v-if="ite.time=='time'">等待放学中</block>
  232. <block v-else>放学时间 {{ite.time}}</block>
  233. </view>
  234. <view class="f15 fw5 coed flex0" v-if="ite.time=='time'">未放学</view>
  235. <view class="f15 fw5 co33 flex0" v-else>已放学</view>
  236. </view>
  237. </block>
  238. <view class="hmore" @click="getMore" v-if="reachflag">
  239. 查看更多
  240. <image :src="moreimg"></image>
  241. </view>
  242. </view>
  243. </view>
  244. <!-- </block> -->
  245. <!-- 暂无信息 -->
  246. <!-- <block v-else><no-data ></no-data></block> -->
  247. </view>
  248. </view>
  249. <!-- 发布按钮 -->
  250. <image :src="scoreimg" class="scoreimg" @click="getRelease" v-if="checkPermi(['score:data:add'])"></image>
  251. <!-- 弹窗 -->
  252. <pop-up :type='type' :timetit="timetit" :timelist="timelist" :confdat="confdat" @getConfirm="getConfirm"
  253. @getClose="getClose" @getyanKeyFn="getyanKeyFn" ></pop-up>
  254. <footers v-if="isfootflag" :footlist="footlist" :footerindex="footerindex" :color_checked="color_checked" :color_nochecked="color_nochecked" :isHomeIndex="true"></footers>
  255. </view>
  256. </template>
  257. <script>
  258. import myAmapFun from '@/utils/initmap.js';
  259. import self from '@/utils/location.js';
  260. import noData from "@/components/nodata/nodata.vue"
  261. import luSwiper from "@/components/home/luswiper.vue"
  262. import luVideo from "@/components/home/luvideo.vue"
  263. import popUp from "@/components/popup/popup.vue"
  264. import footers from '@/components/footer/footer.vue'
  265. import {getApplet,getAppxiaKe,getApplist,getTablenow,getxiaKeTime,getAdrinfo,gettenantCheck,getptenantList} from "@/api/index/index.js"
  266. import {getDictionaryFn,getconfigKeyFn} from '@/api/mine/register.js'
  267. import {getConfigKey,getupdConfigKey} from "@/api/mine/mine.js"
  268. import {checkPermi,checkRole} from "@/utils/permission"; // 权限判断函数
  269. import {getInfo} from '@/api/login'
  270. import { resolveTransitionHooks } from "vue";
  271. export default {
  272. data() {
  273. return {
  274. footlist:[
  275. {module:'home',title:'首页',icon_checked:require('@/static/images/tabbar/home_.png'),icon_nochecked:require('@/static/images/tabbar/home.png'),},
  276. {module:'work',title:'课表',icon_checked:require('@/static/images/tabbar/work_.png'),icon_nochecked:require('@/static/images/tabbar/work.png'),limit:'course:table:list'},
  277. {module:'trends',title:'动态',icon_checked:require('@/static/images/tabbar/trends_.png'),icon_nochecked:require('@/static/images/tabbar/trends.png'),limit:'xiaoYuan:notice:list'},
  278. {module:'mine',title:'我的',icon_checked:require('@/static/images/tabbar/mine_.png'),icon_nochecked:require('@/static/images/tabbar/mine.png')},
  279. ],
  280. footerindex:'home',
  281. isfootflag:true,
  282. color_checked :'161616',
  283. color_nochecked :'666666',
  284. navborder: false,
  285. abg: require('@/static/images/index/habg.png'),
  286. bbg: require('@/static/images/index/hbbg.png'),
  287. cbg: require('@/static/images/index/hcbg.png'),
  288. hcheck: require('@/static/images/hcheck.png'),
  289. habag: require('@/static/images/index/habag.png'),
  290. haclass: require('@/static/images/index/haclass.png'),
  291. hbag: require('@/static/images/index/hbag.png'),
  292. hbaga: require('@/static/images/index/hbaga.png'),
  293. hline: require('@/static/images/hline.png'),
  294. htime: require('@/static/images/htime.png'),
  295. upimg: require('@/work/static/pay/aup.png'),
  296. moreimg: require('@/static/images/hmore.png'),
  297. itaba: require('@/static/images/index/itaba.png'),
  298. itabb: require('@/static/images/index/itabb.png'),
  299. itabc: require('@/static/images/index/itabc.png'),
  300. itabd: require('@/static/images/index/itabd.png'),
  301. itabe: require('@/static/images/index/itabe.png'),
  302. itabf: require('@/static/images/index/itabf.png'),
  303. itabg: require('@/static/images/index/itabg.png'),
  304. itabh: require('@/static/images/index/itabh.png'),
  305. itabi: require('@/static/images/index/itabi.png'),
  306. itabj: require('@/static/images/index/itabj.png'),
  307. itabk: require('@/static/images/index/itabk.png'),
  308. itabl: require('@/static/images/index/itabl.png'),
  309. itabm: require('@/static/images/index/itabm.png'),
  310. itabn: require('@/static/images/index/itabn.png'),
  311. itabo: require('@/static/images/index/itabo.png'),
  312. itabp: require('@/static/images/index/itabp.png'),
  313. itabq: require('@/static/images/index/itabq.png'),
  314. scoreimg: require('@/static/images/index/release.png'),
  315. adrimg: require('@/static/images/adr.png'),
  316. checimg: require("@/static/images/check.png"),
  317. checkidx: 2,
  318. checkidxs: 2,
  319. timetype: 1,
  320. backgroundColor: "transparent",
  321. allinfo: {},
  322. pageSize: 10,
  323. pageNum: 1,
  324. reachflag: true,
  325. wtdt: '',
  326. list: [],
  327. confdat: {
  328. tit: '确认放学',
  329. txt: "是否确认准备放学?",
  330. closetxt: '取消',
  331. suretxt: '确认放学'
  332. },
  333. confdata: {
  334. tit: '确认放学',
  335. txt: "是否确认准备放学?",
  336. closetxt: '取消',
  337. suretxt: '确认放学'
  338. },
  339. confdatb: {
  340. tit: '延迟放学',
  341. txt: "是否确认延迟放学?",
  342. closetxt: '取消',
  343. suretxt: '确认延迟'
  344. },
  345. type: 0,
  346. timefn: '',
  347. kaTime: '',
  348. timetit: '',
  349. ftimetit: '',
  350. ytimetit: '',
  351. timelist: [],
  352. checkclassidx: 0, //切换班级idx
  353. classId: '', //班级id
  354. schoolId: '', //学校id
  355. roles: '',
  356. teacherClass: [],
  357. parentsStudent: [],
  358. dataflag: false,
  359. choseroles: '',
  360. tablenow: {
  361. teacher: '',
  362. subject: ''
  363. }, //现在上课
  364. loadflag: true,
  365. tops:0,
  366. location:'',
  367. address:'',
  368. userrolesarr:[],
  369. rolesidx:0,
  370. scrollTop:0,
  371. setflag:false,
  372. voList:[],
  373. companyName:'',
  374. tenantId:'',
  375. voindex:0,
  376. videoflag:'false'
  377. }
  378. },
  379. components: {
  380. luSwiper,
  381. luVideo,
  382. popUp,
  383. noData,footers
  384. },
  385. onUnload() {
  386. clearInterval(this.timefn)
  387. if (this.teacherClass && this.teacherClass.length > 0) {
  388. var idx = Number(this.checkclassidx) || 0;
  389. var newArr = this.teacherClass || [];
  390. var newstr = newArr[idx]
  391. var newobj = {
  392. classId: newstr.classId,
  393. schoolId: newstr.schoolId,
  394. discipline: newstr.discipline,
  395. schoolName: newstr.schoolName,
  396. }
  397. // 修改储存的schoolId
  398. this.$store.dispatch('checkClass', newobj).then(() => {
  399. }).catch(() => {
  400. })
  401. uni.setStorageSync('checkclass', JSON.parse(JSON.stringify(newobj)))
  402. }
  403. },
  404. onLoad: function() {
  405. this.loadflag = true;
  406. this.getptenantList()
  407. this.getClassFn();
  408. uni.getSystemInfo({
  409. success: (e) => {
  410. this.tops = Number(e.statusBarHeight);
  411. }
  412. })
  413. var that=this;
  414. this.userrolesarr=this.$store.state.user.roles;
  415. this.getconfigKeyFn()
  416. },
  417. onPullDownRefresh: function() {
  418. this.reachflag = true;
  419. this.pageNum = 1;
  420. this.list = [];
  421. clearInterval(this.timefn)
  422. this.getClassFn();
  423. setTimeout(function() {
  424. uni.stopPullDownRefresh();
  425. }, 1000);
  426. },
  427. onShow: function() {
  428. var scrollTop=this.scrollTop;
  429. if (scrollTop > 0) {
  430. this.backgroundColor = '#c4defb'
  431. } else {
  432. uni.pageScrollTo({
  433. scrollTop: 0,
  434. duration: 0
  435. })
  436. this.backgroundColor = 'transparent'
  437. }
  438. return
  439. // 判断角色是否一样
  440. if (!this.loadflag) {
  441. var choseroles = this.$store.state.user.choseroles;
  442. if (this.roles && choseroles && this.roles != choseroles) {
  443. clearInterval(this.timefn)
  444. this.getClassFn()
  445. } else {
  446. var newArr=this.$store.state.user.refreshflag
  447. if(newArr&&newArr.length){
  448. if(newArr[0]){
  449. clearInterval(this.timefn)
  450. this.getClassFn()
  451. newArr[0]=false
  452. this.$store.dispatch('checkRefresh', newArr).then(() => {
  453. }).catch(() => {
  454. })
  455. return
  456. }
  457. }
  458. if (choseroles != 'parents') {
  459. this.init()
  460. }
  461. if (choseroles == 'teacher') {
  462. this.getConfigKey()
  463. }
  464. }
  465. }
  466. var that=this;
  467. if(that.setflag){
  468. that.setflag=false;
  469. // #ifndef H5
  470. self.getLocation(function(res){
  471. if(res==-1){
  472. that.setflag=true
  473. }else{
  474. that.getAdrinfoFn(res)
  475. // that.location = `${res.lng},${res.lat}`
  476. // that.address=res.city;
  477. }
  478. })
  479. // #endif
  480. }else{
  481. // this.location = `${self.__CFG.lng},${self.__CFG.lat}`
  482. // this.address=self.__CFG.city;
  483. }
  484. },
  485. onReachBottom() {
  486. if (this.reachflag && this.pageNum != 1) {
  487. this.pageNum++
  488. this.getDataFn()
  489. }
  490. },
  491. methods: {
  492. checkPermi,
  493. checkRole,
  494. getconfigKeyFn(){
  495. getconfigKeyFn('sys.video.player').then(res=>{
  496. if(res.code==200){
  497. this.videoflag=res.msg
  498. }
  499. })
  500. },
  501. bindDateChangea(e){
  502. var val=e.detail.value;
  503. var id=this.voList[val].dictValue
  504. this.companyName=this.voList[val].dictLabel;
  505. if(id!=this.tenantId){
  506. this.tenantId=id
  507. gettenantCheck(id).then(res=>{
  508. this.getClassFn();
  509. // 刷新其余的页面
  510. var newArr=[false,true,true,true,true]
  511. this.$store.dispatch('checkRefresh', newArr).then(() => {
  512. }).catch(() => {
  513. })
  514. })
  515. }
  516. },
  517. getptenantList(){
  518. getptenantList().then(res=>{
  519. if(res.code==200){
  520. if(res.data.voList&&res.data.voList.length){
  521. this.voList = res.data.voList.map(v => {
  522. return {
  523. dictLabel: v.companyName,
  524. dictValue: v.tenantId
  525. }
  526. })
  527. }
  528. }else{
  529. this.$toast(res.msg)
  530. }
  531. })
  532. },
  533. getScoreFn() {
  534. this.$tab.navigateTo('/mine/pages/release/scorelist')
  535. },
  536. getPay(){
  537. // 学校看列表
  538. var roles=this.roles;
  539. if(roles=='school'){
  540. this.$tab.navigateTo('/mine/pages/payslip/paylist')
  541. }else if(roles=='teacher'){
  542. this.$tab.navigateTo('/mine/pages/payslip/index')
  543. }
  544. //老师看详情
  545. },
  546. //意见反馈
  547. getopinion(){
  548. this.$tab.navigateTo('/mine/pages/trends/addopinion')
  549. },
  550. getWebview(){
  551. var url='https://ai.cnzxy.cn/room/67'
  552. uni.navigateTo({
  553. url:'/pages/common/webview/index?url='+encodeURIComponent(url)
  554. })
  555. },
  556. getAdrinfoFn(res){
  557. var params={
  558. address:res.address,
  559. longitude:res.lng,
  560. latitude:res.lat,
  561. }
  562. getAdrinfo(params).then(res=>{
  563. })
  564. },
  565. getRoleFn(type,idx){
  566. var that=this;
  567. that.rolesidx=Number(idx)<that.userrolesarr.length-1?Number(idx)+1:0;
  568. var userroles=this.$store.state.user.userroles;
  569. Object.keys(userroles).some((key) => {
  570. if (userroles[key].roleKey == ('' + type)) {
  571. that.$store.dispatch('checkRole', userroles[key]).then(() => {
  572. that.getClassFn()
  573. uni.pageScrollTo({
  574. scrollTop: 0,
  575. duration: 0
  576. })
  577. }).catch(() => {
  578. })
  579. return true;
  580. }
  581. })
  582. },
  583. gettoStuFn() {
  584. },
  585. getRelease() {
  586. this.$tab.navigateTo('/mine/pages/release/index')
  587. },
  588. getStuFn() {
  589. this.$tab.navigateTo('/mine/pages/files/student')
  590. },
  591. getTeaFn() {
  592. this.$tab.navigateTo('/mine/pages/files/teacher')
  593. },
  594. getTiaoFn() {
  595. this.$tab.navigateTo('/work/pages/examine/tkcourse')
  596. },
  597. getSecoreFn(id) {
  598. this.$tab.navigateTo('/work/pages/news/secure?type='+id)
  599. },
  600. getMindFn() {
  601. this.$tab.navigateTo('/mine/pages/files/mindlist')
  602. },
  603. getFanFn(){
  604. this.$tab.navigateTo('/mine/pages/mine/limit')
  605. },
  606. getYuyueFn(){
  607. this.$tab.navigateTo('/work/pages/order/index')
  608. },
  609. getMenuFn(){
  610. this.$tab.navigateTo('/work/pages/menu/list')
  611. },
  612. getLeaveFn() {
  613. this.$tab.navigateTo('/mine/pages/files/leavelist')
  614. },
  615. getHeighFn() {
  616. this.$tab.navigateTo('/mine/pages/files/heightlist')
  617. },
  618. getMore() {
  619. // 判断是否有第二节
  620. if (this.reachflag) {
  621. this.pageNum++
  622. this.getDataFn()
  623. }
  624. },
  625. getcheck(e) {
  626. if (this.checkidx == e) {
  627. } else {
  628. this.checkidx = e;
  629. }
  630. this.checkidxs = e;
  631. if (e == 2) { //准备放学
  632. this.timetype = 1;
  633. this.type = 1;
  634. this.timetit = this.ftimetit
  635. this.confdat = this.confdata
  636. } else { //延迟放学
  637. this.timetype = 2;
  638. // 延迟放学
  639. var obj = this.confdatb;
  640. this.timetit = this.ytimetit
  641. obj.txt = '是否确认延迟' + this.ytimetit + '分钟放学?'
  642. this.confdat = obj;
  643. this.type = 9;
  644. }
  645. },
  646. getConfigKey(e) {
  647. this.getConfigKeyf();
  648. this.getConfigKeyy();
  649. //e 是classid
  650. //"configType":"1:准备下课 2:延迟下课"
  651. // var params={
  652. // configType:this.timetype,
  653. // configKey:this.classId
  654. // }
  655. // //班级id
  656. // // configType "1:准备下课 2:延迟下课",
  657. // getConfigKey(params).then(res=>{
  658. // if(res.code==200){
  659. // this.timetit=res.msg;
  660. // }else{
  661. // this.$toast(res.msg)
  662. // }
  663. // })
  664. //
  665. },
  666. getConfigKeyf() {
  667. var params = {
  668. configType: 1,
  669. configKey: this.classId
  670. }
  671. //班级id
  672. // configType "1:准备下课 2:延迟下课",
  673. getConfigKey(params).then(res => {
  674. if (res.code == 200) {
  675. if (this.checkidx == 2) {
  676. this.timetit = res.msg;
  677. }
  678. this.ftimetit = res.msg;
  679. } else {
  680. this.$toast(res.msg)
  681. }
  682. })
  683. },
  684. getConfigKeyy() {
  685. var params = {
  686. configType: 2,
  687. configKey: this.classId
  688. }
  689. //班级id
  690. // configType "1:准备下课 2:延迟下课",
  691. getConfigKey(params).then(res => {
  692. if (res.code == 200) {
  693. this.ytimetit = res.msg;
  694. if (this.checkidx == 1) {
  695. this.timetit = res.msg;
  696. }
  697. } else {
  698. this.$toast(res.msg)
  699. }
  700. })
  701. },
  702. getinit() {
  703. // 放学时间
  704. getDictionaryFn('sys_time').then(res => {
  705. if (res.code == 200) {
  706. this.timelist = res.data.map(v => {
  707. return {
  708. dictLabel: v.dictLabel,
  709. dictValue: v.dictValue
  710. }
  711. })
  712. }
  713. })
  714. },
  715. getConfirm() {
  716. var params = {
  717. schoolId: this.schoolId,
  718. classId: this.classId
  719. }
  720. if (this.checkidx == 2) {
  721. params.type = 1
  722. } else {
  723. params.type = 2
  724. }
  725. getAppxiaKe(params).then(res => {
  726. if (res.code == 200) {
  727. // this.checkidx=this.checkidxs;
  728. // this.getConfigKey();
  729. this.$toast('放学成功')
  730. this.type = 0;
  731. this.init()
  732. }
  733. })
  734. },
  735. handleTime() {
  736. // this.getConfigKey()
  737. this.type = 3
  738. },
  739. // 延迟
  740. getyanKeyFn(str){
  741. var params = {
  742. schoolId: this.schoolId,
  743. classId: this.classId,
  744. xiakeTime:Number(str)
  745. }
  746. if (this.checkidx == 2) {
  747. params.type = 1
  748. } else {
  749. params.type = 2
  750. }
  751. // console.log(params)
  752. // return
  753. getAppxiaKe(params).then(res => {
  754. if (res.code == 200) {
  755. // this.checkidx=this.checkidxs;
  756. // this.getConfigKey();
  757. this.$toast('放学成功')
  758. this.type = 0;
  759. this.init()
  760. }
  761. })
  762. },
  763. getKeyFn() {
  764. var params = {
  765. 'configKey': this.classId,
  766. 'configValue': this.timetit,
  767. "configType": this.timetype
  768. }
  769. getupdConfigKey(params).then(res => {
  770. if (res.code == 200) {
  771. this.$toast('修改成功')
  772. this.type = 0;
  773. } else {
  774. this.$toast(res.msg)
  775. }
  776. })
  777. },
  778. getClose() {
  779. this.type = 0
  780. },
  781. gettimeFn() {
  782. var that = this;
  783. clearInterval(this.timefn)
  784. that.time();
  785. // var stime = this.shuatime
  786. that.timefn = setInterval(function() {
  787. // if (stime <= 1) {
  788. // that.shuiux()
  789. // stime = that.shuatime
  790. // }
  791. // stime = stime - 1;
  792. that.time();
  793. }, 1000);
  794. },
  795. time() {
  796. var date = new Date();
  797. var y = date.getFullYear();
  798. var m = date.getMonth() + 1;
  799. var d = date.getDate();
  800. var h = date.getHours();
  801. var min = date.getMinutes();
  802. var s = date.getSeconds();
  803. var week = date.getDay(); //获取当前星期X(0-6,0代表星期天)
  804. var weeks = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
  805. var yearStr = y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d)
  806. var timeStr = (h < 10 ? ('0' + h) : h) + ':' + (min < 10 ? ('0' + min) : min) + ':' + (s < 10 ? (
  807. '0' + s) : s);
  808. this.kaTime = yearStr + ' ' + timeStr;
  809. // this.kaYear = y;
  810. // this.kaMonth = m < 10 ? "0" + m : m;
  811. // this.kaDay = d < 10 ? "0" + d : d;
  812. // this.kaWeek = week;
  813. // this.gettime = timeStr
  814. },
  815. init() {
  816. this.getApplet();
  817. this.getApplist()
  818. this.getTablenow();
  819. },
  820. timeinit() {
  821. this.gettimeFn();
  822. this.getTablenow();
  823. this.getinit();
  824. this.getConfigKey();
  825. },
  826. getcheckClass(idx) {
  827. var leng = Number(this.teacherClass.length) - 1;
  828. if (Number(idx) < leng) {
  829. this.checkclassidx++
  830. } else {
  831. this.checkclassidx = 0;
  832. }
  833. var newArr = this.teacherClass;
  834. var nidx = this.checkclassidx;
  835. var newstr = newArr[nidx]
  836. this.classId = newstr.classId;
  837. this.schoolId = newstr.schoolId;
  838. this.getTablenow()
  839. this.getConfigKey();
  840. // 请求新数据
  841. },
  842. getClassFn() {
  843. var that = this;
  844. this.$store.dispatch('GetInforoles').then(resd => {
  845. that.loadflag = false;
  846. if (resd.code == 200) {
  847. var roles = that.$store.state.user.choseroles;
  848. that.roles = roles;
  849. var res=resd.data;
  850. var idx=that.userrolesarr.indexOf(roles)
  851. that.rolesidx=idx<that.userrolesarr.length-1?Number(idx)+1:0;
  852. if (roles == 'teacher') {
  853. if (res.user && res.user.teacherClass && res.user.teacherClass.length) {
  854. var teacherClass=res.user.teacherClass;
  855. var newArrs = [];
  856. const map = new Map();
  857. that.teacherClass = teacherClass.filter(v => !map.has(v.classId) && map.set(v.classId, 1));
  858. if (uni.getStorageSync('checkclass')) {
  859. var newobja = JSON.parse(JSON.stringify(uni.getStorageSync('checkclass')))
  860. // 选择展示那个数据
  861. var newArr = that.teacherClass;
  862. var val = newobja.classId;
  863. var a = 0;
  864. Object.keys(newArr).some((key) => {
  865. if (newArr[key].classId == ('' + val)) {
  866. that.checkclassidx = key;
  867. a = 1;
  868. return true;
  869. }
  870. })
  871. if (a == 0) {
  872. var newstr = that.teacherClass[0];
  873. var newobj = {
  874. classId: newstr.classId,
  875. schoolId: newstr.schoolId,
  876. discipline: newstr.discipline,
  877. schoolName: newstr.schoolName,
  878. }
  879. that.checkclassidx = 0;
  880. that.classId = newobj.classId;
  881. that.schoolId = newobj.schoolId;
  882. that.$store.dispatch('checkClass', newobj).then(() => {
  883. })
  884. uni.setStorageSync('checkclass', JSON.parse(JSON.stringify(newobj)))
  885. } else {
  886. that.classId = newobja.classId;
  887. that.schoolId = newobja.schoolId;
  888. }
  889. } else {
  890. var newstr = that.teacherClass[0];
  891. var newobj = {
  892. classId: newstr.classId,
  893. schoolId: newstr.schoolId,
  894. discipline: newstr.discipline,
  895. schoolName: newstr.schoolName,
  896. }
  897. that.checkclassidx = 0;
  898. that.classId = newobj.classId;
  899. that.schoolId = newobj.schoolId;
  900. that.$store.dispatch('checkClass', newobj).then(() => {
  901. })
  902. uni.setStorageSync('checkclass', JSON.parse(JSON.stringify(newobj)))
  903. }
  904. that.dataflag = true;
  905. this.timeinit()
  906. that.init()
  907. } else {
  908. that.dataflag = false
  909. that.teacherClass =[];
  910. }
  911. } else if (roles == 'parents') {
  912. if (res.user && res.user.parentsStudent && res.user.parentsStudent.length) {
  913. var newArr = [];
  914. const map = new Map();
  915. newArr = res.user.parentsStudent.filter(v => !map.has(v.classId) && map.set(v.classId, 1));
  916. var newArrs = [];
  917. newArr.forEach(ite => {
  918. var schoolId = ite.schoolId;
  919. var classId = ite.classId;
  920. var params = {
  921. schoolId: schoolId,
  922. classId: classId
  923. }
  924. getTablenow(params).then(res => {
  925. if (res.code == 200) {
  926. ite.teacher = res.data.teacher;
  927. ite.subject = res.data.subject;
  928. ite.time = res.data.time;
  929. newArrs[newArrs.length] = JSON.parse(JSON.stringify(
  930. ite));
  931. that.parentsStudent = JSON.parse(JSON.stringify(
  932. newArrs));
  933. // this.tablenow=res.data
  934. } else {
  935. that.$toast(res.msg)
  936. }
  937. }).catch(r => {
  938. if (r == 500) {
  939. newArrs[newArrs.length] = JSON.parse(JSON.stringify(
  940. ite));
  941. that.parentsStudent = JSON.parse(JSON.stringify(
  942. newArrs));
  943. }
  944. })
  945. })
  946. that.dataflag = true;
  947. // var newstr=res.user.parentsStudent[0];
  948. // that.classId=newstr.classId;
  949. // that.schoolId=newstr.schoolId;
  950. // 分班级选择
  951. // this.timeinit()
  952. } else {
  953. that.dataflag = false
  954. that.parentsStudent=[]
  955. }
  956. } else {
  957. // 学校
  958. that.classId = '';
  959. that.schoolId = that.$store.state.user.deptId;
  960. that.init()
  961. }
  962. }
  963. })
  964. },
  965. getTablenow() {
  966. var params = {
  967. schoolId: this.schoolId,
  968. classId: this.classId
  969. }
  970. getTablenow(params).then(res => {
  971. if (res.code == 200) {
  972. this.tablenow = res.data
  973. } else {
  974. this.$toast(res.msg)
  975. }
  976. })
  977. },
  978. getApplet() {
  979. var params = {
  980. schoolId: this.schoolId,
  981. // classId:this.classId
  982. }
  983. getApplet(params).then(res => {
  984. if (res.code == 200) {
  985. this.allinfo = res.data
  986. } else {
  987. this.$toast(res.msg)
  988. }
  989. })
  990. },
  991. getApplist() {
  992. var params = {
  993. schoolId: this.schoolId,
  994. pageSize: this.pageSize,
  995. pageNum: this.pageNum,
  996. }
  997. getApplist(params).then(res => {
  998. if (res.code == 200) {
  999. if (res.data.length < this.pageSize) {
  1000. this.reachflag = false
  1001. this.wtdt = '到底了~';
  1002. } else {
  1003. var num = parseInt(res.data.length) + parseInt(this.pageSize) * parseInt(this.pageNum -
  1004. 1)
  1005. if (num < res.total) {
  1006. this.reachflag = true
  1007. this.wtdt = '上拉加载更多'
  1008. } else {
  1009. this.reachflag = false
  1010. this.wtdt = '到底了~';
  1011. }
  1012. }
  1013. if (this.pageNum == 1) {
  1014. this.list = res.data;
  1015. } else {
  1016. this.list = this.list.concat(res.data)
  1017. }
  1018. } else {
  1019. this.$toast(res.msg)
  1020. }
  1021. })
  1022. },
  1023. getAppxiaKe() {
  1024. },
  1025. },
  1026. onPageScroll(e) {
  1027. var scrollTop = Number(e.scrollTop);
  1028. this.scrollTop=scrollTop;
  1029. if (scrollTop > 0) {
  1030. this.backgroundColor = '#c4defb'
  1031. } else {
  1032. this.backgroundColor = 'transparent'
  1033. }
  1034. },
  1035. }
  1036. </script>
  1037. <style lang="scss" scoped>
  1038. .home_top /deep/ .uni-navbar__placeholder{height: 0 !important;}
  1039. .hatop {position: relative;min-height: 419rpx;margin: 0 22rpx 0rpx;
  1040. .bbg{width: 100%;height: 100%;position: absolute;right: 0;top: 0;bottom: 0;left: 0;z-index: -1;}
  1041. .hatopa{box-sizing: border-box;padding: 58rpx 38rpx 44rpx 49rpx;display: flex;flex-direction: column;
  1042. .hatime{font-style: italic;color: #215CEB;font-size: 30rpx;font-weight: bold;flex: 0 0 auto;}
  1043. .hatit{font-size: 30rpx;color: #161616;display: flex;word-break: break-all;
  1044. text{flex:0 0 auto;font-weight: bold;}
  1045. }
  1046. .checkimg{flex: 0 0 auto;margin-left: 12rpx;padding: 8rpx 12rpx;
  1047. image{width: 28rpx;height: 24rpx;}
  1048. }
  1049. .haftime{display: flex;font-size: 28rpx;font-weight: bold;color: #161616;align-items: center;
  1050. text{font-size: 32rpx;color: #215CEB;min-width: 36rpx;text-align: center;padding: 0 10rpx;box-sizing: border-box;display: inline-block;}
  1051. image{width: 26rpx;height: 30rpx;margin-right: 18rpx;flex: 0 0 auto;}
  1052. }
  1053. .hafbtn{
  1054. flex: 0 0 auto;display: flex;align-items: center;height: 56rpx;border-radius: 28rpx;width:288rpx;background-color: #E8EAEC;
  1055. view{width:50%;display: flex;align-items: center;justify-content: center;font-size: 28rpx;font-weight: 500;color: #666666;height: 100%;
  1056. image{width: 24rpx;height: 24rpx;margin-right: 6rpx;display: none;}
  1057. &.act{background: linear-gradient(-37deg, rgba(22,80,229,0.96), rgba(68,138,255,0.96));border-radius: 28rpx;color: #ffffff;
  1058. image{display: block;}
  1059. }
  1060. &.acts{background: #eb5663;border-radius: 28rpx;color: #ffffff;
  1061. image{display: block;}
  1062. }
  1063. }
  1064. }
  1065. }
  1066. }
  1067. .abg{width: 100%;height: 622rpx;z-index: -2;}
  1068. .w200{width: 400rpx;}
  1069. // 放学状态
  1070. .hsta{margin: 50rpx 32rpx 0;
  1071. .hsta_t{margin-bottom: 39rpx;
  1072. .hsta_tl{font-weight: bold;color: #161616;position: relative;
  1073. .hline{position: absolute;bottom: -20rpx;width: 40rpx;height: 11rpx;left: 50%;margin-left: -20rpx;}
  1074. }
  1075. }
  1076. .hsta_tm{padding: 30rpx 20rpx;box-sizing: border-box;
  1077. .hsta_tmt{width: 48%;height: 140rpx;border-radius: 14rpx;display: flex;align-items: center;padding: 24rpx;box-sizing: border-box;
  1078. image{flex: 0 0 auto;margin-left: 20rpx;}
  1079. &.bg1{background: #EAEAF7;
  1080. image{width: 84rpx;height: 98rpx;}
  1081. }
  1082. &.bg2{background:#F9EAE2;
  1083. image{width: 86rpx;height: 94rpx;}
  1084. }
  1085. .hsta_tmta{flex: 1;font-size: 26rpx;
  1086. .tit{font-size: 30rpx;font-weight: bold;margin-bottom: 20rpx;}
  1087. text{display: inline-block;padding: 0 10rpx;min-width: 40rpx;box-sizing: border-box;}
  1088. }
  1089. }
  1090. // 列表
  1091. .htlist{display: flex;align-items: center;justify-content: space-between;margin-top: 30rpx;
  1092. .htlistl{flex: 1;color: #9D9D9D;
  1093. .line{display: inline-block;margin: 0 10rpx;}
  1094. }
  1095. }
  1096. }
  1097. .hmore{padding-top: 60rpx;font-size: 30rpx;font-weight: 500;text-align: center;
  1098. color: #AAAAAA;
  1099. image{width: 24rpx;height: 22rpx;margin: 12rpx auto 0;}
  1100. }
  1101. }
  1102. .pay_btn{min-width: 240rpx;height: 66rpx;flex: 0 1 auto;margin-left: 20rpx;overflow: hidden;
  1103. font-size: 30rpx;font-weight: 500;color: #333432;
  1104. image{width: 18rpx;height: 10rpx;margin-left: 20rpx;flex:0 0 auto;}
  1105. }
  1106. // tab
  1107. .itab{background-color: #ffffff;border-radius: 14rpx;display: flex;flex-wrap: wrap;padding: 8rpx 0;margin:26rpx 32rpx;
  1108. .tlist{display: flex;align-items: center;flex-direction: column;width: 25%;padding: 20rpx 0;flex:0 0 auto;position: relative;
  1109. .image{width: 52rpx;height: 52rpx;margin-bottom: 20rpx;display: flex;align-items: center;justify-content: center;
  1110. .ico1{width: 48rpx;height: 48rpx;}
  1111. .ico2{width: 48rpx;height: 50rpx;}
  1112. .ico3{width: 46rpx;height: 50rpx;}
  1113. .ico4{width: 52rpx;height: 48rpx;}
  1114. .ico5{width: 50rpx;height: 48rpx;}
  1115. .ico6{width: 50rpx;height: 52rpx;}
  1116. .ico7{width: 42rpx;height: 50rpx;}
  1117. .ico8{width: 50rpx;height: 50rpx;}
  1118. }
  1119. view{font-size: 28rpx;font-weight: 500;color: #161616;}
  1120. .cirbox{position: relative;}
  1121. .cir{min-width: 20rpx;height: 20rpx;background: #FF2D4F;border-radius: 50%;font-size: 20rpx;font-weight: 500;
  1122. color: #FFFFFF;position: absolute;right: -6rpx;top: -6rpx;line-height: 20rpx;text-align: center;}
  1123. }
  1124. }
  1125. .home_top{position: fixed;left: 0;right: 0;top: 0;padding:20rpx 36rpx 0;z-index: 2;}
  1126. .home_adr{display: flex;align-items: flex-start;padding-right: 200rpx;
  1127. view{font-size: 30rpx;font-weight: 500;color: #161616;flex: 1;}
  1128. image{width: 22rpx;height: 26rpx;margin-right:18rpx;box-sizing: border-box;margin-top: 6rpx;}
  1129. }
  1130. .home_check{display: flex;align-items: center;font-size: 30rpx;color: #333432;font-weight: 500;height: 88rpx;overflow: hidden;
  1131. .check_btn{display: flex;align-items: center;line-height: 48rpx;margin-left: 10rpx;flex:0 0 auto;
  1132. image{width: 26rpx;height: 22rpx;margin-right: 10rpx;}
  1133. font-weight: 500;color: #333432;font-size: 28rpx;padding: 0 16rpx;background-color: #e7f3fe;height: 48rpx;border-radius: 24rpx;
  1134. }
  1135. }
  1136. .scoreimg{width: 210rpx;height: 148rpx;position: fixed;right: 0;bottom: 120rpx;z-index: 1;}
  1137. </style>