2023-06-07 10:48:30 +00:00
|
|
|
<template>
|
|
|
|
<div class="login_bg">
|
2023-06-08 11:38:56 +00:00
|
|
|
<div class="login_adv" style="background-image: url(https://oss.gter.net/background);">
|
2023-06-07 10:48:30 +00:00
|
|
|
<div class="login_adv__title">
|
2023-06-08 11:38:56 +00:00
|
|
|
<h2>X-PHP</h2>
|
2023-06-07 10:48:30 +00:00
|
|
|
<h4>{{ $t('login.slogan') }}</h4>
|
|
|
|
<p>{{ $t('login.describe') }}</p>
|
|
|
|
</div>
|
|
|
|
<div class="login_adv__mask"></div>
|
|
|
|
<div class="login_adv__bottom">
|
2023-06-11 15:01:34 +00:00
|
|
|
© {{$config.APP_NAME}} {{$config.APP_VER}}
|
2023-06-07 10:48:30 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="login_main">
|
|
|
|
<div class="login_config">
|
|
|
|
<el-button :icon="config.dark?'el-icon-sunny':'el-icon-moon'" circle type="info" @click="configDark"></el-button>
|
|
|
|
<el-dropdown trigger="click" placement="bottom-end" @command="configLang">
|
|
|
|
<el-button circle>
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 512 512"><path d="M478.33 433.6l-90-218a22 22 0 0 0-40.67 0l-90 218a22 22 0 1 0 40.67 16.79L316.66 406h102.67l18.33 44.39A22 22 0 0 0 458 464a22 22 0 0 0 20.32-30.4zM334.83 362L368 281.65L401.17 362z" fill="currentColor"></path><path d="M267.84 342.92a22 22 0 0 0-4.89-30.7c-.2-.15-15-11.13-36.49-34.73c39.65-53.68 62.11-114.75 71.27-143.49H330a22 22 0 0 0 0-44H214V70a22 22 0 0 0-44 0v20H54a22 22 0 0 0 0 44h197.25c-9.52 26.95-27.05 69.5-53.79 108.36c-31.41-41.68-43.08-68.65-43.17-68.87a22 22 0 0 0-40.58 17c.58 1.38 14.55 34.23 52.86 83.93c.92 1.19 1.83 2.35 2.74 3.51c-39.24 44.35-77.74 71.86-93.85 80.74a22 22 0 1 0 21.07 38.63c2.16-1.18 48.6-26.89 101.63-85.59c22.52 24.08 38 35.44 38.93 36.1a22 22 0 0 0 30.75-4.9z" fill="currentColor"></path></svg>
|
|
|
|
</el-button>
|
|
|
|
<template #dropdown>
|
|
|
|
<el-dropdown-menu>
|
|
|
|
<el-dropdown-item v-for="item in lang" :key="item.value" :command="item" :class="{'selected':config.lang==item.value}">{{item.name}}</el-dropdown-item>
|
|
|
|
</el-dropdown-menu>
|
|
|
|
</template>
|
|
|
|
</el-dropdown>
|
|
|
|
</div>
|
|
|
|
<div class="login-form">
|
|
|
|
<div class="login-header">
|
|
|
|
<div class="logo">
|
2023-08-16 15:22:19 +00:00
|
|
|
<img :alt="$config.APP_NAME" :src="appLogo">
|
2023-06-11 15:01:34 +00:00
|
|
|
<label>{{$config.APP_NAME}}</label>
|
2023-06-07 10:48:30 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<el-tabs>
|
|
|
|
<el-tab-pane :label="$t('login.accountLogin')" lazy>
|
|
|
|
<password-form></password-form>
|
|
|
|
</el-tab-pane>
|
|
|
|
</el-tabs>
|
2023-06-11 15:01:34 +00:00
|
|
|
<template v-if="$config.MY_SHOW_LOGIN_OAUTH">
|
2023-06-07 10:48:30 +00:00
|
|
|
<el-divider>{{ $t('login.signInOther') }}</el-divider>
|
|
|
|
<div class="login-oauth">
|
2023-07-28 11:02:19 +00:00
|
|
|
<el-button type="success" icon="x-icon-wechat" circle @click="wechatLogin"></el-button>
|
2023-06-07 10:48:30 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<el-dialog v-model="showWechatLogin" :title="$t('login.wechatLoginTitle')" :width="400" destroy-on-close>
|
|
|
|
<div class="qrCodeLogin">
|
2023-07-21 11:22:50 +00:00
|
|
|
<x-qr-code class="qrCode" :text="WechatLoginCode" :size="200"></x-qr-code>
|
2023-06-13 11:03:31 +00:00
|
|
|
<p class="msg">{{$tc('login.wechatLoginMsg', 1)}}</p>
|
2023-06-07 10:48:30 +00:00
|
|
|
<div class="qrCodeLogin-result" v-if="isWechatLoginResult">
|
|
|
|
<el-result icon="success" :title="$tc('login.wechatLoginResult', 1)" :sub-title="$tc('login.wechatLoginResult', 2)"></el-result>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</el-dialog>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import passwordForm from './components/passwordForm'
|
|
|
|
import phoneForm from './components/phoneForm'
|
2023-08-16 15:22:19 +00:00
|
|
|
import logo from '@/assets/img/logo.png';
|
|
|
|
|
2023-06-07 10:48:30 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
passwordForm,
|
|
|
|
phoneForm
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
config: {
|
2023-06-11 14:58:26 +00:00
|
|
|
lang: this.$tool.data.get('APP_LANG') || this.$config.LANG,
|
2023-06-11 14:57:51 +00:00
|
|
|
dark: this.$tool.data.get('APP_DARK') || false
|
2023-06-07 10:48:30 +00:00
|
|
|
},
|
|
|
|
lang: [
|
|
|
|
{
|
|
|
|
name: '简体中文',
|
|
|
|
value: 'zh-cn',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'English',
|
|
|
|
value: 'en',
|
|
|
|
}
|
|
|
|
],
|
|
|
|
WechatLoginCode: "",
|
2023-06-13 11:03:31 +00:00
|
|
|
WechatLoginuniqid: "",
|
2023-08-16 15:22:19 +00:00
|
|
|
appLogo: "",
|
2023-06-07 10:48:30 +00:00
|
|
|
showWechatLogin: false,
|
|
|
|
isWechatLoginResult: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch:{
|
|
|
|
'config.dark'(val){
|
|
|
|
if(val){
|
|
|
|
document.documentElement.classList.add("dark")
|
2023-06-11 14:57:51 +00:00
|
|
|
this.$tool.data.set("APP_DARK", val)
|
2023-06-07 10:48:30 +00:00
|
|
|
}else{
|
|
|
|
document.documentElement.classList.remove("dark")
|
2023-06-11 14:57:51 +00:00
|
|
|
this.$tool.data.remove("APP_DARK")
|
2023-06-07 10:48:30 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
'config.lang'(val){
|
|
|
|
this.$i18n.locale = val
|
2023-06-11 14:57:51 +00:00
|
|
|
this.$tool.data.set("APP_LANG", val)
|
2023-06-07 10:48:30 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
created: function() {
|
2023-08-16 15:22:19 +00:00
|
|
|
|
|
|
|
this.appLogo = this.$tool.data.get("appLogo") || (this.$config.APP_LOGO || logo);
|
|
|
|
|
2023-07-06 11:04:04 +00:00
|
|
|
this.$tool.cookie.remove(this.$config.SESSIONNAME)
|
2023-06-27 11:03:41 +00:00
|
|
|
this.$tool.data.remove("user")
|
2023-06-13 07:51:36 +00:00
|
|
|
this.$tool.data.remove("menu")
|
|
|
|
this.$tool.data.remove("permissions")
|
2023-06-13 07:50:06 +00:00
|
|
|
this.$tool.data.remove("dashboardgrid")
|
2023-06-11 14:57:51 +00:00
|
|
|
this.$tool.data.remove("grid")
|
2023-06-07 10:48:30 +00:00
|
|
|
this.$store.commit("clearViewTags")
|
|
|
|
this.$store.commit("clearKeepLive")
|
|
|
|
this.$store.commit("clearIframeList")
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
configDark(){
|
|
|
|
this.config.dark = this.config.dark ? false : true
|
|
|
|
},
|
|
|
|
configLang(command){
|
|
|
|
this.config.lang = command.value
|
|
|
|
},
|
2023-06-13 11:03:31 +00:00
|
|
|
long_contact:function(){
|
|
|
|
|
|
|
|
if (!this.WechatLoginuniqid) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
setTimeout(async ()=>{
|
2023-07-27 10:15:55 +00:00
|
|
|
var res = await this.$http.post('login/wechatSubmit', {uniqid:this.WechatLoginuniqid});
|
2023-06-13 11:03:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
if(res.code==201){
|
|
|
|
this.showWechatLogin = false
|
|
|
|
this.$message.warning(res.message)
|
|
|
|
}else if(res.code==202){
|
|
|
|
this.long_contact()
|
|
|
|
|
|
|
|
}else if(res.code==200){
|
|
|
|
|
|
|
|
this.showWechatLogin = false
|
2023-07-06 11:04:04 +00:00
|
|
|
this.$tool.cookie.set(this.$config.SESSIONNAME, res.data.token, {
|
2023-06-13 11:03:31 +00:00
|
|
|
expires: 86400*360
|
|
|
|
})
|
|
|
|
|
2023-07-05 08:33:52 +00:00
|
|
|
// //获取菜单
|
|
|
|
// var menu = null
|
|
|
|
// menu = await this.$api.system.index.get()
|
|
|
|
|
|
|
|
// if(menu.code == 200){
|
|
|
|
|
|
|
|
// if(menu.data.menu.length==0){
|
|
|
|
// this.islogin = false
|
|
|
|
// this.$alert("当前用户无任何菜单权限,请联系系统管理员", "无权限访问", {
|
|
|
|
// type: 'error',
|
|
|
|
// center: true
|
|
|
|
// })
|
|
|
|
// return false
|
|
|
|
// }
|
|
|
|
// for (const key in menu.data) {
|
|
|
|
// if (Object.prototype.hasOwnProperty.call(menu.data, key)) {
|
|
|
|
// this.$tool.data.set(key, menu.data[key]);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
// 获取登录前的URL
|
|
|
|
const redirect = this.$route.query.redirect || '/'
|
|
|
|
this.$router.replace({
|
|
|
|
path: redirect
|
|
|
|
})
|
|
|
|
|
|
|
|
this.$message.success("Login Success 登录成功")
|
2023-06-13 11:03:31 +00:00
|
|
|
this.islogin = false
|
2023-07-05 08:33:52 +00:00
|
|
|
return false
|
|
|
|
// }
|
|
|
|
// this.islogin = false
|
|
|
|
// this.$message.warning(menu.message)
|
2023-06-13 11:03:31 +00:00
|
|
|
}
|
|
|
|
},1000)
|
|
|
|
|
|
|
|
},
|
|
|
|
async wechatLogin(){
|
2023-07-27 10:15:55 +00:00
|
|
|
var res = await this.$http.get('login/wechatQrcode');
|
2023-06-13 11:03:31 +00:00
|
|
|
if (res.code==200) {
|
|
|
|
this.showWechatLogin = true
|
|
|
|
this.WechatLoginCode = res.data.qrcodeurl
|
|
|
|
this.WechatLoginuniqid = res.data.uniqid
|
|
|
|
this.long_contact();
|
|
|
|
// 已扫码
|
|
|
|
// this.isWechatLoginResult = true
|
|
|
|
}else{
|
|
|
|
this.$message.warning(res.message)
|
|
|
|
return false
|
|
|
|
}
|
2023-06-07 10:48:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.login_bg {width: 100%;height: 100%;background: #fff;display: flex;}
|
|
|
|
.login_adv {width: 33.33333%;background-color: #555;background-size: cover;background-position: center center;background-repeat: no-repeat;position: relative;}
|
|
|
|
.login_adv__title {color: #fff;padding: 40px;position: absolute;top:0px;left:0px;right: 0px;z-index: 2;}
|
|
|
|
.login_adv__title h2 {font-size: 40px;}
|
|
|
|
.login_adv__title h4 {font-size: 18px;margin-top: 10px;font-weight: normal;}
|
|
|
|
.login_adv__title p {font-size: 14px;margin-top:10px;line-height: 1.8;color: rgba(255,255,255,0.6);}
|
|
|
|
.login_adv__title div {margin-top: 10px;display: flex;align-items: center;}
|
|
|
|
.login_adv__title div span {margin-right: 15px;}
|
|
|
|
.login_adv__title div i {font-size: 40px;}
|
|
|
|
.login_adv__title div i.add {font-size: 20px;color: rgba(255,255,255,0.6);}
|
|
|
|
.login_adv__bottom {position: absolute;left:0px;right: 0px;bottom: 0px;color: #fff;padding: 40px;background-image:linear-gradient(transparent, #000);z-index: 3;}
|
|
|
|
.login_adv__mask {position: absolute;top:0px;left:0px;right: 0px;bottom: 0px;background: rgba(0,0,0,0.5);z-index: 1;}
|
|
|
|
|
|
|
|
.login_main {flex: 1;overflow: auto;display:flex;}
|
|
|
|
.login-form {width: 400px;margin: auto;padding:20px 0;}
|
|
|
|
.login-header {margin-bottom: 40px;}
|
|
|
|
.login-header .logo {display: flex;align-items: center;}
|
|
|
|
.login-header .logo img {width: 40px;height: 40px;vertical-align: bottom;margin-right: 10px;}
|
|
|
|
.login-header .logo label {font-size: 26px;font-weight: bold;}
|
|
|
|
.login-oauth {display: flex;justify-content:space-around;}
|
|
|
|
.login-form .el-divider {margin-top:40px;}
|
|
|
|
|
|
|
|
.login-form {}
|
|
|
|
.login-form:deep(.el-tabs) .el-tabs__header {margin-bottom: 25px;}
|
|
|
|
.login-form:deep(.el-tabs) .el-tabs__header .el-tabs__item {font-size: 14px;}
|
|
|
|
|
|
|
|
.login-form:deep(.login-forgot) {text-align: right;}
|
|
|
|
.login-form:deep(.login-forgot) a {color: var(--el-color-primary);}
|
|
|
|
.login-form:deep(.login-forgot) a:hover {color: var(--el-color-primary-light-3);}
|
|
|
|
.login-form:deep(.login-reg) {font-size: 14px;color: var(--el-text-color-primary);}
|
|
|
|
.login-form:deep(.login-reg) a {color: var(--el-color-primary);}
|
|
|
|
.login-form:deep(.login-reg) a:hover {color: var(--el-color-primary-light-3);}
|
|
|
|
|
|
|
|
.login_config {position: absolute;top:20px;right: 20px;}
|
|
|
|
|
|
|
|
.login-form:deep(.login-msg-yzm) {display: flex;width: 100%;}
|
|
|
|
.login-form:deep(.login-msg-yzm) .el-button {margin-left: 10px;--el-button-size:42px;}
|
|
|
|
|
|
|
|
.qrCodeLogin {text-align: center;position: relative;padding: 20px 0;}
|
|
|
|
.qrCodeLogin img.qrCode {background: #fff;padding:20px;border-radius:10px;}
|
|
|
|
.qrCodeLogin p.msg {margin-top: 15px;}
|
|
|
|
.qrCodeLogin .qrCodeLogin-result {position: absolute;top:0;left:0;right: 0;bottom: 0;text-align: center;background: var(--el-mask-color);}
|
|
|
|
|
|
|
|
@media (max-width: 1200px){
|
|
|
|
.login-form {width: 340px;}
|
|
|
|
}
|
|
|
|
@media (max-width: 1000px){
|
|
|
|
.login_main {display: block;}
|
|
|
|
.login_main .login_config {position: static;padding:20px 20px 0 20px;text-align: right;}
|
|
|
|
.login-form {width:100%;padding:20px 40px;}
|
|
|
|
.login_adv {display: none;}
|
|
|
|
}
|
|
|
|
</style>
|