123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- <template>
- <div>
- <div class="bigBox">
- <div class="winBox">
- <button class="winBtn" @click="WinMin">-</button>
- <button class="winBtn" @click="WinClose">×</button>
- </div>
- <!-- 信息 -->
- <div class="imgBox">
- <img src="../../assets/image/loginImg.png" alt="">
- <!-- <p>登录</p> -->
- </div>
- <!-- 登录信息 -->
- <div class="formBox">
- <el-form :model="loginForm" label-width="45px" style="padding-top: 24px;">
- <el-form-item label="账号">
- <el-input class="loginInp" v-model="loginForm.username" placeholder="你的账号..." maxlength="32" />
- </el-form-item>
- <el-form-item label="密码">
- <el-input class="loginInp" type="password" v-model="loginForm.userpass" show-password
- placeholder="你的密码..." maxlength="32" />
- </el-form-item>
- </el-form>
- <el-button class="loginBtn" type="primary" @click="sureLog" @keyup.enter="sureLog">登录</el-button>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { ref, onMounted } from "vue"
- import { useRouter } from 'vue-router'
- import { ElMessage } from "element-plus"
- import login from "@/api/login"
- export default {
- setup() {
- let less = ref("")
- let loginForm = ref({
- username: "",
- userpass: ""
- })
- let isLogin = ref(false)
- let router = useRouter()
- function encryptPassword(password) {
- let val = SmCrypto.doSm3AndSm2Encrypt(password) + '0000'
- let ascCode = 0
- for (var i = 0; i < password.length; i++) {
- ascCode = password.charCodeAt(i).toString(16);
- // console.log(ascCode,'asc');
- if (ascCode.length == 1) {
- val += '00' + ascCode
- } else if (ascCode.length == 2) {
- val += '0' + ascCode
- } else {
- val += ascCode
- }
- }
- console.log(val, 'val');
- return val
- }
- function sureLog() {
- let kis = encryptPassword(loginForm.value.userpass)
- login.LoginNow({
- login_account: loginForm.value.username,
- pwd: kis
- }).then(res => {
- console.log(res, 'login');
- if (res.returncode === 200) {
- isLogin.value = true
- sessionStorage.setItem("loginStatus", isLogin.value)
- sessionStorage.setItem("userInfo", JSON.stringify(res.data))
- if (typeof (window.windowEx) != "undefined") {
- windowEx.Size(0, 0) //全屏
- windowEx.Position('center')
- }
- router.push('/home/mission')
- ElMessage({
- message: '登陆成功!',
- type: "success"
- })
- windowEx.Size(1920, 1080)
- // windowEx.Position('center')
- } else {
- ElMessage({
- message: res.msg,
- type: "error"
- })
- }
- })
- }
- function WinClose() {
- windowEx.Exit()
- }
- function WinMin() {
- windowEx.Min()
- }
- onMounted(() => {
- // window.onload = function () {
- // // 设置定时器,在 5000 毫秒(即 5 秒)后执行刷新操作
- // setTimeout(function () {
- // location.reload(); // 执行页面刷新
- // }, 100); // 5000 毫秒 = 5 秒
- // };
- })
- return {
- encryptPassword,
- less,
- sureLog,
- loginForm,
- isLogin,
- WinMin,
- WinClose
- }
- }
- }
- </script>
- <style scoped>
- .bigBox {
- width: 31.8rem;
- height: 35.5rem;
- margin: 0;
- background: #FFFFFF;
- box-shadow: 0px 1px 1.25rem 2px rgba(61, 128, 177, 0.13);
- position: relative;
- border: 1px solid #ededed;
- border-radius: 3px;
- }
- .formBox {
- width: 320px;
- height: 244px;
- text-align: center;
- background: #FFFFFF;
- box-shadow: 0px 1px 1.67rem 3px rgba(52, 123, 231, 0.12);
- border-radius: 4px 4px 4px 4px;
- opacity: 1;
- margin: 0 auto;
- }
- .imgBox {
- width: 22.67rem;
- height: 8.33rem;
- margin: 0 auto;
- margin-left: 90px;
- padding-top: 40px;
- }
- .loginInp {
- width: 22.5rem;
- height: 3.33rem;
- margin-top: 5px;
- border: 1px solid #A3ADE0;
- }
- .loginBtn {
- width: 22.67rem;
- height: 3.33rem;
- margin-top: 10px;
- background-color: #255CE7;
- }
- .winBox {
- width: 5.67rem;
- height: 5.67rem;
- position: absolute;
- top: 0px;
- right: 0px;
- color: #676767;
- }
- .winBtn {
- width: 2.83rem;
- height: 2.83rem;
- background-color: transparent;
- border: none;
- font-size: 2.5rem;
- text-align: center;
- line-height: 2.83rem;
- color: #676767;
- }
- .winBtn:nth-child(1):hover {
- border: 1px black solid;
- }
- .winBtn:nth-child(2):hover {
- background-color: red;
- }
- </style>
|