From fbb61549bf96e9e0910b676a5524b0760d29c4be Mon Sep 17 00:00:00 2001
From: WXL (wul) <wl_5969728@163.com>
Date: 星期二, 07 四月 2026 15:16:54 +0800
Subject: [PATCH] 测试完成

---
 src/views/login-sy.vue |  322 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 322 insertions(+), 0 deletions(-)

diff --git a/src/views/login-sy.vue b/src/views/login-sy.vue
new file mode 100644
index 0000000..0408a34
--- /dev/null
+++ b/src/views/login-sy.vue
@@ -0,0 +1,322 @@
+<template>
+  <div class="login">
+    <el-form
+      ref="loginForm"
+      :model="loginForm"
+      :rules="loginRules"
+      class="login-form"
+    >
+      <h3 class="title">鏅烘収闅忚绯荤粺</h3>
+      <el-form-item prop="username">
+        <el-input
+          v-model="loginForm.username"
+          type="text"
+          auto-complete="off"
+          placeholder="璐﹀彿"
+        >
+          <svg-icon
+            slot="prefix"
+            icon-class="user"
+            class="el-input__icon input-icon"
+          />
+        </el-input>
+      </el-form-item>
+      <el-form-item prop="password">
+        <el-input
+          v-model="loginForm.password"
+          type="password"
+          auto-complete="off"
+          placeholder="瀵嗙爜"
+          @keyup.enter.native="handleLogin"
+        >
+          <svg-icon
+            slot="prefix"
+            icon-class="password"
+            class="el-input__icon input-icon"
+          />
+        </el-input>
+      </el-form-item>
+      <!-- 甯備竴===================涓� -->
+      <el-form-item prop="medicalCode">
+        <el-select
+          style="width: 100%"
+          v-model="loginForm.medicalCode"
+          placeholder="璇烽�夋嫨闄㈠尯"
+        >
+          <el-option
+            v-for="item in options"
+            :label="item.label"
+            :value="item.value"
+          >
+          </el-option>
+          <i slot="prefix" class="el-icon-mobile"></i>
+        </el-select>
+      </el-form-item>
+      <!-- <el-form-item prop="code" v-if="captchaEnabled">
+        <el-input
+          v-model="loginForm.code"
+          auto-complete="off"
+          placeholder="楠岃瘉鐮�"
+          style="width: 63%"
+          @keyup.enter.native="handleLogin"
+        >
+          <svg-icon
+            slot="prefix"
+            icon-class="validCode"
+            class="el-input__icon input-icon"
+          />
+        </el-input>
+        <div class="login-code">
+          <img :src="codeUrl" @click="getCode" class="login-code-img" />
+        </div>
+      </el-form-item> -->
+      <el-checkbox
+        v-model="loginForm.rememberMe"
+        style="margin: 0px 0px 25px 0px"
+        >璁颁綇瀵嗙爜</el-checkbox
+      >
+      <el-form-item style="width: 100%">
+        <el-button
+          :loading="loading"
+          size="medium"
+          type="primary"
+          style="width: 100%"
+          @click.native.prevent="handleLogin"
+        >
+          <span v-if="!loading">鐧� 褰�</span>
+          <span v-else>鐧� 褰� 涓�...</span>
+        </el-button>
+        <div style="float: right" v-if="register">
+          <router-link class="link-type" :to="'/register'"
+            >绔嬪嵆娉ㄥ唽1</router-link
+          >
+        </div>
+      </el-form-item>
+    </el-form>
+    <!--  搴曢儴  -->
+    <!-- <div class="el-login-footer">
+      <span style="color: #568FBD; font-size: 25px;">Copyright 漏 2018-2022 ruoyi.vip All Rights Reserved.</span>
+    </div> -->
+  </div>
+</template>
+
+<script>
+import { getCodeImg } from "@/api/login";
+import Cookies from "js-cookie";
+import { encrypt, decrypt } from "@/utils/jsencrypt";
+import { getorganization } from "@/api/AiCentre/index";
+
+export default {
+  name: "Login",
+  data() {
+    return {
+      codeUrl: "",
+      loginForm: {
+        username: "",
+        password: "",
+        rememberMe: false,
+        code: "",
+        orgid: "H41010500003",
+      },
+      options: [
+      ],
+      loginRules: {
+        username: [
+          { required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勮处鍙�" },
+        ],
+        password: [
+          { required: true, trigger: "blur", message: "璇疯緭鍏ユ偍鐨勫瘑鐮�" },
+        ],
+        orgid: [{ required: true, trigger: "blur", message: "璇烽�夋嫨闄㈠尯" }],
+      },
+      loading: false,
+      // 楠岃瘉鐮佸紑鍏�
+      captchaEnabled: true,
+      // 娉ㄥ唽寮�鍏�
+      register: false,
+      redirect: undefined,
+    };
+  },
+  watch: {
+    $route: {
+      handler: function (route) {
+        this.redirect = route.query && route.query.redirect;
+      },
+      immediate: true,
+    },
+  },
+  created() {
+    this.getorganization();
+    this.getCode();
+    this.getCookie();
+    // if (localStorage.getItem('orgid')) {
+    //   this.loginForm.orgid = localStorage.getItem('orgid');
+    // }
+  },
+  methods: {
+    getCode() {
+      getCodeImg().then((res) => {
+        this.captchaEnabled =
+          res.captchaEnabled === undefined ? true : res.captchaEnabled;
+        if (this.captchaEnabled) {
+          this.codeUrl = "data:image/gif;base64," + res.img;
+          this.loginForm.uuid = res.uuid;
+        }
+      });
+    },
+    getorganization() {
+      getorganization({ pageSize: 30 }).then((res) => {
+        if (res.code == 200) {
+          this.options = res.rows.map((item) => ({
+            value: item.medicalCode,
+            // value: item.medicalCode,
+            label: item.organizationName,
+          }));
+        }
+      });
+    },
+    getCookie() {
+      const username = Cookies.get("username");
+      const password = Cookies.get("password");
+      const rememberMe = Cookies.get("rememberMe");
+      this.loginForm = {
+        username: username === undefined ? this.loginForm.username : username,
+        password:
+          password === undefined ? this.loginForm.password : decrypt(password),
+        rememberMe: rememberMe === undefined ? false : Boolean(rememberMe),
+      };
+    },
+    handleLogin() {
+  this.$refs.loginForm.validate((valid) => {
+    if (valid) {
+      this.loading = true;
+
+      if (this.loginForm.rememberMe) {
+        Cookies.set("username", this.loginForm.username, { expires: 30 });
+        Cookies.set("password", encrypt(this.loginForm.password), {
+          expires: 30,
+        });
+        Cookies.set("rememberMe", this.loginForm.rememberMe, {
+          expires: 30,
+        });
+      } else {
+        Cookies.remove("username");
+        Cookies.remove("password");
+        Cookies.remove("rememberMe");
+      }
+
+      // 鍔ㄦ�佽缃� campusid 鍙傛暟
+      const selectedOrg = this.options.find(item => item.value === this.loginForm.medicalCode);
+      console.log(selectedOrg);
+
+      if (selectedOrg) {
+        if (selectedOrg.label.includes('婀栨花')) {
+          this.loginForm.campusid = 1;
+          this.loginForm.orgid = 1;
+        } else if (selectedOrg.label.includes('鍚村北')) {
+          this.loginForm.campusid = 2;
+          this.loginForm.orgid = 1;
+        } else {
+          this.loginForm.campusid = 1; // 榛樿鍊兼垨鍏朵粬澶勭悊
+          this.loginForm.orgid = 1;
+        }
+      }
+
+      this.$store
+        .dispatch("Login", this.loginForm)
+        .then((res) => {
+          if (this.loginForm.username == "admin") {
+            this.$router.push({ path: "/index" }).catch(() => {});
+          } else {
+            this.$router
+              .push({ path: "/followvisit/discharge" })
+              .catch(() => {});
+          }
+        })
+        .catch(() => {
+          this.loading = false;
+          if (this.captchaEnabled) {
+            this.getCode();
+          }
+        });
+    }
+  });
+}
+  },
+};
+</script>
+
+<style rel="stylesheet/scss" lang="scss">
+.login {
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  height: 100%;
+  overflow: hidden !important;
+  background-position: center center;
+
+  /* 鑳屾櫙鍥句笉骞抽摵 */
+  background-repeat: no-repeat;
+  /* 褰撳唴瀹归珮搴﹀ぇ浜庡浘鐗囬珮搴︽椂锛岃儗鏅浘鍍忕殑浣嶇疆鐩稿浜巚iewport鍥哄畾 */
+  background-attachment: fixed;
+  /* 璁╄儗鏅浘鍩轰簬瀹瑰櫒澶у皬浼哥缉 */
+  background-size: cover;
+  /* 璁剧疆鑳屾櫙棰滆壊锛岃儗鏅浘鍔犺浇杩囩▼涓細鏄剧ず鑳屾櫙鑹� */
+  background-color: #464646;
+  background-image: url("../assets/images/login-background.jpg");
+  background-size: cover;
+}
+.title {
+  margin: 0px auto 30px auto;
+  text-align: center;
+  color: #707070;
+}
+
+.login-form {
+  border-radius: 6px;
+  background: #ffffff;
+  width: 400px;
+  padding: 25px 25px 5px 25px;
+  .el-input {
+    height: 38px;
+    input {
+      height: 38px;
+    }
+  }
+  .input-icon {
+    height: 39px;
+    width: 14px;
+    margin-left: 2px;
+  }
+}
+.login-tip {
+  font-size: 13px;
+  text-align: center;
+  color: #bfbfbf;
+}
+.login-code {
+  width: 33%;
+  height: 38px;
+  float: right;
+  img {
+    cursor: pointer;
+    vertical-align: middle;
+  }
+}
+.el-login-footer {
+  height: 40px;
+  line-height: 40px;
+  position: fixed;
+  bottom: 0;
+  width: 100%;
+  text-align: center;
+  color: #fff;
+  font-family: Arial;
+  font-size: 12px;
+  letter-spacing: 1px;
+}
+
+.login-code-img {
+  height: 38px;
+}
+</style>

--
Gitblit v1.9.3