好友列表
This commit is contained in:
parent
151d93a6d1
commit
8c141f0d9a
|
@ -127,6 +127,13 @@ export const news = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
query: param
|
query: param
|
||||||
})
|
})
|
||||||
|
},
|
||||||
|
//获取好友列表
|
||||||
|
getFriendList() {
|
||||||
|
return util.request({
|
||||||
|
url: `/user/chat/relation/myFriends`,
|
||||||
|
method: 'GET'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,11 @@
|
||||||
// 底部菜单
|
// 底部菜单
|
||||||
import footerMneu from '@/components/footerMenu/footerMenu'
|
import footerMneu from '@/components/footerMenu/footerMenu'
|
||||||
import videoApi from '@/api/video.js';
|
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 store = useStore()
|
||||||
// 菜单列表
|
// 菜单列表
|
||||||
const menuList = reactive([{
|
const menuList = reactive([{
|
||||||
|
@ -72,16 +76,35 @@
|
||||||
handleMenuIndex(2)
|
handleMenuIndex(2)
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 切换下标
|
* 切换下标
|
||||||
* @param {Number} index
|
* @param {Number} index
|
||||||
*/
|
*/
|
||||||
function handleMenuIndex(index) {
|
function handleMenuIndex(index) {
|
||||||
if (menuIndex.value === index) return
|
if (menuIndex.value === index) return
|
||||||
menuIndex.value = index
|
menuIndex.value = index
|
||||||
if (!menuList[index].load) menuList[index].load = true
|
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() {
|
function showActionSheet() {
|
||||||
uni.showActionSheet({
|
uni.showActionSheet({
|
||||||
|
@ -199,7 +222,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
//
|
//
|
||||||
.headMenu {
|
.headMenu {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(4, 1fr);
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
@ -252,7 +275,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
.swiper {
|
.swiper {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue