Browse Source

mima

release/epdc
tianq 3 years ago
parent
commit
4b4dac4949
  1. 185
      src/views/main-navbar-update-password.vue
  2. 277
      src/views/main-navbar.vue
  3. 382
      src/views/pages/login.vue

185
src/views/main-navbar-update-password.vue

@ -1,97 +1,100 @@
<template> <template>
<el-dialog <el-dialog :visible.sync="visible" :title="$t('updatePassword.title')" :close-on-click-modal="false" :close-on-press-escape="false" :append-to-body="true">
:visible.sync="visible" <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" label-width="120px">
:title="$t('updatePassword.title')" <el-form-item :label="$t('updatePassword.username')">
:close-on-click-modal="false" <span>{{ $store.state.user.name }}</span>
:close-on-press-escape="false" </el-form-item>
:append-to-body="true"> <el-form-item prop="password" :label="$t('updatePassword.password')">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" label-width="120px"> <el-input v-model="dataForm.password" type="password" :placeholder="$t('updatePassword.password')"></el-input>
<el-form-item :label="$t('updatePassword.username')"> </el-form-item>
<span>{{ $store.state.user.name }}</span> <el-form-item prop="newPassword" :label="$t('updatePassword.newPassword')">
</el-form-item> <el-input v-model="dataForm.newPassword" type="password" :placeholder="$t('updatePassword.newPassword')"></el-input>
<el-form-item prop="password" :label="$t('updatePassword.password')"> </el-form-item>
<el-input v-model="dataForm.password" type="password" :placeholder="$t('updatePassword.password')"></el-input> <el-form-item prop="comfirmPassword" :label="$t('updatePassword.comfirmPassword')">
</el-form-item> <el-input v-model="dataForm.comfirmPassword" type="password" :placeholder="$t('updatePassword.comfirmPassword')"></el-input>
<el-form-item prop="newPassword" :label="$t('updatePassword.newPassword')"> </el-form-item>
<el-input v-model="dataForm.newPassword" type="password" :placeholder="$t('updatePassword.newPassword')"></el-input> </el-form>
</el-form-item> <template slot="footer">
<el-form-item prop="comfirmPassword" :label="$t('updatePassword.comfirmPassword')"> <el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-input v-model="dataForm.comfirmPassword" type="password" :placeholder="$t('updatePassword.comfirmPassword')"></el-input> <el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
</el-form-item> </template>
</el-form> </el-dialog>
<template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
</template>
</el-dialog>
</template> </template>
<script> <script>
import debounce from 'lodash/debounce' import debounce from 'lodash/debounce';
import { clearLoginInfo } from '@/utils' import { clearLoginInfo } from '@/utils';
export default { export default {
data () { data() {
return { return {
visible: false, visible: false,
dataForm: { dataForm: {
password: '', password: '',
newPassword: '', newPassword: '',
comfirmPassword: '' comfirmPassword: ''
} }
} };
}, },
computed: {
dataRule () { computed: {
var validateComfirmPassword = (rule, value, callback) => { dataRule() {
if (this.dataForm.newPassword !== value) { var validateComfirmPassword = (rule, value, callback) => {
return callback(new Error(this.$t('updatePassword.validate.comfirmPassword'))) if (this.dataForm.newPassword !== value) {
} return callback(new Error(this.$t('updatePassword.validate.comfirmPassword')));
callback() }
} callback();
return { };
password: [ var validateNewPassword = (rule, value, callback) => {
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } const check = /^(?=.{10})(?=.*?[a-z])(?=.*?[A-Z])(?=.*?\d)(?=.*?[*?!&¥$%^#,./@";:><\[\]}{\-=+_\\|》《。,、?’‘“”~ `]).*$/;
], if (!check.test(this.dataForm.newPassword)) {
newPassword: [ return callback(new Error('新密码长度不小于10个字符且必须包含大小写、数字、特殊符号'));
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } }
], callback();
comfirmPassword: [ };
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }, return {
{ validator: validateComfirmPassword, trigger: 'blur' } password: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
] newPassword: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }, { validator: validateNewPassword, trigger: 'blur' }],
} comfirmPassword: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }, { validator: validateComfirmPassword, trigger: 'blur' }]
} };
}, }
methods: { },
init () { methods: {
this.visible = true init() {
this.$nextTick(() => { this.visible = true;
this.$refs['dataForm'].resetFields() this.$nextTick(() => {
}) this.$refs['dataForm'].resetFields();
}, });
// },
dataFormSubmitHandle: debounce(function () { //
this.$refs['dataForm'].validate((valid) => { dataFormSubmitHandle: debounce(
if (!valid) { function() {
return false this.$refs['dataForm'].validate(valid => {
} if (!valid) {
this.$http.put('/sys/user/password', this.dataForm).then(({ data: res }) => { return false;
if (res.code !== 0) { }
return this.$message.error(res.msg) this.$http
} .put('/sys/user/password', this.dataForm)
this.$message({ .then(({ data: res }) => {
message: this.$t('prompt.success'), if (res.code !== 0) {
type: 'success', return this.$message.error(res.msg);
duration: 500, }
onClose: () => { this.$message({
this.visible = false message: this.$t('prompt.success'),
clearLoginInfo() type: 'success',
this.$router.replace({ name: 'login' }) duration: 500,
} onClose: () => {
}) this.visible = false;
}).catch(() => {}) clearLoginInfo();
}) this.$router.replace({ name: 'login' });
}, 1000, { 'leading': true, 'trailing': false }) }
} });
} })
.catch(() => {});
});
},
1000,
{ leading: true, trailing: false }
)
}
};
</script> </script>

277
src/views/main-navbar.vue

@ -1,34 +1,29 @@
<template> <template>
<nav class="aui-navbar" :class="`aui-navbar--${$store.state.navbarLayoutType}`"> <nav class="aui-navbar" :class="`aui-navbar--${$store.state.navbarLayoutType}`">
<div class="aui-navbar__header"> <div class="aui-navbar__header">
<h1 class="aui-navbar__brand new" style="text-transform: none;" @click="$router.push({ name: 'home' })"> <h1 class="aui-navbar__brand new" style="text-transform: none;" @click="$router.push({ name: 'home' })">
<!-- <a class="aui-navbar__brand-lg" href="javascript:;">北尚诉办</a> --> <!-- <a class="aui-navbar__brand-lg" href="javascript:;">北尚诉办</a> -->
<a class="aui-navbar__brand-lg" href="javascript:;">{{ $t('brand.lg') }}</a> <a class="aui-navbar__brand-lg" href="javascript:;">{{ $t('brand.lg') }}</a>
</h1>
</div>
<div class="aui-navbar__body">
<el-menu class="aui-navbar__menu mr-auto" mode="horizontal">
<el-menu-item index="1" @click="$store.state.sidebarFold = !$store.state.sidebarFold">
<svg class="icon-svg aui-navbar__icon-menu aui-navbar__icon-menu--switch" aria-hidden="true"><use xlink:href="#icon-outdent"></use></svg>
</el-menu-item>
<el-menu-item index="2" @click="refresh()">
<svg class="icon-svg aui-navbar__icon-menu aui-navbar__icon-menu--refresh" aria-hidden="true"><use xlink:href="#icon-sync"></use></svg>
</el-menu-item>
</h1> <el-menu-item v-if="isShowBnt" index="3" @click="goScreen()">
</div> 数据统计分析
<div class="aui-navbar__body"> <!-- <svg class="icon-svg aui-navbar__icon-menu aui-navbar__icon-menu--promotion" aria-hidden="true">
<el-menu class="aui-navbar__menu mr-auto" mode="horizontal">
<el-menu-item index="1" @click="$store.state.sidebarFold = !$store.state.sidebarFold">
<svg class="icon-svg aui-navbar__icon-menu aui-navbar__icon-menu--switch" aria-hidden="true">
<use xlink:href="#icon-outdent"></use>
</svg>
</el-menu-item>
<el-menu-item index="2" @click="refresh()">
<svg class="icon-svg aui-navbar__icon-menu aui-navbar__icon-menu--refresh" aria-hidden="true">
<use xlink:href="#icon-sync"></use>
</svg>
</el-menu-item>
<el-menu-item v-if="isShowBnt" index="3" @click="goScreen()">
数据统计分析
<!-- <svg class="icon-svg aui-navbar__icon-menu aui-navbar__icon-menu--promotion" aria-hidden="true">
<use xlink:href="#icon-earth"></use> <use xlink:href="#icon-earth"></use>
</svg> --> </svg> -->
</el-menu-item> </el-menu-item>
</el-menu> </el-menu>
<el-menu class="aui-navbar__menu" mode="horizontal"> <el-menu class="aui-navbar__menu" mode="horizontal">
<!-- <el-menu-item index="1"> <!-- <el-menu-item index="1">
<el-dropdown placement="bottom" <el-dropdown placement="bottom"
:show-timeout="0"> :show-timeout="0">
<el-button size="mini">{{ $t('_lang') }}</el-button> <el-button size="mini">{{ $t('_lang') }}</el-button>
@ -48,131 +43,141 @@
</svg> </svg>
</a> </a>
</el-menu-item> --> </el-menu-item> -->
<el-menu-item index="3" @click="fullscreenHandle()"> <el-menu-item index="3" @click="fullscreenHandle()">
<svg class="icon-svg aui-navbar__icon-menu" aria-hidden="true"> <svg class="icon-svg aui-navbar__icon-menu" aria-hidden="true"><use xlink:href="#icon-fullscreen"></use></svg>
<use xlink:href="#icon-fullscreen"></use> </el-menu-item>
</svg> <el-menu-item index="4" class="aui-navbar__avatar">
</el-menu-item> <el-dropdown placement="bottom" :show-timeout="0">
<el-menu-item index="4" class="aui-navbar__avatar"> <span class="el-dropdown-link">
<el-dropdown placement="bottom" :show-timeout="0"> <img src="~@/assets/img/avatar.png" />
<span class="el-dropdown-link"> <span>{{ $store.state.user.deptName }}</span>
<img src="~@/assets/img/avatar.png"> <i class="el-icon-arrow-down"></i>
<span>{{ $store.state.user.deptName }}</span> </span>
<i class="el-icon-arrow-down"></i> <el-dropdown-menu slot="dropdown">
</span> <el-dropdown-item @click.native="updatePasswordHandle()">{{ $t('updatePassword.title') }}</el-dropdown-item>
<el-dropdown-menu slot="dropdown"> <el-dropdown-item @click.native="logoutHandle()">{{ $t('logout') }}</el-dropdown-item>
<el-dropdown-item @click.native="updatePasswordHandle()">{{ $t('updatePassword.title') }} </el-dropdown-menu>
</el-dropdown-item> </el-dropdown>
<el-dropdown-item @click.native="logoutHandle()">{{ $t('logout') }}</el-dropdown-item> </el-menu-item>
</el-dropdown-menu> </el-menu>
</el-dropdown> </div>
</el-menu-item> <!-- 弹窗, 修改密码 -->
</el-menu> <update-password v-if="updatePassowrdVisible" :type="type" ref="updatePassowrd"></update-password>
</div> </nav>
<!-- 弹窗, 修改密码 -->
<update-password v-if="updatePassowrdVisible" ref="updatePassowrd"></update-password>
</nav>
</template> </template>
<script> <script>
import { messages } from '@/i18n' import { messages } from '@/i18n';
import screenfull from 'screenfull' import screenfull from 'screenfull';
import UpdatePassword from './main-navbar-update-password' import UpdatePassword from './main-navbar-update-password';
import { clearLoginInfo } from '@/utils' import { clearLoginInfo } from '@/utils';
export default { export default {
inject: ['refresh'], inject: ['refresh'],
data () { data() {
return { return {
i18nMessages: messages, type: 'sys',
updatePassowrdVisible: false, i18nMessages: messages,
isShowBnt: true, updatePassowrdVisible: false,
streetId: '', isShowBnt: true,
communityId: '' streetId: '',
} communityId: ''
}, };
components: { },
UpdatePassword components: {
}, UpdatePassword
created () { },
this.getGuess() created() {
}, this.getGuess();
methods: { },
// methods: {
fullscreenHandle () { //
if (!screenfull.enabled) { fullscreenHandle() {
return this.$message({ if (!screenfull.enabled) {
message: this.$t('fullscreen.prompt'), return this.$message({
type: 'warning', message: this.$t('fullscreen.prompt'),
duration: 500 type: 'warning',
}) duration: 500
} });
screenfull.toggle() }
}, screenfull.toggle();
// },
updatePasswordHandle () { //
this.updatePassowrdVisible = true updatePasswordHandle() {
this.$nextTick(() => { this.updatePassowrdVisible = true;
this.$refs.updatePassowrd.init() this.$nextTick(() => {
}) this.$refs.updatePassowrd.init();
}, });
// 退 },
logoutHandle () { // 退
this.$confirm(this.$t('prompt.info', { 'handle': this.$t('logout') }), this.$t('prompt.title'), { logoutHandle() {
confirmButtonText: this.$t('confirm'), this.$confirm(this.$t('prompt.info', { handle: this.$t('logout') }), this.$t('prompt.title'), {
cancelButtonText: this.$t('cancel'), confirmButtonText: this.$t('confirm'),
type: 'warning' cancelButtonText: this.$t('cancel'),
}).then(() => { type: 'warning'
this.$http.post('/auth/logout').then(({ data: res }) => { })
if (res.code !== 0) { .then(() => {
return this.$message.error(res.msg) this.$http
} .post('/auth/logout')
window.sessionStorage.removeItem('routeList') .then(({ data: res }) => {
clearLoginInfo() if (res.code !== 0) {
this.$router.push({ name: 'login' }) return this.$message.error(res.msg);
}).catch(() => { }) }
}).catch(() => { }) window.sessionStorage.removeItem('routeList');
}, clearLoginInfo();
getGuess () { this.$router.push({ name: 'login' });
this.$http.post(`/sys/dept/guess/${this.$store.state.user.deptId}`).then(({ data: res }) => { })
if (res.code !== 0) { .catch(() => {});
return this.$message.error(res.msg) })
} .catch(() => {});
if (res.data.gridId !== 0) { },
this.isShowBnt = false getGuess() {
} else { this.$http
this.isShowBnt = true .post(`/sys/dept/guess/${this.$store.state.user.deptId}`)
this.streetId = res.data.streetId ? res.data.streetId : '' .then(({ data: res }) => {
this.communityId = res.data.communityId ? res.data.communityId : '' if (res.code !== 0) {
} return this.$message.error(res.msg);
}).catch(() => { }) }
}, if (res.data.gridId !== 0) {
goScreen () { this.isShowBnt = false;
this.$router.push({ name: 'screen' }) } else {
// let url = 'https://epdc-shibei.elinkservice.cn/screen-bssb/#/home' this.isShowBnt = true;
// let streetUrl = this.streetId ? `${url}?formPcStreetId=${this.streetId}` : url this.streetId = res.data.streetId ? res.data.streetId : '';
// let communityUrl = this.communityId ? `${url}?formPcStreetId=${this.streetId}&formPcCommunityId=${this.communityId}` : url this.communityId = res.data.communityId ? res.data.communityId : '';
// window.open(this.communityId ? communityUrl : streetUrl) }
} })
} .catch(() => {});
}
if (sessionStorage['changPWD'] == '1') {
this.updatePasswordHandle();
}
},
goScreen() {
this.$router.push({ name: 'screen' });
// let url = 'https://epdc-shibei.elinkservice.cn/screen-bssb/#/home'
// let streetUrl = this.streetId ? `${url}?formPcStreetId=${this.streetId}` : url
// let communityUrl = this.communityId ? `${url}?formPcStreetId=${this.streetId}&formPcCommunityId=${this.communityId}` : url
// window.open(this.communityId ? communityUrl : streetUrl)
}
}
};
</script> </script>
<style scoped> <style scoped>
.new { .new {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
} }
.new a { .new a {
font-size: 18px; font-size: 18px;
} }
.new-top { .new-top {
margin-top: 6px; margin-top: 6px;
font-size: 15px !important; font-size: 15px !important;
} }
.aui-navbar__header_new h1 { .aui-navbar__header_new h1 {
color: #fff; color: #fff;
} }
</style> </style>

382
src/views/pages/login.vue

@ -1,206 +1,202 @@
<template> <template>
<div class="aui-wrapper aui-page__login"> <div class="aui-wrapper aui-page__login">
<div class="aui-content__wrapper"> <div class="aui-content__wrapper">
<main class="aui-content"> <main class="aui-content">
<div class="login-header"> <div class="login-header">
<h2 class="login-brand" <h2 class="login-brand" style="text-transform: none;color:red;">{{ $t('brand.lg') }}</h2>
style="text-transform: none;color:red;">{{ $t('brand.lg') }}</h2> </div>
</div> <div class="login-body">
<div class="login-body"> <h3 class="login-title">{{ $t('login.title') }}</h3>
<h3 class="login-title">{{ $t('login.title') }}</h3> <el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmitHandle()" status-icon>
<el-form :model="dataForm" <!-- <el-form-item>
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmitHandle()"
status-icon>
<!-- <el-form-item>
<el-select v-model="$i18n.locale" class="w-percent-100"> <el-select v-model="$i18n.locale" class="w-percent-100">
<el-option v-for="(val, key) in i18nMessages" :key="key" :label="val._lang" :value="key"></el-option> <el-option v-for="(val, key) in i18nMessages" :key="key" :label="val._lang" :value="key"></el-option>
</el-select> </el-select>
</el-form-item> --> </el-form-item> -->
<el-form-item prop="username"> <el-form-item prop="username">
<el-input v-model="dataForm.username" <el-input v-model="dataForm.username" :placeholder="$t('login.username')">
:placeholder="$t('login.username')"> <span slot="prefix" class="el-input__icon">
<span slot="prefix" <svg class="icon-svg" aria-hidden="true"><use xlink:href="#icon-user"></use></svg>
class="el-input__icon"> </span>
<svg class="icon-svg" </el-input>
aria-hidden="true"> </el-form-item>
<use xlink:href="#icon-user"></use> <el-form-item prop="password">
</svg> <el-input v-model="dataForm.password" type="password" :placeholder="$t('login.password')">
</span> <span slot="prefix" class="el-input__icon">
</el-input> <svg class="icon-svg" aria-hidden="true"><use xlink:href="#icon-lock"></use></svg>
</el-form-item> </span>
<el-form-item prop="password"> </el-input>
<el-input v-model="dataForm.password" </el-form-item>
type="password" <el-form-item prop="captcha">
:placeholder="$t('login.password')"> <el-row :gutter="20">
<span slot="prefix" <el-col :span="14">
class="el-input__icon"> <el-input v-model="dataForm.captcha" :placeholder="$t('login.captcha')">
<svg class="icon-svg" <span slot="prefix" class="el-input__icon">
aria-hidden="true"> <svg class="icon-svg" aria-hidden="true"><use xlink:href="#icon-safetycertificate"></use></svg>
<use xlink:href="#icon-lock"></use> </span>
</svg> </el-input>
</span> </el-col>
</el-input> <el-col :span="10" class="login-captcha"><img :src="captchaPath" @click="getCaptcha()" /></el-col>
</el-form-item> </el-row>
<el-form-item prop="captcha"> </el-form-item>
<el-row :gutter="20"> <el-form-item>
<el-col :span="14"> <el-button type="primary" @click="dataFormSubmitHandle()" class="w-percent-100">{{ $t('login.title') }}</el-button>
<el-input v-model="dataForm.captcha" </el-form-item>
:placeholder="$t('login.captcha')"> </el-form>
<span slot="prefix" </div>
class="el-input__icon"> <div v-if="isHidden">
<svg class="icon-svg" <p>
aria-hidden="true"> <a
<use xlink:href="#icon-safetycertificate"></use> href="https://dl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7B0EBBEC46-30F5-946B-A54E-5628DFF12914%7D%26lang%3Den%26browser%3D4%26usagestats%3D1%26appname%3DGoogle%2520Chrome%26needsadmin%3Dprefers%26ap%3Dx64-stable-statsdef_1%26installdataindex%3Ddefaultbrowser/update2/installers/ChromeSetup.exe"
</svg> target="_blank"
</span> >
</el-input> 点击此处下载谷歌浏览器
</el-col> </a>
<el-col :span="10" </p>
class="login-captcha"> </div>
<img :src="captchaPath" <!-- <div class="login-footer">
@click="getCaptcha()">
</el-col>
</el-row>
</el-form-item>
<el-form-item>
<el-button type="primary"
@click="dataFormSubmitHandle()"
class="w-percent-100">{{ $t('login.title') }}</el-button>
</el-form-item>
</el-form>
</div>
<div v-if="isHidden">
<p><a href="https://dl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7B0EBBEC46-30F5-946B-A54E-5628DFF12914%7D%26lang%3Den%26browser%3D4%26usagestats%3D1%26appname%3DGoogle%2520Chrome%26needsadmin%3Dprefers%26ap%3Dx64-stable-statsdef_1%26installdataindex%3Ddefaultbrowser/update2/installers/ChromeSetup.exe" target="_blank">点击此处下载谷歌浏览器</a></p>
</div>
<!-- <div class="login-footer">
<p><a href="http://www.elinkit.com.cn/" <p><a href="http://www.elinkit.com.cn/"
target="_blank">{{ $t('login.copyright') }}</a>2020 © www.elinkit.com.cn</p> target="_blank">{{ $t('login.copyright') }}</a>2020 © www.elinkit.com.cn</p>
</div> --> </div> -->
</main> </main>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import Cookies from 'js-cookie' import Cookies from 'js-cookie';
import debounce from 'lodash/debounce' import debounce from 'lodash/debounce';
import { messages } from '@/i18n' import { messages } from '@/i18n';
import { getUUID } from '@/utils' import { getUUID } from '@/utils';
export default { export default {
data () { data() {
return { return {
i18nMessages: messages, type: 'login',
captchaPath: '', updatePassowrdVisible: false,
isHidden: false, i18nMessages: messages,
dataForm: { captchaPath: '',
username: '', isHidden: false,
password: '', dataForm: {
uuid: '', username: '',
captcha: '' password: '',
} uuid: '',
} captcha: ''
}, }
computed: { };
dataRule () { },
return {
username: [ computed: {
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } dataRule() {
], return {
password: [ username: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } password: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],
], captcha: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }]
captcha: [ };
{ required: true, message: this.$t('validate.required'), trigger: 'blur' } }
] },
} created() {
} if (this.$route.query.autologin === '1') {
}, this.autologin();
created () { } else {
if (this.$route.query.autologin === '1') { this.getCaptcha();
this.autologin() this.myBrowser();
} else { }
this.getCaptcha() },
this.myBrowser() methods: {
} myBrowser() {
}, var userAgent = navigator.userAgent;
methods: { if (userAgent.indexOf('Chrome') > -1) {
myBrowser () { this.isHidden = false;
var userAgent = navigator.userAgent } else {
if (userAgent.indexOf('Chrome') > -1) { this.isHidden = true;
this.isHidden = false }
} else { },
this.isHidden = true //
} getCaptcha() {
}, this.dataForm.uuid = getUUID();
// this.captchaPath = `${window.SITE_CONFIG['apiURL']}/auth/captcha?uuid=${this.dataForm.uuid}`;
getCaptcha () { },
this.dataForm.uuid = getUUID() //
this.captchaPath = `${window.SITE_CONFIG['apiURL']}/auth/captcha?uuid=${this.dataForm.uuid}` dataFormSubmitHandle: debounce(
}, function() {
// let _this = this;
dataFormSubmitHandle: debounce(function () { this.$refs['dataForm'].validate(valid => {
this.$refs['dataForm'].validate((valid) => { if (!valid) {
if (!valid) { return false;
return false }
} const check = /^(?=.{10})(?=.*?[a-z])(?=.*?[A-Z])(?=.*?\d)(?=.*?[*?!&¥$%^#,./@";:><\[\]}{\-=+_\\|》《。,、?’‘“”~ `]).*$/;
const check = /^(?=.{10})(?=.*?[a-z])(?=.*?[A-Z])(?=.*?\d)(?=.*?[*?!&¥$%^#,./@";:><\[\]}{\-=+_\\|》《。,、?’‘“”~ `]).*$/ if (check.test(this.dataForm.password)) {
if (check.test(this.dataForm.password)) { sessionStorage['changPWD'] = '0';
this.loginUrl() this.loginUrl();
} else {
this.$alert('长度不小于10个字符且必须包含大小写、数字、特殊符号', '密码复杂度不符合要求,请尽快修改!', { // localStorage
confirmButtonText: '确定', // this.checkLocakStorage();
callback: action => { } else {
this.loginUrl() sessionStorage['changPWD'] = '1';
}
}) this.$alert('长度不小于10个字符且必须包含大小写、数字、特殊符号', '密码复杂度不符合要求,请尽快修改!', {
} confirmButtonText: '确定',
}) callback: action => {
}, 1000, { 'leading': true, 'trailing': false }), this.loginUrl();
loginUrl () { // _this.updatePasswordHandle();
this.$http.post('/auth/login', this.dataForm).then(({ data: res }) => { }
if (res.code !== 0) { });
this.getCaptcha() }
return this.$message.error(res.msg) });
} },
Cookies.set('token', res.data.token) 1000,
this.$router.replace({ name: 'home' }) { leading: true, trailing: false }
// localStorage ),
this.checkLocakStorage() loginUrl() {
}).catch(() => { }) this.$http
}, .post('/auth/login', this.dataForm)
autologin () { .then(({ data: res }) => {
let dataForm_ = { if (res.code !== 0) {
username: 'screen', this.getCaptcha();
password: '111111' return this.$message.error(res.msg);
} }
this.$http.post('/auth/autologin', dataForm_).then(({ data: res }) => { Cookies.set('token', res.data.token);
if (res.code !== 0) { this.$router.replace({ name: 'home' });
this.getCaptcha() // // localStorage
return this.$message.error(res.msg) this.checkLocakStorage();
} })
Cookies.set('token', res.data.token) .catch(() => {});
this.$router.replace({ name: 'home' }) },
// localStorage autologin() {
this.checkLocakStorage() let dataForm_ = {
}).catch(() => { }) username: 'screen',
}, password: '111111'
checkLocakStorage () { };
var street = localStorage.getItem('street') this.$http
if (street === null) { .post('/auth/autologin', dataForm_)
this.getIdByCode('shibei') .then(({ data: res }) => {
} if (res.code !== 0) {
}, this.getCaptcha();
// return this.$message.error(res.msg);
getIdByCode (partyCode) { }
this.$http.get(`/sys/dept/getIdByCode/` + partyCode).then(({ data: res }) => { Cookies.set('token', res.data.token);
if (res.code !== 0) { })
return this.$message.error(res.msg) .catch(() => {});
} },
localStorage.setItem('street', res.data.id) checkLocakStorage() {
}).catch(() => { }) var street = localStorage.getItem('street');
} if (street === null) {
} this.getIdByCode('shibei');
} }
},
//
getIdByCode(partyCode) {
this.$http
.get(`/sys/dept/getIdByCode/` + partyCode)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
localStorage.setItem('street', res.data.id);
})
.catch(() => {});
}
}
};
</script> </script>

Loading…
Cancel
Save