diff --git a/frontend/.env.example b/frontend/.env.example
index 05619d2..f10294a 100644
--- a/frontend/.env.example
+++ b/frontend/.env.example
@@ -1,3 +1,4 @@
VITE_API_BASE='http://localhost:3001/api' # Use this URL when developing locally
+# VITE_API_BASE='http://172.16.2.31:3001/api'
# VITE_API_BASE="https://$CODESPACE_NAME-3001.$GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN/api" # for GitHub Codespaces
# VITE_API_BASE='/api' # Use this URL deploying on non-localhost address OR in docker.
diff --git a/frontend/src/models/admin.js b/frontend/src/models/admin.js
index 7081fe4..a3895e3 100644
--- a/frontend/src/models/admin.js
+++ b/frontend/src/models/admin.js
@@ -15,6 +15,7 @@ const Admin = {
return [];
});
},
+ // 旧用户
newUser: async (data) => {
return await fetch(`${API_BASE}/admin/users/new`, {
method: "POST",
@@ -27,6 +28,21 @@ const Admin = {
return { user: null, error: e.message };
});
},
+
+ // 用户
+ newUserTo: async (data,depId) => {
+ return await fetch(`${API_BASE}/admin/users/add/${depId}`, {
+ method: "POST",
+ headers: baseHeaders(),
+ body: JSON.stringify(data),
+ })
+ .then((res) => res.json())
+ .catch((e) => {
+ console.error(e);
+ return { user: null, error: e.message };
+ });
+ },
+
updateUser: async (userId, data) => {
return await fetch(`${API_BASE}/admin/user/${userId}`, {
method: "POST",
diff --git a/frontend/src/pages/Admin/Section/index.jsx b/frontend/src/pages/Admin/Section/index.jsx
index feeb2ef..1012e2d 100644
--- a/frontend/src/pages/Admin/Section/index.jsx
+++ b/frontend/src/pages/Admin/Section/index.jsx
@@ -61,7 +61,7 @@ function DepartmentsContainer() {
useEffect(() => {
async function fetchDepartments() {
const _departments = await Admin.depts();
- console.log(1111,_departments);
+ console.log(1111, _departments);
setDepartments(buildTree(_departments)); // 将组织机构列表转换为树状结构
setLoading(false);
}
@@ -85,28 +85,28 @@ function DepartmentsContainer() {
return (
-
-
- 组织机构名称
-
-
- 排序
-
-
- 状态
-
-
- 创建时间
-
-
- 操作
-
-
+
+
+ 组织机构名称
+
+
+ 排序
+
+
+ 状态
+
+
+ 创建时间
+
+
+ 操作
+
+
- {departments.map((dept) => (
-
- ))}
+ {departments.map((dept) => (
+
+ ))}
);
@@ -160,11 +160,10 @@ function DepartmentRow({ dept }) {
{dept.orderNum}
{dept.status === 0 ? "启用" : "停用"}
@@ -239,71 +238,122 @@ function NewDepartmentModal({ closeModal }) {
// 处理表单提交
const handleSubmit = async () => {
await Admin.addDepts(formData);
+ closeModal()
+ window.location.reload();
+ };
+
+ // 取消
+ const handleCancel = () => {
closeModal();
};
return (
-
-
+
+
添加组织机构
-
+
+
{/* 上级组织机构选择器 */}
-
-
+
+
上级组织机构
- setFormData({ ...formData, parentId: value })
- }
+ treeData={treeData}
+ value={formData.parentId}
+ onChange={(value) => setFormData({ ...formData, parentId: value })}
placeholder="请选择上级组织机构"
- className="w-full"
- dropdownStyle={{ maxHeight: 400, overflow: "auto" }}
+ className="w-full rounded-md border-gray-300 hover:border-blue-400 focus:border-blue-500 focus:ring-1 focus:ring-blue-500"
+ dropdownStyle={{
+ maxHeight: 400,
+ overflow: "auto",
+ borderRadius: "6px",
+ boxShadow: "0 2px 8px rgba(0, 0, 0, 0.15)"
+ }}
+ dropdownClassName="bg-white border border-gray-200"
/>
- {/* 组织机构名称输入框 */}
-
- setFormData({ ...formData, deptName: e.target.value })
- }
- className="border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5"
- />
+ {/* 输入框组 */}
+
+
+
+ 组织机构名称
+
+ setFormData({ ...formData, deptName: e.target.value })}
+ className="w-[100%] border border-[#D9D9D9] rounded-md hover:border-blue-400 focus:border-blue-500 pt-[5px] pb-[5px] pl-[10px] text-[14px]"
+ />
+
- {/* 排序输入框 */}
-
- setFormData({ ...formData, orderNum: Number(e.target.value) })
- }
- className="border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5"
- />
+
+
+ 排序
+
+ setFormData({ ...formData, orderNum: Number(e.target.value) })}
+ className="w-[100%] border border-[#D9D9D9] rounded-md hover:border-blue-400 focus:border-blue-500 pt-[5px] pb-[5px] pl-[10px] text-[14px]"
+ />
+
- {/* 状态选择器 */}
-
- setFormData({ ...formData, status: Number(e.target.value) })
- }
- className="border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5"
- >
- 启用
- 停用
-
+
+
+ 状态
+
+ setFormData({ ...formData, status: Number(e.target.value) })}
+ className="w-[100%] border border-[#D9D9D9] rounded-md hover:border-blue-400 focus:border-blue-500 pt-[5px] pb-[5px] pl-[10px] text-[14px]"
+ >
+ 启用
+ 停用
+
+
+
- {/* 保存按钮 */}
- 保存
+
+ {/* 保存按钮 */}
+
+ 保存
+
+
+ {/* 取消按钮 */}
+
+ 取消
+
+
);
+
+ // 通用输入样式 (可添加到全局CSS)
+ // .form-input {
+ // @apply w-full px-3 py-2 border border-gray-300 rounded-md
+ // text-gray-700 text-sm placeholder-gray-400
+ // focus:outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500
+ // transition-all;
+ // }
+
+ // 在样式文件中添加(或使用 tailwind @apply):
+ // .input-field {
+ // @apply w-full px-4 py-2.5 bg-theme-settings-input-bg border border-theme-border rounded-lg
+ // text-theme-text-primary text-sm placeholder-theme-settings-input-placeholder
+ // focus:ring-2 focus:ring-primary-500 focus:border-transparent
+ // transition-all outline-none;
+ // }
}
function EditDepartmentModal({ dept, closeModal, onSuccess }) {
@@ -327,7 +377,7 @@ function EditDepartmentModal({ dept, closeModal, onSuccess }) {
}, []);
const handleSubmit = async () => {
- await Admin.updateDept(dept.deptId,formData); // 调用更新 API
+ await Admin.updateDept(dept.deptId, formData); // 调用更新 API
onSuccess(); // 通知父组件刷新数据
closeModal();
};
diff --git a/frontend/src/pages/Admin/Users/NewUserModal/index.jsx b/frontend/src/pages/Admin/Users/NewUserModal/index.jsx
index 54dab87..d1e3cef 100644
--- a/frontend/src/pages/Admin/Users/NewUserModal/index.jsx
+++ b/frontend/src/pages/Admin/Users/NewUserModal/index.jsx
@@ -1,8 +1,9 @@
-import React, { useState } from "react";
+import React, { useState, useEffect } from "react";
import { X } from "@phosphor-icons/react";
import Admin from "@/models/admin";
import { userFromStorage } from "@/utils/request";
import { MessageLimitInput, RoleHintDisplay } from "..";
+import { Select } from "antd";
export default function NewUserModal({ closeModal }) {
const [error, setError] = useState(null);
@@ -11,6 +12,7 @@ export default function NewUserModal({ closeModal }) {
enabled: false,
limit: 10,
});
+ const [depId, setDepId] = useState([]);
const handleCreate = async (e) => {
setError(null);
@@ -19,13 +21,36 @@ export default function NewUserModal({ closeModal }) {
const form = new FormData(e.target);
for (var [key, value] of form.entries()) data[key] = value;
data.dailyMessageLimit = messageLimit.enabled ? messageLimit.limit : null;
-
- const { user, error } = await Admin.newUser(data);
- if (!!user) window.location.reload();
+ console.log('用户', data);
+ const { user, error } = await Admin.newUserTo(data,depId);
+ // console.log('获取',user);
+ console.log('获取',depId);
+ // if (!!user) window.location.reload();
setError(error);
};
const user = userFromStorage();
+ const [departments, setDepartments] = useState([]);
+ const [treeData, setTreeData] = useState([]);
+
+
+ useEffect(() => {
+ async function fetchDepartments() {
+ const _departments = await Admin.depts();
+ const list = _departments.map(item=>({
+ value:item.deptId,
+ label:item.deptName
+ }))
+ console.log(222222, list);
+ setDepartments(list);
+ }
+ fetchDepartments();
+ }, []);
+
+ const handleChange = (value) => {
+ console.log(value);
+ setDepId(value)
+ };
return (
@@ -33,7 +58,7 @@ export default function NewUserModal({ closeModal }) {
+
+
+
+ 部门
+
+
+ (option?.label ?? '').toLowerCase().includes(input.toLowerCase())
+ }
+ options={departments}
+ />
+
+ 请选择部门
+
+
+
- Role
+ 角色
+
{error &&
Error: {error}
}
- After creating a user they will need to login with their initial
- login to get access.
+ 创建用户后,他们将需要登录他们的首字母
+ 登录获取访问权限.
@@ -135,13 +184,13 @@ export default function NewUserModal({ closeModal }) {
type="button"
className="transition-all duration-300 text-white hover:bg-zinc-700 px-4 py-2 rounded-lg text-sm"
>
- Cancel
+ 取消
- Add user
+ 添加用户
diff --git a/frontend/src/pages/Admin/Users/index.jsx b/frontend/src/pages/Admin/Users/index.jsx
index 125e091..d8eec0c 100644
--- a/frontend/src/pages/Admin/Users/index.jsx
+++ b/frontend/src/pages/Admin/Users/index.jsx
@@ -62,7 +62,7 @@ function UsersContainer() {
useEffect(() => {
async function fetchUsers() {
const _users = await Admin.users();
- console.log(1111,_users);
+ console.log(1111, _users);
setUsers(_users);
setLoading(false);
}
@@ -88,13 +88,13 @@ function UsersContainer() {
- 用户名
+ 用户名
- 角色
+ 角色
- 添加日期
+ 添加日期
{" "}
@@ -112,8 +112,8 @@ function UsersContainer() {
const ROLE_HINT = {
default: [
- "Can only send chats with workspaces they are added to by admin or managers.",
- "Cannot modify any settings at all.",
+ "只能发送由管理员或经理添加到的工作区的聊天记录吗.",
+ "不能修改任何设置.",
],
manager: [
"Can view, create, and delete any workspaces and modify workspace-specific settings.",
@@ -129,7 +129,7 @@ const ROLE_HINT = {
export function RoleHintDisplay({ role }) {
return (
-
Permissions
+
权限
{ROLE_HINT[role ?? "default"].map((hints, i) => {
return (
@@ -150,7 +150,7 @@ export function MessageLimitInput({ enabled, limit, updateState, role }) {
{enabled && (
diff --git a/frontend/src/pages/DataAnalysis/DataAnalysis.css b/frontend/src/pages/DataAnalysis/DataAnalysis.css
index 825593f..dbc6409 100644
--- a/frontend/src/pages/DataAnalysis/DataAnalysis.css
+++ b/frontend/src/pages/DataAnalysis/DataAnalysis.css
@@ -13,12 +13,16 @@
grid-template-rows: 100px 1fr;
}
+.head{
+ position: relative;
+}
+
.head>div:first-child img {
width: 35px;
height: 35px;
position: absolute;
top: 25px;
- left: 140px;
+ left: 0;
cursor: pointer;
}
diff --git a/frontend/src/pages/DataAnalysis/index.jsx b/frontend/src/pages/DataAnalysis/index.jsx
index 04fa6d5..6ffbdd8 100644
--- a/frontend/src/pages/DataAnalysis/index.jsx
+++ b/frontend/src/pages/DataAnalysis/index.jsx
@@ -1,4 +1,5 @@
import React, { useEffect, useState, useRef } from 'react';
+import { useNavigate } from 'react-router-dom';
import './DataAnalysis.css'
import sou from './img/sou.png'
import home from './img/home.png'
@@ -16,7 +17,7 @@ import { message } from "antd";
function DataAnalysis() {
const [renderKey, setRenderKey] = useState();
-
+ const navigate = useNavigate();
const list = [
{
name: '舆情分析',
@@ -78,7 +79,7 @@ function DataAnalysis() {
const bindUrl = (e) => {
console.log(1234, e);
if (e.url) {
- window.location = e.url
+ navigate(e.url)
} else {
message.info({
content: e.name + '开发中...'
@@ -88,7 +89,7 @@ function DataAnalysis() {
const bindUrl1 = () => {
- window.location = "/"
+ navigate("/")
}
return (
diff --git a/frontend/src/pages/Home/home.css b/frontend/src/pages/Home/home.css
index 88e8fe4..e6e9750 100644
--- a/frontend/src/pages/Home/home.css
+++ b/frontend/src/pages/Home/home.css
@@ -1,7 +1,7 @@
-.box {
+.bod_box {
width: 100%;
}
-.box video {
+.bod_box video {
position: absolute;
top: 0;
left: 0;
@@ -69,11 +69,11 @@
.head2 div:nth-child(2) {
margin: 0 20px;
- margin-top: 10px;
+ margin-top: 14px;
}
.head2 div:nth-child(3) {
- margin-top: 10px;
+ margin-top: 14px;
}
@@ -82,7 +82,7 @@
background-size: 100% 100%;
}
-.content {
+.matter {
width: 100%;
top: 0;
bottom: 0;
diff --git a/frontend/src/pages/Home/index.jsx b/frontend/src/pages/Home/index.jsx
index a7337ba..46b79e2 100644
--- a/frontend/src/pages/Home/index.jsx
+++ b/frontend/src/pages/Home/index.jsx
@@ -1,4 +1,5 @@
import { useState, useEffect } from "react";
+import { useNavigate } from 'react-router-dom';
import './home.css'
import videoRef from "./img/bj1.mp4"
import headImg from "./img/head.png"
@@ -14,10 +15,11 @@ import icon7 from "./img/7.png"
import icon8 from "./img/8.png"
+
export default function Home() {
- const [data, setData] = useState(false);
- const weeks = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
- const [renderKey, setRenderKey] = useState(1);
+ const WeekDays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
+ const [currentTime, setCurrentTime] = useState(moment());
+ const navigate = useNavigate();
// 链接类型:1-路由 2-链接 3-建设中 4-点击事件
const list = [
{
@@ -70,29 +72,37 @@ export default function Home() {
},
]
+
// 点击事件
const bindUrl = (e) => {
console.log(1234, e);
if (e.type == 1) {
- window.location = e.url
+ // window.location = e.url
+ navigate(e.url)
} else {
- message.info({
- content: e.name + '开发中...'
- })
+ message.info(`${e.name}功能开发中,敬请期待`)
}
}
- //方法
+ // 更新时间
useEffect(() => {
const timer = setInterval(() => {
- setRenderKey(Math.random());
+ setCurrentTime(moment());
}, 1000);
- // 组件卸载清除定时器
return () => clearInterval(timer);
}, []);
+ // 时间格式化
+ const formatTime = (time) => ({
+ time: time.format('HH:mm:ss'),
+ date: time.format('YYYY年MM月DD日'),
+ week: WeekDays[time.day()]
+ });
+
+ const { time, date, week } = formatTime(currentTime);
+
return (
-
+
{/* 背景视频 */}
@@ -102,12 +112,12 @@ export default function Home() {
阿拉善盟AI行政数据分析与决策参考系统
-
{moment().format('HH:mm:ss')}
-
{moment().format('YYYY年MM月DD日')}
-
{weeks[moment().day()]}
+
{time}
+
{date}
+
{week}
-
+
diff --git a/frontend/src/pages/ReportGeneration/ReportGeneration.css b/frontend/src/pages/ReportGeneration/ReportGeneration.css
index d7f45a0..dbc6409 100644
--- a/frontend/src/pages/ReportGeneration/ReportGeneration.css
+++ b/frontend/src/pages/ReportGeneration/ReportGeneration.css
@@ -12,12 +12,17 @@
display: grid;
grid-template-rows: 100px 1fr;
}
-.head>div:first-child img{
+
+.head{
+ position: relative;
+}
+
+.head>div:first-child img {
width: 35px;
height: 35px;
position: absolute;
top: 25px;
- left: 140px;
+ left: 0;
cursor: pointer;
}
@@ -75,35 +80,47 @@
}
.content2 {
+ width: 100%;
display: grid;
grid-template-rows: 1fr 50px;
box-shadow: 0 0 2px #CFCFCF;
background-color: #fff;
border-radius: 10px;
+ padding: 20px 15px;
}
.content2_1 {
- width: 95%;
- display: grid;
- grid-template-columns: 50px 1fr;
+ width: 100%;
+ display: flex;
column-gap: 20px;
border-bottom: 1px solid #F0F0F5;
- padding: 10px;
}
.nr1 img {
width: 100%;
}
+.nr2 {
+ width: 100%;
+}
+
.nr2 div:first-child {
font-size: 18px;
font-weight: bold;
}
.nr2 div:last-child {
+ width: 100%;
+ height: 60px;
color: #7E807C;
font-size: 14px;
- padding: 5px 0;
+ margin: 5px 0 20px;
+ overflow: hidden;
+ display: -webkit-box;
+ box-sizing: border-box;
+ -webkit-line-clamp: 3;
+ -webkit-box-orient: vertical;
+
}
.content2_2 {
@@ -119,5 +136,4 @@
margin-right: 20px;
border-radius: 5px;
font-size: 14px;
-}
-
+}
\ No newline at end of file
diff --git a/frontend/src/pages/Tendency/Tendency.css b/frontend/src/pages/Tendency/Tendency.css
index d7f45a0..90fdce4 100644
--- a/frontend/src/pages/Tendency/Tendency.css
+++ b/frontend/src/pages/Tendency/Tendency.css
@@ -12,12 +12,16 @@
display: grid;
grid-template-rows: 100px 1fr;
}
-.head>div:first-child img{
+.head{
+ position: relative;
+}
+
+.head>div:first-child img {
width: 35px;
height: 35px;
position: absolute;
top: 25px;
- left: 140px;
+ left: 0;
cursor: pointer;
}
@@ -75,35 +79,47 @@
}
.content2 {
+ width: 100%;
display: grid;
grid-template-rows: 1fr 50px;
box-shadow: 0 0 2px #CFCFCF;
background-color: #fff;
border-radius: 10px;
+ padding: 20px 15px;
}
.content2_1 {
- width: 95%;
- display: grid;
- grid-template-columns: 50px 1fr;
+ width: 100%;
+ display: flex;
column-gap: 20px;
border-bottom: 1px solid #F0F0F5;
- padding: 10px;
}
.nr1 img {
width: 100%;
}
+.nr2 {
+ width: 100%;
+}
+
.nr2 div:first-child {
font-size: 18px;
font-weight: bold;
}
.nr2 div:last-child {
+ width: 100%;
+ height: 60px;
color: #7E807C;
font-size: 14px;
- padding: 5px 0;
+ margin: 5px 0 20px;
+ overflow: hidden;
+ display: -webkit-box;
+ box-sizing: border-box;
+ -webkit-line-clamp: 3;
+ -webkit-box-orient: vertical;
+
}
.content2_2 {
@@ -119,5 +135,4 @@
margin-right: 20px;
border-radius: 5px;
font-size: 14px;
-}
-
+}
\ No newline at end of file
diff --git a/frontend/src/utils/constants.js b/frontend/src/utils/constants.js
index 71f3048..ccf3044 100644
--- a/frontend/src/utils/constants.js
+++ b/frontend/src/utils/constants.js
@@ -1,4 +1,5 @@
-export const API_BASE = import.meta.env.VITE_API_BASE || "/api";
+// export const API_BASE = import.meta.env.VITE_API_BASE || "/api";
+export const API_BASE = 'http://172.16.2.31:3001/api'
export const ONBOARDING_SURVEY_URL = "https://onboarding.anythingllm.com";
export const AUTH_USER = "anythingllm_user";