gasCylinderSupplierLogin.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  1. <!-- 登录 -->
  2. <template>
  3. <view id="gasCylinderSupplierLogin">
  4. <img class="login-max-big" :src="loginBanner">
  5. <view class="login-box">
  6. <view class="tabTitle">
  7. <view class="tabTitle_li" @tap="tabClick(index)" :key="index" v-for="(item,index) in tabText">
  8. <view :class="{on:curTab==index}" class="tabTitle_text">{{item}}</view>
  9. <!-- <view :class="{on:curTab==index}" class="tabTitle_across"></view> -->
  10. </view>
  11. </view>
  12. <view class="input-max-box-one">
  13. <view class="input-box">
  14. <img :src="imagesUrl('commonality/img_log_in_account.png')">
  15. <input type="text" v-model="username" placeholder="请输入账号" maxlength="20">
  16. </view>
  17. </view>
  18. <view class="input-max-box-two">
  19. <view class="input-box">
  20. <img :src="imagesUrl('commonality/img_log_in_password.png')">
  21. <input type="password" v-model="password" placeholder="请输入密码" maxlength="20">
  22. </view>
  23. </view>
  24. <view class="check-box" @click="checkboxChange()">
  25. <img v-if="checkedType" :src="imagesUrl('commonality/icon_13.png')">
  26. <img v-if="!checkedType" :src="imagesUrl('commonality/icon_12.png')"/>
  27. <view>记住我</view>
  28. </view>
  29. <view class="button-box" @click="gasSupplierLogin()">登录</view>
  30. <!-- <view class="passwrod-button-box" @click="forgotPasswordButton()">忘记密码?</view> -->
  31. </view>
  32. <view class="loginButton" @click="backButton()">统一身份认证登录</view>
  33. </view>
  34. </template>
  35. <script>
  36. import md5 from '@/utils/md5.js'
  37. import {
  38. config
  39. } from '@/api/request/config.js'
  40. import {
  41. gasSupplierLogin,
  42. configInfo,
  43. getConfigByType,
  44. systemAppletRolePermission,
  45. systemSubjectCheckIsAdminOrSafeUser,
  46. securityDataStatisticsGetUserIdentity
  47. } from '@/pages/api/index.js'
  48. import {
  49. Encrypt,
  50. Decrypt
  51. } from '@/utils/secret.js'
  52. export default {
  53. onShareAppMessage(res) {
  54. return {
  55. title: '实验室安全智慧化管控系统',
  56. path: '/pages/views/login/login'
  57. }
  58. },
  59. data() {
  60. return {
  61. identityStatus: 1,
  62. username: "",
  63. password: "",
  64. checkedType: false,
  65. loginBanner: uni.getStorageSync('loginBanner'),
  66. infoList: [], //模板消息Id
  67. tabText: ['供应商登录'],
  68. curTab: 0,
  69. pageType: 0,
  70. supplierType: false,
  71. }
  72. },
  73. onLoad(option) {
  74. //供应商注册成功后返回到供应商注册页面
  75. if (option.status) {
  76. this.identityStatus = 2
  77. }
  78. if (uni.getStorageSync('userName') && uni.getStorageSync('password')) {
  79. this.username = uni.getStorageSync('userName');
  80. this.password = uni.getStorageSync('password');
  81. this.checkedType = true;
  82. }
  83. },
  84. onShow() {
  85. this.getConfigInfo();
  86. },
  87. methods: {
  88. backButton(){
  89. uni.navigateBack();
  90. },
  91. //顶部tab点击
  92. tabClick(index) {
  93. this.curTab = index;
  94. },
  95. //跳转忘记密码
  96. forgotPasswordButton(){
  97. uni.navigateTo({
  98. url: '/pages_basics/views/forgotPassword/forgotPassword',
  99. });
  100. },
  101. //登录
  102. async gasSupplierLogin() {
  103. let self = this;
  104. let obj = {
  105. account: this.username,
  106. password: md5.hex_md5(this.password),
  107. tenantId:0,
  108. }
  109. const {
  110. data
  111. } = await gasSupplierLogin(obj)
  112. if (data.code == 200) {
  113. if(data.data.userType == null){
  114. uni.setStorageSync('dataBoardType', false);
  115. uni.setStorageSync('token', data.data.token);
  116. uni.setStorageSync('userId', data.data.userId);
  117. uni.setStorageSync('isInitPwd', true);
  118. uni.setStorageSync('supplierUserName', data.data.userName);
  119. // userType 0-系统 1-教职工 2-学生 3-大屏
  120. uni.setStorageSync('userType', data.data.userType == 0 || data.data.userType == 1 ? '1' :
  121. (data.data.userType == 2 ? '2' : (data.data.userType == 3 ? '3' : 'none')));
  122. if (this.checkedType) {
  123. uni.setStorageSync('userName', this.username)
  124. uni.setStorageSync('password', this.password)
  125. } else {
  126. uni.removeStorageSync('userName')
  127. uni.removeStorageSync('password')
  128. }
  129. //等待配置与字段获取到后跳转
  130. Promise.all([
  131. //获取开发配置
  132. this.getConfigByType(),
  133. //获取权限字段
  134. this.systemAppletRolePermission(),
  135. //查询是否是管理员/安全员
  136. this.systemSubjectCheckIsAdminOrSafeUser(),
  137. //查询身份
  138. this.securityDataStatisticsGetUserIdentity()
  139. ]).then((result) => {
  140. if (uni.getStorageSync('codeData')) {
  141. uni.redirectTo({
  142. url: '/pages/views/saoCode/saoCode',
  143. });
  144. } else if (uni.getStorageSync('warningId')) {
  145. uni.reLaunch({
  146. url: '/pages_basics/views/earlyWarningManage/earlyWarningDetail',
  147. });
  148. } else if (uni.getStorageSync('manageCation')) {
  149. uni.reLaunch({
  150. url: '/pages_manage/views/accessQualification/accessQualificationInfo?item=' + uni.getStorageSync('manageCation')
  151. })
  152. } else if (uni.getStorageSync('studentCation')) {
  153. uni.reLaunch({
  154. url: '/pages_student/views/accessApplication/applicationDetails?item=' + uni.getStorageSync('studentCation')
  155. })
  156. } else if(uni.getStorageSync('recyclingReportRecord')){
  157. //短信跳转-危废回收-报备
  158. uni.removeStorageSync('recyclingReportRecord')
  159. uni.reLaunch({
  160. url: "/pages_hazardousWasteRecycling/views/recyclingReportRecord/index",
  161. });
  162. } else if(uni.getStorageSync('permissionApply')){
  163. //短信跳转-危废回收-申请列表
  164. uni.removeStorageSync('permissionApply')
  165. uni.reLaunch({
  166. url: "/pages_hazardousWasteRecycling/views/permissionApply/listPage",
  167. });
  168. } else {
  169. uni.reLaunch({
  170. url: '/pages/views/home/home',
  171. });
  172. }
  173. }).catch((error) => {
  174. wx.showToast({
  175. title: '数据异常,请稍候再试!',
  176. icon: "none",
  177. duration: 3000
  178. });
  179. })
  180. }else{
  181. wx.showToast({
  182. title: '非供应商,无法登录本系统.',
  183. icon: "none",
  184. duration: 3000
  185. });
  186. }
  187. }
  188. },
  189. //获取权限字段
  190. async systemAppletRolePermission() {
  191. let self = this;
  192. const {
  193. data
  194. } = await systemAppletRolePermission();
  195. if (data.code == 200) {
  196. uni.setStorageSync('permissions', data.data.data)
  197. uni.setStorageSync('controlsRestrict', data.data.roleKeys ? data.data.roleKeys : [])
  198. uni.setStorageSync('user', data.data.userInfo)
  199. }
  200. },
  201. switchClick() {
  202. if (this.identityStatus == 1) {
  203. this.identityStatus = 2;
  204. } else {
  205. this.identityStatus = 1;
  206. }
  207. },
  208. //查询公共配置
  209. async getConfigInfo() {
  210. const {
  211. data
  212. } = await configInfo({
  213. type: '1,2,4'
  214. });
  215. if (data.code == 200) {
  216. let list = JSON.parse(data.data)
  217. let newData = {};
  218. list.forEach((item) => {
  219. let obj = JSON.parse(item.configValue)
  220. newData = {
  221. ...newData,
  222. ...obj
  223. }
  224. })
  225. uni.setStorageSync('circularLogo', config.base_url + newData.circularLogo)
  226. uni.setStorageSync('rectangleLogo', config.base_url + newData.rectangleLogo)
  227. uni.setStorageSync('videoCover', config.base_url + newData.videoCover)
  228. this.$set(this, 'loginBanner', config.base_url + newData.loginBanner);
  229. uni.setStorageSync('loginBanner', config.base_url + newData.loginBanner)
  230. this.$set(this, 'supplierType', newData.supplier);
  231. uni.setStorageSync('supplierType', newData.supplier)
  232. uni.setStorageSync('homepageBanner', config.base_url + newData.homepageBanner)
  233. }
  234. },
  235. //获取开发配置
  236. async getConfigByType() {
  237. const {
  238. data
  239. } = await getConfigByType({
  240. category: 2,
  241. configType: 5
  242. });
  243. if (data.code == 200) {
  244. let obj = JSON.parse(data.data.configValue)
  245. //文件预览地址
  246. uni.setStorageSync('filePreviewUrl', 'https://' + obj.fileExtranetUrl)
  247. //小程序视频地址
  248. uni.setStorageSync('cameraExtranetAgent', 'https://' + obj.cameraExtranetAgent)
  249. //MQTT地址
  250. uni.setStorageSync('mqttUrl', Decrypt(obj.mqttExtranetUrl))
  251. //MQTT地址-内网
  252. uni.setStorageSync('mqttIntranetUrl', Decrypt(obj.mqttIntranetUrl))
  253. //MQTT账号
  254. uni.setStorageSync('mqttUser', Decrypt(obj.mqttExtranetUser))
  255. //MQTT密码
  256. uni.setStorageSync('mqttPassword', Decrypt(obj.mqttExtranetPassword))
  257. //版本号
  258. if(config.weChatProgramVersion === obj.weChatProgramVersion){
  259. uni.setStorageSync('weChatProgramVersion', true)
  260. }else{
  261. uni.setStorageSync('weChatProgramVersion', false)
  262. }
  263. //文件浏览环境
  264. uni.setStorageSync('fileBrowseEnvironment','http://'+Decrypt(obj.fileBrowseEnvironment))
  265. uni.setStorageSync('fileBrowseEnvironmentExtranet','https://'+Decrypt(obj.fileBrowseEnvironmentExtranet))
  266. }
  267. },
  268. //查询是否是管理员/安全员
  269. async systemSubjectCheckIsAdminOrSafeUser(){
  270. let self = this;
  271. const {
  272. data
  273. } = await systemSubjectCheckIsAdminOrSafeUser();
  274. if (data.code == 200) {
  275. if(data.data.isSafe || data.data.isAdmin){
  276. uni.setStorageSync('subAdmin','1');
  277. }else{
  278. uni.setStorageSync('subAdmin','0');
  279. }
  280. }
  281. },
  282. //查询身份
  283. async securityDataStatisticsGetUserIdentity(routeUrl) {
  284. let self = this;
  285. const {
  286. data
  287. } = await securityDataStatisticsGetUserIdentity();
  288. if(data.schoolAdmin){
  289. //校级管理员
  290. uni.setStorageSync('identityData',{
  291. type:'schoolAdmin'
  292. });
  293. }else if(data.collegeAdmin){
  294. //院级管理员
  295. uni.setStorageSync('identityData',{
  296. type:'collegeAdmin'
  297. });
  298. }else if(data.schoolGroup){
  299. //校级督导组
  300. uni.setStorageSync('identityData',{
  301. type:'schoolGroup',
  302. groupIds:data.groupIds
  303. });
  304. }else if(data.collegeGroup){
  305. //院级督导组
  306. uni.setStorageSync('identityData',{
  307. type:'collegeGroup',
  308. groupIds:data.groupIds
  309. });
  310. }else{
  311. uni.removeStorageSync('identityData');
  312. }
  313. },
  314. checkboxChange() {
  315. this.checkedType = !this.checkedType;
  316. },
  317. },
  318. }
  319. </script>
  320. <style lang="stylus" scoped>
  321. #gasCylinderSupplierLogin {
  322. height: 100%;
  323. width: 100%;
  324. background #f5f5f5;
  325. position relative;
  326. .login-max-big {
  327. width: 750rpx;
  328. height: 1177rpx;
  329. z-index: 0;
  330. }
  331. .login-box {
  332. z-index: 3;
  333. position: absolute;
  334. top: 430rpx;
  335. left: 46rpx;
  336. width: 658rpx;
  337. height: 700rpx;
  338. // background #fff
  339. /* 切换按钮 */
  340. .tabTitle {
  341. display flex;
  342. width: 100%;
  343. height: 100rpx;
  344. position: absolute;
  345. // top: 50rpx;
  346. justify-content: center;
  347. .tabTitle_li {
  348. width: 168rpx;
  349. text-align center;
  350. .tabTitle_text {
  351. display: inline-block;
  352. font-size: 32rpx;
  353. font-family: PingFang SC;
  354. font-weight: 500;
  355. color: #333333;
  356. line-height: 90rpx;
  357. &.on {
  358. color: #0183FA;
  359. }
  360. }
  361. .tabTitle_across {
  362. width: 100rpx;
  363. height: 4rpx;
  364. background: #0183FA;
  365. border-radius: 2rpx;
  366. margin-left 30rpx;
  367. display none;
  368. &.on {
  369. display block;
  370. }
  371. }
  372. }
  373. }
  374. border-radius:20rpx;
  375. .input-max-box-one {
  376. overflow: hidden;
  377. // margin-top: 68rpx;
  378. .input-box {
  379. display flex;
  380. width: 600rpx;
  381. height: 80rpx;
  382. border: 1rpx solid #e0e0e0;
  383. border-radius: 40rpx;
  384. margin: 147rpx auto 0;
  385. img {
  386. width: 28rpx;
  387. height: 32rpx;
  388. margin: 24rpx 31rpx;
  389. }
  390. input {
  391. flex: 1;
  392. font-size: 24rpx;
  393. height: 80rpx;
  394. line-height: 80rpx;
  395. margin-right: 31rpx;
  396. }
  397. }
  398. .text-box {
  399. height: 59rpx;
  400. line-height: 59rpx;
  401. color: #DC1616;
  402. font-size: 24rpx;
  403. margin-left: 102rpx;
  404. }
  405. }
  406. .input-max-box-two {
  407. margin-top: 40rpx;
  408. .input-box {
  409. display flex;
  410. width: 600rpx;
  411. height: 80rpx;
  412. border: 1rpx solid #e0e0e0;
  413. border-radius: 40rpx;
  414. margin: 0 auto 0;
  415. img {
  416. width: 30rpx;
  417. height: 32rpx;
  418. margin: 24rpx 30rpx;
  419. }
  420. input {
  421. flex: 1;
  422. font-size: 24rpx;
  423. height: 80rpx;
  424. line-height: 80rpx;
  425. margin-right: 31rpx;
  426. }
  427. }
  428. .text-box {
  429. height: 59rpx;
  430. line-height: 59rpx;
  431. color: #DC1616;
  432. font-size: 24rpx;
  433. margin-left: 102rpx;
  434. }
  435. }
  436. .check-box {
  437. margin: 30rpx 0 30rpx 104rpx;
  438. width: 300rpx;
  439. height: 50rpx;
  440. display: flex;
  441. img {
  442. margin-top: 10rpx;
  443. width: 32rpx;
  444. height: 32rpx;
  445. margin-right: 10rpx;
  446. }
  447. view {
  448. font-size: 24rpx;
  449. line-height: 50rpx;
  450. }
  451. }
  452. .button-box {
  453. width: 600rpx;
  454. line-height: 80rpx;
  455. background: #0183FA;
  456. border-radius: 40rpx;
  457. font-size: 36rpx;
  458. color: #fff;
  459. text-align center;
  460. margin: 0 auto 0;
  461. }
  462. .passwrod-button-box{
  463. line-height:60rpx;
  464. width:120rpx;
  465. margin:20rpx 0 0 40rpx;
  466. color:#333;
  467. font-size:24rpx;
  468. }
  469. /* 供应商注册 */
  470. .supplier {
  471. display: flex;
  472. justify-content: space-between;
  473. margin: 30rpx 40rpx 0;
  474. .supplier_l {
  475. font-size: 24rpx;
  476. font-family: PingFang SC;
  477. font-weight: 400;
  478. color: #333333;
  479. line-height: 24rpx;
  480. }
  481. .supplier_r {
  482. font-size: 24rpx;
  483. font-family: PingFang SC;
  484. font-weight: 400;
  485. color: #333333;
  486. line-height: 24rpx;
  487. >text {
  488. color: #0183FA;
  489. }
  490. }
  491. }
  492. /* 供应商切换 */
  493. .switch_btn {
  494. display: flex;
  495. justify-content: center;
  496. align-items: center;
  497. font-size: 24rpx;
  498. font-family: PingFang SC;
  499. font-weight: 400;
  500. color: #0183FA;
  501. line-height: 24rpx;
  502. margin-top: 60rpx;
  503. >img {
  504. width: 24rpx;
  505. height: 24rpx;
  506. margin-left: 12rpx;
  507. }
  508. }
  509. }
  510. .loginButton{
  511. position: absolute;
  512. bottom:40rpx;
  513. left:295rpx;
  514. width:300;
  515. height:80rpx;
  516. line-height:80rpx;
  517. text-align: center;
  518. color:#0183fa;
  519. font-size:28rpx;
  520. }
  521. .top-back {
  522. z-index: 2;
  523. position: absolute;
  524. top: 261rpx;
  525. left: 375rpx;
  526. height: 296rpx;
  527. width: 366rpx;
  528. }
  529. }
  530. </style>