🐞 fix(role): 修改前后端数据结构不一致的问题

This commit is contained in:
砂糖
2025-09-20 09:45:52 +08:00
parent bf6987a630
commit c6d7d4b107
6 changed files with 24 additions and 22 deletions

View File

@@ -14,7 +14,7 @@
* 本仓库为前端技术栈 [Vue3](https://v3.cn.vuejs.org) + [Element Plus](https://element-plus.org/zh-CN) + [Vite](https://cn.vitejs.dev) 版本。 * 本仓库为前端技术栈 [Vue3](https://v3.cn.vuejs.org) + [Element Plus](https://element-plus.org/zh-CN) + [Vite](https://cn.vitejs.dev) 版本。
* 配套后端代码仓库地址[RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue) 或 [RuoYi-Vue-fast](https://gitcode.com/yangzongzhuan/RuoYi-Vue-fast) 版本。 * 配套后端代码仓库地址[RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue) 或 [RuoYi-Vue-fast](https://gitcode.com/yangzongzhuan/RuoYi-Vue-fast) 版本。
* 前端技术栈([Vue2](https://cn.vuejs.org) + [Element](https://github.com/ElemeFE/element) + [Vue CLI](https://cli.vuejs.org/zh)),请移步[RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue/tree/master/ruoyi-ui)。 * 前端技术栈([Vue2](https://cn.vuejs.org) + [Element](https://github.com/ElemeFE/element) + [Vue CLI](https://cli.vuejs.org/zh)),请移步[RuoYi-Vue](https://gitee.com/y_project/RuoYi-Vue/tree/master/ruoyi-ui)。
* 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip)   * 阿里云折扣场:[点我进入](http://aly.),腾讯云秒杀场:[点我进入](http://txy.)  
## 前端运行 ## 前端运行
@@ -62,8 +62,8 @@ yarn dev
- admin/admin123 - admin/admin123
- 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。 - 陆陆续续收到一些打赏,为了更好的体验已用于演示服务器升级。谢谢各位小伙伴。
演示地址http://vue.ruoyi.vip 演示地址http://vue.
文档地址http://doc.ruoyi.vip 文档地址http://doc.
## 演示图 ## 演示图

View File

@@ -1,9 +1,9 @@
<template> <template>
<div class="login" :class="{ 'dark': isDark }"> <div class="login" :class="{ 'dark': isDark }">
<div class="login-container"> <div class="login-container">
<div class="login-right"> <!-- <div class="login-right">
<img :src="RightImage" alt="" class="right-img" /> <img :src="RightImage" alt="" class="right-img" />
</div> </div> -->
<el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form"> <el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
<h3 class="title"> <h3 class="title">
{{ title }} {{ title }}
@@ -30,7 +30,7 @@
</el-form-item> </el-form-item>
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox> <el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
<el-form-item style="width:100%;"> <el-form-item style="width:100%;">
<el-button :loading="loading" size="large" type="primary" style="width:100%;" @click.prevent="handleLogin"> <el-button :loading="loading" size="large" type="primary" style="width:100%; height: 40px;" @click.prevent="handleLogin">
<span v-if="!loading"> </span> <span v-if="!loading"> </span>
<span v-else> 中...</span> <span v-else> 中...</span>
</el-button> </el-button>
@@ -42,9 +42,9 @@
</div> </div>
<!-- 底部 --> <!-- 底部 -->
<div class="el-login-footer"> <!-- <div class="el-login-footer">
<span>Copyright © 2018-2025 ruoyi.vip All Rights Reserved.</span> <span>Copyright © 2018-2025 All Rights Reserved.</span>
</div> </div> -->
</div> </div>
</template> </template>
@@ -54,7 +54,7 @@ import Cookies from "js-cookie"
import { encrypt, decrypt } from "@/utils/jsencrypt" import { encrypt, decrypt } from "@/utils/jsencrypt"
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import useProductStore from '@/store/modules/product' import useProductStore from '@/store/modules/product'
import RightImage from '@/assets/images/right.png' // import RightImage from '@/assets/logo/logo.png'
import { useDark } from "@vueuse/core" import { useDark } from "@vueuse/core"
const isDark = useDark() const isDark = useDark()
@@ -164,8 +164,8 @@ getCookie()
background-image: url('@/assets/images/back.jpg'); background-image: url('@/assets/images/back.jpg');
/* 亮色主题变量 */ /* 亮色主题变量 */
--color-bg-primary: #f5f7fa; --color-bg-primary: #f5f7fa90;
--color-bg-form: #ffffff; --color-bg-form: #f5f7fa90;
--color-bg-input: #f0f2f5; --color-bg-input: #f0f2f5;
--color-border-input: #dcdfe6; --color-border-input: #dcdfe6;
--color-text-primary: #303133; --color-text-primary: #303133;
@@ -198,8 +198,9 @@ getCookie()
justify-content: center; justify-content: center;
align-items: center; align-items: center;
box-sizing: border-box; box-sizing: border-box;
width: 60%; width: 30%;
border-radius: 6px; border-radius: 6px;
backdrop-filter: blur(10px);
background: var(--color-bg-form); background: var(--color-bg-form);
padding: 25px; padding: 25px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
@@ -220,7 +221,7 @@ getCookie()
z-index: 1; z-index: 1;
flex: 3; flex: 3;
border-radius: 6px; border-radius: 6px;
background: var(--color-bg-form); // background: var(--color-bg-form);
padding: 25px; padding: 25px;
// box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); // box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
@@ -248,6 +249,7 @@ getCookie()
.login-right { .login-right {
display: flex; display: flex;
padding: 30px; padding: 30px;
height: 55vh;
flex: 4; flex: 4;
} }

View File

@@ -70,7 +70,7 @@
</el-form> </el-form>
<!-- 底部 --> <!-- 底部 -->
<div class="el-register-footer"> <div class="el-register-footer">
<span>Copyright © 2018-2025 ruoyi.vip All Rights Reserved.</span> <span>Copyright © 2018-2025 All Rights Reserved.</span>
</div> </div>
</div> </div>
</template> </template>

View File

@@ -435,7 +435,7 @@ function handleUpdate(row) {
open.value = true open.value = true
nextTick(() => { nextTick(() => {
roleMenu.then((res) => { roleMenu.then((res) => {
let checkedKeys = res.checkedKeys let checkedKeys = res.data.checkedKeys
checkedKeys.forEach((v) => { checkedKeys.forEach((v) => {
nextTick(() => { nextTick(() => {
menuRef.value.setChecked(v, true, false) menuRef.value.setChecked(v, true, false)
@@ -450,7 +450,7 @@ function handleUpdate(row) {
/** 根据角色ID查询菜单树结构 */ /** 根据角色ID查询菜单树结构 */
function getRoleMenuTreeselect(roleId) { function getRoleMenuTreeselect(roleId) {
return roleMenuTreeselect(roleId).then(response => { return roleMenuTreeselect(roleId).then(response => {
menuOptions.value = response.menus menuOptions.value = response.data.menus
return response return response
}) })
} }
@@ -458,7 +458,7 @@ function getRoleMenuTreeselect(roleId) {
/** 根据角色ID查询部门树结构 */ /** 根据角色ID查询部门树结构 */
function getDeptTree(roleId) { function getDeptTree(roleId) {
return deptTreeSelect(roleId).then(response => { return deptTreeSelect(roleId).then(response => {
deptOptions.value = response.depts deptOptions.value = response.data.depts
return response return response
}) })
} }
@@ -553,7 +553,7 @@ function handleDataScope(row) {
deptTreeSelect.then(res => { deptTreeSelect.then(res => {
nextTick(() => { nextTick(() => {
if (deptRef.value) { if (deptRef.value) {
deptRef.value.setCheckedKeys(res.checkedKeys) deptRef.value.setCheckedKeys(res.data.checkedKeys)
} }
}) })
}) })

View File

@@ -11,7 +11,7 @@ export default defineConfig(({ mode, command }) => {
return { return {
// 部署生产环境和开发环境下的URL。 // 部署生产环境和开发环境下的URL。
// 默认情况下vite 会假设你的应用是被部署在一个域名的根路径上 // 默认情况下vite 会假设你的应用是被部署在一个域名的根路径上
// 例如 https://www.ruoyi.vip/。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www.ruoyi.vip/admin/,则设置 baseUrl 为 /admin/。 // 例如 https://www./。如果应用被部署在一个子路径上,你就需要用这个选项指定这个子路径。例如,如果你的应用被部署在 https://www./admin/,则设置 baseUrl 为 /admin/。
base: VITE_APP_ENV === 'production' ? '/' : '/', base: VITE_APP_ENV === 'production' ? '/' : '/',
plugins: createVitePlugins(env, command === 'build'), plugins: createVitePlugins(env, command === 'build'),
resolve: { resolve: {

View File

@@ -6,7 +6,7 @@ export default function createCompression(env) {
if (VITE_BUILD_COMPRESS) { if (VITE_BUILD_COMPRESS) {
const compressList = VITE_BUILD_COMPRESS.split(',') const compressList = VITE_BUILD_COMPRESS.split(',')
if (compressList.includes('gzip')) { if (compressList.includes('gzip')) {
// http://doc.ruoyi.vip/ruoyi-vue/other/faq.html#使用gzip解压缩静态文件 // http://doc./ruoyi-vue/other/faq.html#使用gzip解压缩静态文件
plugin.push( plugin.push(
compression({ compression({
ext: '.gz', ext: '.gz',