mirror of https://github.com/rocboss/paopao-ce
parent
c97f143cac
commit
bfffadf820
@ -1,440 +0,0 @@
|
|||||||
import { request } from '@/utils/request';
|
|
||||||
|
|
||||||
/** 获取验证码 */
|
|
||||||
export const getCaptcha = (
|
|
||||||
params: NetParams.UserGetCaptcha = {},
|
|
||||||
): Promise<NetReq.UserGetCaptcha> => {
|
|
||||||
return request({
|
|
||||||
method: 'get',
|
|
||||||
url: '/v1/captcha',
|
|
||||||
params,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发送短信验证码
|
|
||||||
* @param {Object} data
|
|
||||||
* @returns Promise
|
|
||||||
*/
|
|
||||||
export const sendCaptcha = (data: any) => {
|
|
||||||
return request({
|
|
||||||
method: 'post',
|
|
||||||
url: '/v1/captcha',
|
|
||||||
data,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发送用户私信
|
|
||||||
* @param {Object} data
|
|
||||||
* @returns Promise
|
|
||||||
*/
|
|
||||||
export const sendUserWhisper = (
|
|
||||||
data: NetParams.UserWhisper,
|
|
||||||
): Promise<NetParams.UserWhisper> => {
|
|
||||||
return request({
|
|
||||||
method: 'post',
|
|
||||||
url: '/v1/user/whisper',
|
|
||||||
data,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加朋友申请
|
|
||||||
* @param {Object} data
|
|
||||||
* @returns Promise
|
|
||||||
*/
|
|
||||||
export const requestingFriend = (
|
|
||||||
data: NetParams.RequestingFriend,
|
|
||||||
): Promise<NetReq.RequestingFriend> => {
|
|
||||||
return request({
|
|
||||||
method: 'post',
|
|
||||||
url: '/v1/friend/requesting',
|
|
||||||
data,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加好友
|
|
||||||
* @param {Object} data
|
|
||||||
* @returns Promise
|
|
||||||
*/
|
|
||||||
export const addFriend = (
|
|
||||||
data: NetParams.AddFriend,
|
|
||||||
): Promise<NetReq.AddFriend> => {
|
|
||||||
return request({
|
|
||||||
method: 'post',
|
|
||||||
url: '/v1/friend/add',
|
|
||||||
data,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 关注 用户
|
|
||||||
export const followUser = (
|
|
||||||
data: NetParams.FollowUserReq,
|
|
||||||
): Promise<NetReq.FollowUserResp> => {
|
|
||||||
return request({
|
|
||||||
method: 'post',
|
|
||||||
url: '/v1/user/follow',
|
|
||||||
data,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 取消关注 用户
|
|
||||||
export const unfollowUser = (
|
|
||||||
data: NetParams.UnfollowUserReq,
|
|
||||||
): Promise<NetReq.UnfollowUserResp> => {
|
|
||||||
return request({
|
|
||||||
method: 'post',
|
|
||||||
url: '/v1/user/unfollow',
|
|
||||||
data,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取关注列表
|
|
||||||
* @param {Object} params
|
|
||||||
* @returns Promise
|
|
||||||
*/
|
|
||||||
export const getUserFollows = (
|
|
||||||
params: NetParams.GetUserFollows,
|
|
||||||
): Promise<NetReq.GetContacts> => {
|
|
||||||
return request({
|
|
||||||
method: 'get',
|
|
||||||
url: '/v1/user/follows',
|
|
||||||
params,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取粉丝列表
|
|
||||||
* @param {Object} params
|
|
||||||
* @returns Promise
|
|
||||||
*/
|
|
||||||
export const getUserFollowings = (
|
|
||||||
params: NetParams.GetUserFollowings,
|
|
||||||
): Promise<NetReq.GetContacts> => {
|
|
||||||
return request({
|
|
||||||
method: 'get',
|
|
||||||
url: '/v1/user/followings',
|
|
||||||
params,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 拒绝朋友申请
|
|
||||||
* @param {Object} data
|
|
||||||
* @returns Promise
|
|
||||||
*/
|
|
||||||
export const rejectFriend = (
|
|
||||||
data: NetParams.RejectFriend,
|
|
||||||
): Promise<NetReq.RejectFriend> => {
|
|
||||||
return request({
|
|
||||||
method: 'post',
|
|
||||||
url: '/v1/friend/reject',
|
|
||||||
data,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除好友
|
|
||||||
* @param {Object} data
|
|
||||||
* @returns Promise
|
|
||||||
*/
|
|
||||||
export const deleteFriend = (
|
|
||||||
data: NetParams.DeleteFriend,
|
|
||||||
): Promise<NetReq.DeleteFriend> => {
|
|
||||||
return request({
|
|
||||||
method: 'post',
|
|
||||||
url: '/v1/friend/delete',
|
|
||||||
data,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取联系人列表
|
|
||||||
* @param {Object} data
|
|
||||||
* @returns Promise
|
|
||||||
*/
|
|
||||||
export const getContacts = (
|
|
||||||
data: NetParams.GetContacts,
|
|
||||||
): Promise<NetReq.GetContacts> => {
|
|
||||||
return request({
|
|
||||||
method: 'post',
|
|
||||||
url: '/v1/user/contacts',
|
|
||||||
data,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 绑定用户手机
|
|
||||||
* @param {Object} data
|
|
||||||
* @returns Promise
|
|
||||||
*/
|
|
||||||
export const bindUserPhone = (
|
|
||||||
data: NetParams.UserBindUserPhone,
|
|
||||||
): Promise<NetParams.UserBindUserPhone> => {
|
|
||||||
return request({
|
|
||||||
method: 'post',
|
|
||||||
url: '/v1/user/phone',
|
|
||||||
data,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 激活码激活
|
|
||||||
* @param {Object} data
|
|
||||||
* @returns Promise
|
|
||||||
*/
|
|
||||||
export const activateUser = (
|
|
||||||
data: NetParams.UserActivation,
|
|
||||||
): Promise<NetParams.UserActivation> => {
|
|
||||||
return request({
|
|
||||||
method: 'post',
|
|
||||||
url: '/v1/user/activate',
|
|
||||||
data,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 更改密码 */
|
|
||||||
export const changePassword = (
|
|
||||||
data: NetParams.UserChangePassword,
|
|
||||||
): Promise<NetReq.UserChangePassword> => {
|
|
||||||
return request({
|
|
||||||
method: 'post',
|
|
||||||
url: '/v1/user/password',
|
|
||||||
data,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 更改昵称 */
|
|
||||||
export const changeNickname = (
|
|
||||||
data: NetParams.UserChangeNickname,
|
|
||||||
): Promise<NetReq.UserChangeNickname> => {
|
|
||||||
return request({
|
|
||||||
method: 'post',
|
|
||||||
url: '/v1/user/nickname',
|
|
||||||
data,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更改头像
|
|
||||||
* @param {Object} data
|
|
||||||
* @returns Promise
|
|
||||||
*/
|
|
||||||
export const changeAvatar = (data: any) => {
|
|
||||||
return request({
|
|
||||||
method: 'post',
|
|
||||||
url: '/v1/user/avatar',
|
|
||||||
data,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 获取未读消息数 */
|
|
||||||
export const getUnreadMsgCount = (
|
|
||||||
params: NetParams.UserGetUnreadMsgCount = {},
|
|
||||||
): Promise<NetReq.UserGetUnreadMsgCount> => {
|
|
||||||
return request({
|
|
||||||
method: 'get',
|
|
||||||
url: '/v1/user/msgcount/unread',
|
|
||||||
params,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 获取消息列表 */
|
|
||||||
export const getMessages = (
|
|
||||||
params: NetParams.UserGetMessages,
|
|
||||||
): Promise<NetReq.UserGetMessages> => {
|
|
||||||
return request({
|
|
||||||
method: 'get',
|
|
||||||
url: '/v1/user/messages',
|
|
||||||
params,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 阅读消息
|
|
||||||
* @param {Object} data
|
|
||||||
* @returns Promise
|
|
||||||
*/
|
|
||||||
export const readMessage = (
|
|
||||||
data: NetParams.ReadMessageReq,
|
|
||||||
): Promise<NetReq.ReadMessageResp> => {
|
|
||||||
return request({
|
|
||||||
method: 'post',
|
|
||||||
url: '/v1/user/message/read',
|
|
||||||
data,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 阅读所有消息
|
|
||||||
* @returns Promise
|
|
||||||
*/
|
|
||||||
export const readAllMessage = (): Promise<NetReq.ReadAllMessageResp> => {
|
|
||||||
return request({
|
|
||||||
method: 'post',
|
|
||||||
url: '/v1/user/message/readall',
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 获取收藏列表 */
|
|
||||||
export const getCollections = (
|
|
||||||
params: NetParams.UserGetCollections,
|
|
||||||
): Promise<NetReq.UserGetCollections> => {
|
|
||||||
return request({
|
|
||||||
method: 'get',
|
|
||||||
url: '/v1/user/collections',
|
|
||||||
params,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 获取用户基础信息 */
|
|
||||||
export const getUserProfile = (
|
|
||||||
params: NetParams.UserGetUserProfile,
|
|
||||||
): Promise<NetReq.UserGetUserProfile> => {
|
|
||||||
return request({
|
|
||||||
method: 'get',
|
|
||||||
url: '/v1/user/profile',
|
|
||||||
params,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 获取用户帖子列表 */
|
|
||||||
export const getUserPosts = (
|
|
||||||
params: NetParams.UserGetUserPosts,
|
|
||||||
): Promise<NetReq.UserGetUserPosts> => {
|
|
||||||
return request({
|
|
||||||
method: 'get',
|
|
||||||
url: '/v1/user/posts',
|
|
||||||
params,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/** 获取账单列表 */
|
|
||||||
export const getBills = (
|
|
||||||
params: NetParams.UserGetBills,
|
|
||||||
): Promise<NetReq.UserGetBills> => {
|
|
||||||
return request({
|
|
||||||
method: 'get',
|
|
||||||
url: '/v1/user/wallet/bills',
|
|
||||||
params,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 发起充值请求
|
|
||||||
* @param {Object} data
|
|
||||||
* @returns Promise
|
|
||||||
*/
|
|
||||||
export const reqRecharge = (
|
|
||||||
data: NetParams.UserReqRecharge,
|
|
||||||
): Promise<NetReq.UserReqRecharge> => {
|
|
||||||
return request({
|
|
||||||
method: 'post',
|
|
||||||
url: '/v1/user/recharge',
|
|
||||||
data,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取充值状态
|
|
||||||
* @param {Object} params
|
|
||||||
* @returns Promise
|
|
||||||
*/
|
|
||||||
export const getRecharge = (
|
|
||||||
params: NetParams.UserGetRecharge,
|
|
||||||
): Promise<NetReq.UserGetRecharge> => {
|
|
||||||
return request({
|
|
||||||
method: 'get',
|
|
||||||
url: '/v1/user/recharge',
|
|
||||||
params,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取推荐用户
|
|
||||||
* @param {Object} params
|
|
||||||
* @returns Promise
|
|
||||||
*/
|
|
||||||
export const getSuggestUsers = (params: {
|
|
||||||
k: string;
|
|
||||||
}): Promise<NetReq.UserGetSuggestUsers> => {
|
|
||||||
return request({
|
|
||||||
method: 'get',
|
|
||||||
url: '/v1/suggest/users',
|
|
||||||
params,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取推荐用户
|
|
||||||
* @param {Object} params
|
|
||||||
* @returns Promise
|
|
||||||
*/
|
|
||||||
export const getSuggestTags = (params: {
|
|
||||||
k: string;
|
|
||||||
}): Promise<NetReq.UserGetSuggestTags> => {
|
|
||||||
return request({
|
|
||||||
method: 'get',
|
|
||||||
url: '/v1/suggest/tags',
|
|
||||||
params,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取附件
|
|
||||||
* @param {Object} params
|
|
||||||
* @returns Promise
|
|
||||||
*/
|
|
||||||
export const precheckAttachment = (
|
|
||||||
params: NetParams.UserPrecheckAttachment,
|
|
||||||
): Promise<NetReq.UserPrecheckAttachment> => {
|
|
||||||
return request({
|
|
||||||
method: 'get',
|
|
||||||
url: '/v1/attachment/precheck',
|
|
||||||
params,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取附件
|
|
||||||
* @param {Object} params
|
|
||||||
* @returns Promise
|
|
||||||
*/
|
|
||||||
export const getAttachment = (
|
|
||||||
params: NetParams.UserGetAttachment,
|
|
||||||
): Promise<NetReq.UserGetAttachment> => {
|
|
||||||
return request({
|
|
||||||
method: 'get',
|
|
||||||
url: '/v1/attachment',
|
|
||||||
params,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 管理·用户禁言/解禁
|
|
||||||
* @param {Object} data
|
|
||||||
* @returns Promise
|
|
||||||
*/
|
|
||||||
export const changeUserStatus = (
|
|
||||||
data: NetParams.UserStatusReq,
|
|
||||||
): Promise<NetReq.UserChangeStatus> => {
|
|
||||||
return request({
|
|
||||||
method: 'post',
|
|
||||||
url: '/v1/admin/user/status',
|
|
||||||
data,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取站点状态信息
|
|
||||||
* @returns Promise
|
|
||||||
*/
|
|
||||||
export const getSiteInfo = (): Promise<NetReq.SiteInfoResp> => {
|
|
||||||
return request({
|
|
||||||
method: 'get',
|
|
||||||
url: '/v1/admin/site/status',
|
|
||||||
});
|
|
||||||
};
|
|
||||||
@ -1,201 +0,0 @@
|
|||||||
import { createStore } from 'vuex';
|
|
||||||
|
|
||||||
export default createStore({
|
|
||||||
state: {
|
|
||||||
refresh: Date.now(),
|
|
||||||
refreshTopicFollow: Date.now(),
|
|
||||||
theme: localStorage.getItem('PAOPAO_THEME'),
|
|
||||||
collapsedLeft: document.body.clientWidth <= 821,
|
|
||||||
collapsedRight: document.body.clientWidth <= 821,
|
|
||||||
drawerModelShow: document.body.clientWidth <= 821,
|
|
||||||
desktopModelShow: document.body.clientWidth > 821,
|
|
||||||
authModalShow: false,
|
|
||||||
authModelTab: 'signin',
|
|
||||||
unreadMsgCount: 0,
|
|
||||||
userLogined: false,
|
|
||||||
userInfo: {
|
|
||||||
id: 0,
|
|
||||||
username: '',
|
|
||||||
nickname: '',
|
|
||||||
created_on: 0,
|
|
||||||
follows: 0,
|
|
||||||
followings: 0,
|
|
||||||
tweets_count: 0,
|
|
||||||
is_admin: false,
|
|
||||||
},
|
|
||||||
profile: {
|
|
||||||
useFriendship: true,
|
|
||||||
enableTrendsBar: true,
|
|
||||||
enableWallet: false,
|
|
||||||
allowTweetAttachment: true,
|
|
||||||
allowTweetAttachmentPrice: true,
|
|
||||||
allowTweetVideo: true,
|
|
||||||
allowUserRegister: true,
|
|
||||||
allowPhoneBind: true,
|
|
||||||
defaultTweetMaxLength: 2000,
|
|
||||||
tweetWebEllipsisSize: 400,
|
|
||||||
tweetMobileEllipsisSize: 300,
|
|
||||||
defaultTweetVisibility: 'friend',
|
|
||||||
defaultMsgLoopInterval: 5000,
|
|
||||||
copyrightTop: '2023 paopao.info',
|
|
||||||
copyrightLeft: "Roc's Me",
|
|
||||||
copyrightLeftLink: '',
|
|
||||||
copyrightRight: '泡泡(PaoPao)开源社区',
|
|
||||||
copyrightRightLink: 'https://www.paopao.info',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
mutations: {
|
|
||||||
refresh(state, refresh) {
|
|
||||||
state.refresh = refresh || Date.now();
|
|
||||||
},
|
|
||||||
refreshTopicFollow(state) {
|
|
||||||
state.refreshTopicFollow = Date.now();
|
|
||||||
},
|
|
||||||
updateUnreadMsgCount(state, count) {
|
|
||||||
state.unreadMsgCount = count;
|
|
||||||
},
|
|
||||||
triggerTheme(state, theme) {
|
|
||||||
state.theme = theme;
|
|
||||||
},
|
|
||||||
triggerAuth(state, status) {
|
|
||||||
state.authModalShow = status;
|
|
||||||
},
|
|
||||||
triggerAuthKey(state, key) {
|
|
||||||
state.authModelTab = key;
|
|
||||||
},
|
|
||||||
triggerCollapsedLeft(state, status) {
|
|
||||||
state.collapsedLeft = status;
|
|
||||||
state.drawerModelShow = status;
|
|
||||||
state.desktopModelShow = !status;
|
|
||||||
},
|
|
||||||
triggerCollapsedRight(state, status) {
|
|
||||||
state.collapsedRight = status;
|
|
||||||
},
|
|
||||||
updateUserinfo(state, data) {
|
|
||||||
state.userInfo = data;
|
|
||||||
if (state.userInfo.id > 0) {
|
|
||||||
state.userLogined = true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
loadDefaultSiteProfile(state) {
|
|
||||||
state.profile.useFriendship =
|
|
||||||
import.meta.env.VITE_USE_FRIENDSHIP.toLowerCase() === 'true';
|
|
||||||
|
|
||||||
state.profile.enableTrendsBar =
|
|
||||||
import.meta.env.VITE_ENABLE_TRENDS_BAR.toLowerCase() === 'true';
|
|
||||||
|
|
||||||
state.profile.enableWallet =
|
|
||||||
import.meta.env.VITE_ENABLE_WALLET.toLocaleLowerCase() === 'true';
|
|
||||||
|
|
||||||
state.profile.allowTweetAttachment =
|
|
||||||
import.meta.env.VITE_ALLOW_TWEET_ATTACHMENT.toLowerCase() === 'true';
|
|
||||||
|
|
||||||
state.profile.allowTweetAttachmentPrice =
|
|
||||||
import.meta.env.VITE_ALLOW_TWEET_ATTACHMENT_PRICE.toLowerCase() ===
|
|
||||||
'true';
|
|
||||||
|
|
||||||
state.profile.allowTweetVideo =
|
|
||||||
import.meta.env.VITE_ALLOW_TWEET_VIDEO.toLowerCase() === 'true';
|
|
||||||
|
|
||||||
state.profile.allowUserRegister =
|
|
||||||
import.meta.env.VITE_ALLOW_USER_REGISTER.toLowerCase() === 'true';
|
|
||||||
|
|
||||||
state.profile.allowPhoneBind =
|
|
||||||
import.meta.env.VITE_ALLOW_PHONE_BIND.toLowerCase() === 'true';
|
|
||||||
|
|
||||||
state.profile.defaultTweetMaxLength = Number(
|
|
||||||
import.meta.env.VITE_DEFAULT_TWEET_MAX_LENGTH,
|
|
||||||
);
|
|
||||||
|
|
||||||
state.profile.tweetWebEllipsisSize = Number(
|
|
||||||
import.meta.env.VITE_TWEET_WEB_ELLIPSIS_SIZE,
|
|
||||||
);
|
|
||||||
|
|
||||||
state.profile.tweetMobileEllipsisSize = Number(
|
|
||||||
import.meta.env.VITE_TWEET_MOBILE_ELLIPSIS_SIZE,
|
|
||||||
);
|
|
||||||
|
|
||||||
state.profile.defaultTweetVisibility =
|
|
||||||
import.meta.env.VITE_DEFAULT_TWEET_VISIBILITY.toLowerCase();
|
|
||||||
|
|
||||||
state.profile.defaultMsgLoopInterval = Number(
|
|
||||||
import.meta.env.VITE_DEFAULT_MSG_LOOP_INTERVAL,
|
|
||||||
);
|
|
||||||
|
|
||||||
state.profile.copyrightTop = import.meta.env.VITE_COPYRIGHT_TOP;
|
|
||||||
|
|
||||||
state.profile.copyrightLeft = import.meta.env.VITE_COPYRIGHT_LEFT;
|
|
||||||
|
|
||||||
state.profile.copyrightLeftLink =
|
|
||||||
import.meta.env.VITE_COPYRIGHT_LEFT_LINK;
|
|
||||||
|
|
||||||
state.profile.copyrightRight = import.meta.env.VITE_COPYRIGHT_RIGHT;
|
|
||||||
state.profile.copyrightRightLink =
|
|
||||||
import.meta.env.VITE_COPYRIGHT_RIGHT_LINK;
|
|
||||||
},
|
|
||||||
updateSiteProfile(state, data) {
|
|
||||||
const p = state.profile;
|
|
||||||
state.profile.useFriendship = data.use_friendship ?? p.useFriendship;
|
|
||||||
|
|
||||||
state.profile.enableTrendsBar =
|
|
||||||
data.enable_trends_bar ?? p.enableTrendsBar;
|
|
||||||
|
|
||||||
state.profile.enableWallet = data.enable_wallet ?? p.enableWallet;
|
|
||||||
|
|
||||||
state.profile.allowTweetAttachment =
|
|
||||||
data.allow_tweet_attachment ?? p.allowTweetAttachment;
|
|
||||||
|
|
||||||
state.profile.allowTweetAttachmentPrice =
|
|
||||||
data.allow_tweet_attachment_price ?? p.allowTweetAttachmentPrice;
|
|
||||||
|
|
||||||
state.profile.allowTweetVideo =
|
|
||||||
data.allow_tweet_video ?? p.allowTweetVideo;
|
|
||||||
|
|
||||||
state.profile.allowUserRegister =
|
|
||||||
data.allow_user_register ?? p.allowUserRegister;
|
|
||||||
|
|
||||||
state.profile.allowPhoneBind = data.allow_phone_bind ?? p.allowPhoneBind;
|
|
||||||
|
|
||||||
state.profile.defaultTweetMaxLength =
|
|
||||||
data.default_tweet_max_length ?? p.defaultTweetMaxLength;
|
|
||||||
|
|
||||||
state.profile.tweetWebEllipsisSize =
|
|
||||||
data.tweet_web_ellipsis_size ?? p.tweetWebEllipsisSize;
|
|
||||||
|
|
||||||
state.profile.tweetMobileEllipsisSize =
|
|
||||||
data.tweet_mobile_ellipsis_size ?? p.tweetMobileEllipsisSize;
|
|
||||||
|
|
||||||
state.profile.defaultTweetVisibility =
|
|
||||||
data.default_tweet_visibility ?? p.defaultTweetVisibility;
|
|
||||||
|
|
||||||
state.profile.defaultMsgLoopInterval =
|
|
||||||
data.default_msg_loop_interval ?? p.defaultMsgLoopInterval;
|
|
||||||
|
|
||||||
state.profile.copyrightTop = data.copyright_top ?? p.copyrightTop;
|
|
||||||
state.profile.copyrightLeft = data.copyright_left ?? p.copyrightLeft;
|
|
||||||
|
|
||||||
state.profile.copyrightLeftLink =
|
|
||||||
data.copyright_left_link ?? p.copyrightLeftLink;
|
|
||||||
|
|
||||||
state.profile.copyrightRight = data.copyright_right ?? p.copyrightRight;
|
|
||||||
state.profile.copyrightRightLink =
|
|
||||||
data.copyright_right_link ?? p.copyrightRightLink;
|
|
||||||
},
|
|
||||||
userLogout(state) {
|
|
||||||
localStorage.removeItem('PAOPAO_TOKEN');
|
|
||||||
state.userInfo = {
|
|
||||||
id: 0,
|
|
||||||
nickname: '',
|
|
||||||
username: '',
|
|
||||||
created_on: 0,
|
|
||||||
follows: 0,
|
|
||||||
followings: 0,
|
|
||||||
tweets_count: 0,
|
|
||||||
is_admin: false,
|
|
||||||
};
|
|
||||||
state.userLogined = false;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
actions: {},
|
|
||||||
modules: {},
|
|
||||||
});
|
|
||||||
@ -0,0 +1,70 @@
|
|||||||
|
import { defineStore } from 'pinia';
|
||||||
|
import { reactive, ref } from 'vue';
|
||||||
|
|
||||||
|
export const useStoreMain = defineStore('main', () => {
|
||||||
|
const refresh = ref(Date.now());
|
||||||
|
const refreshTopicFollow = ref(Date.now());
|
||||||
|
const theme = ref(localStorage.getItem('PAOPAO_THEME'));
|
||||||
|
const collapsedLeft = ref(document.body.clientWidth <= 821);
|
||||||
|
const collapsedRight = ref(document.body.clientWidth <= 821);
|
||||||
|
const drawerModelShow = ref(document.body.clientWidth <= 821);
|
||||||
|
const desktopModelShow = ref(document.body.clientWidth > 821);
|
||||||
|
const authModalShow = ref(false);
|
||||||
|
const authModelTab = ref('signin');
|
||||||
|
const unreadMsgCount = ref(0);
|
||||||
|
|
||||||
|
function doRefresh(val?: number) {
|
||||||
|
refresh.value = val || Date.now();
|
||||||
|
}
|
||||||
|
|
||||||
|
function doRefreshTopicFollow() {
|
||||||
|
refreshTopicFollow.value = Date.now();
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateUnreadMsgCount(count: number) {
|
||||||
|
unreadMsgCount.value = count;
|
||||||
|
}
|
||||||
|
|
||||||
|
function triggerTheme(t: string) {
|
||||||
|
theme.value = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
function triggerAuth(status: boolean) {
|
||||||
|
authModalShow.value = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
function triggerAuthKey(key: string) {
|
||||||
|
authModelTab.value = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
function triggerCollapsedLeft(status: boolean) {
|
||||||
|
collapsedLeft.value = status;
|
||||||
|
drawerModelShow.value = status;
|
||||||
|
desktopModelShow.value = !status;
|
||||||
|
}
|
||||||
|
|
||||||
|
function triggerCollapsedRight(status: boolean) {
|
||||||
|
collapsedRight.value = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
refresh,
|
||||||
|
refreshTopicFollow,
|
||||||
|
theme,
|
||||||
|
collapsedLeft,
|
||||||
|
collapsedRight,
|
||||||
|
drawerModelShow,
|
||||||
|
desktopModelShow,
|
||||||
|
authModalShow,
|
||||||
|
authModelTab,
|
||||||
|
unreadMsgCount,
|
||||||
|
doRefresh,
|
||||||
|
doRefreshTopicFollow,
|
||||||
|
updateUnreadMsgCount,
|
||||||
|
triggerTheme,
|
||||||
|
triggerAuth,
|
||||||
|
triggerAuthKey,
|
||||||
|
triggerCollapsedLeft,
|
||||||
|
triggerCollapsedRight,
|
||||||
|
};
|
||||||
|
});
|
||||||
@ -0,0 +1,131 @@
|
|||||||
|
import { defineStore } from "pinia";
|
||||||
|
import { ref } from "vue";
|
||||||
|
|
||||||
|
export const useStoreProfile = defineStore("profile", () => {
|
||||||
|
|
||||||
|
const profile = ref({
|
||||||
|
useFriendship: true,
|
||||||
|
enableTrendsBar: true,
|
||||||
|
enableWallet: false,
|
||||||
|
allowTweetAttachment: true,
|
||||||
|
allowTweetAttachmentPrice: true,
|
||||||
|
allowTweetVideo: true,
|
||||||
|
allowUserRegister: true,
|
||||||
|
allowPhoneBind: true,
|
||||||
|
defaultTweetMaxLength: 2000,
|
||||||
|
tweetWebEllipsisSize: 400,
|
||||||
|
tweetMobileEllipsisSize: 300,
|
||||||
|
defaultTweetVisibility: 'friend',
|
||||||
|
defaultMsgLoopInterval: 5000,
|
||||||
|
copyrightTop: '2023 paopao.info',
|
||||||
|
copyrightLeft: "Roc's Me",
|
||||||
|
copyrightLeftLink: '',
|
||||||
|
copyrightRight: '泡泡(PaoPao)开源社区',
|
||||||
|
copyrightRightLink: 'https://www.paopao.info',
|
||||||
|
});
|
||||||
|
|
||||||
|
function loadDefaultSiteProfile() {
|
||||||
|
profile.value.useFriendship =
|
||||||
|
import.meta.env.VITE_USE_FRIENDSHIP.toLowerCase() === 'true';
|
||||||
|
|
||||||
|
profile.value.enableTrendsBar =
|
||||||
|
import.meta.env.VITE_ENABLE_TRENDS_BAR.toLowerCase() === 'true';
|
||||||
|
|
||||||
|
profile.value.enableWallet =
|
||||||
|
import.meta.env.VITE_ENABLE_WALLET.toLowerCase() === 'true';
|
||||||
|
|
||||||
|
profile.value.allowTweetAttachment =
|
||||||
|
import.meta.env.VITE_ALLOW_TWEET_ATTACHMENT.toLowerCase() === 'true';
|
||||||
|
|
||||||
|
profile.value.allowTweetAttachmentPrice =
|
||||||
|
import.meta.env.VITE_ALLOW_TWEET_ATTACHMENT_PRICE.toLowerCase() === 'true';
|
||||||
|
|
||||||
|
profile.value.allowTweetVideo =
|
||||||
|
import.meta.env.VITE_ALLOW_TWEET_VIDEO.toLowerCase() === 'true';
|
||||||
|
|
||||||
|
profile.value.allowUserRegister =
|
||||||
|
import.meta.env.VITE_ALLOW_USER_REGISTER.toLowerCase() === 'true';
|
||||||
|
|
||||||
|
profile.value.allowPhoneBind =
|
||||||
|
import.meta.env.VITE_ALLOW_PHONE_BIND.toLowerCase() === 'true';
|
||||||
|
|
||||||
|
profile.value.defaultTweetMaxLength = Number(
|
||||||
|
import.meta.env.VITE_DEFAULT_TWEET_MAX_LENGTH,
|
||||||
|
);
|
||||||
|
|
||||||
|
profile.value.tweetWebEllipsisSize = Number(
|
||||||
|
import.meta.env.VITE_TWEET_WEB_ELLIPSIS_SIZE,
|
||||||
|
);
|
||||||
|
|
||||||
|
profile.value.tweetMobileEllipsisSize = Number(
|
||||||
|
import.meta.env.VITE_TWEET_MOBILE_ELLIPSIS_SIZE,
|
||||||
|
);
|
||||||
|
|
||||||
|
profile.value.defaultTweetVisibility =
|
||||||
|
import.meta.env.VITE_DEFAULT_TWEET_VISIBILITY.toLowerCase();
|
||||||
|
|
||||||
|
profile.value.defaultMsgLoopInterval = Number(
|
||||||
|
import.meta.env.VITE_DEFAULT_MSG_LOOP_INTERVAL,
|
||||||
|
);
|
||||||
|
|
||||||
|
profile.value.copyrightTop = import.meta.env.VITE_COPYRIGHT_TOP;
|
||||||
|
|
||||||
|
profile.value.copyrightLeft = import.meta.env.VITE_COPYRIGHT_LEFT;
|
||||||
|
|
||||||
|
profile.value.copyrightLeftLink = import.meta.env.VITE_COPYRIGHT_LEFT_LINK;
|
||||||
|
|
||||||
|
profile.value.copyrightRight = import.meta.env.VITE_COPYRIGHT_RIGHT;
|
||||||
|
profile.value.copyrightRightLink = import.meta.env.VITE_COPYRIGHT_RIGHT_LINK;
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateSiteProfile(data: Record<string, any>) {
|
||||||
|
profile.value.useFriendship = data.use_friendship ?? profile.value.useFriendship;
|
||||||
|
|
||||||
|
profile.value.enableTrendsBar = data.enable_trends_bar ?? profile.value.enableTrendsBar;
|
||||||
|
|
||||||
|
profile.value.enableWallet = data.enable_wallet ?? profile.value.enableWallet;
|
||||||
|
|
||||||
|
profile.value.allowTweetAttachment =
|
||||||
|
data.allow_tweet_attachment ?? profile.value.allowTweetAttachment;
|
||||||
|
|
||||||
|
profile.value.allowTweetAttachmentPrice =
|
||||||
|
data.allow_tweet_attachment_price ?? profile.value.allowTweetAttachmentPrice;
|
||||||
|
|
||||||
|
profile.value.allowTweetVideo = data.allow_tweet_video ?? profile.value.allowTweetVideo;
|
||||||
|
|
||||||
|
profile.value.allowUserRegister =
|
||||||
|
data.allow_user_register ?? profile.value.allowUserRegister;
|
||||||
|
|
||||||
|
profile.value.allowPhoneBind = data.allow_phone_bind ?? profile.value.allowPhoneBind;
|
||||||
|
|
||||||
|
profile.value.defaultTweetMaxLength =
|
||||||
|
data.default_tweet_max_length ?? profile.value.defaultTweetMaxLength;
|
||||||
|
|
||||||
|
profile.value.tweetWebEllipsisSize =
|
||||||
|
data.tweet_web_ellipsis_size ?? profile.value.tweetWebEllipsisSize;
|
||||||
|
|
||||||
|
profile.value.tweetMobileEllipsisSize =
|
||||||
|
data.tweet_mobile_ellipsis_size ?? profile.value.tweetMobileEllipsisSize;
|
||||||
|
|
||||||
|
profile.value.defaultTweetVisibility =
|
||||||
|
data.default_tweet_visibility ?? profile.value.defaultTweetVisibility;
|
||||||
|
|
||||||
|
profile.value.defaultMsgLoopInterval =
|
||||||
|
data.default_msg_loop_interval ?? profile.value.defaultMsgLoopInterval;
|
||||||
|
|
||||||
|
profile.value.copyrightTop = data.copyright_top ?? profile.value.copyrightTop;
|
||||||
|
profile.value.copyrightLeft = data.copyright_left ?? profile.value.copyrightLeft;
|
||||||
|
|
||||||
|
profile.value.copyrightLeftLink = data.copyright_left_link ?? profile.value.copyrightLeftLink;
|
||||||
|
|
||||||
|
profile.value.copyrightRight = data.copyright_right ?? profile.value.copyrightRight;
|
||||||
|
profile.value.copyrightRightLink =
|
||||||
|
data.copyright_right_link ?? profile.value.copyrightRightLink;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
profile,
|
||||||
|
loadDefaultSiteProfile, updateSiteProfile,
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
import { defineStore } from "pinia";
|
||||||
|
import { computed, ref } from "vue";
|
||||||
|
|
||||||
|
/** 本地存储的用户令牌键名 */
|
||||||
|
export const TOKEN_KEY = 'PAOPAO_TOKEN';
|
||||||
|
|
||||||
|
export const useStoreUser = defineStore('user', () => {
|
||||||
|
const userInfo = ref<Record<string, any>>({
|
||||||
|
id: 0,
|
||||||
|
username: '',
|
||||||
|
nickname: '',
|
||||||
|
created_on: 0,
|
||||||
|
follows: 0,
|
||||||
|
followings: 0,
|
||||||
|
tweets_count: 0,
|
||||||
|
is_admin: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
const userLogined = computed(() => userInfo.value.id > 0);
|
||||||
|
|
||||||
|
function updateUserinfo(data: Record<string, any>) {
|
||||||
|
userInfo.value = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
function userLogout() {
|
||||||
|
localStorage.removeItem(TOKEN_KEY);
|
||||||
|
userInfo.value = {
|
||||||
|
id: 0,
|
||||||
|
nickname: '',
|
||||||
|
username: '',
|
||||||
|
created_on: 0,
|
||||||
|
follows: 0,
|
||||||
|
followings: 0,
|
||||||
|
tweets_count: 0,
|
||||||
|
is_admin: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
userInfo,
|
||||||
|
userLogined,
|
||||||
|
updateUserinfo, userLogout,
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
interface Api {
|
||||||
|
|
||||||
|
v1: {
|
||||||
|
auth: Api.Auth.Api;
|
||||||
|
user: Api.User.Api;
|
||||||
|
friend: Api.Friend.Api;
|
||||||
|
captcha: Api.Captcha.Api;
|
||||||
|
attachment: Api.Attachment.Api;
|
||||||
|
|
||||||
|
suggest: Api.Suggest.Api;
|
||||||
|
admin: Api.Admin.Api;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
declare namespace Api {
|
||||||
|
|
||||||
|
namespace Admin {
|
||||||
|
|
||||||
|
interface Api {
|
||||||
|
post: {
|
||||||
|
user: {
|
||||||
|
/** 管理·用户禁言/解禁 */
|
||||||
|
status: (params: NetParams.UserStatusReq) => Promise<NetReq.UserChangeStatus>;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
get: {
|
||||||
|
site: {
|
||||||
|
/** 获取站点状态信息 */
|
||||||
|
status: () => Promise<NetReq.SiteInfoResp>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace NetParams {
|
||||||
|
|
||||||
|
interface UserStatusReq {
|
||||||
|
id: number;
|
||||||
|
status: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace NetReq {
|
||||||
|
interface UserChangeStatus {}
|
||||||
|
|
||||||
|
interface SiteInfoResp {
|
||||||
|
register_user_count: number;
|
||||||
|
online_user_count: number;
|
||||||
|
history_max_online: number;
|
||||||
|
server_up_time: number;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
declare namespace Api {
|
||||||
|
|
||||||
|
namespace Attachment {
|
||||||
|
|
||||||
|
interface Api {
|
||||||
|
get: {
|
||||||
|
/** 获取附件 */
|
||||||
|
_self: (params: NetParams.UserGetAttachment) => Promise<NetReq.UserGetAttachment>;
|
||||||
|
/** 获取附件 */
|
||||||
|
precheck: (params: NetParams.UserPrecheckAttachment) => Promise<NetReq.UserPrecheckAttachment>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace NetParams {
|
||||||
|
|
||||||
|
interface UserGetAttachment {
|
||||||
|
id: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UserPrecheckAttachment {
|
||||||
|
id: number;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace NetReq {
|
||||||
|
|
||||||
|
interface UserGetAttachment {
|
||||||
|
signed_url: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UserPrecheckAttachment {
|
||||||
|
paid: number;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,42 @@
|
|||||||
|
declare namespace Api {
|
||||||
|
|
||||||
|
namespace Auth {
|
||||||
|
|
||||||
|
interface Api {
|
||||||
|
post: {
|
||||||
|
/** 用户登录 */
|
||||||
|
login: (params: NetParams.AuthUserLogin) => Promise<NetReq.AuthUserLogin>;
|
||||||
|
/** 用户注册 */
|
||||||
|
register: (params: NetParams.AuthUserRegister) => Promise<NetReq.AuthUserRegister>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace NetParams {
|
||||||
|
interface AuthUserLogin {
|
||||||
|
/** 用户名 */
|
||||||
|
username: string;
|
||||||
|
/** 密码 */
|
||||||
|
password: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface AuthUserRegister extends AuthUserLogin {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace NetReq {
|
||||||
|
interface AuthUserLogin {
|
||||||
|
token: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface AuthUserRegister {
|
||||||
|
/** 用户UID */
|
||||||
|
id: number;
|
||||||
|
/** 用户名 */
|
||||||
|
username: string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,38 @@
|
|||||||
|
declare namespace Api {
|
||||||
|
|
||||||
|
namespace Captcha {
|
||||||
|
|
||||||
|
interface Api {
|
||||||
|
get: {
|
||||||
|
/** 获取验证码 */
|
||||||
|
_self: (params: NetParams.UserGetCaptcha) => Promise<NetReq.UserGetCaptcha>;
|
||||||
|
},
|
||||||
|
post: {
|
||||||
|
/** 发送验证码 */
|
||||||
|
_self: (data: NetParams.UserPostCaptcha) => Promise<void>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace NetParams {
|
||||||
|
|
||||||
|
interface UserGetCaptcha {}
|
||||||
|
|
||||||
|
interface UserPostCaptcha {
|
||||||
|
phone: string;
|
||||||
|
img_captcha: string;
|
||||||
|
img_captcha_id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace NetReq {
|
||||||
|
interface UserGetCaptcha {
|
||||||
|
id: string;
|
||||||
|
/** 头像图片 base64 */
|
||||||
|
b64s: string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,44 @@
|
|||||||
|
declare namespace Api {
|
||||||
|
|
||||||
|
namespace Friend {
|
||||||
|
|
||||||
|
interface Api {
|
||||||
|
post: {
|
||||||
|
/** 添加朋友申请 */
|
||||||
|
requesting: (data: NetParams.RequestingFriend) => Promise<NetReq.RequestingFriend>;
|
||||||
|
/** 添加好友 */
|
||||||
|
add: (data: NetParams.AddFriend) => Promise<NetReq.AddFriend>;
|
||||||
|
/** 拒绝朋友申请 */
|
||||||
|
reject: (data: NetParams.RejectFriend) => Promise<NetReq.RejectFriend>;
|
||||||
|
/** 删除好友 */
|
||||||
|
delete: (data: NetParams.DeleteFriend) => Promise<NetReq.DeleteFriend>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace NetParams {
|
||||||
|
|
||||||
|
interface RequestingFriend {
|
||||||
|
user_id: number;
|
||||||
|
greetings: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface AddFriend {
|
||||||
|
user_id: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface RejectFriend extends AddFriend {}
|
||||||
|
interface DeleteFriend extends AddFriend {}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace NetReq {
|
||||||
|
|
||||||
|
interface RequestingFriend {}
|
||||||
|
|
||||||
|
interface AddFriend {}
|
||||||
|
interface RejectFriend {}
|
||||||
|
interface DeleteFriend {}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
declare namespace Api {
|
||||||
|
|
||||||
|
namespace Suggest {
|
||||||
|
|
||||||
|
interface Api {
|
||||||
|
get: {
|
||||||
|
/** 获取推荐用户 */
|
||||||
|
users: (params: NetParams.GetSuggestUsers) => Promise<NetReq.UserGetSuggestUsers>;
|
||||||
|
/** 获取推荐用户 */
|
||||||
|
tags: (params: NetParams.GetSuggestTags) => Promise<NetReq.UserGetSuggestTags>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace NetParams {
|
||||||
|
interface GetSuggestUsers {
|
||||||
|
k: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface GetSuggestTags extends GetSuggestUsers {}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace NetReq {
|
||||||
|
interface UserGetSuggestUsers {
|
||||||
|
suggest: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UserGetSuggestTags {
|
||||||
|
suggest: string[];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,224 @@
|
|||||||
|
declare namespace Api {
|
||||||
|
|
||||||
|
namespace User {
|
||||||
|
|
||||||
|
interface Api {
|
||||||
|
get: {
|
||||||
|
/** 获取用户基础信息 */
|
||||||
|
profile: (params: NetParams.UserGetUserProfile) => Promise<NetReq.UserGetUserProfile>;
|
||||||
|
/** 获取关注列表 */
|
||||||
|
follows: (params: NetParams.GetUserFollows) => Promise<NetReq.GetContacts>;
|
||||||
|
/** 获取粉丝列表 */
|
||||||
|
followings: (params: NetParams.GetUserFollowings) => Promise<NetReq.GetContacts>;
|
||||||
|
msgcount: {
|
||||||
|
/** 获取未读消息数 */
|
||||||
|
unread: (params: NetParams.UserGetUnreadMsgCount) => Promise<NetReq.UserGetUnreadMsgCount>;
|
||||||
|
};
|
||||||
|
/** 获取消息列表 */
|
||||||
|
messages: (params: NetParams.UserGetMessages) => Promise<NetReq.UserGetMessages>;
|
||||||
|
/** 获取收藏列表 */
|
||||||
|
collections: (params: NetParams.UserGetCollections) => Promise<NetReq.UserGetCollections>;
|
||||||
|
/** 获取用户帖子列表 */
|
||||||
|
posts: (params: NetParams.UserGetUserPosts) => Promise<NetReq.UserGetUserPosts>;
|
||||||
|
wallet: {
|
||||||
|
/** 获取账单列表 */
|
||||||
|
bills: (params: NetParams.UserGetBills) => Promise<NetReq.UserGetBills>;
|
||||||
|
}
|
||||||
|
/** 获取充值状态 */
|
||||||
|
recharge: (params: NetParams.UserGetRecharge) => Promise<NetReq.UserGetRecharge>;
|
||||||
|
},
|
||||||
|
post: {
|
||||||
|
/** 发送用户私信 */
|
||||||
|
whisper: (data: NetParams.UserWhisper) => Promise<NetParams.UserWhisper>;
|
||||||
|
/** 关注用户 */
|
||||||
|
follow: (data: NetParams.FollowUserReq) => Promise<NetReq.FollowUserResp>;
|
||||||
|
/** 取消关注用户 */
|
||||||
|
unfollow: (data: NetParams.UnfollowUserReq) => Promise<NetReq.UnfollowUserResp>;
|
||||||
|
/** 获取联系人列表 */
|
||||||
|
contacts: (params: NetParams.GetContacts) => Promise<NetReq.GetContacts>;
|
||||||
|
/** 绑定用户手机 */
|
||||||
|
phone: (data: NetParams.UserBindUserPhone) => Promise<NetParams.UserBindUserPhone>;
|
||||||
|
/** 激活码激活 */
|
||||||
|
activate: (data: NetParams.UserActivation) => Promise<NetParams.UserActivation>;
|
||||||
|
/** 更改密码 */
|
||||||
|
password: (data: NetParams.UserChangePassword) => Promise<NetReq.UserChangePassword>;
|
||||||
|
/** 更改昵称 */
|
||||||
|
nickname: (data: NetParams.UserChangeNickname) => Promise<NetReq.UserChangeNickname>;
|
||||||
|
/** 更改头像 */
|
||||||
|
avatar: (data: NetParams.UserChangeAvatar) => Promise<void>;
|
||||||
|
/** 发起充值请求 */
|
||||||
|
recharge: (data: NetParams.UserReqRecharge) => Promise<NetReq.UserReqRecharge>;
|
||||||
|
},
|
||||||
|
/** 信息相关 */
|
||||||
|
message: {
|
||||||
|
post: {
|
||||||
|
/** 阅读消息 */
|
||||||
|
read: (data: NetParams.ReadMessageReq) => Promise<NetReq.ReadMessageResp>;
|
||||||
|
/** 阅读所有消息 */
|
||||||
|
readall: () => Promise<NetReq.ReadAllMessageResp>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace NetParams {
|
||||||
|
|
||||||
|
interface UserGetUserProfile {
|
||||||
|
username: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UserWhisper {
|
||||||
|
user_id: number;
|
||||||
|
content: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface FollowUserReq {
|
||||||
|
user_id: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UnfollowUserReq extends FollowUserReq {}
|
||||||
|
|
||||||
|
interface GetUserFollows {
|
||||||
|
username: string;
|
||||||
|
page: number;
|
||||||
|
page_size: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface GetUserFollowings extends GetUserFollows {}
|
||||||
|
|
||||||
|
interface GetContacts {
|
||||||
|
page: number;
|
||||||
|
page_size: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UserBindUserPhone {
|
||||||
|
phone: string;
|
||||||
|
captcha: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UserActivation {
|
||||||
|
activate_code: string;
|
||||||
|
captcha_id: string;
|
||||||
|
imgCaptcha: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UserChangePassword {
|
||||||
|
/** 新密码 */
|
||||||
|
password: string;
|
||||||
|
/** 旧密码 */
|
||||||
|
old_password: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UserChangeNickname {
|
||||||
|
/** 昵称 */
|
||||||
|
nickname: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UserChangeAvatar {
|
||||||
|
/** 头像图片 */
|
||||||
|
avatar: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UserGetUnreadMsgCount {}
|
||||||
|
|
||||||
|
interface UserGetMessages {
|
||||||
|
style: 'all' | 'system' | 'whisper' | 'requesting' | 'unread';
|
||||||
|
page: number;
|
||||||
|
page_size: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ReadMessageReq {
|
||||||
|
id: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UserGetCollections {
|
||||||
|
page: number;
|
||||||
|
page_size: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UserGetUserPosts {
|
||||||
|
username: string;
|
||||||
|
style: string;
|
||||||
|
page: number;
|
||||||
|
page_size: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UserGetBills {
|
||||||
|
page: number;
|
||||||
|
page_size: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UserReqRecharge {
|
||||||
|
amount: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UserGetRecharge {
|
||||||
|
id: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace NetReq {
|
||||||
|
|
||||||
|
type UserGetUserProfile = Item.UserInfo;
|
||||||
|
|
||||||
|
interface FollowUserResp {}
|
||||||
|
|
||||||
|
interface UnfollowUserResp {}
|
||||||
|
|
||||||
|
interface GetContacts {
|
||||||
|
/** 评论列表 */
|
||||||
|
list: Item.ContactItemProps[];
|
||||||
|
/** 页码信息 */
|
||||||
|
pager: Item.PagerProps;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UserChangePassword {}
|
||||||
|
interface UserChangeNickname {}
|
||||||
|
|
||||||
|
interface UserGetUnreadMsgCount {
|
||||||
|
count: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UserGetMessages {
|
||||||
|
/** 消息列表 */
|
||||||
|
list: Item.MessageProps[];
|
||||||
|
/** 页码信息 */
|
||||||
|
pager: Item.PagerProps;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ReadMessageResp {}
|
||||||
|
interface ReadAllMessageResp {}
|
||||||
|
|
||||||
|
interface UserGetCollections {
|
||||||
|
/** 帖子列表 */
|
||||||
|
list: Item.PostProps[];
|
||||||
|
/** 页码信息 */
|
||||||
|
pager: Item.PagerProps;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UserGetUserPosts {
|
||||||
|
/** 帖子列表 */
|
||||||
|
list: Item.PostProps[];
|
||||||
|
/** 页码信息 */
|
||||||
|
pager: Item.PagerProps;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UserGetBills {
|
||||||
|
list: Item.BillProps[];
|
||||||
|
/** 页码信息 */
|
||||||
|
pager: Item.PagerProps;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UserReqRecharge {
|
||||||
|
id: number;
|
||||||
|
pay: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UserGetRecharge {
|
||||||
|
status: string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,14 +0,0 @@
|
|||||||
import { ComponentCustomProperties } from 'vue';
|
|
||||||
import { Store } from 'vuex';
|
|
||||||
|
|
||||||
declare module '@vue/runtime-core' {
|
|
||||||
// 声明自己的 store state
|
|
||||||
interface State {
|
|
||||||
[key: string]: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 为 `this.$store` 提供类型声明
|
|
||||||
interface ComponentCustomProperties {
|
|
||||||
$store: Store<State>;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in new issue