Merge branch 'master' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into feature/1.8.0-uniapp

 Conflicts:
	sql/optional/mall/mall.sql
This commit is contained in:
YunaiV
2022-09-04 21:06:28 +08:00
618 changed files with 49151 additions and 1382 deletions

View File

@ -133,7 +133,7 @@ import {
inputComponents, selectComponents, layoutComponents, formConf
} from '@/components/generator/config'
import {
exportDefault, beautifierConf, isNumberStr, titleCase, deepClone, isObjectObject
exportDefault, beautifierConf, isNumberStr, titleCase, deepClone
} from '@/utils/index'
import {
makeUpHtml, vueTemplate, vueScript, cssStyle
@ -272,7 +272,7 @@ export default {
arr.reduce((pre, item, i) => {
if (arr.length === i + 1) {
pre[item] = data
} else if (!isObjectObject(pre[item])) {
} else if (pre[item]===undefined) {
pre[item] = {}
}
return pre[item]
@ -300,7 +300,7 @@ export default {
url
}).then(resp => {
this.setLoading(component, false)
this.setRespData(component, resp.data)
this.setRespData(component, resp)
})
}
},

View File

@ -36,19 +36,10 @@
</el-form-item>
<el-form-item prop="password">
<el-input v-model="loginForm.password" type="password" auto-complete="off" placeholder="密码"
@keyup.enter.native="handleLogin">
@keyup.enter.native="getCode">
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon"/>
</el-input>
</el-form-item>
<el-form-item prop="code" v-if="captchaEnable">
<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:0 0 25px 0;">记住密码</el-checkbox>
</div>
@ -76,7 +67,7 @@
<!-- 下方的登录按钮 -->
<el-form-item style="width:100%;">
<el-button :loading="loading" size="medium" type="primary" style="width:100%;"
@click.native.prevent="handleLogin">
@click.native.prevent="getCode">
<span v-if="!loading"> </span>
<span v-else> 中...</span>
</el-button>
@ -96,6 +87,11 @@
</div>
</div>
</div>
<!-- 图形验证码 -->
<Verify ref="verify" :captcha-type="'blockPuzzle'" :img-size="{width:'400px',height:'200px'}"
@success="handleLogin" />
<!-- footer -->
<div class="footer">
Copyright © 2020-2022 iocoder.cn All Rights Reserved.
@ -104,10 +100,10 @@
</template>
<script>
import {getCodeImg, sendSmsCode, socialAuthRedirect} from "@/api/login";
import {sendSmsCode, socialAuthRedirect} from "@/api/login";
import {getTenantIdByName} from "@/api/system/tenant";
import {SystemUserSocialTypeEnum} from "@/utils/constants";
import {getTenantEnable} from "@/utils/ruoyi";
import {getCaptchaEnable, getTenantEnable} from "@/utils/ruoyi";
import {
getPassword,
getRememberMe, getTenantName,
@ -118,8 +114,13 @@ import {
setUsername
} from "@/utils/auth";
import Verify from '@/components/Verifition/Verify';
export default {
name: "Login",
components: {
Verify
},
data() {
return {
codeUrl: "",
@ -130,11 +131,10 @@ export default {
loginType: "uname",
username: "admin",
password: "admin123",
captchaVerification: "",
mobile: "",
mobileCode: "",
rememberMe: false,
code: "",
uuid: "",
tenantName: "芋道源码",
},
scene: 21,
@ -146,7 +146,6 @@ export default {
password: [
{required: true, trigger: "blur", message: "密码不能为空"}
],
code: [{required: true, trigger: "change", message: "验证码不能为空"}],
mobile: [
{required: true, trigger: "blur", message: "手机号不能为空"},
{
@ -185,37 +184,26 @@ export default {
SysUserSocialTypeEnum: SystemUserSocialTypeEnum,
};
},
// watch: {
// $route: {
// handler: function(route) {
// this.redirect = route.query && route.query.redirect;
// },
// immediate: true
// }
// },
created() {
// 租户开关
this.tenantEnable = getTenantEnable();
// 验证码开关
this.captchaEnable = getCaptchaEnable();
// 重定向地址
this.redirect = this.$route.query.redirect;
this.getCode();
this.getCookie();
},
methods: {
getCode() {
// 只有开启的状态,才加载验证码。默认开启
// 情况一,未开启:则直接登录
if (!this.captchaEnable) {
this.handleLogin({})
return;
}
// 请求远程,获得验证码
getCodeImg().then(res => {
res = res.data;
this.captchaEnable = res.enable;
if (this.captchaEnable) {
this.codeUrl = "data:image/gif;base64," + res.img;
this.loginForm.uuid = res.uuid;
}
});
// 情况二,已开启:则展示验证码;只有完成验证码的情况,才进行登录
// 弹出验证码
this.$refs.verify.show()
},
getCookie() {
const username = getUsername();
@ -230,7 +218,7 @@ export default {
tenantName: tenantName ? tenantName : this.loginForm.tenantName,
};
},
handleLogin() {
handleLogin(captchaParams) {
this.$refs.loginForm.validate(valid => {
if (valid) {
this.loading = true;
@ -246,6 +234,7 @@ export default {
removeRememberMe()
removeTenantName()
}
this.loginForm.captchaVerification = captchaParams.captchaVerification
// 发起登陆
// console.log("发起登录", this.loginForm);
this.$store.dispatch(this.loginForm.loginType === "sms" ? "SmsLogin" : "Login", this.loginForm).then(() => {
@ -253,7 +242,6 @@ export default {
});
}).catch(() => {
this.loading = false;
this.getCode();
});
}
});

View File

@ -32,20 +32,11 @@
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon"/>
</el-input>
</el-form-item>
<el-form-item prop="code" v-if="captchaEnable">
<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:0 0 25px 0;">记住密码</el-checkbox>
<!-- 下方的登录按钮 -->
<el-form-item style="width:100%;">
<el-button :loading="loading" size="medium" type="primary" style="width:100%;"
@click.native.prevent="handleLogin">
@click.native.prevent="getCode">
<span v-if="!loading"> </span>
<span v-else> 中...</span>
</el-button>
@ -55,6 +46,11 @@
</div>
</div>
</div>
<!-- 图形验证码 -->
<Verify ref="verify" :captcha-type="'blockPuzzle'" :img-size="{width:'400px',height:'200px'}"
@success="handleLogin" />
<!-- footer -->
<div class="footer">
Copyright © 2020-2022 iocoder.cn All Rights Reserved.
@ -72,10 +68,15 @@ import {
setRememberMe,
setUsername
} from "@/utils/auth";
import {getCodeImg} from "@/api/login";
import Verify from '@/components/Verifition/Verify';
import {getCaptchaEnable} from "@/utils/ruoyi";
export default {
name: "ThirdLogin",
components: {
Verify
},
data() {
return {
codeUrl: "",
@ -85,8 +86,7 @@ export default {
username: "admin",
password: "admin123",
rememberMe: false,
code: "",
uuid: "",
captchaVerification: "",
},
loginRules: {
username: [
@ -114,9 +114,10 @@ export default {
// },
created() {
this.getCookie();
// 验证码开关
this.captchaEnable = getCaptchaEnable();
// 重定向地址
this.redirect = this.$route.query.redirect;
this.getCode();
// 社交登录相关
this.type = this.$route.query.type;
this.code = this.$route.query.code;
@ -133,19 +134,15 @@ export default {
},
methods: {
getCode() {
// 只有开启的状态,才加载验证码。默认开启
// 情况一,未开启:则直接登录
if (!this.captchaEnable) {
this.handleLogin({})
return;
}
// 请求远程,获得验证码
getCodeImg().then(res => {
res = res.data;
this.captchaEnable = res.enable;
if (this.captchaEnable) {
this.codeUrl = "data:image/gif;base64," + res.img;
this.loginForm.uuid = res.uuid;
}
});
// 情况二,已开启:则展示验证码;只有完成验证码的情况,才进行登录
// 弹出验证码
this.$refs.verify.show()
},
getCookie() {
const username = getUsername();
@ -158,7 +155,7 @@ export default {
loginType: this.loginForm.loginType,
};
},
handleLogin() {
handleLogin(captchaParams) {
this.$refs.loginForm.validate(valid => {
if (valid) {
this.loading = true;
@ -177,8 +174,7 @@ export default {
// 账号密码登录
username: this.loginForm.username,
password: this.loginForm.password,
code: this.loginForm.code,
uuid: this.loginForm.uuid,
captchaVerification: captchaParams.captchaVerification
}).then(() => {
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
}).catch(() => {

View File

@ -167,7 +167,7 @@ export default {
],
phone: [
{
pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
pattern: /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/,
message: "请输入正确的手机号码",
trigger: "blur"
}

View File

@ -183,8 +183,6 @@ export default {
accountCount: [{ required: true, message: "账号额度不能为空", trigger: "blur" }],
expireTime: [{ required: true, message: "过期时间不能为空", trigger: "blur" }],
domain: [{ required: true, message: "绑定域名不能为空", trigger: "blur" }],
username: [{ required: true, message: "用户名称不能为空", trigger: "blur" }],
password: [{ required: true, message: "用户密码不能为空", trigger: "blur" }],
}
};
},