修改禅道已知bug

This commit is contained in:
qq787203167
2022-03-09 16:54:00 +08:00
parent f5c717d99d
commit 68896d0c46
4 changed files with 186 additions and 157 deletions
+1 -1
View File
@@ -9,4 +9,4 @@ window._CONFIG['staticDomainURL'] = window._CONFIG['domianURL'] + '/sys/common/d
window._CONFIG['pdfDomainURL'] = window._CONFIG['domianURL'] + '/sys/common/pdf/pdfPreviewIframe'
window._CONFIG['casPrefixUrl'] = 'http://cas.example.org:8443/cas'
// 预览文件地址
window._CONFIG['onlinePreviewDomainURL'] = 'http://cas.example.org:8443/onlinePreview'
window._CONFIG['onlinePreviewDomainURL'] = 'http://127.0.0.1:8012/onlinePreview'
@@ -196,7 +196,6 @@
this.fileList = []
},
preview(file) {
console.log(file)
let fileQuery = file.response ? file.response.result : file
let fileName = fileQuery.fileName
let index1 = fileName.lastIndexOf('.')
@@ -170,8 +170,22 @@
}
})
},
pdfPreview(item) {
window.open('/pdf/web/viewer.html?file=' + encodeURIComponent('/jero-boot/sys/common/pdf/viewFile?id=' + item.id))
pdfPreview(fileQuery) {
let fileName = fileQuery.fileName
let index1 = fileName.lastIndexOf('.')
let index2 = fileName.length
let fileSuffix = fileName.substring(index1, index2)
if (fileSuffix == '.pdf') {
window.open('/pdf/web/viewer.html?file=' + encodeURIComponent('/jero-boot/sys/common/pdf/viewFile?id=' + fileQuery.id))
} else if (fileSuffix == '.docx') {
let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + encodeURIComponent(this.downLoadFileUrl + '/' + fileQuery.id)
window.open(url, '_blank')
} else if (fileSuffix == '.xlsx' || fileSuffix == '.xls') {
let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + encodeURIComponent(this.downLoadFileUrl + '/' + fileQuery.id)
window.open(url, '_blank')
} else {
downloadFile('/sys/common/download', fileQuery.fileName, { id: fileQuery.id })
}
},
download(item) {
downloadFile('/sys/common/download', item.fileName, { id: item.id })
+169 -153
View File
@@ -51,7 +51,8 @@
</a-form-item>
</a-col>
<a-col :span="6" style="text-align: right">
<img v-if="requestCodeSuccess" style="margin-top: 2px;" :src="randCodeImage" @click="handleChangeCheckCode"/>
<img v-if="requestCodeSuccess" style="margin-top: 2px;" :src="randCodeImage"
@click="handleChangeCheckCode"/>
<img v-else style="margin-top: 2px;" src="../../assets/checkcode.png" @click="handleChangeCheckCode"/>
</a-col>
<a-col :span="3"></a-col>
@@ -64,13 +65,13 @@
</a-form-item>
</a-col>
<a-col :span="6"></a-col>
<a-col :span="5" style="text-align: right;color: #1891FF;">
<a-form-item>
<router-link :to="{ name: 'alteration'}" class="forge-password" style="float: right;">
忘记密码
</router-link>
</a-form-item>
</a-col>
<!-- <a-col :span="5" style="text-align: right;color: #1891FF;">-->
<!-- <a-form-item>-->
<!-- <router-link :to="{ name: 'alteration'}" class="forge-password" style="float: right;">-->
<!-- 忘记密码-->
<!-- </router-link>-->
<!-- </a-form-item>-->
<!-- </a-col>-->
</a-row>
<a-row class="login-btn">
<a-col :span="3"></a-col>
@@ -84,7 +85,7 @@
:loading="loginBtn"
@click.stop.prevent="handleSubmit"
:disabled="loginBtn">
{{ loginBtn ? "登录中" : "登录" }}
{{ loginBtn ? '登录中' : '登录' }}
</a-button>
</a-form-item>
</a-col>
@@ -92,7 +93,8 @@
</a-row>
</div>
</a-form>
<a-form v-if="mobile" :form="form" class="user-layout-login user-layout-login-mobile" ref="formLogin" id="formLogin">
<a-form v-if="mobile" :form="form" class="user-layout-login user-layout-login-mobile" ref="formLogin"
id="formLogin">
<div class="user-box user-box-mobile">
<a-row>
<a-col :span="24">
@@ -136,7 +138,8 @@
</a-form-item>
</a-col>
<a-col :span="10" style="text-align: right">
<img v-if="requestCodeSuccess" style="margin-top: 2px;" :src="randCodeImage" @click="handleChangeCheckCode"/>
<img v-if="requestCodeSuccess" style="margin-top: 2px;" :src="randCodeImage"
@click="handleChangeCheckCode"/>
<img v-else style="margin-top: 2px;" src="../../assets/checkcode.png" @click="handleChangeCheckCode"/>
</a-col>
</a-row>
@@ -147,13 +150,13 @@
</a-form-item>
</a-col>
<a-col :span="4"></a-col>
<a-col :span="9" style="text-align: right;color: #1891FF;">
<a-form-item>
<router-link :to="{ name: 'alteration'}" class="forge-password" style="float: right;">
忘记密码
</router-link>
</a-form-item>
</a-col>
<!-- <a-col :span="9" style="text-align: right;color: #1891FF;">-->
<!-- <a-form-item>-->
<!-- <router-link :to="{ name: 'alteration'}" class="forge-password" style="float: right;">-->
<!-- 忘记密码-->
<!-- </router-link>-->
<!-- </a-form-item>-->
<!-- </a-col>-->
</a-row>
<a-row class="login-btn">
<a-col :span="24">
@@ -166,7 +169,7 @@
:loading="loginBtn"
@click.stop.prevent="handleSubmit"
:disabled="loginBtn">
{{ loginBtn ? "登录中" : "登录" }}
{{ loginBtn ? '登录中' : '登录' }}
</a-button>
</a-form-item>
</a-col>
@@ -176,58 +179,59 @@
</div>
</template>
<script>
import { mapActions } from "vuex"
import { timeFix } from "@/utils/util"
import { mapActions } from 'vuex'
import { timeFix } from '@/utils/util'
import Vue from 'vue'
import { ACCESS_TOKEN ,ENCRYPTED_STRING} from "@/store/mutation-types"
import { putAction,postAction,getAction } from '@/api/manage'
import { USER_INFO } from "@/store/mutation-types"
import {getRSAPublicKey} from '@/api/login.js'
import { ACCESS_TOKEN, ENCRYPTED_STRING } from '@/store/mutation-types'
import { putAction, postAction, getAction } from '@/api/manage'
import { USER_INFO } from '@/store/mutation-types'
import { getRSAPublicKey } from '@/api/login.js'
const Base64 = require('js-base64').Base64
import {JSEncrypt} from 'jsencrypt'
import { JSEncrypt } from 'jsencrypt'
export default {
components: {},
data () {
data() {
return {
loginBtn: false,
mobile:isMobile(),
mobile: isMobile(),
// login type: 0 email, 1 username, 2 telephone
loginType: 0,
stepCaptchaVisible: false,
form: this.$form.createForm(this),
state: {
time: 60,
smsSendBtn: false,
smsSendBtn: false
},
validatorRules:{
username:{rules: [{ required: true, message: '请输入用户名!'},{validator: this.handleUsernameOrEmail}]},
password:{rules: [{ required: true, message: '请输入密码!',validator: 'click'}]},
mobile:{rules: [{validator:this.validateMobile}]},
captcha:{rule: [{ required: true, message: '请输入验证码!'}]},
inputCode:{rules: [{ required: true, message: '请输入验证码!'}]}
validatorRules: {
username: { rules: [{ required: true, message: '请输入用户名!' }, { validator: this.handleUsernameOrEmail }] },
password: { rules: [{ required: true, message: '请输入密码!', validator: 'click' }] },
mobile: { rules: [{ validator: this.validateMobile }] },
captcha: { rule: [{ required: true, message: '请输入验证码!' }] },
inputCode: { rules: [{ required: true, message: '请输入验证码!' }] }
},
velorifiedCode:"",
inputCodeContent:"",
inputCodeNull:true,
currentUsername:"",
currdatetime:'',
randCodeImage:'',
requestCodeSuccess:false,
rsaPublicKey:''
velorifiedCode: '',
inputCodeContent: '',
inputCodeNull: true,
currentUsername: '',
currdatetime: '',
randCodeImage: '',
requestCodeSuccess: false,
rsaPublicKey: ''
}
},
created () {
this.currdatetime = new Date().getTime();
created() {
this.currdatetime = new Date().getTime()
Vue.ls.remove(ACCESS_TOKEN)
this.getRouterData();
this.handleChangeCheckCode();
this.getRouterData()
this.handleChangeCheckCode()
},
methods: {
...mapActions(['Login', 'Logout', 'PhoneLogin']),
handleUsernameOrEmail (rule, value, callback) {
const regex = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;
handleUsernameOrEmail(rule, value, callback) {
const regex = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/
if (regex.test(value)) {
this.loginType = 0
} else {
@@ -235,194 +239,201 @@
}
callback()
},
handleSubmit () {
handleSubmit() {
let that = this
let loginParams = {};
that.loginBtn = true;
that.form.validateFields([ 'username', 'password','inputCode', 'rememberMe' ], { force: true }, (err, values) => {
let loginParams = {}
that.loginBtn = true
that.form.validateFields(['username', 'password', 'inputCode', 'rememberMe'], { force: true }, (err, values) => {
if (!err) {
loginParams.remember_me = values.rememberMe
loginParams.captcha = that.inputCodeContent
loginParams.checkKey = that.currdatetime
loginParams.rsaPublicKey = that.rsaPublicKey;
loginParams.rsaPublicKey = that.rsaPublicKey
// 新建JSEncrypt对象
let encrypt = new JSEncrypt();
encrypt.setPublicKey(loginParams.rsaPublicKey);
// 公钥加密
loginParams.username = encrypt.encrypt(values.username)
loginParams.password = encrypt.encrypt(values.password)
let encrypt = new JSEncrypt()
encrypt.setPublicKey(loginParams.rsaPublicKey)
// 公钥加密
loginParams.username = encrypt.encrypt(values.username)
loginParams.password = encrypt.encrypt(values.password)
//登录
that.Login(loginParams).then((res) => {
this.loginSuccess()
}).catch((err) => {
if (err.code === 500) {
// 刷新验证码
this.handleChangeCheckCode();
this.handleChangeCheckCode()
}
that.requestFailed(err);
});
}else {
that.loginBtn = false;
that.requestFailed(err)
})
} else {
that.loginBtn = false
}
})
},
getCaptcha (e) {
e.preventDefault();
let that = this;
this.form.validateFields([ 'mobile' ], { force: true },(err,values) => {
if(!values.mobile){
that.cmsFailed("请输入手机号");
}else if (!err) {
this.state.smsSendBtn = true;
getCaptcha(e) {
e.preventDefault()
let that = this
this.form.validateFields(['mobile'], { force: true }, (err, values) => {
if (!values.mobile) {
that.cmsFailed('请输入手机号')
} else if (!err) {
this.state.smsSendBtn = true
let interval = window.setInterval(() => {
if (that.state.time-- <= 0) {
that.state.time = 60;
that.state.smsSendBtn = false;
window.clearInterval(interval);
that.state.time = 60
that.state.smsSendBtn = false
window.clearInterval(interval)
}
}, 1000);
}, 1000)
const hide = this.$message.loading('验证码发送中..', 0);
let smsParams = {};
smsParams.mobile=values.mobile;
smsParams.smsmode="0";
postAction("/sys/sms",smsParams)
const hide = this.$message.loading('验证码发送中..', 0)
let smsParams = {}
smsParams.mobile = values.mobile
smsParams.smsmode = '0'
postAction('/sys/sms', smsParams)
.then(res => {
if(!res.success){
setTimeout(hide, 0);
this.cmsFailed(res.message);
if (!res.success) {
setTimeout(hide, 0)
this.cmsFailed(res.message)
}
setTimeout(hide, 500);
setTimeout(hide, 500)
})
.catch(err => {
setTimeout(hide, 1);
clearInterval(interval);
that.state.time = 60;
that.state.smsSendBtn = false;
this.requestFailed(err);
});
setTimeout(hide, 1)
clearInterval(interval)
that.state.time = 60
that.state.smsSendBtn = false
this.requestFailed(err)
})
}
}
);
)
},
handleChangeCheckCode(){
this.currdatetime = new Date().getTime();
getAction(`/sys/randomImage/${this.currdatetime}`).then(res=>{
if(res.success){
handleChangeCheckCode() {
this.currdatetime = new Date().getTime()
getAction(`/sys/randomImage/${this.currdatetime}`).then(res => {
if (res.success) {
this.randCodeImage = res.result
this.requestCodeSuccess=true
}else{
this.requestCodeSuccess = true
} else {
this.$message.error(res.message)
this.requestCodeSuccess=false
this.requestCodeSuccess = false
}
}).catch(()=>{
this.requestCodeSuccess=false
}).catch(() => {
this.requestCodeSuccess = false
})
this.getPublicKey();
this.getPublicKey()
},
//获取RSA公钥
getPublicKey(){
getPublicKey() {
// 获取公钥
getRSAPublicKey().then(res => {
this.rsaPublicKey = res.result
})
},
loginSuccess () {
loginSuccess() {
let langCn = localStorage.language
// 默认中文
if (!langCn) {
localStorage.setItem('language', 'zh-cn')
}
this.$router.push({ path: "/dashboard/analysis" }).catch((res)=>{})
this.$router.push({ path: '/dashboard/analysis' }).catch((res) => {
})
this.$notification.success({
message: '欢迎',
description: `${timeFix()},欢迎回来`,
});
description: `${timeFix()},欢迎回来`
})
},
cmsFailed(err){
this.$notification[ 'error' ]({
message: "登录失败",
description:err,
duration: 4,
});
},
requestFailed (err) {
this.$notification[ 'error' ]({
cmsFailed(err) {
this.$notification['error']({
message: '登录失败',
description: ((err.response || {}).data || {}).message || err.message || "请求出现错误请稍后再试",
duration: 4,
});
this.loginBtn = false;
description: err,
duration: 4
})
},
validateMobile(rule,value,callback){
if (!value || new RegExp(/^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/).test(value)){
callback();
}else{
callback("您的手机号码格式不正确!");
requestFailed(err) {
this.form.resetFields()
this.$notification['error']({
message: '登录失败',
// description:'账号或密码错误',
description: err.message == '验证码错误' ? err.message : '账号或密码错误',
duration: 4
})
this.loginBtn = false
},
validateMobile(rule, value, callback) {
if (!value || new RegExp(/^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/).test(value)) {
callback()
} else {
callback('您的手机号码格式不正确!')
}
},
validateInputCode(rule,value,callback){
if(!value || this.verifiedCode==this.inputCodeContent){
callback();
}else{
callback("您输入的验证码不正确!");
validateInputCode(rule, value, callback) {
if (!value || this.verifiedCode == this.inputCodeContent) {
callback()
} else {
callback('您输入的验证码不正确!')
}
},
generateCode(value){
generateCode(value) {
this.verifiedCode = value.toLowerCase()
},
inputCodeChange(e){
inputCodeChange(e) {
this.inputCodeContent = e.target.value
},
getRouterData(){
getRouterData() {
this.$nextTick(() => {
if (this.$route.params.username) {
this.form.setFieldsValue({
'username': this.$route.params.username
});
})
}
})
},
}
}
}
// 判断当前设备
function isMobile() {
var userAgentInfo = navigator.userAgent;
var userAgentInfo = navigator.userAgent
var mobileAgents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
var mobileAgents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod']
var mobile_flag = false;
var mobile_flag = false
//根据userAgent判断是否是手机
for (var v = 0; v < mobileAgents.length; v++) {
if (userAgentInfo.indexOf(mobileAgents[v]) > 0) {
mobile_flag = true;
break;
mobile_flag = true
break
}
}
var screen_width = window.screen.width;
var screen_height = window.screen.height;
var screen_width = window.screen.width
var screen_height = window.screen.height
//根据屏幕分辨率判断是否是手机
if (screen_width < 500 && screen_height < 800) {
mobile_flag = true;
mobile_flag = true
}
return mobile_flag;
return mobile_flag
}
</script>
<style lang="less" scoped>
.ant-input-affix-wrapper/deep/ .ant-input:not(:first-child){
.ant-input-affix-wrapper /deep/ .ant-input:not(:first-child) {
padding-left: 40px;
}
.ant-row{
.ant-row {
margin-bottom: 4%;
}
.main{
.main {
height: 100%;
.user-layout-login{
.user-layout-login {
z-index: 99;
width: 24%;
height: 56%;
@@ -435,14 +446,16 @@
right: 8%;
top: 50%;
transform: translateY(-50%);
.user-box{
.user-box {
width: 100%;
height: 100%;
overflow: hidden;
display: flex;
justify-content: space-between;
flex-direction: column;
.title{
.title {
display: block;
color: #1891FF;
font-size: 28px;
@@ -450,13 +463,15 @@
margin: 0 0 5% 0;
text-align: center;
}
.login-btn{
.login-btn {
margin-bottom: 0;
font-size: 10px;
}
}
}
.user-layout-login-mobile{
.user-layout-login-mobile {
right: 0;
width: 100%;
min-width: 0 !important;
@@ -468,7 +483,8 @@
top: 50%;
margin-top: 6rem;
transform: translateY(-50%);
.ant-row{
.ant-row {
margin-bottom: 0;
}
}