|
|
@@ -1,43 +1,65 @@
|
|
|
<template>
|
|
|
<!-- 我的好友 -->
|
|
|
- <div>
|
|
|
- <a-auto-complete placeholder="输入好友代码进行搜索">
|
|
|
-
|
|
|
- </a-auto-complete>
|
|
|
- </div>
|
|
|
+ <a-spin :spinning="loading">
|
|
|
+ <div>
|
|
|
+ <a-auto-complete placeholder="输入好友代码进行搜索"
|
|
|
+ @search="handleSearch">
|
|
|
+ <template #dataSource>
|
|
|
+ <a-select-option v-for="(item, index) in friendsList"
|
|
|
+ :key="index + '11'">
|
|
|
+ {{ item.friendname }}
|
|
|
+ </a-select-option>
|
|
|
+ </template>
|
|
|
+ </a-auto-complete>
|
|
|
+ </div>
|
|
|
+ </a-spin>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts">
|
|
|
import { defineComponent, ref } from 'vue';
|
|
|
-import { closeModal } from '@/common/setup/modal/index';
|
|
|
-import NoticeContent from './components/noticeContent.vue';
|
|
|
import { initData } from '@/common/methods';
|
|
|
-import { queryTableList } from '@/common/setup/table';
|
|
|
import { QueryWrFriendApplyRsp } from '@/services/go/wrtrade/interface';
|
|
|
import { queryQueryWrFriendApply } from '@/services/go/wrtrade';
|
|
|
import { friendOperate } from '@/services/proto/accountinfo';
|
|
|
+import { getUsrId } from '@/services/bus/user';
|
|
|
+import { queryResultLoadingAndInfo, requestResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
|
|
|
|
|
|
export default defineComponent({
|
|
|
- name: 'notice',
|
|
|
- components: {
|
|
|
- NoticeContent,
|
|
|
- },
|
|
|
+ name: 'friend',
|
|
|
setup() {
|
|
|
- // const { visible, cancel } = closeModal('notice');
|
|
|
+ const loading = ref<boolean>(false);
|
|
|
+ const friendsList = ref<QueryWrFriendApplyRsp[]>([]);
|
|
|
// 设置 新增和删除好友 公共请求参数
|
|
|
- function getParam() {
|
|
|
- return {};
|
|
|
+ // operatetype: number; // 操作类型-1:申请 2:审核通过 3:审核拒绝 4: 删除
|
|
|
+ function getParam(operatetype: 1 | 2 | 3 | 4, frienduserid: number) {
|
|
|
+ return {
|
|
|
+ operatetype,
|
|
|
+ userid: getUsrId(),
|
|
|
+ frienduserid,
|
|
|
+ applysrc: 2,
|
|
|
+ };
|
|
|
}
|
|
|
// 删除好友
|
|
|
- function deleteFriend() {}
|
|
|
+ function deleteFriend(frienduserid: number) {
|
|
|
+ const param = getParam(4, frienduserid);
|
|
|
+ requestResultLoadingAndInfo(friendOperate, param, loading, ['删除好友成功', '删除好友失败:']);
|
|
|
+ }
|
|
|
+
|
|
|
// 添加好友
|
|
|
- function addFriend() {}
|
|
|
- initData(() => {
|
|
|
- queryQueryWrFriendApply().then((res) => {
|
|
|
- console.log('好友', res);
|
|
|
+ function addFriend(frienduserid: number) {
|
|
|
+ const param = getParam(1, frienduserid);
|
|
|
+ requestResultLoadingAndInfo(friendOperate, param, loading, ['删除好友成功', '删除好友失败:']);
|
|
|
+ }
|
|
|
+ // 查询我的好友列表
|
|
|
+ function queryMyFriend() {
|
|
|
+ queryResultLoadingAndInfo(queryQueryWrFriendApply, loading).then((res) => {
|
|
|
+ friendsList.value = res;
|
|
|
});
|
|
|
+ }
|
|
|
+ initData(() => {
|
|
|
+ queryMyFriend();
|
|
|
});
|
|
|
- return {};
|
|
|
+ return { deleteFriend, addFriend, friendsList };
|
|
|
},
|
|
|
});
|
|
|
</script>
|