From 52ffefd06e59cbd56c1a919972866592379cfed2 Mon Sep 17 00:00:00 2001 From: xiejun <xj@2023> Date: 星期四, 21 九月 2023 11:27:11 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/UBCS-WEB/src/page/login/userlogin.vue | 520 ++++++++++++++++++++++++++++++++++++++++----------------- 1 files changed, 363 insertions(+), 157 deletions(-) diff --git a/Source/UBCS-WEB/src/page/login/userlogin.vue b/Source/UBCS-WEB/src/page/login/userlogin.vue index 5ccde5a..1311274 100644 --- a/Source/UBCS-WEB/src/page/login/userlogin.vue +++ b/Source/UBCS-WEB/src/page/login/userlogin.vue @@ -1,14 +1,14 @@ <template> - <el-form class="login-form" - status-icon - :rules="loginRules" - ref="loginForm" - :model="loginForm" - label-width="0" - > - + <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"> + <el-select v-model="loginForm.tenantId" placeholder="璇烽�夋嫨绉熸埛" style="width: 100%" @change="selectChange"> <i slot="prefix" class="el-icon-s-operation"/> <el-option v-for="(item,index) in loginForm.region" @@ -19,160 +19,351 @@ </el-select> </el-form-item> <el-form-item prop="username"> - <el-input size="small" - @keyup.enter.native="handleLogin" - v-model="loginForm.username" + <el-input v-model="loginForm.username" + :placeholder="$t('login.username')" auto-complete="off" - :placeholder="$t('login.username')"> + size="small" + @keyup.enter.native="handleLogin"> <i slot="prefix" class="icon-yonghu"/> </el-input> </el-form-item> <el-form-item prop="password"> - <el-input size="small" - @keyup.enter.native="handleLogin" + <el-input v-model="loginForm.password" + :placeholder="$t('login.password')" :type="passwordType" - v-model="loginForm.password" auto-complete="off" - :placeholder="$t('login.password')"> - <i class="el-icon-view el-input__icon" slot="suffix" @click="showPassword"/> + 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 type="primary" + <el-button @click="ChandleLogin">娴嬭瘯鍗曠偣鐧诲綍</el-button> + <el-button class="login-submit" size="small" - @click.native.prevent="handleLogin" - class="login-submit">{{$t('login.submit')}} + type="primary" + @click.native.prevent="handleLogin">{{ $t('login.submit') }} </el-button> </el-form-item> + <!--瀵嗙爜淇敼寮瑰嚭妗�--> + </el-form> + <el-dialog :close-on-press-escape="false" :visible.sync="dialogFormVisible" append-to-body title="淇敼瀵嗙爜" + @closed="closehandle"> + <el-form :model="form" :rules="rules"> + <el-form-item :label-width="formLabelWidth" label="鍘熷瘑鐮�" prop="oldPassword"> + <el-input v-model="form.oldPassword" autocomplete="off"></el-input> + </el-form-item> + <el-form-item :label-width="formLabelWidth" label="鏂板瘑鐮�" prop="newPassword"> + <el-input v-model="form.newPassword" autocomplete="off"></el-input> + </el-form-item> + <el-form-item :label-width="formLabelWidth" label="纭瀵嗙爜" prop="newPassword1"> + <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="addHandler">纭� 瀹�</el-button> + </div> + </el-dialog> + </div> - - - - </el-form> </template> <script> - import {mapGetters} from "vuex"; - import {info} from "@/api/system/tenant"; - import {getTopUrl} from "@/util/util"; +import {mapGetters} from "vuex"; +import {info} from "@/api/system/tenant"; +import {getTopUrl} from "@/util/util"; +import {oaSsos, 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:[], - 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", +export default { + name: "userlogin", + data() { + return { + tenantMode: this.website.tenantMode, + ButtonList: [], + dialogFormVisible: false, + form: { + oldPassword: '', + newPassword: '', + newPassword1: '', + }, + loginRules: { + username: [ + {required: true, message: '璇疯緭鍏ヨ处鍙�', trigger: 'blur'} + ], + password: [ + {required: true, message: '璇疯緭鍏ュ瘑鐮�', trigger: 'blur'} + ], + }, + rules: { + oldPassword: [ + {required: true, message: '璇疯緭鍏ュ師瀵嗙爜', trigger: 'blur'} + ], + newPassword: [ + {required: true, message: '璇疯緭鍏ユ柊瀵嗙爜', trigger: 'blur'} + ], + newPassword1: [ + {required: true, message: '璇疯緭纭瀵嗙爜', trigger: 'blur'} + ] + }, + loginForm: { + //绉熸埛ID + tenantId: "", + //閮ㄩ棬ID + deptId: "", + //瑙掕壊ID + roleId: "", + //鐢ㄦ埛鍚� + username: "", + //瀵嗙爜 + password: "", + 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: '' - }, - }; + }, + 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(); + //杩欓噷鏄祻瑙堝櫒鐨勪竴涓猙ug锛岀獊鐒跺嚭鐜扮殑鐩墠鎵句笉鍒板師鍥狅紝鏂扮殑娴忚鍣ㄦ墦寮�姝ら」鐩�俵ocalStorage浼氬皯瀛樺偍涓�涓悕涓簊aber-permission鐨勬暟鎹紝灏戜簡杩欐潯鏁版嵁绉熸埛绠$悊鐣岄潰浼氱己灏戝嚑涓寜閽拰鏍峰紡 + localStorage.setItem("saber-permission", JSON.stringify({ + "dataType": "object", "content": { + "flow_model_create": true, + "flow_model_update": true, + "flow_model_deploy": true, + "flow_model_download": true, + "flow_model_delete": true, + "work_start_flow": true, + "work_start_image": true, + "oss_add": true, + "oss_edit": true, + "oss_delete": true, + "oss_view": true, + "oss_enable": true, + "role_add": true, + "role_edit": true, + "role_delete": true, + "role_view": true, + "notice_add": true, + "notice_edit": true, + "notice_delete": true, + "notice_view": true, + "user_add": true, + "user_edit": true, + "user_delete": true, + "user_role": true, + "user_reset": true, + "user_view": true, + "log_usual_view": true, + "code_add": true, + "code_edit": true, + "code_delete": true, + "code_view": true, + "region_add": true, + "region_delete": true, + "region_import": true, + "region_export": true, + "region_debug": true, + "work_claim_sign": true, + "work_claim_detail": true, + "work_claim_follow": true, + "work_todo_handle": true, + "work_todo_detail": true, + "work_todo_follow": true, + "data_scope_setting": true, + "datasource_add": true, + "datasource_edit": true, + "datasource_delete": true, + "datasource_view": true, + "attach_upload": true, + "attach_download": true, + "attach_delete": true, + "dept_add": true, + "dept_edit": true, + "dept_delete": true, + "dept_view": true, + "log_api_view": true, + "flow_manager_state": true, + "flow_manager_image": true, + "flow_manager_remove": true, + "work_send_detail": true, + "work_send_follow": true, + "sms_add": true, + "sms_edit": true, + "sms_delete": true, + "sms_view": true, + "sms_enable": true, + "api_scope_setting": true, + "log_error_view": true, + "post_add": true, + "post_edit": true, + "post_delete": true, + "post_view": true, + "flow_follow_delete": true, + "work_done_detail": true, + "work_done_follow": true, + "dict_add": true, + "dict_edit": true, + "dict_delete": true, + "dict_view": true, + "dictbiz_add": true, + "dictbiz_edit": true, + "dictbiz_delete": true, + "dictbiz_view": true, + "menu_add": true, + "menu_edit": true, + "menu_delete": true, + "menu_view": true, + "topmenu_add": true, + "topmenu_edit": true, + "topmenu_delete": true, + "topmenu_view": true, + "topmenu_setting": true, + "param_add": true, + "param_edit": true, + "param_delete": true, + "param_view": true, + "tenant_add": true, + "tenant_edit": true, + "tenant_delete": true, + "tenant_view": true, + "client_add": true, + "client_edit": true, + "client_delete": true, + "client_view": true + }, "datetime": 1678352291697 + })) + }, + mounted() { + this.$axios.get('/api/ubcs-system/tenant/tenant-map').then(res => { + if (res.data.code == 200) { + this.loginForm.tenantId = res.data.data[0].TENANT_ID; + 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 = ''; + } }, - created() { - this.getTenant(); + '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: { + ChandleLogin() { + // this.$store.dispatch("LoginBySso").then((res) => { + // console.log('res', res) + // this.$router.push({path: this.tagWel.value}); + // }) + this.$router.push({path:'/sso'}); }, - mounted() { - //鍦╩ounted鑾峰彇棣栭〉涓嬫媺鑿滃崟鏁版嵁 - this.$axios.get('/api/blade-system/tenant/tenant-map').then(res=>{ - if(res.data.code == 200){ - this.loginForm.region=res.data.data + closehandle() { + removeToken() + }, + delok() { + //鐐瑰嚮鍙栨秷鎴栬�厁 娓呴櫎token鍏抽棴寮圭獥 娓呴櫎token鍚庝細鑷姩閲嶆柊鑾峰彇鐢ㄦ埛淇℃伅 杩欓噷娌℃湁閲嶆柊璋冪敤鏂规硶锛屽洜涓轰笅闈㈤�昏緫鏈夌偣缁曪紝鎬曢噸鏂版帀鏈塨ug鐩存帴娓呴櫎token閲嶆柊鑾峰彇鐢ㄦ埛淇℃伅 + this.dialogFormVisible = false; + removeToken() + }, + // 鐐瑰嚮纭畾淇敼瀵嗙爜 + addHandler() { + 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}) } }) }, - watch: { - 'loginForm.deptId'() { - const column = this.findObject(this.userOption.column, "deptId"); - if (this.loginForm.deptId.includes(",")) { - column.dicUrl = `/api/blade-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/blade-system/role/select?roleId=${this.loginForm.roleId}`; - column.display = true; - } else { - column.dicUrl = ''; - } + // 缁戝畾涓嬫媺鑿滃崟鍔ㄦ�両D + selectChange(value) { + this.loginForm.tenantId = value + }, + 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(); + }, - computed: { - ...mapGetters(["tagWel", "userInfo"]) - }, - props: [], - methods: { - // 缁戝畾涓嬫媺鑿滃崟鍔ㄦ�両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() { - 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(() => { + handleLogin: function () { + debugger + this.userInfo = this.$store.state.upadatastatus + localStorage.setItem('username', this.loginForm.username) + 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(() => { + //涓婇潰鍙堝姞浜嗕竴灞傚垽鏂殑鎰忔�濇槸濡傛灉鏄秴绠′笉杩涜鍒ゆ柇 鏆傛椂鍔犱笂杩欎釜鍒ゆ柇鐨勮瘽锛岀櫥褰曚細鏈塨ug锛岀偣鍑荤櫥褰曞埛鏂板悗鎵嶈繘鍏ワ紝鍏堢畝鍗曞湪涓嬮潰鍒ゆ柇鏄惁涓虹┖锛屽彧鏈夎秴绠$殑strategyUpdateStatus涓虹┖ + // if(this.userInfo.user_id != '0' && this.userInfo.tenant_id !== '000000'){ + //鍒ゆ柇濡傛灉涓嶇瓑浜�0灏辨槸绛栫暐瀵嗙爜娌℃湁淇敼璧颁笅闈㈤�昏緫 + if (this.userInfo.strategyUpdateStatus == 0 || this.userInfo.strategyUpdateStatus == null) { if (this.website.switchMode) { const deptId = this.userInfo.dept_id; const roleId = this.userInfo.role_id; @@ -183,33 +374,48 @@ this.$store.dispatch("LogOut").then(() => { loading.close(); }); - return false; } } this.$router.push({path: this.tagWel.value}); - loading.close(); - }).catch(() => { - loading.close(); + } else { + //绛変簬0璇存槑瀵嗙爜绛栫暐琚慨鏀癸紝鎻愮ず鐢ㄦ埛淇敼瀵嗙爜锛岀粰涓�涓慨鏀瑰脊妗� + this.$message({ + type: "warning", + message: "瀵嗙爜绛栫暐宸茶淇敼锛岃閲嶆柊淇敼瀵嗙爜锛�" + }) + setTimeout(() => { + this.dialogFormVisible = true + }, 1500) + } - }); - } - }); - }, - 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})`; - } - }) - } + // } + //鎶婂垽鏂瘑鐮佺瓥鐣ヤ慨鏀圭殑鍊煎瓨杩涙湰鍦帮紝鐒跺悗鍐嶈矾鐢辨潈闄恓s鏂囦欢閲岄潰鑾峰彇鍐嶅仛鍒ゆ柇锛屼笉鐒跺埛鏂颁細杩涘叆棣栭〉锛堝洜涓哄湪鏈塱d鍜宼oken鐨勬儏鍐典笅锛屽埛鏂伴〉闈㈡垨鑰呰繘鍏ョ櫥褰曢〉浼氳嚜鍔ㄨ繘鍏ラ椤碉級 + //index椤甸潰涔熷彲浠ョ敤鍒拌繖涓�兼潵鍒ゆ柇鏄惁鏄秴绠¤韩浠界櫥褰曟潵鍒ゆ柇鏄惁鎻愰啋杩囨湡鏃堕棿绛� + localStorage.setItem("updataid", JSON.stringify(this.userInfo)) + localStorage.setItem("userId", this.userInfo.user_id) + 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> -- Gitblit v1.9.3