|
@@ -104,7 +104,10 @@
|
|
|
</van-col>
|
|
|
</van-row>
|
|
|
<van-col span="24" class="sticky">
|
|
|
- <span @click="chat">咨询<br />服务</span>
|
|
|
+ <!-- <span @click="chat">咨询<br />服务</span> -->
|
|
|
+ <van-badge :content="unTotal" @click.native="chat">
|
|
|
+ <div class="child">资讯服务</div>
|
|
|
+ </van-badge>
|
|
|
</van-col>
|
|
|
<van-dialog v-model="chatShow" class="dialog" title="咨询服务" :showConfirmButton="false" :showCancelButton="false" :closeOnClickOverlay="true">
|
|
|
<frame-chat></frame-chat>
|
|
@@ -120,6 +123,7 @@ import transfer1 from '../parts/transfer-1.vue';
|
|
|
import frameChat from '@/layout/chatCommon/chat.vue';
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
const { mapActions: statistics } = createNamespacedHelpers('statistics');
|
|
|
+const { mapActions: patentchat } = createNamespacedHelpers('patentchat');
|
|
|
export default {
|
|
|
name: 'userBtn',
|
|
|
props: {},
|
|
@@ -135,17 +139,28 @@ export default {
|
|
|
chatShow: false,
|
|
|
active: '1',
|
|
|
numData: {},
|
|
|
+ // 未读总数
|
|
|
+ unList: [],
|
|
|
+ unTotal: 0,
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
if (this.user.id) this.search();
|
|
|
},
|
|
|
methods: {
|
|
|
+ ...patentchat(['query', 'update']),
|
|
|
...statistics(['patentUserIndex']),
|
|
|
async search({ skip = 0, limit = 10, ...info } = {}) {
|
|
|
let res = await this.patentUserIndex({ id: this.user.id });
|
|
|
+ if (this.$checkRes(res)) this.$set(this, `numData`, res.data);
|
|
|
+ // 查询聊天未读数
|
|
|
+ res = await this.query({ id: this.user.id });
|
|
|
if (this.$checkRes(res)) {
|
|
|
- this.$set(this, `numData`, res.data);
|
|
|
+ let data = res.data.filter((i) => i.is_read == false);
|
|
|
+ if (data) {
|
|
|
+ this.$set(this, `unList`, data);
|
|
|
+ this.$set(this, `unTotal`, data.length);
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
pathBtn(type, path, query) {
|
|
@@ -155,7 +170,14 @@ export default {
|
|
|
this.$router.push({ path: '/login' });
|
|
|
}
|
|
|
},
|
|
|
- chat() {
|
|
|
+ async chat() {
|
|
|
+ if (this.unList) {
|
|
|
+ for (const val of this.unList) {
|
|
|
+ val.is_read = true;
|
|
|
+ let res = await this.update(val);
|
|
|
+ if (this.$checkRes(res));
|
|
|
+ }
|
|
|
+ }
|
|
|
this.$router.push({ path: '/patent/user/chat/index' });
|
|
|
},
|
|
|
// 更多
|
|
@@ -217,15 +239,14 @@ export default {
|
|
|
z-index: 999;
|
|
|
text-align: right;
|
|
|
right: 15px;
|
|
|
- span {
|
|
|
- display: inline-block;
|
|
|
- width: 50px;
|
|
|
- padding: 6px 0;
|
|
|
- background-color: #409eff;
|
|
|
- color: #ffffff;
|
|
|
- border-radius: 90px;
|
|
|
- font-size: 14px;
|
|
|
+ .child {
|
|
|
+ width: 40px;
|
|
|
+ background: #409eff;
|
|
|
+ border-radius: 10px;
|
|
|
+ color: #fff;
|
|
|
text-align: center;
|
|
|
+ font-size: 14px;
|
|
|
+ padding: 5px;
|
|
|
}
|
|
|
}
|
|
|
.onlyColor {
|