login.vue 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132
  1. <template>
  2. <div class="login-page scrollbar-box">
  3. <img class="logo-img" :src="rectangleLogo">
  4. <div class="title-img-box">
  5. <div>
  6. <img class="title-img" src="@/assets/ZDimages/basicsModules/title_icon.png">
  7. </div>
  8. </div>
  9. <div v-if="loginBoxType == 1" class="form-box">
  10. <p class="form-title-p">登录</p>
  11. <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
  12. <div class="username-input-box" :class="userTypeCode == 1||userTypeCode == 4?'username-input-box-code':''">
  13. <img src="@/assets/ZDimages/basicsModules/icon_dl_zh.png" alt="">
  14. <input type="text" v-model="loginForm.username" placeholder="请输入账号" maxlength="20" @keyup.enter="handleLogin(1)">
  15. </div>
  16. <div class="password-input-box" :class="userTypeCode == 2||userTypeCode == 4?'username-input-box-code':''">
  17. <img src="@/assets/ZDimages/basicsModules/icon_dl_mm.png" alt="">
  18. <input type="password" v-model="loginForm.password" placeholder="请输入密码" maxlength="20" @keyup.enter="handleLogin(1)">
  19. </div>
  20. <p class="text-p">{{text}}</p>
  21. <div class="code-input-box">
  22. <div class="code-input-left-box" :class="userTypeCode == 3||userTypeCode == 5?'username-input-box-code':''">
  23. <img src="@/assets/ZDimages/basicsModules/icon_dl_yzm.png" alt="">
  24. <input type="text" v-model="loginForm.code" placeholder="请输入验证码" maxlength="4" @keyup.enter="handleLogin(1)">
  25. </div>
  26. <div class="login-code">
  27. <img :src="codeUrl" @click="getCode" class="login-code-img"/>
  28. </div>
  29. </div>
  30. <el-form-item>
  31. <el-button
  32. class="form-button-p"
  33. :loading="loading"
  34. size="medium"
  35. height="50"
  36. @click.native.prevent="handleLogin(1)"
  37. >
  38. <span v-if="!loading">登 录</span>
  39. <span v-else>登 录 中...</span>
  40. </el-button>
  41. <!--<div style="float: right;" v-if="register">-->
  42. <!--<router-link class="link-type" :to="'/register'">立即注册</router-link>-->
  43. <!--</div>-->
  44. <div class="forgotPasswordBox">
  45. <p class="forgotPasswordNull"></p>
  46. <p class="forgotPassword">忘记密码</p>
  47. <p class="forgotPasswordNull"></p>
  48. </div>
  49. </el-form-item>
  50. </el-form>
  51. </div>
  52. <div v-if="loginBoxType == 2" class="form-box-one">
  53. <div class="form-title-box">
  54. <p class="form-title-null"></p>
  55. <p class="form-title-p" :class="loginType==1?'form-title-p-color':''" @click="loginTypeClick(1)">密码登录</p>
  56. <p class="form-title-p" :class="loginType==2?'form-title-p-color':''" @click="loginTypeClick(2)">短信登录</p>
  57. <p class="form-title-null"></p>
  58. </div>
  59. <el-form ref="loginForm"v-show="loginType == 1"
  60. :model="loginForm" :rules="loginRules" class="login-form-one">
  61. <div class="username-input-box" :class="userTypeCode == 1||userTypeCode == 4?'username-input-box-code':''">
  62. <img src="@/assets/ZDimages/basicsModules/icon_dl_zh.png" alt="">
  63. <input type="text" v-model="loginForm.username" placeholder="请输入账号" maxlength="20" @keyup.enter="handleLogin(1)">
  64. </div>
  65. <div class="password-input-box" :class="userTypeCode == 2||userTypeCode == 4?'username-input-box-code':''">
  66. <img src="@/assets/ZDimages/basicsModules/icon_dl_mm.png" alt="">
  67. <input type="password" v-model="loginForm.password" placeholder="请输入密码" maxlength="20" autocomplete="new-password" @keyup.enter="handleLogin(1)">
  68. </div>
  69. <p class="text-p">{{text}}</p>
  70. <div class="code-input-box">
  71. <div class="code-input-left-box" :class="userTypeCode == 3||userTypeCode == 5?'username-input-box-code':''">
  72. <img src="@/assets/ZDimages/basicsModules/icon_dl_yzm.png" alt="">
  73. <input type="text" v-model="loginForm.code" placeholder="请输入验证码" maxlength="4" @keyup.enter="handleLogin(1)">
  74. </div>
  75. <div class="login-code">
  76. <img :src="codeUrl" @click="getCode" class="login-code-img"/>
  77. </div>
  78. </div>
  79. <el-form-item>
  80. <el-button
  81. class="form-button-p"
  82. :loading="loading"
  83. size="medium"
  84. height="50"
  85. @click.native.prevent="handleLogin(1)"
  86. >
  87. <span v-if="!loading">登 录</span>
  88. <span v-else>登 录 中...</span>
  89. </el-button>
  90. <div class="forgotPasswordBox">
  91. <p class="forgotPasswordNull"></p>
  92. <p class="forgotPassword">忘记密码</p>
  93. <p class="forgotPasswordNull"></p>
  94. </div>
  95. <!--<div style="float: right;" v-if="register">-->
  96. <!--<router-link class="link-type" :to="'/register'">立即注册</router-link>-->
  97. <!--</div>-->
  98. </el-form-item>
  99. </el-form>
  100. <el-form ref="loginFormTwo" v-show="loginType == 2"
  101. :model="loginFormTwo" :rules="loginRulesTwo" class="login-form-two">
  102. <div class="username-input-box">
  103. <img src="@/assets/ZDimages/basicsModules/user.png" alt="">
  104. <p>
  105. <span>+86</span>
  106. <span>丨</span>
  107. </p>
  108. <input type="text" v-model="loginFormTwo.username" placeholder="请输入联系方式"
  109. onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"
  110. maxlength="11">
  111. </div>
  112. <p class="text-p">{{textTwo}}</p>
  113. <div class="code-input-box">
  114. <div class="code-input-left-box">
  115. <img src="@/assets/ZDimages/basicsModules/code.png" alt="">
  116. <input type="text" v-model="loginFormTwo.password" placeholder="请输入验证码"
  117. onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"
  118. maxlength="6">
  119. </div>
  120. <div class="login-code" :class="codeNum>0?'login-code-one':'login-code-two'" @click="getCodeOne">
  121. 获取验证码 {{codeNum>0?'('+codeNum+')':''}}
  122. <!--<img :src="codeUrl" @click="getCode" class="login-code-img"/>-->
  123. </div>
  124. </div>
  125. <el-form-item>
  126. <el-button
  127. class="form-button-p"
  128. :loading="loading"
  129. size="medium"
  130. height="50"
  131. @click.native.prevent="handleLogin(2)"
  132. >
  133. <span v-if="!loading">登 录</span>
  134. <span v-else>登 录 中...</span>
  135. </el-button>
  136. <div class="forgotPasswordBox">
  137. <p class="forgotPasswordNull"></p>
  138. <p class="forgotPassword">忘记密码</p>
  139. <p class="forgotPasswordNull"></p>
  140. </div>
  141. </el-form-item>
  142. </el-form>
  143. </div>
  144. <p class="introduction-p">技术支持:江苏忠江智能科技有限公司</p>
  145. </div>
  146. </template>
  147. <script>
  148. import Cookies from "js-cookie";
  149. import { encrypt, decrypt } from '@/utils/jsencrypt'
  150. import store from '@/store'
  151. import { authInfo,getCodeImg,initPage,sendCode,getRouters} from "@/api/basicsModules/index";
  152. import { Encrypt,Decrypt} from '@/utils/secret'
  153. import { getConfigByType } from "@/api/commonality/permission";
  154. import { configInfo } from "@/api/commonality/noPermission";
  155. export default {
  156. name: "Login",
  157. data() {
  158. return {
  159. loginBoxType:0,
  160. codeUrl: "",
  161. cookiePassword: "",
  162. type:1,
  163. loginForm: {
  164. username: "superadmin",
  165. password: "zd123456",
  166. rememberMe: false,
  167. code: "",
  168. uuid: "",
  169. },
  170. loginRules: {
  171. // username: [
  172. // { required: true, trigger: "blur", message: "请输入您的账号" }
  173. // ],
  174. // password: [
  175. // { required: true, trigger: "blur", message: "请输入您的密码" }
  176. // ],
  177. // code: [{ required: true, trigger: "change", message: "请输入验证码" }]
  178. },
  179. loading: false,
  180. // 验证码开关
  181. captchaOnOff: true,
  182. // 注册开关
  183. register: false,
  184. redirect: undefined,
  185. text:"",
  186. userTypeCode:"",
  187. rectangleLogo:localStorage.getItem('rectangleLogo'),
  188. //手机登录
  189. loginType:1,
  190. loginFormTwo:{
  191. username:"",
  192. password:"",
  193. },
  194. loginRulesTwo:{
  195. username: [
  196. { required: true, message: "请输入手机号码", trigger: "blur" },
  197. { required: true, message: "请输入手机号码", validator: this.spaceJudgment, trigger: "blur" }
  198. ],
  199. password: [
  200. { required: true, message: "请输入验证码", trigger: "blur" },
  201. { required: true, message: "请输入验证码", validator: this.spaceJudgment, trigger: "blur" }
  202. ],
  203. },
  204. textTwo:"",
  205. codeNum:"",
  206. timer:null,
  207. codeButtonType:true,
  208. };
  209. },
  210. watch: {
  211. $route: {
  212. handler: function(route) {
  213. this.redirect = route.query && route.query.redirect;
  214. },
  215. immediate: true
  216. }
  217. },
  218. created() {
  219. localStorage.setItem('windowHref',window.location.href)
  220. this.getCode();
  221. this.getCookie();
  222. },
  223. mounted(){
  224. this.authInfo();
  225. this.configInfo();
  226. },
  227. methods: {
  228. //获取登录配置
  229. authInfo(){
  230. authInfo().then(response => {
  231. let idType = false;
  232. let phoneType = false;
  233. for(let i=0;i<response.data.length;i++){
  234. if(response.data[i].id == 0){
  235. idType = response.data[i].enable;
  236. }
  237. if(response.data[i].id == 1){
  238. phoneType = response.data[i].enable;
  239. }
  240. }
  241. if( idType && phoneType ){
  242. this.$set(this,'loginBoxType',2);
  243. }else{
  244. this.$set(this,'loginBoxType',1);
  245. }
  246. });
  247. },
  248. //获取公共配置数据
  249. configInfo(){
  250. let self = this;
  251. configInfo({ type: '1,2,3' }).then(response => {
  252. let list = JSON.parse(response.data)
  253. let newData = {};
  254. list.forEach((item) => {
  255. let obj = JSON.parse(item.configValue)
  256. newData = {...newData,...obj}
  257. })
  258. setTimeout(function(){
  259. self.$set(self,'rectangleLogo',newData.rectangleLogo);
  260. localStorage.setItem('schoolName',newData.schoolName)
  261. localStorage.setItem('circularLogo',newData.circularLogo)
  262. localStorage.setItem('rectangleLogo',newData.rectangleLogo)
  263. localStorage.setItem('videoCover',newData.videoCover)
  264. store.dispatch('settings/setSmartAlarmType', newData.smartLock)
  265. localStorage.setItem('setSmartAlarmType',newData.smartLock)
  266. },200);
  267. });
  268. },
  269. //获取开发配置
  270. getExploitConfig(){
  271. getConfigByType({ category: 2, configType: 5 }).then(response => {
  272. let obj = JSON.parse(response.data.configValue)
  273. //判定http或者https
  274. let urlText = window.location.href.split('://')[0]+'://';
  275. let outerNet = window.location.href.indexOf(obj.ipIdentify) == -1//true外网 false 内网
  276. if(outerNet){//外网
  277. //文件预览地址
  278. localStorage.setItem('filePreviewUrl',urlText+obj.fileExtranetUrl)
  279. //摄像头代理访问地址
  280. localStorage.setItem('cameraExtranetAgent',urlText+obj.cameraExtranetAgent)
  281. //摄像头地址ip段
  282. localStorage.setItem('ipIdentify',obj.ipIdentify)
  283. //摄像头访问地址
  284. localStorage.setItem('cameraUrl','wss://'+obj.cameraExtranetUrl)
  285. //MQTT地址
  286. localStorage.setItem('mqttUrl','wss://'+Decrypt(obj.mqttExtranetUrl))
  287. //MQTT账号
  288. localStorage.setItem('mqttUser',Decrypt(obj.mqttExtranetUser))
  289. //MQTT密码
  290. localStorage.setItem('mqttPassword',Decrypt(obj.mqttExtranetPassword))
  291. //可视化大屏访问地址
  292. localStorage.setItem('screenUrl',urlText+obj.screenExtranetUrl)
  293. //小程序二维码规则
  294. localStorage.setItem('codeOnlineAdd',obj.codeOnlineAdd)
  295. }else{
  296. //文件预览地址
  297. localStorage.setItem('filePreviewUrl',urlText+obj.fileIntranetUrl)
  298. //摄像头代理访问地址
  299. localStorage.setItem('cameraExtranetAgent',urlText+obj.cameraIntranetAgent)
  300. //摄像头地址ip段
  301. localStorage.setItem('ipIdentify',obj.ipIdentify)
  302. //摄像头访问地址
  303. localStorage.setItem('cameraUrl','wss://'+obj.cameraIntranetUrl)
  304. //MQTT地址
  305. localStorage.setItem('mqttUrl','ws://'+Decrypt(obj.mqttIntranetUrl))
  306. //MQTT账号
  307. localStorage.setItem('mqttUser',Decrypt(obj.mqttIntranetUser))
  308. //MQTT密码
  309. localStorage.setItem('mqttPassword',Decrypt(obj.mqttIntranetPassword))
  310. //可视化大屏访问地址
  311. localStorage.setItem('screenUrl',urlText+obj.screenIntranetUrl)
  312. //小程序二维码规则
  313. localStorage.setItem('codeOnlineAdd',obj.codeOnlineAdd)
  314. }
  315. });
  316. },
  317. //获取首页配置
  318. getHomeConfig(){
  319. getConfigByType({ category: 2, configType: 6 }).then(response => {
  320. localStorage.setItem('homeConfig',response.data.configValue);
  321. let obj = JSON.parse(response.data.configValue)
  322. localStorage.setItem('initPage',obj.skipHomePage);
  323. });
  324. },
  325. getCode() {
  326. getCodeImg().then(res => {
  327. this.captchaOnOff = res.captchaOnOff === undefined ? true : res.captchaOnOff;
  328. if (this.captchaOnOff) {
  329. this.codeUrl = "data:image/gif;base64," + res.data.image;
  330. this.loginForm.uuid = res.data.uuid;
  331. }
  332. });
  333. },
  334. getCookie() {
  335. const username = Cookies.get("username");
  336. const password = Cookies.get("password");
  337. const rememberMe = Cookies.get('rememberMe')
  338. this.loginForm = {
  339. username: username === undefined ? this.loginForm.username : username,
  340. password: password === undefined ? this.loginForm.password : decrypt(password),
  341. rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
  342. };
  343. },
  344. handleLogin(type) {
  345. let self = this;
  346. if(type == 1){
  347. //账号登录
  348. if(this.loginForm.username.length<1){
  349. this.text = "*请输入账号";
  350. this.userTypeCode = "1";
  351. return
  352. }else if(this.loginForm.password.length<1){
  353. this.text = "*请输入密码";
  354. this.userTypeCode = "2";
  355. return
  356. }else if(!this.loginForm.code||this.loginForm.code.length<1){
  357. this.text = "*请输入验证码";
  358. this.userTypeCode = "3";
  359. return
  360. }
  361. this.text = "";
  362. this.userTypeCode = "";
  363. this.$refs.loginForm.validate(valid => {
  364. if (valid) {
  365. this.loading = true;
  366. if (this.loginForm.rememberMe) {
  367. Cookies.set("username", this.loginForm.username, { expires: 30 });
  368. Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
  369. Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
  370. } else {
  371. Cookies.remove("username");
  372. Cookies.remove("password");
  373. Cookies.remove('rememberMe');
  374. }
  375. this.$store.dispatch("Login", this.loginForm).then((res) => {
  376. if(res.code != 200){
  377. this.text = "*"+res.message;
  378. if(res.code == 530){
  379. this.userTypeCode = "4";
  380. }else if(res.code == 503){
  381. this.userTypeCode = "5";
  382. }
  383. this.loading = false;
  384. this.getCode();
  385. return
  386. }
  387. this.getExploitConfig();
  388. this.getHomeConfig();
  389. // localStorage.setItem('initPage',res.data.skipHomePage);
  390. if(res.data.reset_password){
  391. this.$confirm('账号当前登录密码为默认密码,是否现在修改?', "提示", {
  392. confirmButtonText: "确定",
  393. cancelButtonText: "取消",
  394. type: "warning"
  395. }).then(function() {
  396. let routeData = JSON.parse(localStorage.getItem("routeData"))
  397. for(let i=0;i<routeData.length;i++){
  398. if(!routeData[i].hidden&&routeData[i].name != 'Https://www.sxitdlc.com'){
  399. store.dispatch('settings/setPageName', routeData[i].meta.title)
  400. self.$store.commit("SET_SIDEBAR_ROUTERS", routeData[i].children);
  401. self.$router.push({ path: '/comprehensive/system/mine' });
  402. break
  403. }
  404. }
  405. }).then(() => {
  406. }).catch(() => {
  407. });
  408. }
  409. //身份字段规则转义 原定11老师 22学生 新版本后0系统1老师2学生,这里身份字段转义为旧版本规则
  410. localStorage.setItem('userType',res.data.userType==0||res.data.userType==1?'11':'22')
  411. localStorage.setItem('userId',res.data.userId)
  412. // if(res.data.userType){
  413. //临时注销了
  414. // localStorage.setItem('identity',res.data.screen_token);
  415. // localStorage.setItem('identityType',res.data.screen_type);
  416. // }
  417. this.fullScreen();
  418. this.$router.push({ path: this.redirect || "/home" }).catch(()=>{});
  419. }).catch(() => {
  420. this.loading = false;
  421. if (this.captchaOnOff) {
  422. this.getCode();
  423. }
  424. });
  425. }
  426. });
  427. }else if(type == 2){
  428. //手机号码登录
  429. if(this.checkPhone(this.loginFormTwo.username)){
  430. if(!this.loginFormTwo.password){
  431. this.textTwo = '*请输入正确的验证码';
  432. return
  433. }
  434. this.textTwo = "";
  435. this.$refs.loginFormTwo.validate(valid => {
  436. if (valid) {
  437. this.loading = true;
  438. this.loginFormTwo.authType = 'mobile'
  439. this.$store.dispatch("LoginPhone", this.loginFormTwo).then((res) => {
  440. if(res.code != 200){
  441. this.textTwo = "*"+res.message;
  442. if(res.code == 530){
  443. this.textTwo = "*"+res.message;
  444. }else if(res.code == 503){
  445. this.textTwo = "*"+res.message;
  446. }
  447. this.loading = false;
  448. return
  449. }
  450. this.getExploitConfig();
  451. this.getHomeConfig();
  452. // localStorage.setItem('initPage',res.data.skipHomePage);
  453. if(res.data.reset_password){
  454. this.$confirm('账号当前登录密码为默认密码,是否现在修改?', "提示", {
  455. confirmButtonText: "确定",
  456. cancelButtonText: "取消",
  457. type: "warning"
  458. }).then(function() {
  459. let routeData = JSON.parse(localStorage.getItem("routeData"))
  460. for(let i=0;i<routeData.length;i++){
  461. if(!routeData[i].hidden&&routeData[i].name != 'Https://www.sxitdlc.com'){
  462. store.dispatch('settings/setPageName', routeData[i].meta.title)
  463. self.$store.commit("SET_SIDEBAR_ROUTERS", routeData[i].children);
  464. self.$router.push({ path: '/comprehensive/system/mine' });
  465. break
  466. }
  467. }
  468. }).then(() => {
  469. }).catch(() => {
  470. });
  471. }
  472. localStorage.setItem('userType',res.data.userType==0||res.data.userType==1?'11':'22')
  473. localStorage.setItem('userId',res.data.userId)
  474. // if(res.data.userType){
  475. //身份字段规则转义 原定11老师 22学生 新版本后0系统1老师2学生,这里身份字段转义为旧版本规则
  476. //临时注销了
  477. // localStorage.setItem('identity',res.data.screen_token);
  478. // localStorage.setItem('identityType',res.data.screen_type);
  479. // }
  480. this.fullScreen();
  481. this.$router.push({ path: this.redirect || "/home" }).catch(()=>{});
  482. }).catch(() => {
  483. this.loading = false;
  484. });
  485. }
  486. });
  487. }
  488. }
  489. },
  490. //全屏
  491. fullScreen() {
  492. var element = document.documentElement;
  493. if (element.requestFullscreen) {
  494. element.requestFullscreen();
  495. } else if (element.msRequestFullscreen) {
  496. element.msRequestFullscreen();
  497. } else if (element.mozRequestFullScreen) {
  498. element.mozRequestFullScreen();
  499. } else if (element.webkitRequestFullscreen) {
  500. element.webkitRequestFullscreen();
  501. }
  502. },
  503. //退出全屏
  504. exitFullscreen() {
  505. if (document.exitFullscreen) {
  506. document.exitFullscreen();
  507. } else if (document.msExitFullscreen) {
  508. document.msExitFullscreen();
  509. } else if (document.mozCancelFullScreen) {
  510. document.mozCancelFullScreen();
  511. } else if (document.webkitExitFullscreen) {
  512. document.webkitExitFullscreen();
  513. }
  514. },
  515. /*******************手机登录*******************/
  516. loginTypeClick(type){
  517. if(type!=this.loginType){
  518. this.loginType = type;
  519. }
  520. },
  521. getCodeOne() {
  522. if(this.checkPhone(this.loginFormTwo.username)){
  523. if(this.codeButtonType){
  524. sendCode(this.loginFormTwo.username).then(response => {
  525. if(response.code != 200){
  526. this.textTwo = "*"+response.message;
  527. if(response.code == 530){
  528. this.textTwo = "*"+response.message;
  529. }
  530. }else {
  531. this.textTwo = "";
  532. // this.msgSuccess('发送成功');
  533. this.codeButtonType = false;
  534. this.time();
  535. }
  536. });
  537. }
  538. }
  539. },
  540. //定时器
  541. time(){
  542. let self = this;
  543. let time = 30;
  544. self.codeNum = parseInt(time);
  545. this.timer = window.setInterval(refreshCount, 1000);
  546. function refreshCount() {
  547. if(time<=0){
  548. self.codeNum = parseInt(time);
  549. self.codeButtonType = true;
  550. window.clearInterval(self.timer);
  551. }else{
  552. time--;
  553. self.codeNum = parseInt(time);
  554. }
  555. }
  556. },
  557. //手机号验证
  558. checkPhone(value) {
  559. if (!value) {
  560. this.textTwo = '*手机号不能为空哦~';
  561. return false
  562. } else {
  563. const reg = /^1[3|4|5|7|8|9][0-9]\d{8}$/;
  564. if (reg.test(value)) {
  565. this.textTwo = '';
  566. return true
  567. } else {
  568. this.textTwo = '*请输入正确的手机号码';
  569. return false
  570. }
  571. }
  572. },
  573. },
  574. beforeDestroy() {
  575. //清除定时器
  576. clearInterval(this.timer);
  577. console.log("beforeDestroy-timer");
  578. },
  579. destroyed() {
  580. //清除定时器
  581. clearInterval(this.timer);
  582. console.log("destroyed-timer");
  583. }
  584. };
  585. </script>
  586. <style rel="stylesheet/scss" lang="scss">
  587. .login-page{
  588. height: 100%;
  589. width:100%;
  590. background-image: url("../../assets/ZDimages/basicsModules/icon_dl_bbg.png");
  591. background-repeat:no-repeat;
  592. background-size: cover;
  593. -webkit-background-size: cover;
  594. -o-background-size: cover;
  595. position: relative;
  596. *{
  597. margin:0;
  598. }
  599. .forgotPasswordBox{
  600. margin-top:5px;
  601. display: flex;
  602. .forgotPasswordNull{
  603. flex:1;
  604. }
  605. .forgotPassword{
  606. text-align: center;
  607. color:#ffffff;
  608. font-size:14px;
  609. cursor: pointer;
  610. }
  611. .forgotPassword:hover{
  612. color:#00ffff;
  613. }
  614. }
  615. .logo-img{
  616. position: absolute;
  617. top:29px;
  618. left:52px;
  619. width:250px;
  620. height:55px;
  621. }
  622. .title-img-box{
  623. position: absolute;
  624. top:74px;
  625. left:50%;
  626. margin-left:-580px;
  627. width:1180px;
  628. height:230px;
  629. div{
  630. position: relative;
  631. img{
  632. width:1180px;
  633. height:230px;
  634. }
  635. p{
  636. position: absolute;
  637. top:72px;
  638. right:300px;
  639. width:50px;
  640. height:26px;
  641. line-height:26px;
  642. text-align: center;
  643. background: #0045AF;
  644. color:#fff;
  645. font-size:14px;
  646. border-radius:70px;
  647. }
  648. }
  649. }
  650. .form-box{
  651. width:680px;
  652. height:520px;
  653. background-image: url("../../assets/ZDimages/basicsModules/img_dlk_bg.png");
  654. position: absolute;
  655. top:290px;
  656. left:50%;
  657. margin-left:-340px;
  658. .form-title-p{
  659. line-height:52px;
  660. font-size:24px;
  661. text-align: center;
  662. color:#fff;
  663. font-weight:700;
  664. }
  665. .username-input-box-code:hover{
  666. box-shadow: 0 0 4px 1px rgba(255,39,39,1)!important;
  667. }
  668. .username-input-box-code{
  669. border: 1px solid #FF6A6A!important;
  670. }
  671. .username-input-box:hover{
  672. box-shadow: 0 0 4px 1px rgba(0, 255, 252, 1);
  673. }
  674. .username-input-box{
  675. width:480px;
  676. height:60px;
  677. border: 1px solid #00FFFC;
  678. border-radius: 10px;
  679. background: rgba(0, 13, 41, 0.2);
  680. margin: 40px auto 32px;
  681. display: flex;
  682. overflow: hidden;
  683. img{
  684. height:20px;
  685. width:20px;
  686. margin:20px;
  687. }
  688. input:-webkit-autofill {
  689. -webkit-box-shadow : 0 0 0 1000px rgba(1,25,67,1) inset !important;
  690. -webkit-text-fill-color: #FFFFFF !important;
  691. }
  692. input{
  693. flex:1;
  694. border:none;
  695. outline:none;
  696. background-color: transparent !important;
  697. color: #dedede;
  698. font-size:16px;
  699. }
  700. ::placeholder{
  701. color:#999999 ;
  702. font-size:16px;
  703. }
  704. }
  705. .password-input-box:hover{
  706. box-shadow: 0 0 4px 1px rgba(0, 255, 252, 1);
  707. }
  708. .password-input-box{
  709. width:480px;
  710. height:60px;
  711. border: 1px solid #00FFFC;
  712. border-radius: 10px;
  713. background: rgba(0, 13, 41, 0.2);
  714. margin: 0 auto;
  715. display: flex;
  716. overflow: hidden;
  717. img{
  718. height:20px;
  719. width:20px;
  720. margin:20px;
  721. }
  722. input:-webkit-autofill {
  723. -webkit-box-shadow : 0 0 0 1000px rgba(1,25,67,1) inset !important;
  724. -webkit-text-fill-color: #FFFFFF !important;
  725. }
  726. input{
  727. flex:1;
  728. border:none;
  729. outline:none;
  730. background-color: transparent !important;
  731. color: #dedede;
  732. font-size:16px;
  733. }
  734. ::placeholder{
  735. color:#999999 ;
  736. font-size:16px;
  737. }
  738. }
  739. .text-p{
  740. width:480px;
  741. height:59px;
  742. line-height: 59px;
  743. margin: 0 auto;
  744. font-size: 14px;
  745. font-family: Microsoft YaHei;
  746. color: #DC1616;
  747. }
  748. .code-input-box{
  749. width:480px;
  750. height:60px;
  751. display: flex;
  752. margin: 0 auto;
  753. .code-input-left-box:hover{
  754. box-shadow: 0 0 4px 1px rgba(0, 255, 252, 1);
  755. }
  756. .code-input-left-box{
  757. width:330px;
  758. height:60px;
  759. border: 1px solid #00FFFC;
  760. border-radius: 10px;
  761. background: rgba(0, 13, 41, 0.2);
  762. display: flex;
  763. overflow: hidden;
  764. img{
  765. height:20px;
  766. width:20px;
  767. margin:20px;
  768. }
  769. input:-webkit-autofill {
  770. -webkit-box-shadow: 0 0 0 1000px white inset !important;
  771. }
  772. input{
  773. flex:1;
  774. border:none;
  775. outline:none;
  776. background-color: transparent !important;
  777. color: #dedede;
  778. font-size:16px;
  779. }
  780. ::placeholder{
  781. color:#999999 ;
  782. font-size:16px;
  783. }
  784. }
  785. .login-code{
  786. width:124px;
  787. height:50px;
  788. margin:6px 0 0 25px;
  789. img {
  790. width:124px;
  791. height:50px;
  792. cursor: pointer;
  793. vertical-align: middle;
  794. }
  795. }
  796. }
  797. .form-button-p{
  798. font-size:16px;
  799. display: block;
  800. width:480px;
  801. height: 60px;
  802. background: #0045AF;
  803. color:#fff;
  804. border:none;
  805. border-radius: 10px;
  806. margin:34px auto 0;
  807. }
  808. }
  809. .form-box-one{
  810. width:680px;
  811. height:520px;
  812. background-image: url("../../assets/ZDimages/basicsModules/img_dlk_bg_one.png");
  813. position: absolute;
  814. top:290px;
  815. left:50%;
  816. margin-left:-340px;
  817. .form-title-box{
  818. height:52px;
  819. display: flex;
  820. .form-title-null{
  821. flex:1;
  822. }
  823. .form-title-p{
  824. padding:0 30px;
  825. line-height:52px;
  826. font-size:20px;
  827. text-align: center;
  828. color:#fff;
  829. font-weight:700;
  830. cursor: pointer;
  831. }
  832. .form-title-p-color{
  833. color:#00ffff;
  834. }
  835. }
  836. .login-form-one {
  837. .form-title-p{
  838. line-height:52px;
  839. font-size:24px;
  840. text-align: center;
  841. color:#fff;
  842. font-weight:700;
  843. }
  844. .username-input-box-code:hover{
  845. box-shadow: 0 0 4px 1px rgba(255,39,39,1)!important;
  846. }
  847. .username-input-box-code{
  848. border: 1px solid #FF6A6A!important;
  849. }
  850. .username-input-box:hover{
  851. box-shadow: 0 0 4px 1px rgba(0, 255, 252, 1);
  852. }
  853. .username-input-box{
  854. width:480px;
  855. height:60px;
  856. border: 1px solid #00FFFC;
  857. border-radius: 10px;
  858. background: rgba(0, 13, 41, 0.2);
  859. margin: 40px auto 32px;
  860. display: flex;
  861. overflow: hidden;
  862. img{
  863. height:20px;
  864. width:20px;
  865. margin:20px;
  866. }
  867. input:-webkit-autofill {
  868. //input 背景色 #0C2034根据自己需要替换
  869. -webkit-box-shadow : 0 0 0px 1000px rgba(1,25,67,1) inset !important;
  870. //input字体颜色 颜色根据自己要求替换
  871. -webkit-text-fill-color: #FFFFFF !important;
  872. }
  873. input{
  874. flex:1;
  875. border:none;
  876. outline:none;
  877. background-color: transparent !important;
  878. color: #dedede;
  879. font-size:16px;
  880. }
  881. ::placeholder{
  882. color:#999999 ;
  883. font-size:16px;
  884. }
  885. }
  886. .password-input-box:hover{
  887. box-shadow: 0 0 4px 1px rgba(0, 255, 252, 1);
  888. }
  889. .password-input-box{
  890. width:480px;
  891. height:60px;
  892. border: 1px solid #00FFFC;
  893. border-radius: 10px;
  894. background: rgba(0, 13, 41, 0.2);
  895. margin: 0 auto;
  896. display: flex;
  897. overflow: hidden;
  898. img{
  899. height:20px;
  900. width:20px;
  901. margin:20px;
  902. }
  903. input:-webkit-autofill {
  904. //input 背景色 #0C2034根据自己需要替换
  905. -webkit-box-shadow : 0 0 0px 1000px rgba(1,25,67,1) inset !important;
  906. //input字体颜色 颜色根据自己要求替换
  907. -webkit-text-fill-color: #FFFFFF !important;
  908. }
  909. input{
  910. flex:1;
  911. border:none;
  912. outline:none;
  913. background-color: transparent !important;
  914. color: #dedede;
  915. font-size:16px;
  916. }
  917. ::placeholder{
  918. color:#999999 ;
  919. font-size:16px;
  920. }
  921. }
  922. .text-p{
  923. width:480px;
  924. height:59px;
  925. line-height: 59px;
  926. margin: 0 auto;
  927. font-size: 14px;
  928. font-family: Microsoft YaHei;
  929. color: #DC1616;
  930. }
  931. .code-input-box{
  932. width:480px;
  933. height:60px;
  934. display: flex;
  935. margin: 0 auto;
  936. .code-input-left-box:hover{
  937. box-shadow: 0 0 4px 1px rgba(0, 255, 252, 1);
  938. }
  939. .code-input-left-box{
  940. width:330px;
  941. height:60px;
  942. border: 1px solid #00FFFC;
  943. border-radius: 10px;
  944. background: rgba(0, 13, 41, 0.2);
  945. display: flex;
  946. overflow: hidden;
  947. img{
  948. height:20px;
  949. width:20px;
  950. margin:20px;
  951. }
  952. input:-webkit-autofill {
  953. -webkit-box-shadow: 0 0 0 1000px white inset !important;
  954. }
  955. input{
  956. flex:1;
  957. border:none;
  958. outline:none;
  959. background-color: transparent !important;
  960. color: #dedede;
  961. font-size:16px;
  962. }
  963. ::placeholder{
  964. color:#999999 ;
  965. font-size:16px;
  966. }
  967. }
  968. .login-code{
  969. width:124px;
  970. height:50px;
  971. margin:6px 0 0 25px;
  972. img {
  973. width:124px;
  974. height:50px;
  975. cursor: pointer;
  976. vertical-align: middle;
  977. }
  978. }
  979. }
  980. .form-button-p{
  981. font-size:16px;
  982. display: block;
  983. width:480px;
  984. height: 60px;
  985. background: #0045AF;
  986. color:#fff;
  987. border:none;
  988. border-radius: 10px;
  989. margin:34px auto 0;
  990. }
  991. }
  992. .login-form-two{
  993. .username-input-box:hover{
  994. box-shadow: 0 0 4px 1px rgba(0, 255, 252, 1);
  995. }
  996. .username-input-box{
  997. width:480px;
  998. height:60px;
  999. border: 1px solid #00FFFC;
  1000. border-radius: 10px;
  1001. background: rgba(0, 13, 41, 0.2);
  1002. margin: 70px auto 0;
  1003. display: flex;
  1004. overflow: hidden;
  1005. img{
  1006. height:20px;
  1007. width:20px;
  1008. margin:19px 30px 19px 20px;
  1009. }
  1010. p{
  1011. color: #999999;
  1012. line-height:60px;
  1013. span:nth-child(1){
  1014. }
  1015. span:nth-child(2){
  1016. margin:0 10px;
  1017. }
  1018. }
  1019. input:-webkit-autofill {
  1020. //input 背景色 #0C2034根据自己需要替换
  1021. -webkit-box-shadow : 0 0 0px 1000px rgba(1,25,67,1) inset !important;
  1022. //input字体颜色 颜色根据自己要求替换
  1023. -webkit-text-fill-color: #FFFFFF !important;
  1024. }
  1025. input{
  1026. flex:1;
  1027. border:none;
  1028. outline:none;
  1029. background-color: transparent !important;
  1030. color: #dedede;
  1031. font-size:16px;
  1032. }
  1033. ::placeholder{
  1034. color:#999999 ;
  1035. font-size:16px;
  1036. }
  1037. }
  1038. .text-p{
  1039. width:480px;
  1040. height:59px;
  1041. line-height: 59px;
  1042. margin: 0 auto;
  1043. font-size: 14px;
  1044. font-family: Microsoft YaHei;
  1045. color: #DC1616;
  1046. }
  1047. .code-input-box{
  1048. width:480px;
  1049. height:60px;
  1050. display: flex;
  1051. margin: 0 auto;
  1052. .code-input-left-box:hover{
  1053. box-shadow: 0 0 4px 1px rgba(0, 255, 252, 1);
  1054. }
  1055. .code-input-left-box{
  1056. width:300px;
  1057. height:60px;
  1058. border: 1px solid #00FFFC;
  1059. border-radius: 10px;
  1060. background: rgba(0, 13, 41, 0.2);
  1061. display: flex;
  1062. overflow: hidden;
  1063. img{
  1064. height:20px;
  1065. width:20px;
  1066. margin:19px 30px 19px 20px;
  1067. }
  1068. input:-webkit-autofill {
  1069. -webkit-box-shadow: 0 0 0 1000px white inset !important;
  1070. }
  1071. input{
  1072. flex:1;
  1073. border:none;
  1074. outline:none;
  1075. background-color: transparent !important;
  1076. color: #dedede;
  1077. font-size:16px;
  1078. }
  1079. ::placeholder{
  1080. color:#999999 ;
  1081. font-size:16px;
  1082. }
  1083. }
  1084. .login-code-one{
  1085. background: #999;
  1086. color:#fff;
  1087. }
  1088. .login-code-two{
  1089. background: #0045AF;
  1090. color:#fff;
  1091. }
  1092. .login-code{
  1093. width:160px;
  1094. height:60px;
  1095. line-height:60px;
  1096. cursor: pointer;
  1097. margin-left:20px;
  1098. border-radius:10px;
  1099. font-size:14px;
  1100. text-align: center;
  1101. }
  1102. }
  1103. .form-button-p{
  1104. font-size:16px;
  1105. display: block;
  1106. width:480px;
  1107. height: 60px;
  1108. background: #0045AF;
  1109. color:#fff;
  1110. border:none;
  1111. border-radius: 10px;
  1112. margin:50px auto 0;
  1113. }
  1114. }
  1115. }
  1116. .introduction-p{
  1117. width:100%;
  1118. text-align: center;
  1119. color:#fff;
  1120. font-size:16px;
  1121. line-height:44px;
  1122. position: absolute;
  1123. left:0;
  1124. bottom:0;
  1125. }
  1126. }
  1127. </style>