diff --git a/src/api/demands.js b/src/api/demands.js index b8e0ba7..096cea8 100644 --- a/src/api/demands.js +++ b/src/api/demands.js @@ -75,4 +75,27 @@ export const deleteDemand = async (id) => { console.error('删除需求失败:', error); throw error; } -}; \ No newline at end of file +}; + +/** + * 添加需求回复 + * @param {number} id - 需求ID + * @param {Object} replyData - 回复数据 + * @param {string} replyData.reply - 回复内容 + * @returns {Promise} 返回添加回复的响应数据 + * 说明:会将回复内容与用户qq拼接在一起,格式qq:内容|qq:内容 + */ +export const addDemandReply = async (id, replyData) => { + try { + const payload = { + id: id, + reply: replyData.reply + }; + console.log('添加需求回复的数据:', payload); + const response = await axiosInstance.put('/demands/reply', payload); + return response.data; + } catch (error) { + console.error('添加需求回复失败:', error); + throw error; + } +}; diff --git a/src/views/backend/Dashboard.vue b/src/views/backend/Dashboard.vue index 3463083..bb4083a 100644 --- a/src/views/backend/Dashboard.vue +++ b/src/views/backend/Dashboard.vue @@ -69,6 +69,7 @@
+
@@ -79,6 +80,7 @@ import { ref, onMounted, computed, onUnmounted } from 'vue' import { useRouter } from 'vue-router' import { getUserInfo } from '@/utils/jwt' import AdminEditUserPrivilege from '@/components/backend/AdminEditUserPrivilege.vue' +import AffairManagement from '@/components/backend/AffairManagement.vue' const router = useRouter() const hasToken = ref(false) @@ -91,7 +93,11 @@ const dropdownOpen3 = ref(false) let privilegeCheckTimer = null const isAdmin = computed(() => { - return currentUserData.value && currentUserData.value.privilege === 'lv-admin'; + return currentUserData.value && ( + currentUserData.value.privilege === 'lv-admin' || + currentUserData.value.privilege === 'lv-user' || + currentUserData.value.privilege === 'admin' + ); }) async function checkPrivilege() { @@ -106,7 +112,7 @@ async function checkPrivilege() { try { const userInfo = await getUserInfo(); currentUserData.value = userInfo; - if (!userInfo || userInfo.privilege !== 'lv-admin') { + if (!userInfo || (userInfo.privilege !== 'lv-admin' && userInfo.privilege !== 'lv-user' && userInfo.privilege !== 'admin')) { // 退出登录并跳转首页 localStorage.removeItem('access_token') currentUserData.value = null diff --git a/src/views/index.vue b/src/views/index.vue index 0bee3d1..8f1c6eb 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -602,4 +602,84 @@ const showCompetitionMenu = computed(() => showCompetition.value) background-color: #f5f5f5; color: #416bdf; } + +@media (max-width: 768px) { + /* 整体导航栏布局 */ + .nav-container { + flex-direction: column; + align-items: stretch; + } + + .nav-brand { + text-align: center; + margin-right: 0; + } + + /* 固定汉堡菜单按钮到右上角 */ + .mobile-menu-toggle { + position: fixed; + top: 10px; + right: 12px; + z-index: 1002; + background-color: rgba(0, 0, 0, 0.1); + border-radius: 50%; + padding: 8px; + height: 40px; + width: 40px; + display: flex; + align-items: center; + justify-content: center; + } + + /* 移动端菜单展开后的容器样式 */ + .nav-left.active, + .nav-right.active { + display: flex !important; /* 由脚本控制,我们只定义样式 */ + flex-direction: column; + width: 100%; + gap: 5px; + padding: 10px 0; + } + + .nav-right { + margin-left: 0; + } + + /* 调整下拉菜单在一级菜单内的定位方式 */ + .nav-dropdown { + position: static; + } + + /* 下拉菜单内容区的移动端样式 */ + .dropdown-content { + position: static; /* 覆盖桌面端的 absolute 定位 */ + background-color: transparent; + box-shadow: none; + border-radius: 0; + padding: 8px 0 8px 15px; /* 子菜单缩进 */ + margin-top: 5px; + border-left: 2px solid rgba(255, 255, 255, 0.15); + min-width: unset; + width: 100%; + } + + /* 下拉菜单中的链接在移动端的样式 */ + .dropdown-content .nav-link { + color: rgba(255, 255, 255, 0.9); + font-weight: normal; + } + + .dropdown-content .nav-link:hover { + color: #fff; + background-color: rgba(255, 255, 255, 0.1); + } + + /* 用户登录/信息区域的移动端样式 */ + .login-btn, + .user-info-nav { + width: 100%; + justify-content: center; + margin: 5px 0; + } +} \ No newline at end of file diff --git a/src/views/index/DemandList.vue b/src/views/index/DemandList.vue index 3c4fb33..a8fdb6e 100644 --- a/src/views/index/DemandList.vue +++ b/src/views/index/DemandList.vue @@ -22,7 +22,7 @@ - + {{ index + 1 }} 匿名 @@ -55,13 +55,6 @@