jwg 7 months ago
parent 4c1d597a57
commit 655f354ad9

@ -11,6 +11,17 @@ export function loginIn(data) {
data
})
}
// 企业登录
export function Wxlogin(data) {
return request({
url: 'system/auth/social-auth-redirect',
method: 'get',
headers: {
isToken: false
},
params: data
})
}
// 获取个人权限信息
export function getUserInfo() {

@ -4,32 +4,51 @@
<div class="contain-topbg flex flex-center flex-c flex-c-center">
<img class="logo-img" src="@/assets/logo.png" alt="" />
<div class="logo-text">链友融财务数字一体化信息系统</div>
<div class="logo-text logo-text-new"> OA办公每一天都高效</div>
<div class="logo-text logo-text-new">OA办公每一天都高效</div>
<div class="round"></div>
</div>
<div style="width: 90%;z-index: 10;">
<div style="width: 90%; z-index: 10">
<div class="login-form">
<div style="border-bottom: 1px solid #ddd; padding-bottom: 0.3rem;">
<div style="border-bottom: 1px solid #ddd; padding-bottom: 0.3rem">
<div class="userName">企业</div>
<input v-model="loginForm.tenantName" placeholder="请输入企业名称" />
<input
v-model="loginForm.tenantName"
placeholder="请输入企业名称"
/>
</div>
<div style="border-bottom: 1px solid #ddd; padding-bottom: 0.3rem;">
<div style="border-bottom: 1px solid #ddd; padding-bottom: 0.3rem">
<div class="userName">账号</div>
<input v-model="loginForm.username" placeholder="请输入用户名" />
</div>
<div style="border-bottom: 1px solid #ddd; padding-bottom: 0.3rem;">
<div style="border-bottom: 1px solid #ddd; padding-bottom: 0.3rem">
<div class="password">密码</div>
<input v-model="loginForm.password" type="password" placeholder="请输入密码" />
<input
v-model="loginForm.password"
type="password"
placeholder="请输入密码"
/>
</div>
</div>
<div class="whiteSpace"></div>
<div class="btn-box">
<van-button type="info" style="width: 100%" @click="handleLogin" loading-text="...">登录</van-button>
<van-button
type="info"
style="width: 100%"
@click="handleLogin"
loading-text="登录中..."
>登录</van-button
>
</div>
<div class="btn-box rember-box">
<van-checkbox v-model="isRemeber" @change="handleCheck" shape="square"></van-checkbox>
<van-checkbox v-model="isRemeber" @change="handleCheck" shape="square"
>记住密码</van-checkbox
>
</div>
</div>
<!-- 企业微信登录 -->
<van-button type="primary" @click="handleWxLogin"
>企业微信登录</van-button
>
</div>
<!-- 图形验证码 -->
<!-- <Verify ref="verify" :captcha-type="'blockPuzzle'" :img-size="{width:'10rem',height:'5rem'}" @success="handleLogin" /> -->
@ -38,23 +57,22 @@
<script>
import { mapGetters, mapActions } from 'vuex'
import { getCaptchaEnable, getTenantEnable } from "@/utils/ruoyi";
import { getTenantIdByName } from "@/api/system/tenant";
import {
setTenantId
} from "@/utils/auth";
import { getCaptchaEnable, getTenantEnable } from '@/utils/ruoyi'
import { getTenantIdByName } from '@/api/system/tenant'
import { Wxlogin } from '@/api/login'
import { setTenantId } from '@/utils/auth'
export default {
data() {
return {
loginForm: {
loginType: "",
username: "", // admin
password: "", // admin123
captchaVerification: "",
mobile: "",
mobileCode: "",
loginType: '',
username: '', // admin
password: '', // admin123
captchaVerification: '',
mobile: '',
mobileCode: '',
rememberMe: false,
tenantName: "", //
tenantName: '', //
},
systemInfo: {},
checked: false,
@ -67,7 +85,7 @@ export default {
// Verify
},
computed: {
...mapGetters(['devSystemList', 'devUserList'])
...mapGetters(['devSystemList', 'devUserList']),
},
created() {
//
@ -85,13 +103,21 @@ export default {
// this.captchaEnable = getCaptchaEnable();
},
methods: {
handleWxLogin() {
Wxlogin({ type: 30, redirectUri: '/home' }).then((res) => {
console.log(res)
window.location.href = res.data
})
},
handleSetLoginInfo() {
if (this.isRemeber) {
const { tenantName, username, password } = JSON.parse(window.localStorage.getItem('loginInfo') || {})
const { tenantName, username, password } = JSON.parse(
window.localStorage.getItem('loginInfo') || {}
)
this.loginForm = {
tenantName,
username,
password
password,
}
} else {
window.localStorage.removeItem('loginInfo')
@ -99,8 +125,10 @@ export default {
},
handleSetTenantId() {
return new Promise((resolve, reject) => {
getTenantIdByName(this.loginForm.tenantName).then(res => { //
const tenantId = res.data.id;
getTenantIdByName(this.loginForm.tenantName)
.then((res) => {
//
const tenantId = res.data.id
window.localStorage.setItem('cn', res.data.name)
if (tenantId && tenantId >= 0) {
setTenantId(tenantId)
@ -108,9 +136,10 @@ export default {
} else {
reject()
}
}).catch(() => {
})
.catch(() => {
reject()
});
})
})
},
handleCheck(val) {
@ -141,12 +170,14 @@ export default {
return
}
this.$loading(true)
this.handleSetTenantId().then(() => {
this.handleSetTenantId()
.then(() => {
this.developLogin({
vm: this,
username: this.loginForm.username,
password: this.loginForm.password,
}).then(() => {
})
.then(() => {
//
if (this.isRemeber) {
let obj = {
@ -157,10 +188,12 @@ export default {
window.localStorage.setItem('loginInfo', JSON.stringify(obj))
}
this.$router.replace('/home')
}).catch(() => {
})
.catch(() => {
this.$loading(false)
})
}).catch(() => {
})
.catch(() => {
this.$fm('企业信息错误!')
this.$loading(false)
})
@ -174,8 +207,8 @@ export default {
},
handleDevUser(val) {
this.loginForm.devUserTitle = val.title
}
}
},
},
}
</script>

@ -22,7 +22,9 @@ module.exports = {
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
['/proxy-api']: {
target: `http://localhost:48080`,
// target: `http://localhost:48080`,
// target: `http://192.168.3.81:48080`,
target: `http://192.168.3.243:48080`,
// target: `http://api-dashboard.yudao.iocoder.cn`,
changeOrigin: true,
pathRewrite: {

Loading…
Cancel
Save