From 0a94fcffe547aee8fa6b88b4668902bf89532ba8 Mon Sep 17 00:00:00 2001 From: zpc Date: Thu, 11 Sep 2025 18:39:12 +0800 Subject: [PATCH] 32 --- common/server/interface/user.js | 54 ++++++++++- common/server/sq.js | 0 common/server/user.js | 7 +- pages/me/blacklist-page.vue | 166 +++++++++++++++++++++++++------- 4 files changed, 189 insertions(+), 38 deletions(-) create mode 100644 common/server/sq.js diff --git a/common/server/interface/user.js b/common/server/interface/user.js index fcdc80a..71e5b2e 100644 --- a/common/server/interface/user.js +++ b/common/server/interface/user.js @@ -85,4 +85,56 @@ export const editUserInfo = async (nickName, avatar, sex, birthday) => { return true; } return false; -} \ No newline at end of file +} + +/** + * 获取黑名单列表 + * @returns {Promise} + */ +export const getMyBlackList = async () => { + const res = await request.get("user/GetMyBlackList"); + if (res.code == 0) { + return res.data; + } + return null; +} + +/** + * 添加黑名单 + * @param {*} userId 要拉黑的用户ID + * @returns {Promise} + */ +export const addUserBlack = async (userId) => { + const res = await request.post("user/AddUserBlack", { id: userId }); + if (res.code == 0) { + return true; + } + return false; +} + +/** + * 取消拉黑名单 + * @param {*} userId 要取消拉黑的用户ID + * @returns {Promise} + */ +export const cancelUserBlack = async (userId) => { + const res = await request.post("user/CancelUserBlack", { id: userId }); + if (res.code == 0) { + return true; + } + return false; +} + +export const userInterface = { + getAnonymousLogin, + ueWxPhoneNumberLogin, + anonymousLogin, + useWxAnonymousLogin, + getUserInfo, + editUserInfo, + getMyBlackList, + addUserBlack, + cancelUserBlack +} + + diff --git a/common/server/sq.js b/common/server/sq.js new file mode 100644 index 0000000..e69de29 diff --git a/common/server/user.js b/common/server/user.js index d678335..74e55c8 100644 --- a/common/server/user.js +++ b/common/server/user.js @@ -1,5 +1,5 @@ // 导入用户相关的接口函数 -import { getUserInfo, editUserInfo, anonymousLogin as anonymousLoginInterface } from '@/common/server/interface/user' +import { getUserInfo, editUserInfo, anonymousLogin as anonymousLoginInterface, userInterface } from '@/common/server/interface/user' import { ref } from 'vue' import throttle from 'lodash/throttle'; @@ -150,4 +150,7 @@ export const anonymousLogin = async () => { console.error('匿名登录失败:', error); clearUserStorage(); } -}; \ No newline at end of file +}; + + + \ No newline at end of file diff --git a/pages/me/blacklist-page.vue b/pages/me/blacklist-page.vue index 4523854..46277ca 100644 --- a/pages/me/blacklist-page.vue +++ b/pages/me/blacklist-page.vue @@ -1,71 +1,167 @@ - \ No newline at end of file