好友列表
This commit is contained in:
parent
151d93a6d1
commit
8c141f0d9a
|
@ -127,6 +127,13 @@ export const news = {
|
|||
method: 'POST',
|
||||
query: param
|
||||
})
|
||||
},
|
||||
//获取好友列表
|
||||
getFriendList() {
|
||||
return util.request({
|
||||
url: `/user/chat/relation/myFriends`,
|
||||
method: 'GET'
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,11 @@
|
|||
// 底部菜单
|
||||
import footerMneu from '@/components/footerMenu/footerMenu'
|
||||
import videoApi from '@/api/video.js';
|
||||
// vuex
|
||||
// 工具库
|
||||
import util from '@/common/js/util.js'
|
||||
// api
|
||||
import newsApi from '@/api/news.js'
|
||||
// vuex
|
||||
const store = useStore()
|
||||
// 菜单列表
|
||||
const menuList = reactive([{
|
||||
|
@ -72,16 +76,35 @@
|
|||
handleMenuIndex(2)
|
||||
})
|
||||
|
||||
/**
|
||||
* 切换下标
|
||||
* @param {Number} index
|
||||
*/
|
||||
function handleMenuIndex(index) {
|
||||
if (menuIndex.value === index) return
|
||||
menuIndex.value = index
|
||||
if (!menuList[index].load) menuList[index].load = true
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换下标
|
||||
* @param {Number} index
|
||||
*/
|
||||
function handleMenuIndex(index) {
|
||||
if (menuIndex.value === index) return
|
||||
menuIndex.value = index
|
||||
if (!menuList[index].load) menuList[index].load = true
|
||||
// 点击通讯录时调用获取好友列表的函数
|
||||
if (index === 0) {
|
||||
getFriends();
|
||||
}
|
||||
}
|
||||
const viewData = ref([])
|
||||
// 获取好友列表
|
||||
function getFriends() {
|
||||
newsApi.getFriendList().then(response => {
|
||||
if (response.success) {
|
||||
viewData.value = response.data;
|
||||
// 这里可以将好友列表传递给book组件进行展示
|
||||
console.log('好友列表:', viewData.value);
|
||||
return
|
||||
}
|
||||
util.alert({
|
||||
content: rs.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
})
|
||||
}
|
||||
// 打开菜单
|
||||
function showActionSheet() {
|
||||
uni.showActionSheet({
|
||||
|
|
Loading…
Reference in New Issue