Commit 9a3bfd85 by xiongyuwen

no message

parent d17eed53
......@@ -171,6 +171,7 @@ export default {
// 更加微信用户id获取对应得用户信息并返回
axios
.get(`http://discuz.bailuntec.com/api/login?useid=${wxUserid}`)
//.get(`http://discuz.bailuntec.com/api/login?useid=chenzekai`)
.then(res => {
if (res.data.data.relationships.users.data.id) {
localStorage.setItem(
......
<template>
<div class="notice-item">
<div class="avatar">
<div
v-if="item.type === 'system'"
class="system-avatar"
>
<svg-icon
type="system-notice"
class="icon"
/>
<div v-if="item.type === 'system'" class="system-avatar">
<svg-icon type="system-notice" class="icon" />
</div>
<avatar
v-else
:user="{ id: item.user_id,username: item.user_name, avatarUrl: item.user_avatar}"
:user="{
id: item.user_id,
username: item.user_name,
avatarUrl: item.user_avatar,
}"
:size="50"
/>
</div>
......@@ -28,37 +26,51 @@
<span class="text">
<template v-if="item.type === 'questioned'">
<template v-if="item.is_answer === 0">
{{ $t('notice.questions') }}
{{ $t("notice.questions") }}
</template>
<template v-if="item.is_answer === 1">
{{ $t('notice.answersMe') }}
{{ $t("notice.answersMe") }}
</template>
</template>
<template v-else-if="item.type === 'rewarded'">
<template v-if="item.isScale">
{{ item.order_type === 1
? typeMap['registerScale'] : item.order_type === 2
? typeMap['rewardScale'] : item.order_type === 3
? typeMap['payScale'] : typeMap[item.type] }}
{{
item.order_type === 1
? typeMap["registerScale"]
: item.order_type === 2
? typeMap["rewardScale"]
: item.order_type === 3
? typeMap["payScale"]
: typeMap[item.type]
}}
</template>
<template v-else-if="item.order_type === 3">{{ typeMap['payMe'] }}</template>
<template v-else-if="item.order_type === 5">{{ typeMap['questions'] }}</template>
<template v-else-if="item.order_type === 6">{{ typeMap['watchedMe'] }}</template>
<template v-else-if="item.order_type === 3">{{
typeMap["payMe"]
}}</template>
<template v-else-if="item.order_type === 5">{{
typeMap["questions"]
}}</template>
<template v-else-if="item.order_type === 6">{{
typeMap["watchedMe"]
}}</template>
<template v-else>{{ typeMap[item.type] }}</template>
</template>
<template v-else>{{ typeMap[item.type] }}</template>
</span>
</template>
<div
v-if="item.title && item.type === 'system'"
class="user-name"
>{{ item.title }}</div>
<div class="time">{{ timerDiff(item.created_at) + $t('topic.before') }}</div>
<div v-if="item.title && item.type === 'system'" class="user-name">
{{ item.title }}
</div>
<div class="time">
{{ timerDiff(item.created_at) + $t("topic.before") }}
</div>
</div>
<nuxt-link
v-if="item.post_content"
:to="`/thread/comment?threadId=${item.thread_id}&commentId=${item.reply_post_id !== 0
? item.reply_post_id : item.post_id}`"
:to="`/thread/comment?threadId=${item.thread_id}&commentId=${
item.reply_post_id !== 0 ? item.reply_post_id : item.post_id
}`"
class="post-content"
v-html="$xss(item.post_content)"
/>
......@@ -68,8 +80,38 @@
class="post-content"
v-html="$xss(item.answer_content)"
/>
<div class="thread">
<div class="thread-user-name">{{ item.thread_username }}:</div>
<div class="thread-title">
<div v-if="item.thread_title" v-html="$xss(item.thread_title)" />
<div v-else-if="item.content" v-html="$xss(item.content)" />
</div>
<div class="to-detail" @click="onClickContent(item)">
{{ $t("notice.toDetail") }}
</div>
</div>
<!-- <nuxt-link
v-if="item.fileid!=null"
:to="`/knowledge/knowledgeDetail?id=${item.fileid}&useid=${item.qywxUserid}`"
class="thread"
target="_blank"
>
<div class="thread-user-name">{{ item.thread_username }}:</div>
<div class="thread-title">
<div
v-if="item.thread_title"
v-html="$xss(item.thread_title)"
/>
<div
v-else-if="item.content"
v-html="$xss(item.content)"
/>
</div>
<div class="to-detail">{{ $t('notice.toDetail') }}</div>
</nuxt-link>
<nuxt-link
v-if="(item.thread_title || item.content) && item.type !== 'system'"
v-if="(item.thread_title || item.content) && item.type !== 'system'&&item.fileid==null"
:to="`/thread/${item.thread_id}`"
class="thread"
target="_blank"
......@@ -86,69 +128,88 @@
/>
</div>
<div class="to-detail">{{ $t('notice.toDetail') }}</div>
</nuxt-link>
</nuxt-link> -->
<div
v-if="item.type === 'system'"
class="post-content"
v-html="$xss(item.content)"
/>
<div
v-if="item.type === 'withdrawal'"
class="thread"
>
<template v-if="item.cash_status === 2">{{ $t('notice.approved') }}</template>
<template v-if="item.cash_status === 3">{{ $t('notice.unapproved') }}</template>
<div v-if="item.type === 'withdrawal'" class="thread">
<template v-if="item.cash_status === 2">{{
$t("notice.approved")
}}</template>
<template v-if="item.cash_status === 3">{{
$t("notice.unapproved")
}}</template>
</div>
<div
v-if="item.type === 'withdrawal' && item.cash_actual_amount"
class="amount green"
>
- {{ $t('post.yuanItem') + item.cash_actual_amount }}
- {{ $t("post.yuanItem") + item.cash_actual_amount }}
</div>
<div
v-if="item.type === 'rewarded' && item.amount"
class="amount"
>
+ {{ $t('post.yuanItem') + item.amount }}
<div v-if="item.type === 'rewarded' && item.amount" class="amount">
+ {{ $t("post.yuanItem") + item.amount }}
</div>
</div>
</div>
</template>
<script>
import handleError from '@/mixin/handleError';
import timerDiff from '@/mixin/timerDiff';
import handleError from "@/mixin/handleError";
import timerDiff from "@/mixin/timerDiff";
import axios from "@/plugins/axios.js";
import config from "@/config.js";
export default {
name: 'NoticeItem',
name: "NoticeItem",
mixins: [timerDiff, handleError],
props: {
item: {
type: Object,
default: () => { }
}
default: () => {},
},
},
data() {
return {
typeMap: {
related: this.$t('notice.relatedMe'),
replied: this.$t('notice.repliedMe'),
liked: this.$t('notice.likedMe'),
rewarded: this.$t('notice.rewardedMe'),
payMe: this.$t('notice.payMe'),
registerScale: this.$t('notice.registerScale'),
rewardScale: this.$t('notice.rewardScale'),
payScale: this.$t('notice.payScale'),
system: this.$t('notice.system'),
questions: this.$t('notice.questions'),
watchedMe: this.$t('notice.watchedMe'),
payedMe: this.$t('notice.payedMe'),
answersMe: this.$t('notice.answersMe'),
questioned: this.$t('notice.questions')
}
related: this.$t("notice.relatedMe"),
replied: this.$t("notice.repliedMe"),
liked: this.$t("notice.likedMe"),
rewarded: this.$t("notice.rewardedMe"),
payMe: this.$t("notice.payMe"),
registerScale: this.$t("notice.registerScale"),
rewardScale: this.$t("notice.rewardScale"),
payScale: this.$t("notice.payScale"),
system: this.$t("notice.system"),
questions: this.$t("notice.questions"),
watchedMe: this.$t("notice.watchedMe"),
payedMe: this.$t("notice.payedMe"),
answersMe: this.$t("notice.answersMe"),
questioned: this.$t("notice.questions"),
},
};
},
methods: {
onClickContent(item) {
let fileid=null;
axios
.get(
`${config.WEI_PAN_URL}/weipan/GetWeiPanFileByThreadId?threadId=${item.thread_id}`
)
.then((res) => {
if (res.data.statusCode == 200) {
fileid = res.data.result.fileId;
}
if (!!fileid) {
window.open(
`/knowledge/knowledgeDetail?id=${fileid}&useid=${item.qywxUserid}`,
"_blank"
);
} else {
window.open(`/thread/${item.thread_id}`, "_blank");
}
});
},
},
};
</script>
<style lang="scss" scoped>
......@@ -246,6 +307,7 @@ export default {
}
.to-detail {
color: $color-blue-base;
cursor: pointer;
}
}
.amount {
......@@ -254,8 +316,8 @@ export default {
font-weight: bold;
color: #fa5151;
}
.green{
color: #09BB07;
.green {
color: #09bb07;
}
}
}
......
......@@ -5,6 +5,6 @@ export default {
DEV_API_URL: 'http://discuz.bailuntec.com',
// ssr api url
SSR_API_URL: 'http://discuz.bailuntec.com',
// WEI_PAN_URL: 'http://localhost:5008'
WEI_PAN_URL: 'http://pps.bailuntec.com/DiscuzApi'
WEI_PAN_URL: 'http://localhost:5008'
//WEI_PAN_URL: 'http://pps.bailuntec.com/DiscuzApi'
};
<template>
<div class="notice-container">
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane v-for="(item, index) in noticeTypeList" :key="index" :name="item.value">
<el-tab-pane
v-for="(item, index) in noticeTypeList"
:key="index"
:name="item.value"
>
<span slot="label">
<el-badge
:is-dot="item.value !== 'chat'
&& userInfo.typeUnreadNotifications
&& userInfo.typeUnreadNotifications[item.value]
? true : false"
:is-dot="
item.value !== 'chat' &&
userInfo.typeUnreadNotifications &&
userInfo.typeUnreadNotifications[item.value]
? true
: false
"
class="badge-item"
>{{ item.label }}</el-badge>
>{{ item.label }}</el-badge
>
</span>
</el-tab-pane>
</el-tabs>
<div class="notice-list">
<template v-if="activeName === 'chat'">
<div v-for="(item, index) in dialog.list" :key="index" class="notice-item">
<chat-item :user-id="userInfo.id" :item="item" @show-chat-box="showChatBox" />
<div class="delete" @click="handleDelete(item._jv && item._jv.id, index, 'chat')">
<div
v-for="(item, index) in dialog.list"
:key="index"
class="notice-item"
>
<chat-item
:user-id="userInfo.id"
:item="item"
@show-chat-box="showChatBox"
/>
<div
class="delete"
@click="handleDelete(item._jv && item._jv.id, index, 'chat')"
>
<svg-icon type="close" />
</div>
</div>
......@@ -31,7 +50,11 @@
/>
</template>
<template v-else>
<div v-for="(item, index) in noticeList" :key="index" class="notice-item">
<div
v-for="(item, index) in noticeList"
:key="index"
class="notice-item"
>
<notice-item :item="item" />
<div class="delete" @click="handleDelete(item.id, index, 'notice')">
<svg-icon type="close" />
......@@ -48,45 +71,55 @@
</template>
</div>
<!-- 聊天框 -->
<chat-box v-if="chatting" :dialog="dialogData || {}" @close="closeChatBox" />
<chat-box
v-if="chatting"
:dialog="dialogData || {}"
@close="closeChatBox"
/>
</div>
</template>
<script>
import head from '@/mixin/head';
import handleError from '@/mixin/handleError';
import head from "@/mixin/head";
import handleError from "@/mixin/handleError";
export default {
name: 'Notice',
layout: 'center_layout',
name: "Notice",
layout: "center_layout",
mixins: [head, handleError],
data() {
return {
title: this.$t('profile.notice'),
activeName: 'chat',
title: this.$t("profile.notice"),
activeName: "chat",
// 消息类型
noticeTypeList: [
{
label: this.$t('notice.message'),
value: 'chat'
}, {
label: this.$t('notice.relate'),
value: 'related'
}, {
label: this.$t('notice.reply'),
value: 'replied'
}, {
label: this.$t('notice.like'),
value: 'liked'
}, {
label: this.$t('notice.reward'),
value: 'rewarded'
}, {
label: this.$t('notice.questionsAnswers'),
value: 'questioned'
}, {
label: this.$t('notice.system'),
value: 'system'
}
label: this.$t("notice.message"),
value: "chat",
},
{
label: this.$t("notice.relate"),
value: "related",
},
{
label: this.$t("notice.reply"),
value: "replied",
},
{
label: this.$t("notice.like"),
value: "liked",
},
{
label: this.$t("notice.reward"),
value: "rewarded",
},
{
label: this.$t("notice.questionsAnswers"),
value: "questioned",
},
{
label: this.$t("notice.system"),
value: "system",
},
],
noticeList: [],
pageNum: 1,
......@@ -99,10 +132,10 @@ export default {
pageSize: 10,
list: [],
hasMore: false,
loading: false
loading: false,
},
chatting: false,
dialogData: { id: '', name: '' }
dialogData: { id: "", name: "" },
};
},
computed: {
......@@ -110,8 +143,8 @@ export default {
return this.$store.state.user.info.attributes || {};
},
userId() {
return this.$store.getters['session/get']('userId');
}
return this.$store.getters["session/get"]("userId");
},
},
mounted() {
this.getDialogList();
......@@ -121,12 +154,16 @@ export default {
getDialogList() {
this.dialog.loading = true;
const params = {
include: 'dialogMessage,sender,recipient,sender.groups,recipient.groups',
sort: '-dialogMessageId',
'page[number]': this.dialog.pageNum,
'page[limit]': this.dialog.pageSize
include:
"dialogMessage,sender,recipient,sender.groups,recipient.groups",
sort: "-dialogMessageId",
"page[number]": this.dialog.pageNum,
"page[limit]": this.dialog.pageSize,
};
this.$store.dispatch('jv/get', ['dialog', { params }]).then(async(data) => {
this.$store
.dispatch("jv/get", ["dialog", { params }])
.then(
async (data) => {
this.dialog.hasMore = data.length === this.dialog.pageSize;
if (this.dialog.pageNum === 1) {
this.dialog.list = data;
......@@ -135,53 +172,71 @@ export default {
}
this.dialog.pageNum += 1;
if (data._jv && data._jv.json && data._jv.json.meta) {
this.dialog.hasMore = this.dialog.list.length < data._jv.json.meta.total
&& this.dialog.list.length >= this.dialog.pageSize;
this.dialog.hasMore =
this.dialog.list.length < data._jv.json.meta.total &&
this.dialog.list.length >= this.dialog.pageSize;
this.surplus = data._jv.json.meta.total - this.dialog.list.length;
}
}, (e) => {
},
(e) => {
this.handleError(e);
})
}
)
.finally(() => {
this.dialog.loading = false;
});
},
// 获取消息列表
getNoticeList() {
self = this;
this.loading = true;
const params = {
'filter[type]': this.activeName,
'page[number]': this.pageNum,
'page[limit]': this.pageSize
"filter[type]": this.activeName,
"page[number]": this.pageNum,
"page[limit]": this.pageSize,
};
// 财务通知里面包括提现信息
if (this.activeName === 'rewarded') {
params['filter[type]'] = 'rewarded,withdrawal';
if (this.activeName === "rewarded") {
params["filter[type]"] = "rewarded,withdrawal";
}
this.$store.dispatch('jv/get', ['notification', { params }]).then(async(data) => {
this.hasMore = data.length === this.pageSize;
if (this.pageNum === 1) {
this.noticeList = data;
this.$store
.dispatch("jv/get", ["notification", { params }])
.then(
async (data) => {
let userInfo = JSON.parse(this.userInfo.wechat_info);
let qywxUserid = userInfo.userid;
data.forEach((u) => {
u.qywxUserid = qywxUserid;
self.hasMore = data.length === self.pageSize;
if (self.pageNum === 1) {
self.noticeList = data;
} else {
this.noticeList = [...this.noticeList, ...data];
self.noticeList = [...self.noticeList, ...data];
}
if (data._jv && data._jv.json && data._jv.json.meta) {
this.hasMore = this.noticeList.length < data._jv.json.meta.total && this.noticeList.length >= this.pageSize;
this.surplus = data._jv.json.meta.total - this.noticeList.length;
self.hasMore =
self.noticeList.length < data._jv.json.meta.total &&
self.noticeList.length >= self.pageSize;
self.surplus =
data._jv.json.meta.total - self.noticeList.length;
}
this.pageNum += 1;
self.pageNum += 1;
});
try {
await this.$store.dispatch('user/getUserInfo', this.userInfo.id);
await this.$store.dispatch("user/getUserInfo", this.userInfo.id);
} catch (err) {
console.log('getUserInfo err', err);
console.log("getUserInfo err", err);
}
}, (e) => {
},
(e) => {
this.handleError(e);
})
}
)
.finally(() => {
this.loading = false;
});
},
loadMore() {
this.getNoticeList();
},
......@@ -190,21 +245,28 @@ export default {
},
// 删除
handleDelete(id, index, type) {
this.$confirm(this.$t('topic.confirmDelete'), this.$t('discuzq.msgBox.title'), {
confirmButtonText: this.$t('discuzq.msgBox.confirm'),
cancelButtonText: this.$t('discuzq.msgBox.cancel')
}).then(() => {
if (type === 'chat') {
this.$store.dispatch('jv/delete', `dialog/${id}`).then((res) => {
this.$confirm(
this.$t("topic.confirmDelete"),
this.$t("discuzq.msgBox.title"),
{
confirmButtonText: this.$t("discuzq.msgBox.confirm"),
cancelButtonText: this.$t("discuzq.msgBox.cancel"),
}
)
.then(() => {
if (type === "chat") {
this.$store.dispatch("jv/delete", `dialog/${id}`).then((res) => {
if (res) {
this.$message.success(this.$t('topic.deleteSuccess'));
this.$message.success(this.$t("topic.deleteSuccess"));
this.dialog.list.splice(index, 1);
}
});
} else {
this.$store.dispatch('jv/delete', `notification/${id}`).then((res) => {
this.$store
.dispatch("jv/delete", `notification/${id}`)
.then((res) => {
if (res) {
this.$message.success(this.$t('topic.deleteSuccess'));
this.$message.success(this.$t("topic.deleteSuccess"));
this.noticeList.splice(index, 1);
}
});
......@@ -213,7 +275,7 @@ export default {
.catch(() => {});
},
handleClick(e) {
if (e.name !== 'chat') {
if (e.name !== "chat") {
this.pageNum = 1;
this.noticeList = [];
this.getNoticeList();
......@@ -226,11 +288,11 @@ export default {
// 显示聊天框
showChatBox(item) {
if (!item) return;
this.dialogData.id = item._jv ? item._jv.id : '';
this.dialogData.id = item._jv ? item._jv.id : "";
if (this.userId * 1 !== item.sender_user_id) {
this.dialogData.name = item.sender ? item.sender.username : '';
this.dialogData.name = item.sender ? item.sender.username : "";
} else {
this.dialogData.name = item.recipient ? item.recipient.username : '';
this.dialogData.name = item.recipient ? item.recipient.username : "";
}
this.chatting = true;
},
......@@ -239,55 +301,56 @@ export default {
this.chatting = false;
this.dialog.pageNum = 1;
this.getDialogList();
}
}
},
},
};
</script>
<style lang='scss' scoped>
@import '@/assets/css/variable/color.scss';
.notice-container{
.el-tabs ::v-deep{
.el-tabs__header{
@import "@/assets/css/variable/color.scss";
.notice-container {
.el-tabs ::v-deep {
.el-tabs__header {
margin: 0;
}
.el-tabs__active-bar, .el-tabs__nav-wrap::after {
.el-tabs__active-bar,
.el-tabs__nav-wrap::after {
height: 0;
}
.el-tabs__nav-wrap{
.el-tabs__nav-wrap {
border-bottom: 1px solid $line-color-base;
padding-bottom:5px;
padding-bottom: 5px;
padding-left: 30px;
}
.el-tabs__item{
.el-tabs__item {
font-size: 16px;
color: #B5B5B5;
&.is-active{
color:#000;
color: #b5b5b5;
&.is-active {
color: #000;
font-size: 18px;
font-weight:bold;
font-weight: bold;
}
}
}
.badge-item{
::v-deep .el-badge__content.is-fixed{
.badge-item {
::v-deep .el-badge__content.is-fixed {
top: 10px;
}
}
.notice-list{
.notice-list {
min-height: 400px;
.notice-item{
.notice-item {
position: relative;
transition: all 0.2s ease-in-out;
&:hover{
background: #FAFBFC;
.delete{
&:hover {
background: #fafbfc;
.delete {
display: block;
}
}
.delete{
.delete {
display: none;
position: absolute;
top:32px;
top: 32px;
right: 32px;
cursor: pointer;
color: #6d6d6d;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment