diff --git a/activitylink/src/api/manage/user.js b/activitylink/src/api/manage/user.js
new file mode 100644
index 0000000..c98bdb6
--- /dev/null
+++ b/activitylink/src/api/manage/user.js
@@ -0,0 +1,25 @@
+import request from '@/utils/request'
+
+export function getuserList(data) {
+ return request({
+ url: '/admin/isLogin/selectByJwcode',
+ method: 'post',
+ data
+ })
+ }
+
+export function deleteuserByjwcode(data) {
+ return request({
+ url: '/admin/isLogin/deleteUser',
+ method: 'post',
+ data
+ })
+ }
+
+export function adduserByjwcode(data) {
+ return request({
+ url: '/admin/isLogin/addUser',
+ method: 'post',
+ data
+ })
+ }
\ No newline at end of file
diff --git a/activitylink/src/router/index.js b/activitylink/src/router/index.js
index e95e914..97c73a5 100644
--- a/activitylink/src/router/index.js
+++ b/activitylink/src/router/index.js
@@ -1,4 +1,5 @@
import { createRouter, createWebHistory } from 'vue-router'
+import { ElMessageBox, ElMessage } from 'element-plus';
const routes = [
{
path: '/',
@@ -75,5 +76,14 @@ const router = createRouter({
history: createWebHistory('/testBack/'),
routes
})
+
+router.beforeEach((to, from, next) => {
+ const token = localStorage.getItem("token");
+ if (to.name != "homePage" && !token ) {
+ ElMessage.error("请先登录!");
+ next('/homePage');
+ }
+ next();
+})
// 导出
export default router
diff --git a/activitylink/src/utils/request.js b/activitylink/src/utils/request.js
index 78b95ee..2b18d0d 100644
--- a/activitylink/src/utils/request.js
+++ b/activitylink/src/utils/request.js
@@ -1,8 +1,11 @@
import axios from 'axios'
import { ElMessage } from 'element-plus'
-import { getToken } from '@/utils/auth'
+import { getToken , removeToken} from '@/utils/auth'
+// import { useRouter } from "vue-router";
+import router from '@/router'
// 创建基础实例
+// const router = useRouter()
const service = axios.create({
baseURL: import.meta.env.VITE_APP_BASE_API,
timeout: 10000
@@ -25,7 +28,7 @@ service.interceptors.request.use(
}
)
-// 响应拦截器(简化版)
+// 响应拦截器
service.interceptors.response.use(
response => response.data,
error => {
diff --git a/activitylink/src/views/homePage.vue b/activitylink/src/views/homePage.vue
index 68a0a80..49a13e2 100644
--- a/activitylink/src/views/homePage.vue
+++ b/activitylink/src/views/homePage.vue
@@ -3,7 +3,7 @@
@@ -36,7 +39,9 @@ const loginHandler = async () => {
password: password.value
})
// router.push('/zhongchou/mainimg')
- if (response.code === 200 ) {
+ console.log(response)
+
+ if (response.code == 200 ) {
const token = response.data.token
console.log(token)
localStorage.setItem('token', token)
@@ -116,6 +121,16 @@ h2 {
border-radius: 4px;
}
+.form-container .button-group {
+ display: flex;
+ justify-content: space-between; /* 平分空间 */
+ gap: 1rem; /* 按钮之间的间距 */
+}
+
+.form-container .button-group button {
+ flex: 1; /* 让按钮自动扩展以填充容器 */
+}
+
button {
width: 100%;
padding: 0.75rem;
diff --git a/activitylink/src/views/zhongchou/activity/index.vue b/activitylink/src/views/zhongchou/activity/index.vue
index e67d80e..b5fbc6a 100644
--- a/activitylink/src/views/zhongchou/activity/index.vue
+++ b/activitylink/src/views/zhongchou/activity/index.vue
@@ -190,8 +190,10 @@ const getActivityId = () => {
const fetchMarketList = async () => {
try {
const response = await getMarket()
+ console.log('市场列表:', response.data)
if (response.code === 200) {
marketList.value = response.data
+ console.log('市场列表:', response.data)
} else {
console.error('获取市场列表失败:', response.message)
}
diff --git a/activitylink/src/views/zhongchou/index.vue b/activitylink/src/views/zhongchou/index.vue
index c58431f..4f3df3c 100644
--- a/activitylink/src/views/zhongchou/index.vue
+++ b/activitylink/src/views/zhongchou/index.vue
@@ -20,33 +20,34 @@ const handleClose = (key, keyPath) => {
// console.log('菜单关闭:', key, keyPath)
}
-const handleLogout = () => {
- ElMessageBox.confirm('确定要退出登录吗?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- // 点击确定,跳转到登录页
- const response = adminlogout(
- {
- token: localStorage.getItem('token')
- }
- )
- if(response.code === 200)
- {
- router.push('/homePage');
- localStorage.removeItem('token');
- ElMessage.success('退出成功')
- }
- else {
- ElMessage.error('退出失败')
- }
- }).catch(() => {
- // 点击取消,不做任何操作
- ElMessage.info('已取消退出');
- router.back();
- });
-};
+// const handleLogout = () => {
+// ElMessageBox.confirm('确定要退出登录吗?', '提示', {
+// confirmButtonText: '确定',
+// cancelButtonText: '取消',
+// type: 'warning'
+// }).then(async () => {
+// try {
+// const response = await adminlogout({
+// token: localStorage.getItem('token')
+// });
+// console.log('response:', response);
+// // ✅ 正确访问 response.data.code
+// if (response.code == 200) {
+// ElMessage.success('退出成功');
+// localStorage.removeItem('token');
+// router.push('/homePage');
+// } else {
+// ElMessage.error(response.data.message || '退出失败');
+// }
+// } catch (error) {
+// ElMessage.error('请求失败,请稍后再试');
+// console.error('退出错误:', error);
+// }
+// }).catch(() => {
+// router.back()
+// ElMessage.info('已取消退出');
+// });
+// };
@@ -92,13 +93,9 @@ const handleLogout = () => {
- 用户管理
+ 管理员管理
-
-
- 退出登录
-
diff --git a/activitylink/src/views/zhongchou/level/index.vue b/activitylink/src/views/zhongchou/level/index.vue
index 47b6165..ffc7b49 100644
--- a/activitylink/src/views/zhongchou/level/index.vue
+++ b/activitylink/src/views/zhongchou/level/index.vue
@@ -137,8 +137,9 @@ const getLevels = async () => {
pageNum: pagination.value.pageNum,
pageSize: pagination.value.pageSize
})
-
+ console.log(res)
if (res.code === 200) {
+ console.log(res.data)
tableData.value = res.data.list
pagination.value.total = res.data.total
} else {
diff --git a/activitylink/src/views/zhongchou/user/index.vue b/activitylink/src/views/zhongchou/user/index.vue
index 46a2857..2fc71da 100644
--- a/activitylink/src/views/zhongchou/user/index.vue
+++ b/activitylink/src/views/zhongchou/user/index.vue
@@ -4,9 +4,6 @@
用户管理
-
-
-
-
+
-
-
-
+
+
删除
@@ -73,9 +69,6 @@
@closed="cancel"
>
-
-
-
@@ -95,24 +88,17 @@