From d342f1f0c42d84c38711b3b096d48423cc27daa6 Mon Sep 17 00:00:00 2001
From: aaron <>
Date: Tue, 21 Jan 2025 16:28:19 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=94=A8=E6=88=B7=E5=88=97?=
=?UTF-8?q?=E8=A1=A8=20=E5=88=97=E9=A1=BA=E5=BA=8F=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Dockerfile | 2 +-
nginx.conf | 91 +++++++++++++++++++++++--------------
src/views/user/UserList.vue | 80 ++++++++++++++++++--------------
3 files changed, 103 insertions(+), 70 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index d7c8ebc..f093ed4 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -39,7 +39,7 @@ RUN mkdir -p /var/cache/nginx/client_temp \
&& chown -R nginx:nginx /var/cache/nginx
# 复制 nginx 配置
-COPY nginx.conf /etc/nginx/conf.d/default.conf
+COPY nginx.conf /etc/nginx/nginx.conf
# 从构建阶段复制构建结果
COPY --from=builder /app/dist /usr/share/nginx/html
diff --git a/nginx.conf b/nginx.conf
index d68e7a4..4c0c54e 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -1,41 +1,64 @@
-server {
- listen 80;
- server_name localhost;
-
- # 添加 gzip 压缩
- gzip on;
- gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
-
- # 设置客户端最大body大小
- client_max_body_size 20M;
+# 移除 user 指令,因为我们以非 root 用户运行
+worker_processes auto;
+pid /var/run/nginx.pid;
- root /usr/share/nginx/html;
- index index.html;
+events {
+ worker_connections 1024;
+}
- # 支持 history 路由模式
- location / {
- try_files $uri $uri/ /index.html;
- add_header Cache-Control "no-cache, no-store, must-revalidate";
- }
+http {
+ include /etc/nginx/mime.types;
+ default_type application/octet-stream;
- # 缓存静态资源
- location /assets {
- expires 1y;
- add_header Cache-Control "public, no-transform";
- access_log off;
- }
+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
+ '$status $body_bytes_sent "$http_referer" '
+ '"$http_user_agent" "$http_x_forwarded_for"';
- # 禁止访问 . 文件
- location ~ /\. {
- deny all;
- access_log off;
- log_not_found off;
- }
+ access_log /var/log/nginx/access.log main;
+ error_log /var/log/nginx/error.log warn;
- # 错误页面配置
- error_page 404 /index.html;
- error_page 500 502 503 504 /50x.html;
- location = /50x.html {
- root /usr/share/nginx/html;
+ sendfile on;
+ keepalive_timeout 65;
+ gzip on;
+
+ server {
+ listen 80;
+ server_name localhost;
+
+ # 添加 gzip 压缩
+ gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
+
+ # 设置客户端最大body大小
+ client_max_body_size 20M;
+
+ root /usr/share/nginx/html;
+ index index.html;
+
+ # 支持 history 路由模式
+ location / {
+ try_files $uri $uri/ /index.html;
+ add_header Cache-Control "no-cache, no-store, must-revalidate";
+ }
+
+ # 缓存静态资源
+ location /assets {
+ expires 1y;
+ add_header Cache-Control "public, no-transform";
+ access_log off;
+ }
+
+ # 禁止访问 . 文件
+ location ~ /\. {
+ deny all;
+ access_log off;
+ log_not_found off;
+ }
+
+ # 错误页面配置
+ error_page 404 /index.html;
+ error_page 500 502 503 504 /50x.html;
+ location = /50x.html {
+ root /usr/share/nginx/html;
+ }
}
}
\ No newline at end of file
diff --git a/src/views/user/UserList.vue b/src/views/user/UserList.vue
index 9084c03..3f25d28 100644
--- a/src/views/user/UserList.vue
+++ b/src/views/user/UserList.vue
@@ -87,9 +87,14 @@
- {{ record.community_name || '-' }}
-
- 修改
+
+ {{ record.community_name }}
+
+
+ 未设置
+
+
+ {{ record.community_name ? '修改' : '设置' }}
@@ -147,21 +152,27 @@
-
+
@@ -198,13 +209,13 @@ export default defineComponent({
const columns = [
{
- title: '用户ID',
+ title: 'ID',
dataIndex: 'userid',
key: 'userid',
width: 80,
},
{
- title: '用户名',
+ title: '昵称',
dataIndex: 'nickname',
key: 'nickname',
width: 120,
@@ -216,13 +227,7 @@ export default defineComponent({
width: 120,
},
{
- title: '角色',
- dataIndex: 'roles',
- key: 'roles',
- width: 200,
- },
- {
- title: '用户编号',
+ title: '邀请码',
dataIndex: 'user_code',
key: 'user_code',
width: 120,
@@ -234,18 +239,24 @@ export default defineComponent({
width: 80,
align: 'right',
},
+ {
+ title: '角色',
+ dataIndex: 'roles',
+ key: 'roles',
+ width: 200,
+ },
+ {
+ title: '归属小区',
+ dataIndex: 'community_name',
+ key: 'community_name',
+ width: 250,
+ },
{
title: '创建时间',
dataIndex: 'create_time',
key: 'create_time',
width: 180,
},
- {
- title: '所属小区',
- dataIndex: 'community_name',
- key: 'community_name',
- width: 200
- },
{
title: '操作',
key: 'action',
@@ -603,21 +614,20 @@ export default defineComponent({
}
:deep(.ant-tag) {
- margin: 2px;
+ min-width: 80px;
+ text-align: center;
+ margin-right: 0;
}
-:deep(.ant-checkbox-group) {
+:deep(.ant-space) {
display: flex;
- flex-direction: column;
- gap: 8px;
+ align-items: center;
}
-:deep(.ant-checkbox-wrapper) {
- margin-left: 0 !important;
-}
-
-:deep(.ant-checkbox-wrapper + .ant-checkbox-wrapper) {
- margin-left: 0 !important;
+:deep(.ant-btn-link) {
+ padding: 0 4px;
+ height: 24px;
+ line-height: 24px;
}
.table-filter {