From 83ff2ebbb1d61c2cd7762df33f61ff0418b2b1c9 Mon Sep 17 00:00:00 2001 From: surprise <15810472099@163.com> Date: 星期日, 28 四月 2024 22:19:49 +0800 Subject: [PATCH] 页面添加 --- src/components/login.vue | 248 ++++++++++++++++++++++--------------------------- 1 files changed, 112 insertions(+), 136 deletions(-) diff --git a/src/components/login.vue b/src/components/login.vue index 4a88b67..08f4ade 100644 --- a/src/components/login.vue +++ b/src/components/login.vue @@ -1,118 +1,90 @@ <template> <div class="container"> - <vue-particles - :particleOpacity="0.7" - :particlesNumber="80" - shapeType="circle" - :particleSize="4" - :linesWidth="1" - :lineLinked="true" - :lineOpacity="0.4" - :linesDistance="80" - :moveSpeed="2" - :hoverEffect="true" - hoverMode="grab" - :clickEffect="false" - clickMode="bubble" - > + <vue-particles :particleOpacity="0.7" + :particlesNumber="80" + shapeType="circle" + :particleSize="4" + :linesWidth="1" + :lineLinked="true" + :lineOpacity="0.4" + :linesDistance="80" + :moveSpeed="2" + :hoverEffect="true" + hoverMode="grab" + :clickEffect="false" + clickMode="bubble"> </vue-particles> <div class="MapMenu"> - <iframe - id="ifream" - style="border: none" - width="100%" - height="100%" - v-bind:src="reportUrl" - ></iframe> + <iframe id="ifream" + style="border: none" + width="100%" + height="100%" + v-bind:src="reportUrl"></iframe> </div> <div class="title_img"> - <img - src="../assets/img/lg_03.png" - alt="" - /> + <img src="../assets/img/lg_03.png" + alt="" /> </div> <div class="login"> <div class="login_title"> <span>鐢ㄦ埛鐧诲綍</span> </div> - <el-form - :model="loginForm" - :rules="rules" - ref="loginForm" - class="loginForm" - > + <el-form :model="loginForm" + :rules="rules" + ref="loginForm" + class="loginForm"> <el-form-item prop="uid"> - <el-input - v-model="loginForm.uid" - placeholder="杈撳叆鐧诲綍璐﹀彿" - class="nobr" - size="meddle" - autocomplete="off" - > - <i - slot="prefix" - class="el-icon-user" - ></i> + <el-input v-model="loginForm.uid" + placeholder="杈撳叆鐧诲綍璐﹀彿" + class="nobr" + size="meddle" + autocomplete="off"> + <i slot="prefix" + class="el-icon-user"></i> </el-input> </el-form-item> <el-form-item prop="pwd"> - <el-input - show-password - v-model="loginForm.pwd" - placeholder="璇疯緭鍏ョ櫥褰曞瘑鐮�" - class="nobr" - autocomplete="off" - > - <i - slot="prefix" - class="el-icon-lock" - ></i> + <el-input show-password + v-model="loginForm.pwd" + placeholder="璇疯緭鍏ョ櫥褰曞瘑鐮�" + class="nobr" + autocomplete="off"> + <i slot="prefix" + class="el-icon-lock"></i> </el-input> </el-form-item> <el-form-item required> <el-col :span="18"> <el-form-item prop="validCode"> - <el-input - v-model="loginForm.validCode" - placeholder="璇疯緭鍏ラ獙璇佺爜锛堝拷鐣ュぇ灏忓啓锛�" - class="nobr" - ></el-input> + <el-input v-model="loginForm.validCode" + placeholder="璇疯緭鍏ラ獙璇佺爜锛堝拷鐣ュぇ灏忓啓锛�" + class="nobr"></el-input> </el-form-item> </el-col> - <el-col - :span="6" - align="right" - > - <validCode - v-model="validCode" - ref="refresh" - @sendData="getCode" - ></validCode> + <el-col :span="6" + align="right"> + <validCode v-model="validCode" + ref="refresh" + @sendData="getCode"></validCode> </el-col> </el-form-item> <el-form-item> - <img - src="../assets/img/zhengshu.png" - alt="" - /><span style="color: black">璇佷功瀹夎涓庢坊鍔犱俊浠荤珯鐐�</span> + <img src="../assets/img/zhengshu.png" + alt="" /><span style="color: black">璇佷功瀹夎涓庢坊鍔犱俊浠荤珯鐐�</span> </el-form-item> <el-form-item> - <img - src="../assets/img/document.png" - alt="" - /><span style="color: black">浣跨敤甯姪鏂囨。</span> + <img src="../assets/img/document.png" + alt="" /><span style="color: black">浣跨敤甯姪鏂囨。</span> </el-form-item> <el-form-item> - <el-button - type="primary" - class="nobr loginbtn" - style="" - :loading="loading" - @click="submitForm('loginForm')" - >鐧诲綍</el-button> + <el-button type="primary" + class="nobr loginbtn" + style="" + :loading="loading" + @click="submitForm('loginForm')">鐧诲綍</el-button> </el-form-item> </el-form> </div> @@ -127,27 +99,27 @@ export default { components: { validCode }, - data() { - let validUserName = (rule, value, callback) => { - if (!value) { + data () { + let validUserName=(rule,value,callback) => { + if(!value) { return callback(new Error("鐢ㄦ埛鍚嶄笉鑳戒负绌�")); } else { callback(); } }; - let validPassword = (rule, value, callback) => { - if (!value) { + let validPassword=(rule,value,callback) => { + if(!value) { return callback(new Error("瀵嗙爜涓嶈兘涓虹┖")); } else { callback(); } }; - const checkValidCode = (rule, value, callback) => { - if (!value) { + const checkValidCode=(rule,value,callback) => { + if(!value) { callback(new Error("璇疯緭鍏ラ獙璇佺爜")); - } else if (value.toUpperCase() !== this.validCode.toUpperCase()) { + } else if(value.toUpperCase()!==this.validCode.toUpperCase()) { callback(new Error("楠岃瘉鐮佷笉姝g‘")); } else { callback(); @@ -165,35 +137,35 @@ pwd: "", }, rules: { - uid: [{ validator: validUserName, trigger: "blur" }], - pwd: [{ validator: validPassword, trigger: "blur" }], - validCode: [{ validator: checkValidCode, trigger: "blur" }], + uid: [{ validator: validUserName,trigger: "blur" }], + pwd: [{ validator: validPassword,trigger: "blur" }], + validCode: [{ validator: checkValidCode,trigger: "blur" }], showSessionId: "", reportUrl: "", }, }; }, - mounted() { + mounted () { this.getpublickey(); }, methods: { - handlePaste(e) { + handlePaste (e) { e.preventDefault(); }, // 鑾峰彇vuex涓瑼ctions閲岀殑鏂规硶 - ...mapActions(["login", "getpublickey"]), - getCode(data) { - this.validCode = data; //鍦╠ata涓畾涔変竴涓� validCode:'',鐢ㄦ潵璁板綍楠岃瘉鐮併�� + ...mapActions(["login","getpublickey"]), + getCode (data) { + this.validCode=data; //鍦╠ata涓畾涔変竴涓� validCode:'',鐢ㄦ潵璁板綍楠岃瘉鐮併�� }, - submitForm(formName) { + submitForm (formName) { this.$refs[formName].validate((valid) => { - if (valid) { - this.loading = true; + if(valid) { + this.loading=true; this.login(this.loginForm) .then((response) => { - if (response.code != 200) { - this.loading = false; + if(response.code!=200) { + this.loading=false; this.$message({ message: response.msg, type: "error", @@ -206,7 +178,7 @@ return; } - if (response.msg != "") { + if(response.msg!="") { this.$message({ message: response.msg, type: "warning", @@ -215,45 +187,49 @@ this.setCookies(response); getPerms().then((res) => { - if (res.code == 200) { - this.$store.commit("getPermsEntity", res.result); + if(res.code==200) { + this.$store.commit("getPermsEntity",res.result); - if (res.result.length != 0) { - sessionStorage.setItem("routerName", "/Thematic"); - sessionStorage.setItem("changeSelectStyle", 1); - this.$router.push("/"); + if(res.result.length!=0) { + + // sessionStorage.setItem("routerName","/Synthesis"); + // sessionStorage.setItem("routerName", "/Thematic"); + // sessionStorage.setItem("changeSelectStyle",1); + // this.$router.push("/"); + sessionStorage.setItem("changeSelectStyle",1) + this.$router.push("/Synthesis") } else { this.$message({ message: "璇锋偍鑱旂郴绠$悊鍛樺垎閰嶈鑹茶彍鍗�", type: "error", }); } - this.loading = false; + this.loading=false; } else { - this.loading = false; + this.loading=false; console.log("error submit!!"); } }); - this.loading = false; + this.loading=false; //璋冪敤褰曟帴鍙� }) .catch((response) => { - this.loading = false; + this.loading=false; }); //濡傛灉鐧诲綍澶辫触锛岄渶瑕佸埛鏂伴獙璇佺爜鐨� this.$refs.refresh.createdCode(); - this.validCode = ""; //娓呯┖楠岃瘉鐮佽緭鍏ユ鐨勫唴瀹� + this.validCode=""; //娓呯┖楠岃瘉鐮佽緭鍏ユ鐨勫唴瀹� } else { - this.loading = false; + this.loading=false; console.log("error submit!!"); return false; } }); }, - setCookies(res) { - var timeData = moment(res.result.expire).format("YYYY-MM-DD HH:mm:ss"); - var LfPrems = { + setCookies (res) { + var timeData=moment(res.result.expire).format("YYYY-MM-DD HH:mm:ss"); + var LfPrems={ token: res.result.token, uname: res.result.uname, time: timeData, @@ -261,16 +237,16 @@ expire: res.result.expire, autoLogOut: res.result.autoLogOut, }; - LfPrems = JSON.stringify(LfPrems); - localStorage.setItem("LFToken", LfPrems); + LfPrems=JSON.stringify(LfPrems); + localStorage.setItem("LFToken",LfPrems); }, - enterLogin() { - document.onkeydown = (e) => { - e = window.event || e; + enterLogin () { + document.onkeydown=(e) => { + e=window.event||e; - if ( - this.$route.path == "/login" && - (e.code == "Enter" || e.code == "enter" || e.code == "NumpadEnter") + if( + this.$route.path=="/login"&& + (e.code=="Enter"||e.code=="enter"||e.code=="NumpadEnter") ) { //鏈�閲嶈鏈�鍚庤皟鐢�1.鐧诲綍鏍¢獙鏂规硶 //this.login(); @@ -278,17 +254,17 @@ } }; }, - startURL() { - var url = window.location.href; - var testurl = ""; - if (url.indexOf("web") != -1) { - testurl = "/web"; + startURL () { + var url=window.location.href; + var testurl=""; + if(url.indexOf("web")!=-1) { + testurl="/web"; } - this.reportUrl = - window.location.origin + testurl + "/mapscreen/index.html"; + this.reportUrl= + window.location.origin+testurl+"/mapscreen/index.html"; }, }, - created() { + created () { this.startURL(); this.enterLogin(); }, -- Gitblit v1.9.3