1
dengjunjie
2025-09-29 d9c99e0480b4910cdb134778dd5c314b35ec4cf2
ÏîÄ¿´úÂë/WMS/WIDESEA_WMSClient/src/views/Login.vue
@@ -8,45 +8,65 @@
            <div>欢迎登录...</div>
            <div class="login-line"></div>
          </div>
          <div style="flex:1;"></div>
          <div style="flex: 1"></div>
        </div>
        <div class="login-text-small">WELCOME TO LOGIN</div>
        <div class="item">
          <div class="input-icon el-icon-user"></div>
          <input type="text" v-focus v-model="userInfo.userName" placeholder="请输入账号" />
          <input
            type="text"
            v-focus
            v-model="userInfo.userName"
            placeholder="请输入账号"
          />
        </div>
        <div class="item">
          <div class="input-icon el-icon-lock"></div>
          <input type="password" v-focus v-model="userInfo.password" placeholder="请输入密码" />
          <input
            type="password"
            v-focus
            v-model="userInfo.password"
            placeholder="请输入密码"
          />
        </div>
        <div class="item">
          <div class="input-icon el-icon-mobile"></div>
          <input v-focus type="text" v-model="userInfo.verificationCode" placeholder="输入验证码" />
          <input
            v-focus
            type="text"
            v-model="userInfo.verificationCode"
            placeholder="输入验证码"
          />
          <div class="code" @click="getVierificationCode">
            <img v-show="codeImgSrc != ''" :src="codeImgSrc" />
          </div>
        </div>
      </div>
      <div class="loging-btn">
        <el-button size="large" :loading="loading" color="#3a6cd1" :dark="true" @click="login" long>
        <el-button
          size="large"
          :loading="loading"
          color="#3a6cd1"
          :dark="true"
          @click="login"
          long
        >
          <span v-if="!loading">登录</span>
          <span v-else>正在登录...</span>
        </el-button>
      </div>
      <!-- è´¦å·ä¿¡æ¯ -->
      <div class="account-info">
        <el-link type="primary">忘记密码</el-link>&nbsp; &nbsp;
            <el-link type="primary" @click="gotoRegister">用户注册</el-link>
        <!-- <p>演示账号:admin666 &nbsp; &nbsp;密码:123456</p>
      <!-- <div class="account-info">
        <p>演示账号:admin666 &nbsp; &nbsp;密码:123456</p>
        <p>本地账号:admin &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;密码:123456</p>
        <p><a href="https://jq.qq.com/?_wv=1027&k=Sqstuy0M" style="text-decoration: none"
            target="_blank">QQ3群:743852316</a>
          &nbsp; &nbsp;&nbsp; &nbsp;
          <a href="http://v2.volcore.xyz/document/guide" style="text-decoration: none" target="_blank">框架文档</a>
        </p> -->
      </div>
        </p>
      </div> -->
      <!-- é“¾æŽ¥ä½ç½® -->
      <!-- <div class="app-link" >
        <a href="#" style="text-decoration: none">移动端扫码</a>
@@ -75,8 +95,7 @@
      <a href="http://120.48.115.252:9990" style="text-decoration: none" target="blank">视频演示地址</a>
    </div> -->
    <!-- <img class="login-bg" src="/static/login_bg.png" /> -->
    <img class="login-bg" :src="loginbg" />
    <img class="login-bg" src="/static/login_bg.png" />
  </div>
</template>
@@ -87,32 +106,26 @@
  ref,
  reactive,
  toRefs,
  getCurrentInstance
} from 'vue';
import { useRouter, useRoute } from 'vue-router';
import store from '../store/index';
import http from '@/../src/api/http.js';
var imgUrl = require("@/assets/login_bg.png");
  getCurrentInstance,
} from "vue";
import { useRouter, useRoute } from "vue-router";
import store from "../store/index";
import http from "@/../src/api/http.js";
export default defineComponent({
  setup(props, context) {
    store.commit('clearUserInfo', '');
    store.commit("clearUserInfo", "");
    const loading = ref(false);
    const codeImgSrc = ref('');
    const codeImgSrc = ref("");
    const userInfo = reactive({
      userName: 'admin',
      password: '123456',
      verificationCode: '1234',
      UUID: undefined
      userName: "",
      password: "",
      verificationCode: "",
      UUID: undefined,
    });
    const loginbg = ref(imgUrl);
    const gotoRegister=()=>{
      router.push({ path: '/register' });
    };
    const getVierificationCode = () => {
      http.get('/api/Sys_User/getVierificationCode').then((x) => {
        codeImgSrc.value = 'data:image/png;base64,' + x.img;
      http.get("/api/User/getVierificationCode").then((x) => {
        codeImgSrc.value = "data:image/png;base64," + x.img;
        userInfo.UUID = x.uuid;
      });
    };
@@ -123,21 +136,22 @@
    let router = useRouter();
    const login = () => {
      if (!userInfo.userName) return $message.error('请输入用户名');
      if (!userInfo.password) return $message.error('请输入密码');
      if (!userInfo.verificationCode) {
        return $message.error('请输入验证码');
      }
      if (!userInfo.userName) return $message.error("请输入用户名");
      if (!userInfo.password) return $message.error("请输入密码");
      if (!userInfo.verificationCode) return $message.error("请输入验证码");
      if (userInfo.verificationCode != "1234")
        return $message.error("验证码有误");
      loading.value = true;
      http.post('/api/Sys_User/login', userInfo, '正在登录....').then((result) => {
      http.post("/api/User/login", userInfo, "正在登录....").then((result) => {
        if (!result.status) {
          loading.value = false;
          getVierificationCode();
          return $message.error(result.message);
        }
        $message.success('登录成功,正在跳转!');
        store.commit('setUserInfo', result.data);
        router.push({ path: '/' });
        if (result.message != "") $message.error(result.message);
        $message.success("登录成功,正在跳转!");
        store.commit("setUserInfo", result.data);
        router.push({ path: "/" });
      });
    };
    const loginPress = (e) => {
@@ -146,7 +160,7 @@
      }
    };
    const openUrl = (url) => {
      window.open(url, '_blank');
      window.open(url, "_blank");
    };
    return {
      loading,
@@ -156,17 +170,15 @@
      userInfo,
      loginPress,
      openUrl,
      gotoRegister,
      loginbg
    };
  },
  directives: {
    focus: {
      inserted: function (el) {
        el.focus();
      }
    }
  }
      },
    },
  },
});
</script>
<style lang="less" scoped>
@@ -371,7 +383,6 @@
<style lang="less" scoped>
@media screen and (max-width: 700px) {
  .login-bg,
  .account-info,
  .app-link,