wechat login is ready

This commit is contained in:
RockYang
2024-07-04 15:34:32 +08:00
parent cdb1a8bde1
commit a5ef4299ec
15 changed files with 416 additions and 238 deletions

View File

@@ -35,19 +35,22 @@
</el-row>
<el-row class="opt" :gutter="24">
<el-col :span="span" v-if="cLoginURL !== ''">
<el-tooltip class="item" effect="light" content="微信扫码登录" placement="top">
<a class="wechat-login" :href="cLoginURL"><i class="iconfont icon-wechat"></i></a>
</el-tooltip>
</el-col>
<el-col :span="span"><el-link type="primary" @click="router.push('/register')">注册</el-link></el-col>
<el-col :span="span">
<el-col :span="8"><el-link type="primary" @click="router.push('/register')">注册</el-link></el-col>
<el-col :span="8">
<el-link type="info" @click="showResetPass = true">重置密码</el-link>
</el-col>
<el-col :span="span">
<el-col :span="8">
<el-link type="info" @click="router.push('/')">首页</el-link>
</el-col>
</el-row>
<div v-if="wechatLoginURL !== ''">
<el-divider class="divider">其他登录方式</el-divider>
<div class="clogin">
<a class="wechat-login" :href="wechatLoginURL"><i class="iconfont icon-wechat"></i></a>
</div>
</div>
</div>
</div>
@@ -80,8 +83,7 @@ const password = ref(process.env.VUE_APP_PASS);
const showResetPass = ref(false)
const logo = ref("/images/logo.png")
const licenseConfig = ref({})
const cLoginURL = ref('')
const span = ref(8)
const wechatLoginURL = ref('')
onMounted(() => {
// 获取系统配置
@@ -94,7 +96,6 @@ onMounted(() => {
httpGet("/api/config/license").then(res => {
licenseConfig.value = res.data
span.value = 6
}).catch(e => {
showMessageError("获取 License 配置:" + e.message)
})
@@ -108,10 +109,9 @@ onMounted(() => {
}).catch(() => {
})
// const returnURL = `${location.protocol}//${location.host}/user/api/clogin/callback`
const returnURL = `https://ai.r9it.com/user/api/clogin/callback`
const returnURL = `${location.protocol}//${location.host}/login/callback`
httpGet("/api/user/clogin/request?return_url="+returnURL).then(res => {
cLoginURL.value = res.data.url
wechatLoginURL.value = res.data.url
}).catch(e => {
console.error(e)
})
@@ -147,103 +147,5 @@ const login = function () {
</script>
<style lang="stylus" scoped>
.bg {
position fixed
left 0
right 0
top 0
bottom 0
background-color #313237
background-image url("~@/assets/img/login-bg.jpg")
background-size cover
background-position center
background-repeat repeat-y
//filter: blur(10px); /* 调整模糊程度,可以根据需要修改值 */
}
.main {
.contain {
position fixed
left 50%
top 40%
width 90%
max-width 400px;
transform translate(-50%, -50%)
padding 20px 10px;
color #ffffff
border-radius 10px;
.logo {
text-align center
.el-image {
width 120px;
cursor pointer
}
}
.header {
width 100%
margin-bottom 24px
font-size 24px
color $white_v1
letter-space 2px
text-align center
padding-top 10px
}
.content {
width 100%
height: auto
border-radius 3px
.block {
margin-bottom 16px
.el-input__inner {
border 1px solid $gray-v6 !important
.el-icon-user, .el-icon-lock {
font-size 20px
}
}
}
.btn-row {
padding-top 10px;
.login-btn {
width 100%
font-size 16px
letter-spacing 2px
}
}
.text-line {
justify-content center
padding-top 10px;
font-size 14px;
}
.opt {
padding 15px
.el-col {
text-align center
}
.wechat-login {
color #0bc15f
}
}
}
}
.footer {
color #ffffff;
.container {
padding 20px;
}
}
}
@import "@/assets/css/login.styl"
</style>