Skip to content

Commit

Permalink
Merge pull request #78 from School-of-Website-Engineering/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
mason369 authored Mar 23, 2023
2 parents 44f1cf3 + 3273901 commit 21af414
Show file tree
Hide file tree
Showing 13 changed files with 230 additions and 109 deletions.
48 changes: 24 additions & 24 deletions src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@
// Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core'

export {};
export {}

declare module '@vue/runtime-core' {
export interface GlobalComponents {
ElAside: typeof import('element-plus/es')['ElAside'];
ElAvatar: typeof import('element-plus/es')['ElAvatar'];
ElBadge: typeof import('element-plus/es')['ElBadge'];
ElButton: typeof import('element-plus/es')['ElButton'];
ElCol: typeof import('element-plus/es')['ElCol'];
ElContainer: typeof import('element-plus/es')['ElContainer'];
ElDialog: typeof import('element-plus/es')['ElDialog'];
ElFooter: typeof import('element-plus/es')['ElFooter'];
ElHeader: typeof import('element-plus/es')['ElHeader'];
ElIcon: typeof import('element-plus/es')['ElIcon'];
ElMain: typeof import('element-plus/es')['ElMain'];
ElMenu: typeof import('element-plus/es')['ElMenu'];
ElMenuItem: typeof import('element-plus/es')['ElMenuItem'];
ElRow: typeof import('element-plus/es')['ElRow'];
ElTable: typeof import('element-plus/es')['ElTable'];
ElTableColumn: typeof import('element-plus/es')['ElTableColumn'];
ElTooltip: typeof import('element-plus/es')['ElTooltip'];
FriendStatus: typeof import('./components/common/FriendStatus.vue')['default'];
NotFound: typeof import('./components/NotFound.vue')['default'];
RouterLink: typeof import('vue-router')['RouterLink'];
RouterView: typeof import('vue-router')['RouterView'];
}
export interface GlobalComponents {
ElAside: typeof import('element-plus/es')['ElAside']
ElAvatar: typeof import('element-plus/es')['ElAvatar']
ElBadge: typeof import('element-plus/es')['ElBadge']
ElButton: typeof import('element-plus/es')['ElButton']
ElCol: typeof import('element-plus/es')['ElCol']
ElContainer: typeof import('element-plus/es')['ElContainer']
ElDialog: typeof import('element-plus/es')['ElDialog']
ElFooter: typeof import('element-plus/es')['ElFooter']
ElHeader: typeof import('element-plus/es')['ElHeader']
ElIcon: typeof import('element-plus/es')['ElIcon']
ElMain: typeof import('element-plus/es')['ElMain']
ElMenu: typeof import('element-plus/es')['ElMenu']
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
ElRow: typeof import('element-plus/es')['ElRow']
ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTooltip: typeof import('element-plus/es')['ElTooltip']
FriendStatus: typeof import('./components/common/FriendStatus.vue')['default']
NotFound: typeof import('./components/NotFound.vue')['default']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
}
}
4 changes: 2 additions & 2 deletions src/components/NotFound.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import { useUserStore } from '@/store/modules/user';
const userStore = useUserStore();
const userData = reactive({
username: 'beibei',
password: '1312',
password: '1312'
});
console.log(userData.password, userData.username);
const onLogin = async () => {
const onLogin = async() => {
// 使用 actions,当作函数一样直接调用
// login action 定义为了 async 函数,所以它返回一个 Promise
await userStore.login(userData);
Expand Down
10 changes: 5 additions & 5 deletions src/components/common/FriendStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
// 父组件传入的状态值:在线、离线、闲置、忙碌
const props = defineProps({
status: {
type: String,
default: 'online',
type : String,
default: 'online'
},
statusText: {
type: String,
default: '在线',
},
type : String,
default: '在线'
}
});
</script>

Expand Down
58 changes: 29 additions & 29 deletions src/mock/asideData/asideUserFriendStatusInformation.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,65 +3,65 @@ export default [
// 用户登录
{
// 请求地址
url: '/aside/privateUserList',
url : '/aside/privateUserList',
// 请求方法
method: 'get',
method : 'get',
// 响应数据
response: () => {
return {
code: 0,
code : 0,
message: 'success',
// 侧边栏数据
data: {
data : {
// 侧边栏列表私信好友列表,状态信息
sidebarList: [
{
// 用户id
id: '345623411435767898',
id : '345623411435767898',
// 用户名
name: 'liuliu',
name : 'liuliu',
// 用户头像
avatar: 'https://cdn.discordapp.com/avatars/1042734257149329418/5ab3131122ac145db5f2edf29e5a7730.webp?size=48',
avatar : 'https://cdn.discordapp.com/avatars/1042734257149329418/5ab3131122ac145db5f2edf29e5a7730.webp?size=48',
// 用户状态
status: 'online',
statusText: '在线',
status : 'online',
statusText: '在线'
},
{
// 用户id
id: '345623411435767899',
id : '345623411435767899',
// 用户名
name: 'Ye Ldzy>>',
name : 'Ye Ldzy>>',
// 用户头像
avatar: 'https://cdn.discordapp.com/avatars/891419145592266812/c8578ca93da963aa9edfdae6111a1a23.webp?size=128',
avatar : 'https://cdn.discordapp.com/avatars/891419145592266812/c8578ca93da963aa9edfdae6111a1a23.webp?size=128',
// 用户状态
status: 'idle',
statusText: '闲置',
status : 'idle',
statusText: '闲置'
},
{
// 用户id
id: '345623411435767900',
id : '345623411435767900',
// 用户名
name: '[ECM]HamSter',
name : '[ECM]HamSter',
// 用户头像
avatar: 'https://cdn.discordapp.com/avatars/760729927552729119/20167f95c93ef46167737aee7201cb92.webp?size=48',
avatar : 'https://cdn.discordapp.com/avatars/760729927552729119/20167f95c93ef46167737aee7201cb92.webp?size=48',
// 用户状态
status: 'offline',
statusText: '离线',
status : 'offline',
statusText: '离线'
},
{
// 用户id
id: '345623411435767901',
id : '345623411435767901',
// 用户名
name: 'JDSA Ling',
name : 'JDSA Ling',
// 用户头像
avatar: 'https://cdn.discordapp.com/avatars/615354796781862913/11ec6f364a0e4b6ceef007fe18c382b3.webp?size=48',
avatar : 'https://cdn.discordapp.com/avatars/615354796781862913/11ec6f364a0e4b6ceef007fe18c382b3.webp?size=48',
// 用户状态
status: 'busy',
statusText: '忙碌',
},
],
},
status : 'busy',
statusText: '忙碌'
}
]
}
};
},
},
}
}
];
2 changes: 1 addition & 1 deletion src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const router = createRouter({
router.beforeEach((to, from, next) => {
// 如果路径为/#/main或/#/message,则跳转到/#/main/message
if (to.path === '/main' || to.path === '/message') {
next('/main/message');
next('/main/@me');
} else {
next();
}
Expand Down
38 changes: 31 additions & 7 deletions src/router/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,40 @@ export const routes: Array<RouteRecordRaw> = [
children : [
{
// 私信
path : '/main/message',
name : 'message',
component: () => import('../views/ChannelMessage/index.vue')
path : '/main/@me',
name : 'message',
components: {
leftAside: () => import('../views/ChannelMessage/index.vue'),
rightMain: () => import('../views/FriendInterface/index.vue')
}
},
//频道服务器
{
path : '/channels/:id',
name : 'channels',
component: () => import('../views/Channels/index.vue'),
props : true
path : '/channels/:id',
name : 'channels',
components: {
leftAside: () => import('../views/Channels/index.vue'),
rightMain: () => import('../views/FriendInterface/index.vue')
},
props: true
},
//FriendInterface
{
path : '/main/@me',
name : 'friend',
components: {
leftAside: () => import('../views/ChannelMessage/index.vue'),
rightMain: () => import('../views/FriendInterface/index.vue')
}
},
//Store
{
path : '/main/store',
name : 'friend',
components: {
leftAside: () => import('../views/ChannelMessage/index.vue'),
rightMain: () => import('../views/Store/index.vue')
}
}
]
},
Expand Down
6 changes: 3 additions & 3 deletions src/utils/http/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ const http = {
url,
data,
...config,
method: 'POST',
headers: { 'Content-Type': 'multipart/form-data' },
method : 'POST',
headers: { 'Content-Type': 'multipart/form-data' }
});
},
}
};

export default http;
2 changes: 1 addition & 1 deletion src/utils/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ export const storage = {

clear() {
localStorage.clear();
},
}
};
4 changes: 2 additions & 2 deletions src/views/Aside/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!--频道侧边栏,菜单-->
<el-aside width="90px" class="main-aside">
<el-menu :collapse="isCollapse" router class="el-menu-vertical-demo">
<el-menu-item index="/message" :class="{ 'is-active': $route.path === '/main/message' }">
<el-menu-item index="/message" :class="{ 'is-active': $route.path === '/main/@me' }">
<img
class="channel-img"
src="https://cdn.discordapp.com/icons/464395429392678912/401026c51da58472a16c650ee263701d.webp?size=160"
Expand Down Expand Up @@ -77,7 +77,7 @@ onMounted(() => {
* @function
* @returns {Promise<void>}
*/
const getChannelList = async () => {
const getChannelList = async() => {
const res = await AsideLPrivateService.getAsideSidebarList();
asideSidebarList.push(...(res.data as any));
console.log(asideSidebarList);
Expand Down
38 changes: 19 additions & 19 deletions src/views/ChannelMessage/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
<el-main class="main-box-right-main1">
<el-container class="main-box-right-main1-flex">
<el-header class="Friends-private-message">
<!-- 好友、store -->
<!-- 好友、Store -->
<el-container class="friends-top friends-top-head">
<el-row
:class="['friends-top-flex', $route.path === '/@me' ? 'is-active' : '']"
:class="['friends-top-flex', $route.path === '/main/@me' ? 'is-active' : '']"
@click="
() => {
$router.push('@me');
$router.push('/main/@me');
}
"
>
Expand All @@ -34,10 +34,10 @@
</el-col>
</el-row>
<el-row
:class="['friends-top-flex', $route.path === '/store' ? 'is-active' : '']"
:class="['friends-top-flex', $route.path === '/main/Store' ? 'is-active' : '']"
@click="
() => {
$router.push('/store');
$router.push('/main/Store');
}
"
>
Expand Down Expand Up @@ -115,25 +115,25 @@ const dialogTableVisible = ref(false);
// 表格数据
const gridData = [
{
date: '2016-05-02',
name: 'John Smith',
address: 'No.1518, Jinshajiang Road, Putuo District',
date : '2016-05-02',
name : 'John Smith',
address: 'No.1518, Jinshajiang Road, Putuo District'
},
{
date: '2016-05-04',
name: 'John Smith',
address: 'No.1518, Jinshajiang Road, Putuo District',
date : '2016-05-04',
name : 'John Smith',
address: 'No.1518, Jinshajiang Road, Putuo District'
},
{
date: '2016-05-01',
name: 'John Smith',
address: 'No.1518, Jinshajiang Road, Putuo District',
date : '2016-05-01',
name : 'John Smith',
address: 'No.1518, Jinshajiang Road, Putuo District'
},
{
date: '2016-05-03',
name: 'John Smith',
address: 'No.1518, Jinshajiang Road, Putuo District',
},
date : '2016-05-03',
name : 'John Smith',
address: 'No.1518, Jinshajiang Road, Putuo District'
}
];
// 私信列表
const privateMessageList = reactive<IAsideLPrivateResponse[]>([]);
Expand All @@ -149,7 +149,7 @@ onMounted(() => {
* @constructor
* @description 获取私信列表
*/
const getPrivateMessageList = async () => {
const getPrivateMessageList = async() => {
const { data } = await AsideLPrivateService.getAsidePrivateUserList();
privateMessageList.push(...data.sidebarList);
console.log('---------getAsidePrivateUserList---------');
Expand Down
Loading

0 comments on commit 21af414

Please sign in to comment.