@@ -19,36 +20,37 @@ import JimiLeftHeader from '@/views/customer/components/JimiLeftHeader.vue';
import UserAvatar from '@/assets/img/dongdong-female.png';
import { reactive, ref, computed, onMounted } from 'vue';
import { getAll } from '../../../apis/conversation';
+import { useRoute } from 'vue-router';
+
+const route = useRoute();
+/**
+ * 用户信息
+ * account:用户名
+ * isPlus:是否会员
+ */
+const userInfo = reactive({
+ userName: route.query.username,
+ userId: route.query.userId,
+ avatar: route.query.avatar || UserAvatar,
+});
+
+console.log('jimileft');
+console.log('userInfo', userInfo);
+
+const contracts = reactive([]);
-const contracts = reactive([
- {
- id: 1,
- username: 'dongdong',
- avatar: UserAvatar,
- },
- {
- id: 2,
- username: 'aaaa',
- avatar: UserAvatar,
- },
- {
- id: 3,
- username: 'bbbb',
- avatar: UserAvatar,
- },
-]);
onMounted(() => {
- gteAllList(1);
+ gteAllList(userInfo.userId);
});
async function gteAllList(userId) {
try {
const res = await getAll(userId);
- console.log(res);
// 响应成功的处理
- if (res.data.code === 200) {
+ if (res.data.code === 19000200) {
contracts.value = res.data.data;
+ console.log(contracts.value);
} else {
alert(res.data.msg);
}
@@ -82,7 +84,7 @@ const filteredContracts = computed(() => {
const searchContracts = (keyword) => {
console.log(keyword);
- return contracts.filter((contract) => contract.username.includes(keyword));
+ return contracts.filter((contract) => contract.user.userName.includes(keyword));
};
const handleSearch = (keyword) => {
@@ -96,7 +98,7 @@ const computedFilteredContracts = computed(() => {