init 3
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { http } from "@/utils/http";
|
||||
import { baseUrlApi } from "./utils";
|
||||
// import { baseUrlApi } from "./utils";
|
||||
import { authApi } from "./utils";
|
||||
|
||||
type Result = {
|
||||
success: boolean;
|
||||
@@ -9,5 +10,6 @@ type Result = {
|
||||
export const getAsyncRoutes = () => {
|
||||
// return http.request<Result>("get", "/get-async-routes");
|
||||
// 暂时返回空动态路由
|
||||
return http.request<Result>("get", baseUrlApi("auth/async-routes"));
|
||||
// return http.request<Result>("get", baseUrlApi("auth/async-routes"));
|
||||
return http.request<Result>("get", authApi("async-routes"));
|
||||
};
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { http } from "@/utils/http";
|
||||
import { baseUrlApi } from "./utils";
|
||||
// import { baseUrlApi } from "./utils";
|
||||
// import { bizApi} from "./utils";
|
||||
import { authApi } from "./utils";
|
||||
|
||||
export type UserResult = {
|
||||
success: boolean;
|
||||
@@ -41,10 +43,17 @@ export const getLogin = (data?: object) => {
|
||||
// return http.request<UserResult>("post", "/login", { data });
|
||||
// console.log(http.request<any>("get", baseUrlApi("/user/roles")));
|
||||
// console.log(data);
|
||||
return http.request<UserResult>("post", baseUrlApi("login"), { data });
|
||||
// return http.request<UserResult>("post", baseUrlApi("login"), { data });
|
||||
return http.request<UserResult>("post", authApi("login"), { data });
|
||||
};
|
||||
|
||||
/** 刷新`token` */
|
||||
export const refreshTokenApi = (data?: object) => {
|
||||
return http.request<RefreshTokenResult>("post", "/refresh-token", { data });
|
||||
return http.request<RefreshTokenResult>("post", authApi("/refresh-token"), {
|
||||
data
|
||||
});
|
||||
};
|
||||
|
||||
export const getCaptcha = () => {
|
||||
return http.request<any>("get", authApi("/captcha"));
|
||||
};
|
||||
|
||||
@@ -1,4 +1,39 @@
|
||||
// 第一个代理后端地址
|
||||
export const baseUrlApi = (url: string) => `/base/${url}`;
|
||||
// 第二个代理后端地址
|
||||
export const baseUrlAuthrApi = (url: string) => `/auth/${url}`;
|
||||
import { getToken } from "@/utils/auth";
|
||||
|
||||
// 创建通用请求方法
|
||||
export const request = async (url: string, options: RequestInit = {}) => {
|
||||
const defaultHeaders = {
|
||||
"Content-Type": "application/json"
|
||||
};
|
||||
|
||||
// 获取token
|
||||
const token = getToken();
|
||||
|
||||
// 非登录接口才添加token
|
||||
if (!url.includes("/login") && token) {
|
||||
defaultHeaders["Authorization"] = `Bearer ${token}`; // 添加Bearer前缀
|
||||
}
|
||||
|
||||
const config = {
|
||||
...options,
|
||||
headers: {
|
||||
...defaultHeaders,
|
||||
...options.headers
|
||||
}
|
||||
};
|
||||
|
||||
const response = await fetch(url, config);
|
||||
const data = await response.json();
|
||||
|
||||
if (data.code === 200 || data.status === 200) {
|
||||
return data;
|
||||
} else {
|
||||
throw new Error(data.message || "请求失败");
|
||||
}
|
||||
};
|
||||
|
||||
// API URL 生成器
|
||||
export const authApi = (path: string) => `/auth/${path}`;
|
||||
|
||||
// 登录接口
|
||||
export const loginApi = (path: string) => `/auth/${path}`;
|
||||
|
||||
@@ -8,7 +8,8 @@ export default {
|
||||
meta: {
|
||||
icon: "ep:apple",
|
||||
title: "飞机管理",
|
||||
rank: 5
|
||||
rank: 5,
|
||||
showLink: false
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -8,7 +8,8 @@ export default {
|
||||
meta: {
|
||||
icon: "ep:apple",
|
||||
title: "工具管理",
|
||||
rank: 7
|
||||
rank: 7,
|
||||
showLink: false
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -8,7 +8,8 @@ export default {
|
||||
meta: {
|
||||
icon: "ep:apple",
|
||||
title: "适航资源",
|
||||
rank: 2
|
||||
rank: 2,
|
||||
showLink: false
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
31
src/router/modules/auth.ts
Normal file
31
src/router/modules/auth.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
const Layout = () => import("@/layout/index.vue");
|
||||
|
||||
export default {
|
||||
path: "/auth",
|
||||
name: "res-auth",
|
||||
component: Layout,
|
||||
redirect: "/auth/company",
|
||||
meta: {
|
||||
icon: "ep:apple",
|
||||
title: "auth管理",
|
||||
rank: 1
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/auth/company",
|
||||
name: "company",
|
||||
component: () => import("@/views/auth/company/index.vue"),
|
||||
meta: {
|
||||
title: "公司管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/auth/frontendUser",
|
||||
name: "frontendUser",
|
||||
component: () => import("@/views/auth/frontendUser/index.vue"),
|
||||
meta: {
|
||||
title: "用户管理"
|
||||
}
|
||||
}
|
||||
]
|
||||
} satisfies RouteConfigsTable;
|
||||
65
src/router/modules/biz.ts
Normal file
65
src/router/modules/biz.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
const Layout = () => import("@/layout/index.vue");
|
||||
|
||||
export default {
|
||||
path: "/biz",
|
||||
name: "res-biz",
|
||||
component: Layout,
|
||||
redirect: "/biz/issuanceBid",
|
||||
meta: {
|
||||
icon: "ep:apple",
|
||||
title: "biz管理",
|
||||
rank: 2
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: "/biz/issuanceBid",
|
||||
name: "issuanceBid",
|
||||
component: () => import("@/views/biz/issuanceBid/index.vue"),
|
||||
meta: {
|
||||
icon: "vscode-icons:file-type-biome",
|
||||
title: "招标管理",
|
||||
showParent: true
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/biz/bid",
|
||||
name: "bid",
|
||||
component: () => import("@/views/biz/bid/index.vue"),
|
||||
meta: {
|
||||
title: "投标管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/biz/membershipPoint",
|
||||
name: "membershipPoint",
|
||||
component: () => import("@/views/biz/membershipPoint/index.vue"),
|
||||
meta: {
|
||||
title: "积分管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/biz/pointSpend",
|
||||
name: "pointSpend",
|
||||
component: () => import("@/views/biz/pointSpend/index.vue"),
|
||||
meta: {
|
||||
title: "积分消费记录"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/biz/purchase",
|
||||
name: "purchase",
|
||||
component: () => import("@/views/biz/purchase/index.vue"),
|
||||
meta: {
|
||||
title: "道具管理"
|
||||
}
|
||||
},
|
||||
{
|
||||
path: "/biz/purchaseSpend",
|
||||
name: "purchaseSpend",
|
||||
component: () => import("@/views/biz/purchaseSpend/index.vue"),
|
||||
meta: {
|
||||
title: "道具消费记录"
|
||||
}
|
||||
}
|
||||
]
|
||||
} satisfies RouteConfigsTable;
|
||||
@@ -8,7 +8,8 @@ export default {
|
||||
meta: {
|
||||
icon: "ep:apple",
|
||||
title: "飞行记录",
|
||||
rank: 1
|
||||
rank: 1,
|
||||
showLink: false
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -8,7 +8,8 @@ export default {
|
||||
meta: {
|
||||
icon: "ep:apple",
|
||||
title: "航材管理",
|
||||
rank: 6
|
||||
rank: 6,
|
||||
showLink: false
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -8,7 +8,8 @@ export default {
|
||||
meta: {
|
||||
icon: "ep:apple",
|
||||
title: "资源共享",
|
||||
rank: 3
|
||||
rank: 3,
|
||||
showLink: false
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -8,7 +8,8 @@ export default {
|
||||
meta: {
|
||||
icon: "ep:apple",
|
||||
title: "数据统计",
|
||||
rank: 4
|
||||
rank: 4,
|
||||
showLink: false
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -8,7 +8,8 @@ export default {
|
||||
meta: {
|
||||
icon: "ep:apple",
|
||||
title: "系统管理",
|
||||
rank: 9
|
||||
rank: 9,
|
||||
showLink: false
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -8,7 +8,8 @@ export default {
|
||||
meta: {
|
||||
icon: "ep:apple",
|
||||
title: "人员管理",
|
||||
rank: 8
|
||||
rank: 8,
|
||||
showLink: false
|
||||
},
|
||||
children: [
|
||||
{
|
||||
|
||||
@@ -88,7 +88,7 @@ export const useUserStore = defineStore({
|
||||
});
|
||||
},
|
||||
/** 前端登出(不调用接口) */
|
||||
logOut() {
|
||||
async logOut() {
|
||||
this.username = "";
|
||||
this.roles = [];
|
||||
this.permissions = [];
|
||||
@@ -96,6 +96,7 @@ export const useUserStore = defineStore({
|
||||
useMultiTagsStoreHook().handleTags("equal", [...routerArrays]);
|
||||
resetRouter();
|
||||
router.push("/login");
|
||||
return Promise.resolve();
|
||||
},
|
||||
/** 刷新`token` */
|
||||
async handRefreshToken(data) {
|
||||
@@ -111,6 +112,19 @@ export const useUserStore = defineStore({
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
},
|
||||
/** 设置用户信息 */
|
||||
async setUserInfo(data) {
|
||||
this.username = data.username;
|
||||
this.roles = data.roles || [];
|
||||
// 设置其他用户信息...
|
||||
return Promise.resolve(data);
|
||||
},
|
||||
/** 重置token */
|
||||
resetToken() {
|
||||
removeToken();
|
||||
this.roles = [];
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -124,6 +124,8 @@ export function removeToken() {
|
||||
|
||||
/** 格式化token(jwt格式) */
|
||||
export const formatToken = (token: string): string => {
|
||||
console.log("token", token);
|
||||
console.info("Bearer " + token);
|
||||
return "Bearer " + token;
|
||||
};
|
||||
|
||||
|
||||
9
src/views/auth/backendUser/index.vue
Normal file
9
src/views/auth/backendUser/index.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: "backendUser"
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h1>管理端用户</h1>
|
||||
</template>
|
||||
270
src/views/auth/company/index.vue
Normal file
270
src/views/auth/company/index.vue
Normal file
@@ -0,0 +1,270 @@
|
||||
<script setup lang="ts">
|
||||
import dayjs from "dayjs";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { clone } from "@pureadmin/utils";
|
||||
import PureTableBar from "@/components/RePureTableBar/src/bar";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { request, authApi } from "@/api/utils";
|
||||
import { getToken } from "@/utils/auth";
|
||||
|
||||
defineOptions({
|
||||
name: "company"
|
||||
});
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
height?: string;
|
||||
}>(),
|
||||
{
|
||||
height: null
|
||||
}
|
||||
);
|
||||
|
||||
// 定义查询参数
|
||||
const queryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
companyName: "",
|
||||
companyCode: "",
|
||||
status: ""
|
||||
});
|
||||
|
||||
// 定义表格数据
|
||||
const tableData = ref([]);
|
||||
const loading = ref(false);
|
||||
const total = ref(0);
|
||||
|
||||
// 获取公司列表数据
|
||||
const getCompanyList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const params = { ...queryParams.value };
|
||||
|
||||
console.log(params);
|
||||
|
||||
const data = await request(authApi("companyPage"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify(params)
|
||||
});
|
||||
console.log(data);
|
||||
|
||||
/* tableData.value = data.data.records;
|
||||
total.value = data.data.total; */
|
||||
if (data.status === 200) {
|
||||
tableData.value = data.data.rows;
|
||||
total.value = data.data.records;
|
||||
} else {
|
||||
ElMessage.error(data.msg || "获取数据失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取公司列表失败:", error);
|
||||
ElMessage.error(error.message || "获取数据失败");
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 搜索方法
|
||||
const handleSearch = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getCompanyList();
|
||||
};
|
||||
|
||||
// 重置方法
|
||||
const handleReset = () => {
|
||||
queryParams.value = {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
companyName: "",
|
||||
companyCode: "",
|
||||
status: ""
|
||||
};
|
||||
getCompanyList();
|
||||
};
|
||||
|
||||
// 分页改变
|
||||
const handleSizeChange = (val: number) => {
|
||||
queryParams.value.pageSize = val;
|
||||
getCompanyList();
|
||||
};
|
||||
|
||||
const handleCurrentChange = (val: number) => {
|
||||
queryParams.value.pageNum = val;
|
||||
getCompanyList();
|
||||
};
|
||||
|
||||
const columns: TableColumnList = [
|
||||
{
|
||||
label: "名称",
|
||||
prop: "companyName",
|
||||
width: "260",
|
||||
fixed: true
|
||||
},
|
||||
{
|
||||
label: "编码",
|
||||
prop: "companyCode",
|
||||
width: "260"
|
||||
},
|
||||
{
|
||||
label: "状态",
|
||||
prop: "status",
|
||||
width: "260",
|
||||
slot: "status"
|
||||
},
|
||||
{
|
||||
label: "创建时间",
|
||||
prop: "createTime",
|
||||
width: "260",
|
||||
formatter: row => {
|
||||
return row.createTime
|
||||
? dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||
: "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "操作",
|
||||
fixed: "right",
|
||||
width: "160",
|
||||
slot: "operation"
|
||||
}
|
||||
];
|
||||
|
||||
function handleClick(row) {
|
||||
console.log(row);
|
||||
}
|
||||
|
||||
// 添加编辑和删除方法
|
||||
const handleEdit = row => {
|
||||
console.log("编辑", row);
|
||||
// TODO: 实现编辑逻辑
|
||||
};
|
||||
|
||||
const handleDelete = row => {
|
||||
ElMessageBox.confirm("确认删除该记录?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(async () => {
|
||||
try {
|
||||
// TODO: 调用删除接口
|
||||
ElMessage.success("删除成功");
|
||||
getCompanyList(); // 刷新列表
|
||||
} catch (error) {
|
||||
console.error("删除失败:", error);
|
||||
ElMessage.error(error.message || "删除失败");
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// 取消删除
|
||||
});
|
||||
};
|
||||
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
getCompanyList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="company-container">
|
||||
<div class="search-box">
|
||||
<el-form ref="queryForm" :model="queryParams" :inline="true">
|
||||
<el-form-item label="公司名称" prop="companyName">
|
||||
<el-input
|
||||
v-model="queryParams.companyName"
|
||||
placeholder="请输入公司名称"
|
||||
clearable
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="公司编码" prop="companyCode">
|
||||
<el-input
|
||||
v-model="queryParams.companyCode"
|
||||
placeholder="请输入公司编码"
|
||||
clearable
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
placeholder="请选择状态"
|
||||
clearable
|
||||
class="status-select"
|
||||
>
|
||||
<el-option label="正常" value="1" />
|
||||
<el-option label="异常" value="0" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleSearch">搜索</el-button>
|
||||
<el-button @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<pure-table
|
||||
v-loading="loading"
|
||||
:data="tableData"
|
||||
:columns="columns"
|
||||
:height="height"
|
||||
row-key="id"
|
||||
>
|
||||
<template #status="{ row }">
|
||||
<el-tag :type="row.status === 1 ? 'success' : 'danger'" size="small">
|
||||
{{ row.status === 1 ? "正常" : "异常" }}
|
||||
</el-tag>
|
||||
</template>
|
||||
|
||||
<template #operation="{ row }">
|
||||
<el-button link type="primary" size="small" @click="handleEdit(row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button link type="danger" size="small" @click="handleDelete(row)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</pure-table>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="queryParams.pageNum"
|
||||
v-model:page-size="queryParams.pageSize"
|
||||
:page-sizes="[10, 20, 30, 50]"
|
||||
:total="total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.company-container {
|
||||
padding: 20px;
|
||||
|
||||
.search-box {
|
||||
padding: 20px;
|
||||
margin-bottom: 20px;
|
||||
background: #fff;
|
||||
border-radius: 4px;
|
||||
|
||||
// 取消 el-form-item 的底部边距
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.pagination-container {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.status-select {
|
||||
width: 90px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
278
src/views/auth/frontendUser/index.vue
Normal file
278
src/views/auth/frontendUser/index.vue
Normal file
@@ -0,0 +1,278 @@
|
||||
<script setup lang="ts">
|
||||
import dayjs from "dayjs";
|
||||
import { ref, onMounted } from "vue";
|
||||
import { clone } from "@pureadmin/utils";
|
||||
import PureTableBar from "@/components/RePureTableBar/src/bar";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { request, authApi } from "@/api/utils";
|
||||
import { getToken } from "@/utils/auth";
|
||||
|
||||
defineOptions({
|
||||
name: "frontendUser"
|
||||
});
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
height?: string;
|
||||
}>(),
|
||||
{
|
||||
height: null
|
||||
}
|
||||
);
|
||||
|
||||
// 定义查询参数
|
||||
const queryParams = ref({
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
name: "",
|
||||
nikeName: "",
|
||||
phoneNum: "",
|
||||
companyId: "",
|
||||
email: "",
|
||||
status: ""
|
||||
});
|
||||
|
||||
// 定义表格数据
|
||||
const tableData = ref([]);
|
||||
const loading = ref(false);
|
||||
const total = ref(0);
|
||||
|
||||
// 获得前端用户列表
|
||||
const getUserList = async () => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const params = { ...queryParams.value };
|
||||
|
||||
console.info(params);
|
||||
const data = await request(authApi("frontendUserPage"), {
|
||||
method: "post",
|
||||
body: JSON.stringify(params)
|
||||
});
|
||||
console.log(data);
|
||||
|
||||
if (data.status === 200) {
|
||||
tableData.value = data.data.rows;
|
||||
total.value = data.data.records;
|
||||
} else {
|
||||
ElMessage.error(data.msg || "获取数据失败");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("获取用户列表信息失败:", error);
|
||||
ElMessage.error(error.message || "获取数据失败");
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
// 搜索方法
|
||||
const handleSearch = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getUserList();
|
||||
};
|
||||
|
||||
// 重置方法
|
||||
const handleReset = () => {
|
||||
queryParams.value = {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
name: "",
|
||||
nikeName: "",
|
||||
phoneNum: "",
|
||||
companyId: "",
|
||||
email: "",
|
||||
status: ""
|
||||
};
|
||||
getUserList();
|
||||
};
|
||||
// 分页改变
|
||||
const handleSizeChange = (val: number) => {
|
||||
queryParams.value.pageSize = val;
|
||||
getUserList();
|
||||
};
|
||||
|
||||
const handleCurrentChange = (val: number) => {
|
||||
queryParams.value.pageNum = val;
|
||||
getUserList();
|
||||
};
|
||||
|
||||
const columns: TableColumnList = [
|
||||
{
|
||||
label: "账号",
|
||||
prop: "name",
|
||||
width: "260",
|
||||
fixed: true
|
||||
},
|
||||
{
|
||||
label: "昵称",
|
||||
prop: "nickName",
|
||||
width: "260"
|
||||
},
|
||||
{
|
||||
label: "电话",
|
||||
prop: "phoneNum",
|
||||
width: "260"
|
||||
},
|
||||
{
|
||||
label: "邮件",
|
||||
prop: "email",
|
||||
width: "260"
|
||||
},
|
||||
{
|
||||
label: "所属公司",
|
||||
prop: "companyId",
|
||||
width: "260"
|
||||
},
|
||||
{
|
||||
label: "角色",
|
||||
prop: "roleId",
|
||||
width: "260"
|
||||
},
|
||||
{
|
||||
label: "微信ID",
|
||||
prop: "wxOpenid",
|
||||
width: "260"
|
||||
},
|
||||
{
|
||||
label: "状态",
|
||||
prop: "status",
|
||||
width: "100"
|
||||
},
|
||||
{
|
||||
label: "上次登陆时间",
|
||||
prop: "createTime",
|
||||
width: "260",
|
||||
formatter: row => {
|
||||
return row.createTime
|
||||
? dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||
: "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "创建时间",
|
||||
prop: "createTime",
|
||||
width: "260",
|
||||
formatter: row => {
|
||||
return row.createTime
|
||||
? dayjs(row.createTime).format("YYYY-MM-DD HH:mm:ss")
|
||||
: "";
|
||||
}
|
||||
},
|
||||
{
|
||||
label: "操作",
|
||||
fixed: "right",
|
||||
width: "160",
|
||||
slot: "operation"
|
||||
}
|
||||
];
|
||||
|
||||
function handleClick(row) {
|
||||
console.log(row);
|
||||
}
|
||||
|
||||
// 添加编辑和删除方法
|
||||
const handleEdit = row => {
|
||||
console.log("编辑", row);
|
||||
// TODO: 实现编辑逻辑
|
||||
};
|
||||
|
||||
const handleDelete = row => {
|
||||
ElMessageBox.confirm("确认删除该记录?", "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(async () => {
|
||||
try {
|
||||
// TODO: 调用删除接口
|
||||
ElMessage.success("删除成功");
|
||||
getUserList(); // 刷新列表
|
||||
} catch (error) {
|
||||
console.error("删除失败:", error);
|
||||
ElMessage.error(error.message || "删除失败");
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// 取消删除
|
||||
});
|
||||
};
|
||||
|
||||
// 页面加载时获取数据
|
||||
onMounted(() => {
|
||||
getUserList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="company-container">
|
||||
<div class="search-box">
|
||||
<el-form ref="queryForm" :model="queryParams" :inline="true">
|
||||
<el-form-item label="账号" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入账号"
|
||||
clearable
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="昵称" prop="nickName">
|
||||
<el-input
|
||||
v-model="queryParams.nikeName"
|
||||
placeholder="请输入昵称"
|
||||
clearable
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
placeholder="请选择状态"
|
||||
clearable
|
||||
class="status-select"
|
||||
>
|
||||
<el-option label="正常" value="1" />
|
||||
<el-option label="异常" value="0" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleSearch">搜索</el-button>
|
||||
<el-button @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<pure-table
|
||||
v-loading="loading"
|
||||
:data="tableData"
|
||||
:columns="columns"
|
||||
:height="height"
|
||||
row-key="id"
|
||||
>
|
||||
<template #status="{ row }">
|
||||
<el-tag :type="row.status === 1 ? 'success' : 'danger'" size="small">
|
||||
{{ row.status === 1 ? "正常" : "异常" }}
|
||||
</el-tag>
|
||||
</template>
|
||||
|
||||
<template #operation="{ row }">
|
||||
<el-button link type="primary" size="small" @click="handleEdit(row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button link type="danger" size="small" @click="handleDelete(row)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</pure-table>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="queryParams.pageNum"
|
||||
v-model:page-size="queryParams.pageSize"
|
||||
:page-sizes="[10, 20, 30, 50]"
|
||||
:total="total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
9
src/views/biz/bid/index.vue
Normal file
9
src/views/biz/bid/index.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: "bid"
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h1>投标管理</h1>
|
||||
</template>
|
||||
9
src/views/biz/issuanceBid/index.vue
Normal file
9
src/views/biz/issuanceBid/index.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: "issuanceBid"
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h1>招标管理</h1>
|
||||
</template>
|
||||
9
src/views/biz/membershipPoint/index.vue
Normal file
9
src/views/biz/membershipPoint/index.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: "membershipPoint"
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h1>积分管理</h1>
|
||||
</template>
|
||||
9
src/views/biz/pointSpend/index.vue
Normal file
9
src/views/biz/pointSpend/index.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: "pointSpend"
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h1>积分消费记录</h1>
|
||||
</template>
|
||||
9
src/views/biz/purchase/index.vue
Normal file
9
src/views/biz/purchase/index.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: "purchase"
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h1>道具管理</h1>
|
||||
</template>
|
||||
9
src/views/biz/purchaseSpend/index.vue
Normal file
9
src/views/biz/purchaseSpend/index.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: "purchaseSpend"
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h1>道具消费记录</h1>
|
||||
</template>
|
||||
9
src/views/biz/settings/index.vue
Normal file
9
src/views/biz/settings/index.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: "settings"
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<h1>设置</h1>
|
||||
</template>
|
||||
@@ -12,6 +12,9 @@ import { bg, avatar, illustration } from "./utils/static";
|
||||
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
|
||||
import { ref, reactive, toRaw, onMounted, onBeforeUnmount } from "vue";
|
||||
import { useDataThemeChange } from "@/layout/hooks/useDataThemeChange";
|
||||
import { request, loginApi } from "@/api/utils";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { setToken } from "@/utils/auth";
|
||||
|
||||
import dayIcon from "@/assets/svg/day.svg?component";
|
||||
import darkIcon from "@/assets/svg/dark.svg?component";
|
||||
@@ -39,39 +42,47 @@ const ruleForm = reactive({
|
||||
|
||||
const onLogin = async (formEl: FormInstance | undefined) => {
|
||||
if (!formEl) return;
|
||||
await formEl.validate((valid, fields) => {
|
||||
await formEl.validate(async (valid, fields) => {
|
||||
if (valid) {
|
||||
loading.value = true;
|
||||
useUserStoreHook()
|
||||
.loginByUsername({
|
||||
username: ruleForm.username,
|
||||
password: ruleForm.password,
|
||||
isBackendUser: 1
|
||||
})
|
||||
.then(res => {
|
||||
console.log(res);
|
||||
console.log("res.status = " + res.status);
|
||||
console.log("res.success = " + res.success);
|
||||
// if (res.success) {
|
||||
console.info(typeof res.status);
|
||||
if (res.status) {
|
||||
console.log(res.status);
|
||||
} else {
|
||||
console.info(res);
|
||||
console.error("res.status is undefined");
|
||||
}
|
||||
if (res.status === 200) {
|
||||
// 获取后端路由
|
||||
return initRouter().then(() => {
|
||||
router.push(getTopMenu(true).path).then(() => {
|
||||
message("登录成功", { type: "success" });
|
||||
});
|
||||
});
|
||||
} else {
|
||||
message("登录失败", { type: "error" });
|
||||
}
|
||||
})
|
||||
.finally(() => (loading.value = false));
|
||||
try {
|
||||
const res = await request(loginApi("login"), {
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
username: ruleForm.username,
|
||||
password: ruleForm.password,
|
||||
isBackendUser: 1
|
||||
})
|
||||
});
|
||||
|
||||
console.log("登录响应:", res);
|
||||
|
||||
if (res.status === 200) {
|
||||
console.log("登录成功,开始初始化路由");
|
||||
console.log("accessToken:", res.data.accessToken);
|
||||
|
||||
// 存储token
|
||||
setToken(res.data.accessToken);
|
||||
|
||||
// 更新用户信息
|
||||
const userStore = useUserStoreHook();
|
||||
await userStore.setUserInfo(res.data);
|
||||
|
||||
// 初始化路由
|
||||
await initRouter();
|
||||
|
||||
// 显示成功消息
|
||||
ElMessage.success("登录成功");
|
||||
|
||||
// 跳转到首页
|
||||
await router.push(getTopMenu(true).path);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("登录错误详情:", error);
|
||||
ElMessage.error(error.message || "登录失败");
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
@@ -29,7 +29,25 @@ export default ({ mode }: ConfigEnv): UserConfigExport => {
|
||||
"/base": {
|
||||
target: "http://127.0.0.1:9098",
|
||||
changeOrigin: true,
|
||||
rewrite: path => path.replace(/^\/base/, ""),
|
||||
rewrite: path => path.replace(/^\/base/, "")
|
||||
},
|
||||
// 第二个代理后端地址
|
||||
"/otherApi": {
|
||||
target: "http://127.0.0.1:3290",
|
||||
changeOrigin: true,
|
||||
rewrite: path => path.replace(/^\/otherApi/, "")
|
||||
},
|
||||
// biz 接口
|
||||
"/biz": {
|
||||
target: "http://127.0.0.1:8089",
|
||||
changeOrigin: true,
|
||||
rewrite: path => path.replace(/^\/biz/, "")
|
||||
},
|
||||
// auth 接口
|
||||
"/auth": {
|
||||
target: "http://127.0.0.1:9098",
|
||||
changeOrigin: true,
|
||||
rewrite: path => path.replace(/^\/auth/, "/auth/user/rd"),
|
||||
configure: (proxy, options) => {
|
||||
// 添加调试日志
|
||||
proxy.on("proxyReq", (proxyReq, req, res) => {
|
||||
@@ -52,18 +70,6 @@ export default ({ mode }: ConfigEnv): UserConfigExport => {
|
||||
console.error("代理错误:", err);
|
||||
});
|
||||
}
|
||||
},
|
||||
// 第二个代理后端地址
|
||||
"/otherApi": {
|
||||
target: "http://127.0.0.1:3290",
|
||||
changeOrigin: true,
|
||||
rewrite: path => path.replace(/^\/otherApi/, "")
|
||||
},
|
||||
// 第三个代理后端地址
|
||||
"/biz": {
|
||||
target: "http://127.0.0.1:8089",
|
||||
changeOrigin: true,
|
||||
rewrite: path => path.replace(/^\/biz/, "")
|
||||
}
|
||||
},
|
||||
// 预热文件以提前转换和缓存结果,降低启动期间的初始页面加载时长并防止转换瀑布
|
||||
|
||||
Reference in New Issue
Block a user