|
@@ -1,23 +1,5 @@
|
|
<template>
|
|
<template>
|
|
<div id="fenlei">
|
|
<div id="fenlei">
|
|
- <!-- <el-col class="swfl" :span="24">
|
|
|
|
- <el-image style="width:22px;height:22px;margin:0 5px -5px 0;" :src="src"></el-image>
|
|
|
|
- <span>个人中心</span>
|
|
|
|
- </el-col>
|
|
|
|
- <el-col>
|
|
|
|
- <el-menu default-active="1" class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose" text-color="#215299" active-text-color="#215299">
|
|
|
|
- <el-menu-item index="1" v-for="(item, index) in liebiaoList" :key="index">
|
|
|
|
- <template v-if="item.name.includes('消息')">
|
|
|
|
- <span slot="title" @click="clickUrl(item.name)" :style="`color:${haveMsg ? 'red' : ''}`">
|
|
|
|
- {{ item.name }}
|
|
|
|
- </span>
|
|
|
|
- </template>
|
|
|
|
- <template v-else>
|
|
|
|
- <span slot="title" @click="clickUrl(item.name)">{{ item.name }}</span>
|
|
|
|
- </template>
|
|
|
|
- </el-menu-item>
|
|
|
|
- </el-menu>
|
|
|
|
- </el-col> -->
|
|
|
|
<el-col class="menu" :span="24">
|
|
<el-col class="menu" :span="24">
|
|
<el-image :src="squareImage"></el-image>
|
|
<el-image :src="squareImage"></el-image>
|
|
<span>个人中心</span>
|
|
<span>个人中心</span>
|
|
@@ -40,6 +22,8 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
|
+const { mapActions: personalChat } = createNamespacedHelpers('personalchat');
|
|
export default {
|
|
export default {
|
|
name: 'fenlei',
|
|
name: 'fenlei',
|
|
props: {
|
|
props: {
|
|
@@ -51,13 +35,31 @@ export default {
|
|
squareImage: require('@/assets/live/square_big.png'),
|
|
squareImage: require('@/assets/live/square_big.png'),
|
|
haveMsg: false,
|
|
haveMsg: false,
|
|
}),
|
|
}),
|
|
- created() {},
|
|
|
|
- computed: {},
|
|
|
|
|
|
+ created() {
|
|
|
|
+ this.onMessage();
|
|
|
|
+ },
|
|
|
|
+ mounted() {
|
|
|
|
+ this.channel();
|
|
|
|
+ },
|
|
|
|
+ computed: {
|
|
|
|
+ ...mapState(['user']),
|
|
|
|
+ },
|
|
methods: {
|
|
methods: {
|
|
|
|
+ ...personalChat({ getChatList: 'query' }),
|
|
clickUrl(id) {
|
|
clickUrl(id) {
|
|
this.$emit('onsave', { id });
|
|
this.$emit('onsave', { id });
|
|
},
|
|
},
|
|
-
|
|
|
|
|
|
+ channel() {
|
|
|
|
+ this.$stomp({
|
|
|
|
+ [`/exchange/chat_message/${this.user.uid}`]: this.onMessage,
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ async onMessage(message) {
|
|
|
|
+ let res = await this.getChatList({ status: 0, receiver_id: this.user.uid });
|
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
|
+ this.$set(this, `haveMsg`, res.data.length > 0);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
handleOpen(key, keyPath) {
|
|
handleOpen(key, keyPath) {
|
|
console.log(key, keyPath);
|
|
console.log(key, keyPath);
|
|
},
|
|
},
|