From b921e333300a26393291ffac44e9d9a2ed2d92ed Mon Sep 17 00:00:00 2001
From: wang1 <844966816@qq.com>
Date: 星期四, 13 七月 2023 18:18:49 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
Source/UBCS-WEB/dist/src/page/login/userlogin.vue | 291 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 291 insertions(+), 0 deletions(-)
diff --git a/Source/UBCS-WEB/dist/src/page/login/userlogin.vue b/Source/UBCS-WEB/dist/src/page/login/userlogin.vue
new file mode 100644
index 0000000..ff135b9
--- /dev/null
+++ b/Source/UBCS-WEB/dist/src/page/login/userlogin.vue
@@ -0,0 +1,291 @@
+<template>
+ <div>
+ <el-form ref="loginForm"
+ :model="loginForm"
+ :rules="loginRules"
+ class="login-form"
+ label-width="0"
+ status-icon
+ >
+ <el-form-item prop="selectInput">
+ <el-select v-model="loginForm.value" placeholder="璇烽�夋嫨缁勭粐" style="width: 326px" @change="selectchange">
+ <i slot="prefix" class="el-icon-s-operation"/>
+ <el-option
+ v-for="(item,index) in loginForm.region"
+ :key="index"
+ :label="item.TENANT_NAME"
+ :value="item.TENANT_ID">
+ </el-option>
+ </el-select>
+ </el-form-item>
+ <el-form-item prop="username">
+ <el-input v-model="loginForm.username"
+ :placeholder="$t('login.username')"
+ auto-complete="off"
+ size="small"
+ @keyup.enter.native="handleLogin">
+ <i slot="prefix" class="icon-yonghu"/>
+ </el-input>
+ </el-form-item>
+ <el-form-item prop="password">
+ <el-input v-model="loginForm.password"
+ :placeholder="$t('login.password')"
+ :type="passwordType"
+ auto-complete="off"
+ size="small"
+ @keyup.enter.native="handleLogin">
+ <i slot="suffix" class="el-icon-view el-input__icon" @click="showPassword"/>
+ <i slot="prefix" class="icon-mima"/>
+ </el-input>
+ </el-form-item>
+
+ <el-form-item>
+ <el-button class="login-submit"
+ size="small"
+ type="primary"
+ @click.native.prevent="handleLogin">{{ $t('login.submit') }}
+ </el-button>
+ </el-form-item>
+ <!--瀵嗙爜淇敼寮瑰嚭妗�-->
+ </el-form>
+ <el-dialog title="淇敼瀵嗙爜" :visible.sync="dialogFormVisible" append-to-body @close="delok" >
+ <el-form :model="form" :rules="rules">
+ <el-form-item label="鍘熷瘑鐮�" :label-width="formLabelWidth" prop="oldname">
+ <el-input v-model="form.oldPassword" autocomplete="off"></el-input>
+ </el-form-item>
+ <el-form-item label="鏂板瘑鐮�" :label-width="formLabelWidth" prop="newname">
+ <el-input v-model="form.newPassword" autocomplete="off"></el-input>
+ </el-form-item>
+ <el-form-item label="纭瀵嗙爜" :label-width="formLabelWidth" prop="newname1">
+ <el-input v-model="form.newPassword1" autocomplete="off"></el-input>
+ </el-form-item>
+ </el-form>
+ <div slot="footer" class="dialog-footer">
+ <el-button @click="delok">鍙� 娑�</el-button>
+ <el-button type="primary" @click="addok">纭� 瀹�</el-button>
+ </div>
+ </el-dialog>
+ </div>
+
+
+</template>
+
+<script>
+import {mapGetters} from "vuex";
+import {info} from "@/api/system/tenant";
+import {getTopUrl} from "@/util/util";
+import {updatePassword} from "@/api/system/user.js"
+import {removeToken} from "@/util/auth";
+import md5 from "js-md5";
+export default {
+ name: "userlogin",
+ data() {
+ return {
+ tenantMode: this.website.tenantMode,
+ ButtonList: [],
+ dialogFormVisible:false,
+ form: {
+ oldPassword: '',
+ newPassword: '',
+ newPassword1: '',
+ },
+ rules: {
+ oldname: [
+ { required: true, message: '璇疯緭鍏ュ師瀵嗙爜', trigger: 'blur' }
+ ],
+ newname:[
+ { required: true, message: '璇疯緭鍏ユ柊瀵嗙爜', trigger: 'blur' }
+ ],
+ newname1:[
+ { required: true, message: '璇疯緭纭瀵嗙爜', trigger: 'blur' }
+ ]
+ },
+ loginForm: {
+ //绉熸埛ID
+ tenantId: "000000",
+ //閮ㄩ棬ID
+ deptId: "",
+ //瑙掕壊ID
+ roleId: "",
+ //鐢ㄦ埛鍚�
+ username: "admin",
+ //瀵嗙爜
+ password: "admin",
+ selectInput: '',
+ //涓嬫媺input鏁版嵁
+ value: '绠$悊缁�',
+ //涓嬫媺鑿滃崟
+ region: [],
+ //璐﹀彿绫诲瀷
+ type: "account",
+ //楠岃瘉鐮佺殑绱㈠紩
+ key: "",
+ //棰勫姞杞界櫧鑹茶儗鏅�
+ image: "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
+
+ },
+ value: {
+ selectInput: [
+ {required: true, message: "璇烽�夋嫨缁勭粐", trigger: "blur"}
+ ],
+ username: [
+ {required: true, message: "璇疯緭鍏ョ敤鎴峰悕", trigger: "blur"}
+ ],
+ password: [
+ {required: true, message: "璇疯緭鍏ュ瘑鐮�", trigger: "blur"},
+ {min: 1, message: "瀵嗙爜闀垮害鏈�灏戜负6浣�", trigger: "blur"}
+ ]
+ },
+ passwordType: "password",
+ userBox: false,
+ userForm: {
+ deptId: '',
+ roleId: ''
+ },
+ userinfo: []
+ };
+ },
+ created() {
+ this.getTenant();
+ },
+ mounted() {
+ //鍦╩ounted鑾峰彇棣栭〉涓嬫媺鑿滃崟鏁版嵁
+ this.$axios.get('/api/ubcs-system/tenant/tenant-map').then(res => {
+ if (res.data.code == 200) {
+ this.loginForm.region = res.data.data
+ }
+ })
+ },
+ watch: {
+ 'loginForm.deptId'() {
+ const column = this.findObject(this.userOption.column, "deptId");
+ if (this.loginForm.deptId.includes(",")) {
+ column.dicUrl = `/api/ubcs-system/dept/select?deptId=${this.loginForm.deptId}`;
+ column.display = true;
+ } else {
+ column.dicUrl = '';
+ }
+ },
+ 'loginForm.roleId'() {
+ const column = this.findObject(this.userOption.column, "roleId");
+ if (this.loginForm.roleId.includes(",")) {
+ column.dicUrl = `/api/ubcs-system/role/select?roleId=${this.loginForm.roleId}`;
+ column.display = true;
+ } else {
+ column.dicUrl = '';
+ }
+ }
+ },
+ computed: {
+ ...mapGetters(["tagWel", "userInfo"])
+ },
+ props: [],
+ methods: {
+ aaa(){
+ console.log(111)
+ },
+ delok(){
+ //鐐瑰嚮鍙栨秷鎴栬�厁 娓呴櫎token鍏抽棴寮圭獥 娓呴櫎token鍚庝細鑷姩閲嶆柊鑾峰彇鐢ㄦ埛淇℃伅
+ this.dialogFormVisible = false;
+ removeToken();
+ },
+ addok(){
+ this.dialogFormVisible = false
+ updatePassword(md5(this.form.oldPassword), this.form.newPassword, this.form.newPassword1).then(res=>{
+ console.log(res)
+ if(res.data.code==200){
+ this.$message({
+ type:"success",
+ message:"淇敼鎴愬姛锛�"
+ })
+ this.$router.push({path: this.tagWel.value})
+ }
+ })
+ },
+ // 缁戝畾涓嬫媺鑿滃崟鍔ㄦ�両D
+ selectchange(value) {
+ this.loginForm.tenantId = value
+ console.log(this.loginForm.tenantId)
+ },
+ showPassword() {
+ this.passwordType === ""
+ ? (this.passwordType = "password")
+ : (this.passwordType = "");
+ },
+ submitLogin(form, done) {
+ if (form.deptId !== '') {
+ this.loginForm.deptId = form.deptId;
+ }
+ if (form.roleId !== '') {
+ this.loginForm.roleId = form.roleId;
+ }
+ this.handleLogin();
+ done();
+
+ },
+ handleLogin: function () {
+ this.userInfo = this.$store.state.upadatastatus
+ this.$refs.loginForm.validate(valid => {
+ if (valid) {
+ const loading = this.$loading({
+ lock: true,
+ text: '鐧诲綍涓�,璇风◢鍚庛�傘�傘��',
+ spinner: "el-icon-loading"
+ });
+ this.$store.dispatch("LoginByUsername", this.loginForm).then(() => {
+ //鍒ゆ柇濡傛灉涓嶇瓑浜�0灏辨槸绛栫暐瀵嗙爜娌℃湁淇敼璧颁笅闈㈤�昏緫
+ if (this.userInfo.strategyUpdateStatus != 0) {
+ if (this.website.switchMode) {
+ const deptId = this.userInfo.dept_id;
+ const roleId = this.userInfo.role_id;
+ if (deptId.includes(",") || roleId.includes(",")) {
+ this.loginForm.deptId = deptId;
+ this.loginForm.roleId = roleId;
+ this.userBox = true;
+ this.$store.dispatch("LogOut").then(() => {
+ loading.close();
+ });
+ }
+ }
+ this.$router.push({path: this.tagWel.value});
+ } else {
+ //绛変簬0璇存槑瀵嗙爜绛栫暐琚慨鏀癸紝鎻愮ず鐢ㄦ埛淇敼瀵嗙爜锛岀粰涓�涓慨鏀瑰脊鍑烘
+ this.$message({
+ type: "warning",
+ message: "瀵嗙爜绛栫暐宸茶淇敼锛岃閲嶆柊淇敼瀵嗙爜锛�"
+ })
+ // 1.5绉掑悗鎵ц 寮瑰嚭妗嗘樉绀�
+ setTimeout(()=>{
+ this.dialogFormVisible=true
+ },1500)
+ }
+ console.log(this.userInfo)
+ //鎶婂垽鏂瘑鐮佺瓥鐣ヤ慨鏀圭殑鍊煎瓨杩涙湰鍦帮紝鐒跺悗鍐嶈矾鐢辨潈闄恓s鏂囦欢閲岄潰鑾峰彇鍐嶅仛鍒ゆ柇锛屼笉鐒跺埛鏂颁細杩涘叆棣栭〉锛堝洜涓哄湪鏈塱d鍜宼oken鐨勬儏鍐典笅锛屽埛鏂伴〉闈㈡垨鑰呰繘鍏ョ櫥褰曢〉浼氳嚜鍔ㄨ繘鍏ラ椤碉級
+ localStorage.setItem("updataid",JSON.stringify(this.userInfo))
+ loading.close();
+ }).catch(() => {
+ loading.close();
+
+ });
+ }
+ });
+ },
+ getTenant() {
+ let domain = getTopUrl();
+ // 涓存椂鎸囧畾鍩熷悕锛屾柟渚挎祴璇�
+ //domain = "https://bladex.vip";
+ info(domain).then(res => {
+ const data = res.data;
+ if (data.success && data.data.tenantId) {
+ this.tenantMode = false;
+ this.loginForm.tenantId = data.data.tenantId;
+ this.$parent.$refs.login.style.backgroundImage = `url(${data.data.backgroundUrl})`;
+ }
+ })
+ }
+ }
+};
+</script>
+
+<style>
+</style>
--
Gitblit v1.10.0