7.5更新
This commit is contained in:
parent
8b6b373803
commit
6794b01be0
@ -77,12 +77,10 @@ router.beforeEach(async (to, from, next) => {
|
||||
next({ name: 'login' });
|
||||
} else {
|
||||
// 判断判断权限有无获取
|
||||
console.log(store.token,permissionStore.addRouters.length)
|
||||
if (store.token && permissionStore.addRouters.length==0) {
|
||||
//store.getUserInfo();
|
||||
await permissionStore.getButtonRole();
|
||||
await permissionStore.getMenuRole();
|
||||
console.log(permissionStore.addRouters)
|
||||
permissionStore.addRouters.forEach((route) => {
|
||||
router.addRoute('/', route);
|
||||
});
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
<template>
|
||||
<div>我是菜单ye</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
onMounted(() => {
|
||||
|
||||
const Router = useRouter()
|
||||
console.log( "22")
|
||||
console.log(Router.options.routes)
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
|
||||
</style>
|
||||
@ -1,12 +0,0 @@
|
||||
<template>
|
||||
<div>我是角色ye</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
</script>
|
||||
|
||||
<style lang='scss' scoped>
|
||||
|
||||
</style>
|
||||
|
||||
@ -34,6 +34,9 @@
|
||||
</a-form>
|
||||
|
||||
<a-divider />
|
||||
<div class="action">
|
||||
<a-button v-has="'admin:sysApi:add'" type="primary" @click="handleAdd()"><icon-plus /> 新增</a-button>
|
||||
</div>
|
||||
|
||||
<!-- Table -->
|
||||
<a-table
|
||||
@ -68,13 +71,14 @@
|
||||
:width="450"
|
||||
@before-ok="handleDrawerSubmit"
|
||||
@cancel="handleDrawerCancel"
|
||||
@close="() => $refs.drawerFormRef.resetFields()"
|
||||
>
|
||||
<template #title> 修改接口管理 </template>
|
||||
<template #title> {{modalTitle}} </template>
|
||||
<a-form :model="drawerForm" ref="drawerFormRef" :rules="rules">
|
||||
<a-form-item field="api_name" label="标题">
|
||||
<a-input v-model="drawerForm.api_name" placeholder="请输入标题" />
|
||||
</a-form-item>
|
||||
<a-form-item field="action" label="方式">
|
||||
<a-form-item field="api_method" label="方式" v-if="!drawerForm.api_id">
|
||||
<a-select
|
||||
v-model="drawerForm.api_method"
|
||||
placeholder="请选择请求方式"
|
||||
@ -86,8 +90,8 @@
|
||||
<a-option>DELETE</a-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item field="path" label="路径">
|
||||
<a-input v-model="drawerForm.api_path" disabled />
|
||||
<a-form-item field="api_path" label="路径">
|
||||
<a-input v-model="drawerForm.api_path" :disabled="drawerForm.api_id" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-drawer>
|
||||
@ -184,12 +188,20 @@ const handlResetQuery = () => {
|
||||
|
||||
handlePageChange(1);
|
||||
};
|
||||
const modalTitle=ref('');
|
||||
// 新增
|
||||
const handleAdd = async() => {
|
||||
drawerVisible.value = true;
|
||||
modalTitle.value = '新增接口';
|
||||
};
|
||||
|
||||
// 修改
|
||||
const handleUpdate = async (record) => {
|
||||
drawerVisible.value = true;
|
||||
// updateSysApi(record);
|
||||
//updateSysApi(record);
|
||||
await nextTick();
|
||||
modalTitle.value = '修改接口';
|
||||
|
||||
Object.assign(drawerForm, record);
|
||||
};
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
<a-divider />
|
||||
|
||||
<div class="action">
|
||||
<a-button type="primary" @click="handleAdd()"><icon-plus /> 新增</a-button>
|
||||
<a-button v-has="'admin:sysDept:edit'" type="primary" @click="handleAdd()"><icon-plus /> 新增</a-button>
|
||||
</div>
|
||||
|
||||
<!-- 异步数据需要defualt-expanded-keys 传入所有行Key才能默认展开 -->
|
||||
@ -40,9 +40,9 @@
|
||||
{{ parseTime(record.created_at) }}
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<a-button type="text" @click="handleUpdate(record)"><icon-edit /> 修改</a-button>
|
||||
<a-button type="text" @click="handleAdd(record)"><icon-plus /> 新增</a-button>
|
||||
<a-button type="text" @click="() => { deleteVisible = true; deleteData = [record.dept_id]; }"><icon-delete /> 删除</a-button>
|
||||
<a-button v-has="'admin:sysDept:edit'" type="text" @click="handleUpdate(record)"><icon-edit /> 修改</a-button>
|
||||
<a-button v-has="'admin:sysDept:add'" type="text" @click="handleAdd(record)"><icon-plus /> 新增</a-button>
|
||||
<a-button v-has="'admin:sysDept:remove'" type="text" @click="() => { deleteVisible = true; deleteData = [record.dept_id]; }"><icon-delete /> 删除</a-button>
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
<!-- 动作 -->
|
||||
<div class="action">
|
||||
<a-space>
|
||||
<a-button type="primary" @click="handleAddMenu()">新增菜单</a-button>
|
||||
<a-button v-has="'admin:sysMenu:add'" type="primary" @click="handleAddMenu()">新增菜单</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
|
||||
@ -46,9 +46,9 @@
|
||||
<a-tag v-else color="red">隐藏</a-tag>
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<a-button type="text" @click="handleAddMenu(record.menuId)">新增</a-button>
|
||||
<a-button type="text" @click="handleUpdate(record)">修改</a-button>
|
||||
<a-button type="text" @click="() => { deleteVisible = true; deleteData = [record.menu_id]; }">删除</a-button>
|
||||
<a-button v-has="'admin:sysMenu:add'" type="text" @click="handleAddMenu(record.menuId)">新增</a-button>
|
||||
<a-button v-has="'admin:sysMenu:edit'" type="text" @click="handleUpdate(record)">修改</a-button>
|
||||
<a-button v-has="'admin:sysMenu:remove'" type="text" @click="() => { deleteVisible = true; deleteData = [record.menu_id]; }">删除</a-button>
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
|
||||
@ -27,9 +27,9 @@
|
||||
|
||||
<div class="action">
|
||||
<a-space>
|
||||
<a-button type="primary" @click="handleAdd">
|
||||
<a-button v-has="'admin:sysRole:add'" type="primary" @click="handleAdd">
|
||||
<icon-plus /> 新增</a-button>
|
||||
<a-button type="primary" status="danger" @click="() => { deleteVisible = true; }">
|
||||
<a-button v-has="'admin:sysRole:remove'" type="primary" status="danger" @click="() => { deleteVisible = true; }">
|
||||
<icon-delete /> 批量删除</a-button>
|
||||
<!-- <a-button type="primary" status="warning" disabled>
|
||||
<icon-download /> 导出</a-button> -->
|
||||
@ -61,11 +61,11 @@
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<a-space>
|
||||
<a-button type="text" @click="handleUpdate(record)">
|
||||
<a-button v-has="'admin:sysRole:edit'" type="text" @click="handleUpdate(record)">
|
||||
<icon-edit /> 修改</a-button>
|
||||
<!-- <a-button type="text" @click="handleDataScope(record)">
|
||||
<icon-check-circle /> 数据权限 </a-button> -->
|
||||
<a-button type="text" @click="() => { deleteVisible = true; deleteData = [record.role_id]; }">
|
||||
<a-button v-has="'admin:sysRole:remove'" type="text" @click="() => { deleteVisible = true; deleteData = [record.role_id]; }">
|
||||
<icon-check-circle /> 删除 </a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
@ -101,7 +101,6 @@
|
||||
<a-radio :value="1">是</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
<div>{{checkedKeys}}</div>
|
||||
<a-form-item label="权限设置">
|
||||
<a-tree
|
||||
v-model:checked-keys="checkedKeys"
|
||||
|
||||
@ -67,8 +67,8 @@
|
||||
<a-col :span="20">
|
||||
<!-- Action -->
|
||||
<a-space class="action">
|
||||
<a-button type="primary" @click="handleAdd" data-test="newUser"><icon-plus /> 新增</a-button>
|
||||
<a-button type="primary" status="danger" @click="() => { deleteVisible = true; }"><icon-delete /> 批量删除</a-button>
|
||||
<a-button v-has="'admin:sysUser:add'" type="primary" @click="handleAdd" data-test="newUser"><icon-plus /> 新增</a-button>
|
||||
<a-button v-has="'admin:sysUser:remove'" type="primary" status="danger" @click="() => { deleteVisible = true; }"><icon-delete /> 批量删除</a-button>
|
||||
</a-space>
|
||||
|
||||
<!-- Table -->
|
||||
@ -99,9 +99,9 @@
|
||||
{{ parseTime(record.created_at) }}
|
||||
</template>
|
||||
<template #action="{ record }">
|
||||
<a-button type="text" @click="handleUpdate(record)"><icon-edit /> 修改</a-button>
|
||||
<a-button type="text" @click="() => { deleteVisible = true; deleteData = [record.user_id]; }"><icon-delete /> 删除</a-button>
|
||||
<a-button type="text" @click="handleReset(record.user_id)"><icon-refresh /> 重置</a-button>
|
||||
<a-button v-has="'admin:sysUser:edit'" type="text" @click="handleUpdate(record)"><icon-edit /> 修改</a-button>
|
||||
<a-button v-has="'admin:sysUser:remove'" type="text" @click="() => { deleteVisible = true; deleteData = [record.user_id]; }"><icon-delete /> 删除</a-button>
|
||||
<a-button v-has="'admin:sysUser:reset'" type="text" @click="handleReset(record.user_id)"><icon-refresh /> 重置</a-button>
|
||||
</template>
|
||||
</a-table>
|
||||
</a-col>
|
||||
@ -251,7 +251,7 @@
|
||||
placeholder="请输入原密码"
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item field="password" label="新密码">
|
||||
<a-form-item field="new_password" label="新密码">
|
||||
<a-input-password
|
||||
v-model="resetPwdForm.new_password"
|
||||
placeholder="请输入新密码"
|
||||
@ -387,15 +387,16 @@ function useResetPwd() {
|
||||
// Rules
|
||||
const resetPwdRules = {
|
||||
password: [{ required: true, message: '请输入密码' }],
|
||||
repeatPwd: [
|
||||
new_password: [
|
||||
{
|
||||
required: true,
|
||||
message: '请重复输入密码',
|
||||
message: '请输入新密码',
|
||||
},
|
||||
{
|
||||
validator: (value, cb) => {
|
||||
if (value !== resetPwdForm.password) {
|
||||
cb('两次输入的密码不一致');
|
||||
let reg=/^(?=.*[A-Za-z])(?=.*\d)(?=.*[$@$!%*#?&])[A-Za-z\d$@$!%*#?&]{8,}$/;
|
||||
if (!reg.test(value)) {
|
||||
cb('密码必须为字母、数字、符号(例如$@$!%*#?&)组合,且不小于8位数');
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@ -94,9 +94,12 @@ import { ref, reactive, onMounted, getCurrentInstance } from 'vue';
|
||||
import { IconUser, IconLock, IconSafe } from '@arco-design/web-vue/es/icon';
|
||||
import { login, getCaptcha } from '@/api/admin/login';
|
||||
import { useUserStore } from '@/store/userInfo';
|
||||
import { usePermissionStore } from '@/store/permission';
|
||||
import { getUserMenuRole} from '@/api/admin/login';
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const store = useUserStore();
|
||||
const permissionStore=usePermissionStore()
|
||||
// form
|
||||
const loginForm = reactive({});
|
||||
// 验证码
|
||||
@ -138,14 +141,23 @@ const handleLogin = () => {
|
||||
content: '登陆成功',
|
||||
duration: 2000,
|
||||
});
|
||||
setTimeout(() => {
|
||||
proxy.$router.push('/admin/role');
|
||||
loading.value = false;
|
||||
}, 500);
|
||||
const res=await getUserMenuRole();
|
||||
let path='';
|
||||
if(code==200){
|
||||
path=res.data[1].children[0].path;
|
||||
}
|
||||
proxy.$router.push(path);
|
||||
loading.value = false;
|
||||
// setTimeout(() => {
|
||||
|
||||
// proxy.$router.push(path);
|
||||
// loading.value = false;
|
||||
// },500);
|
||||
} else {
|
||||
proxy.$message.error(`登陆失败:${message}`);
|
||||
}
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
// 登录失败 重新获取验证码
|
||||
loadCaptcha();
|
||||
} finally {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user