jwg 7 months ago
parent 4c1d597a57
commit 655f354ad9

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

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

@ -22,7 +22,9 @@ module.exports = {
proxy: { proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy // detail: https://cli.vuejs.org/config/#devserver-proxy
['/proxy-api']: { ['/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`, // target: `http://api-dashboard.yudao.iocoder.cn`,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {

Loading…
Cancel
Save