Merge branch 'abp' of https://gitee.com/ccnetcore/Yi into abp

This commit is contained in:
橙子
2023-12-20 23:23:23 +08:00
9 changed files with 257 additions and 209 deletions

View File

@@ -63,3 +63,13 @@ export function getCodePhone(data) {
data, data,
}); });
} }
/**
* 获取登录验证码
*/
export function getLoginCode() {
return request({
url: `/account/captcha-image`,
method: "get",
});
}

View File

@@ -1,24 +1,20 @@
<template class="back-color"> <template class="back-color">
<div class="content-main"> <div class="content-main">
<RouterView /> <RouterView />
</div> </div>
</template> </template>
<style scoped> <style scoped>
.body-main { .body-main {
min-height: 10rem; min-height: 10rem;
min-width: 10rem; min-width: 10rem;
background-color:#F0F2F5; background-color: #f0f2f5;
} }
.content-main { .content-main {
margin: 0 auto; margin: 0 auto;
display: flex; display: flex;
justify-content: center; justify-content: center;
width: 1300px;
min-height: 1150px; min-height: 1150px;
} }
</style> </style>

View File

@@ -123,7 +123,7 @@ const isLogin = getToken("AccessToken") ? true : false;
<style scoped lang="scss"> <style scoped lang="scss">
.header { .header {
padding: 0 100px; padding: 0 100px;
width: 1200px; width: 1300px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;

View File

@@ -14,6 +14,7 @@ const useUserStore = defineStore("user", {
icon: null, icon: null,
roles: [], roles: [],
permissions: [], permissions: [],
hasPermissions: false,
}), }),
getters: {}, getters: {},
actions: { actions: {
@@ -42,18 +43,22 @@ const useUserStore = defineStore("user", {
getUserDetailInfo() getUserDetailInfo()
.then((response) => { .then((response) => {
const res = response.data; const res = response.data;
const user = res.user; const user = res.user;
console.log(user, "user");
const avatar = const avatar =
user.icon == "" || user.icon == null user.icon == "" || user.icon == null
? "/favicon.ico" ? "/favicon.ico"
: import.meta.env.VITE_APP_BASEAPI + "/file/" + user.icon; : import.meta.env.VITE_APP_BASEAPI + "/file/" + user.icon;
console.log(avatar, "avatar"); const all_permission = "*:*:*";
if (res.roleCodes && res.roleCodes.length > 0) { if (res.roleCodes && res.roleCodes.length > 0) {
// 验证返回的roles是否是一个非空数组 // 验证返回的roles是否是一个非空数组
this.roles = res.roleCodes; this.roles = res.roleCodes;
this.permissions = res.permissionCodes; this.permissions = res.permissionCodes;
this.hasPermissions = res.permissionCodes.some((permission) => {
return (
all_permission === permission ||
permissionFlag.includes(permission)
);
});
// this.roles = ["admin"]; // this.roles = ["admin"];
// this.permissions=["*:*:*"] // this.permissions=["*:*:*"]
} else { } else {

View File

@@ -1,5 +1,5 @@
<template> <template>
<div style="width: 90%; min-width: 1200px"> <div class="article-box">
<!-- <div style="width: 1200px;"> --> <!-- <div style="width: 1200px;"> -->
<el-row :gutter="20" class="top-div"> <el-row :gutter="20" class="top-div">
<el-col :span="5"> <el-col :span="5">
@@ -383,6 +383,9 @@ watch(
); );
</script> </script>
<style scoped> <style scoped>
.article-box {
width: 100%;
height: 100%;
.comment { .comment {
min-height: 40rem; min-height: 40rem;
} }
@@ -467,4 +470,5 @@ h2 {
.breadcrumb { .breadcrumb {
margin-bottom: 10px; margin-bottom: 10px;
} }
}
</style> </style>

View File

@@ -1,5 +1,5 @@
<template> <template>
<div style="width: 1200px" class="body-div"> <div class="discuss-box">
<div class="header"> <div class="header">
<el-form :inline="true"> <el-form :inline="true">
<el-form-item label="标题:"> <el-form-item label="标题:">
@@ -20,11 +20,8 @@
" "
>查询</el-button >查询</el-button
> >
<el-button <el-button @click="enterEditArticle" type="primary"
@click="enterEditArticle" >发布主题</el-button
type="primary"
v-hasPer="['bbs:discuss:add']"
>分享</el-button
> >
<el-dropdown> <el-dropdown>
<span class="el-dropdown-link"> <span class="el-dropdown-link">
@@ -183,14 +180,17 @@ watch(
{ immediate: true } { immediate: true }
); );
</script> </script>
<style scoped> <style scoped lang="scss">
.discuss-box {
width: 100%;
height: 100%;
.el-pagination { .el-pagination {
margin: 2rem 0rem 2rem 0rem; margin: 2rem 0rem 2rem 0rem;
justify-content: right; justify-content: right;
} }
.body-div { /* .body-div {
min-height: 1000px; min-height: 1000px;
} } */
.el-dropdown-link { .el-dropdown-link {
cursor: pointer; cursor: pointer;
color: var(--el-color-primary); color: var(--el-color-primary);
@@ -244,4 +244,5 @@ watch(
.el-divider { .el-divider {
margin: 0.5rem 0; margin: 0.5rem 0;
} }
}
</style> </style>

View File

@@ -44,12 +44,6 @@
</div> </div>
</div> </div>
</div> </div>
<!-- <h2> 登录-欢迎</h2>
<el-input v-model="loginForm.userName" placeholder="用户名" />
<el-input v-model="loginForm.password" placeholder="密码" show-password />
<el-button class="login-btn" type="primary" @click="login">登录</el-button>
<br>
<el-button class="login-btn" type="primary" @click="guestlogin">游客临时登录</el-button> -->
</template> </template>
<script setup> <script setup>
import { ref, reactive } from "vue"; import { ref, reactive } from "vue";

View File

@@ -1,5 +1,5 @@
<template> <template>
<div style="width: 1200px"> <div class="home-box">
<el-row :gutter="20" class="top-div"> <el-row :gutter="20" class="top-div">
<el-col :span="17"> <el-col :span="17">
<div class="scrollbar"> <div class="scrollbar">
@@ -157,7 +157,10 @@ const statisOptions = computed(() => {
}; };
}); });
</script> </script>
<style scoped> <style scoped lang="scss">
.home-box {
width: 100%;
height: 100%;
.introduce { .introduce {
color: rgba(0, 0, 0, 0.45); color: rgba(0, 0, 0, 0.45);
font-size: small; font-size: small;
@@ -201,4 +204,5 @@ const statisOptions = computed(() => {
width: 100%; width: 100%;
height: 300px; height: 300px;
} }
}
</style> </style>

View File

@@ -40,6 +40,25 @@
show-password show-password
/> />
</el-form-item> </el-form-item>
<el-form-item label="验证码" class="title-item"></el-form-item>
<div class="flex-between">
<el-col :span="18">
<el-form-item prop="phone">
<el-input
size="large"
type="text"
v-model.trim="loginForm.code"
placeholder="请输入验证码"
/>
</el-form-item>
</el-col>
<el-image
@click="handleGetCode"
style="width: 120px; height: 40px; cursor: pointer"
:src="codeImageURL"
:fit="fit"
/>
</div>
</el-form> </el-form>
<el-form <el-form
class="registerForm" class="registerForm"
@@ -136,10 +155,11 @@
</div> </div>
</template> </template>
<script setup> <script setup>
import { ref, reactive } from "vue"; import { ref, reactive, onMounted } from "vue";
import { useRouter, useRoute } from "vue-router"; import { useRouter, useRoute } from "vue-router";
import useAuths from "@/hooks/useAuths"; import useAuths from "@/hooks/useAuths";
import { getCodePhone } from "@/apis/accountApi"; import { getCodePhone } from "@/apis/accountApi";
import { getLoginCode } from "@/apis/auth";
const { loginFun, registerFun } = useAuths(); const { loginFun, registerFun } = useAuths();
const router = useRouter(); const router = useRouter();
@@ -175,6 +195,11 @@ const login = async (formEl) => {
} }
}); });
}; };
// 获取图片验证码
const codeImageURL = ref("");
const handleGetCode = () => {
getImageCode();
};
// 注册逻辑 // 注册逻辑
const isRegister = ref(true); const isRegister = ref(true);
@@ -238,6 +263,15 @@ const captcha = async () => {
const handleSignInNow = () => { const handleSignInNow = () => {
isRegister.value = !isRegister.value; isRegister.value = !isRegister.value;
}; };
const getImageCode = async () => {
const { data } = await getLoginCode();
codeImageURL.value = "data:image/jpg;base64," + data.img;
loginForm.uuid = data.uuid;
};
onMounted(async () => {
await getImageCode();
});
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.login { .login {