teacherHome.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. <!-- 教师首页 -->
  2. <template>
  3. <view class="teacherHome">
  4. <dataBoard v-if="pageType == 1" style="display: flex;flex-direction:column;flex:1;"></dataBoard>
  5. <view class="home-page" v-if="pageType == 2">
  6. <nav-bar :title="title" :background="background"></nav-bar>
  7. <view class="top-back-img" :style="{top:navHeight+'rpx'}">
  8. <!-- <view class="position-data-button" @click="goPage('dataBoard')" v-if="dataPageType">数据看板</view> -->
  9. <img class="position-data-button" @click="goPage('dataBoard')" v-if="dataPageType" src="@/pages/images/newImage/icon_sy_sjmb@1x.png">
  10. <img class="position-img" :src="rectangleLogo">
  11. </view>
  12. <view class="button-one-box">
  13. <view class="button-min" @click="goPage('securityCheck')">
  14. <img class="button-img" src="@/pages/images/newImage/icon_sy_aqjc@1x.png">
  15. <view class="button-name">安全检查</view>
  16. </view>
  17. <view class="button-min" @click="goPage('securityExamination')">
  18. <img class="button-img" src="@/pages/images/newImage/icon_sy_aqks@1x.png">
  19. <view class="button-name">安全考试</view>
  20. </view>
  21. <view class="button-min" @click="goPage('securityAdmittance')">
  22. <img class="button-img" src="@/pages/images/newImage/icon_sy_aqzr@1x.png">
  23. <view class="button-name">安全准入</view>
  24. </view>
  25. <view class="button-min" @click="goPage('hierarchicalControl')">
  26. <img class="button-img" src="@/pages/images/newImage/icon_sy_fjgk@1x.png">
  27. <view class="button-name">分级管控</view>
  28. </view>
  29. <view class="button-min" @click="goPage('securityResponsibility')">
  30. <img class="button-img" src="@/pages/images/newImage/icon_sy_aqzrr@1x.png">
  31. <view class="button-name">安全责任</view>
  32. </view>
  33. <view class="button-min" @click="goPage('deviceManagement')">
  34. <img class="button-img" src="@/pages/images/newImage/icon_sy_sbgl@1x.png">
  35. <view class="button-name">设备管理</view>
  36. </view>
  37. <view class="button-min" @click="goPage('emergencyDisposal')">
  38. <img class="button-img" src="@/pages/images/newImage/icon_sy_yjcz@1x.png">
  39. <view class="button-name">应急处置</view>
  40. </view>
  41. <view class="button-min" @click="goPage('cageSiteManagement')">
  42. <img class="button-img" src="@/pages/images/newImage/icon_sy_lwgl@1x.png">
  43. <view class="button-name">笼位管理</view>
  44. </view>
  45. </view>
  46. <topWarn></topWarn>
  47. <view class="button-two-box">
  48. <view class="button-big-box" @click="goPage('snapshot')"
  49. style="background-color: #DFF0FF;margin-right:20rpx;">
  50. <img src="@/pages/images/newImage/icon_sy_ssp@1x.png">
  51. <view class="button-min-box">
  52. <view>随手拍</view>
  53. <view>发现隐患</view>
  54. </view>
  55. </view>
  56. <view class="button-big-box" @click="goPage('remoteDoorOpening')" style="background-color: #D6EBDA;">
  57. <img src="@/pages/images/newImage/img_sy_yckm@1x.png">
  58. <view class="button-min-box">
  59. <view>远程开门</view>
  60. <view>立即开门</view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="button-three-box">
  65. <view class="button-big-box" @click="goPage()">
  66. <img src="@/pages/images/newImage/img_bg_hxpgk@1x.png">
  67. <view class="button-min-box">
  68. <view>化学品智能管控</view>
  69. <view>申购审批丨使用台账丨实验室库存</view>
  70. </view>
  71. </view>
  72. </view>
  73. <img class="scan_btn" @click.stop="saoCode" src="@/pages/images/icon_xyxc_sm.png" />
  74. <tab-bar></tab-bar>
  75. </view>
  76. </view>
  77. </template>
  78. <script>
  79. import {
  80. pageRestrictVerify
  81. } from '@/utils/index'
  82. import {
  83. tabBar
  84. } from '@/pages/component/tabBar.vue'
  85. import {
  86. navBar
  87. } from '@/pages/component/navbar.vue'
  88. import {
  89. topWarn
  90. } from '@/pages/component/topWarn.vue'
  91. import {
  92. dataBoard
  93. } from '@/pages/views/dataBoard/dataBoard.vue'
  94. export default {
  95. name: "teacherHome",
  96. components: {
  97. tabBar,
  98. navBar,
  99. topWarn,
  100. dataBoard,
  101. },
  102. data() {
  103. return {
  104. pageType: 2,
  105. navHeight: uni.getStorageSync('navHeight'),
  106. dataPageType: false,
  107. title: '实验室安全智慧化管控系统',
  108. background: '#0183FA',
  109. rectangleLogo: uni.getStorageSync('rectangleLogo'),
  110. identityData:uni.getStorageSync('identityData'),
  111. }
  112. },
  113. created() {
  114. if (pageRestrictVerify('dataBoard')) {
  115. this.dataPageType = true;
  116. if (!uni.getStorageSync('dataBoardType')) {
  117. this.pageType = 1;
  118. uni.setStorageSync('dataBoardType', true);
  119. }
  120. }
  121. },
  122. mounted() {
  123. this.passwrodTips();
  124. },
  125. methods: {
  126. goHome() {
  127. this.pageType = 2;
  128. },
  129. goPage(type) {
  130. if (!type) {
  131. uni.showToast({
  132. title: '暂未开放',
  133. icon: "none",
  134. mask: true,
  135. duration: 2000
  136. });
  137. return
  138. }
  139. if (!pageRestrictVerify(type)) {
  140. uni.showToast({
  141. title: '没有相关权限,请联系管理员',
  142. icon: "none",
  143. mask: true,
  144. duration: 2000
  145. });
  146. return
  147. }
  148. if (type == 'dataBoard') {
  149. //数据看板
  150. this.pageType = 1;
  151. } else if (type == 'securityCheck') {
  152. //安全检查
  153. uni.navigateTo({
  154. url: "/pages_safetyCheck/views/safetyCheck",
  155. });
  156. /* if(this.identityData){
  157. uni.navigateTo({
  158. url: "/pages_safetyCheck/views/safetyCheck",
  159. });
  160. }else{
  161. uni.showToast({
  162. mask: true,
  163. icon: "none",
  164. position: "center",
  165. title: '您不是校/院级管理员或督导组成员,无法使用该功能.',
  166. duration: 2000
  167. });
  168. } */
  169. } else if (type == 'securityExamination') {
  170. //安全考试
  171. uni.navigateTo({
  172. url: "/pages_basics/views/deviceCageSitePage?pageType=3",
  173. });
  174. } else if (type == 'securityAdmittance') {
  175. //安全准入
  176. uni.navigateTo({
  177. url: "/pages_manage/views/accessQualification/accessQualification",
  178. });
  179. } else if (type == 'hierarchicalControl') {
  180. //分级管控
  181. uni.navigateTo({
  182. url: "/pages_basics/views/gradingControl/gradingControl",
  183. });
  184. } else if (type == 'securityResponsibility') {
  185. //安全责任
  186. } else if (type == 'deviceManagement') {
  187. //设备管理
  188. uni.navigateTo({
  189. url: "/pages_basics/views/deviceCageSitePage?pageType=1",
  190. });
  191. } else if (type == 'emergencyDisposal') {
  192. //应急处置
  193. uni.navigateTo({
  194. url: "/pages_manage/views/emergencyEvacuationBig",
  195. });
  196. } else if (type == 'cageSiteManagement') {
  197. //笼位管理
  198. uni.navigateTo({
  199. url: "/pages_basics/views/deviceCageSitePage?pageType=2",
  200. });
  201. } else if (type == 'snapshot') {
  202. //随手拍
  203. uni.navigateTo({
  204. url: "/pages_safetyCheck/views/snapshotManage/snapshotList",
  205. });
  206. /* uni.navigateTo({
  207. url: "/pages_safetyExamine/views/snapshotManage/snapshotAdd",
  208. }); */
  209. } else if (type == 'remoteDoorOpening') {
  210. //远程开门
  211. uni.navigateTo({
  212. url: "/pages_manage/views/accessControl/remoteOpen",
  213. });
  214. } else if (type == 'chemicalsManagement') {
  215. //化学品管控
  216. }
  217. },
  218. /* 扫一扫*/
  219. saoCode() {
  220. let self = this;
  221. uni.scanCode({
  222. onlyFromCamera: true,
  223. success: function(res) {
  224. let list = res.result.split("?")[1].split("&");
  225. let codeData = {};
  226. list.forEach((item) => {
  227. codeData[item.split("=")[0]] = item.split("=")[1];
  228. })
  229. if (codeData.type == 1 || codeData.type == 2 || codeData.type == 3 || codeData.type ==
  230. 5 || codeData.type == 7 ||
  231. codeData.type == 8 || codeData.type == 9 || codeData.type == 10 ||
  232. codeData.type == 11 || codeData.type == 12) {
  233. uni.reLaunch({
  234. url: '/pages/views/saoCode/saoCode?q=' + encodeURIComponent(res.result)
  235. });
  236. } else {
  237. uni.showToast({
  238. mask: true,
  239. icon: "none",
  240. position: "center",
  241. title: '请扫描正确的小程序二维码',
  242. duration: 2000
  243. });
  244. }
  245. }
  246. });
  247. },
  248. //初始密码修改提示
  249. passwrodTips(){
  250. uni.showModal({
  251. title: '提示',
  252. cancelColor: '#999999',
  253. confirmColor: '#0183FA',
  254. content: '为了保证信息安全,是否修改默认密码',
  255. cancelText:'稍后修改',
  256. confirmText:'修改密码',
  257. success(res) {
  258. if (res.confirm) {
  259. console.log('确定')
  260. uni.navigateTo({
  261. url: '/pages_basics/views/editPassword/editPassword',
  262. });
  263. } else if (res.cancel) {
  264. console.log('取消')
  265. }
  266. }
  267. })
  268. },
  269. }
  270. }
  271. </script>
  272. <style lang="stylus" scoped>
  273. .teacherHome {
  274. flex: 1;
  275. display: flex;
  276. flex-direction: column;
  277. overflow: hidden;
  278. .data-board {
  279. flex: 1;
  280. display: flex;
  281. flex-direction: column;
  282. overflow: hidden;
  283. }
  284. .home-page {
  285. flex: 1;
  286. display: flex;
  287. flex-direction: column;
  288. overflow-y: scroll;
  289. overflow-x: hidden;
  290. .top-page-title {
  291. text-align: center;
  292. font-size: 28rpx;
  293. background-color: #0183FA;
  294. color: #fff;
  295. }
  296. .top-back-img {
  297. position: absolute;
  298. top: 0;
  299. left: 0;
  300. width: 750rpx;
  301. height: 539rpx;
  302. background: url("@/pages/images/newImage/img_sy_bg@1x.png");
  303. background-size 100%;
  304. background-repeat: no-repeat;
  305. .position-img {
  306. z-index: 5;
  307. position: absolute;
  308. left: 0;
  309. top: 10rpx;
  310. width: 400rpx;
  311. height: 88rpx;
  312. }
  313. .position-data-button {
  314. z-index: 5;
  315. position: fixed;
  316. right: 0;
  317. top: 180rpx;
  318. width: 130rpx;
  319. height: 109rpx;
  320. /* line-height: 50rpx;
  321. background-color: #0183fa;
  322. color: #fff;
  323. font-size: 28rpx;
  324. text-align: center;
  325. border-top-left-radius: 30rpx;
  326. border-bottom-left-radius: 30rpx; */
  327. }
  328. }
  329. .button-one-box {
  330. z-index: 5;
  331. background: #fff;
  332. width: 690rpx;
  333. border-radius: 20rpx;
  334. padding: 13px 0 20px;
  335. overflow: hidden;
  336. margin: 490rpx 30rpx 0;
  337. .button-min {
  338. display: inline-block;
  339. overflow: hidden;
  340. width: 172rpx;
  341. height: 123rpx;
  342. margin-top: 23rpx;
  343. .button-img {
  344. display: block;
  345. width: 80rpx;
  346. height: 80rpx;
  347. margin: 0 auto;
  348. }
  349. .button-name {
  350. margin-top: 15rpx;
  351. height: 28rpx;
  352. line-height: 28rpx;
  353. font-size: 28rpx;
  354. text-align: center;
  355. color: #333;
  356. }
  357. }
  358. }
  359. .button-two-box {
  360. z-index: 5;
  361. width: 690rpx;
  362. height: 120rpx;
  363. display: flex;
  364. margin: 20rpx 30rpx 0;
  365. .button-big-box {
  366. width: 335rpx;
  367. display: flex;
  368. border-radius: 20rpx;
  369. img {
  370. display: block;
  371. margin: 20rpx 31rpx 0 36rpx;
  372. height: 80rpx;
  373. width: 80rpx;
  374. }
  375. .button-min-box {
  376. view:nth-child(1) {
  377. line-height: 32rpx;
  378. height: 32rpx;
  379. font-size: 32rpx;
  380. color: #333;
  381. margin: 20rpx 0 18rpx;
  382. }
  383. view:nth-child(2) {
  384. line-height: 28rpx;
  385. height: 28rpx;
  386. font-size: 28rpx;
  387. color: #999;
  388. }
  389. }
  390. }
  391. }
  392. .button-three-box {
  393. z-index: 5;
  394. width: 690rpx;
  395. height: 150rpx;
  396. margin: 20rpx 30rpx 0;
  397. .button-big-box {
  398. border-radius: 20rpx;
  399. background-color: #FFF0DD;
  400. display: flex;
  401. img {
  402. display: block;
  403. width: 134rpx;
  404. height: 104rpx;
  405. margin: 23rpx 34rpx 0 30rpx;
  406. }
  407. .button-min-box {
  408. view:nth-child(1) {
  409. line-height: 30rpx;
  410. height: 30rpx;
  411. font-size: 30rpx;
  412. color: #FF8C00;
  413. margin: 27rpx 0 15rpx;
  414. }
  415. view:nth-child(2) {
  416. line-height: 26rpx;
  417. height: 26rpx;
  418. font-size: 26rpx;
  419. color: #666666;
  420. }
  421. }
  422. }
  423. }
  424. .scan_btn {
  425. z-index: 10;
  426. position: fixed;
  427. bottom: 210rpx;
  428. right: 0rpx;
  429. width: 140rpx;
  430. height: 140rpx;
  431. }
  432. }
  433. }
  434. </style>