|
@@ -2,17 +2,33 @@
|
|
|
<layout-page class="ss-m-x-15">
|
|
|
<view class="box" v-for="item in items" :key="item.id" @tap="handleTo(item)">
|
|
|
<view class="box-header">
|
|
|
- <image
|
|
|
- class="enterAvatar"
|
|
|
- :src="item.headers"
|
|
|
- ></image>
|
|
|
+ <template v-if="item.unread === '0'">
|
|
|
+ <image
|
|
|
+ class="enterAvatar"
|
|
|
+ :src="getUserAvatar(item?.userInfoVo?.userInfoResp?.avatar, item?.userInfoVo?.userInfoResp?.sex)"
|
|
|
+ ></image>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <uni-badge class="uni-badge-left-margin" :text="item.unread" absolute="rightTop" size="small">
|
|
|
+ <image
|
|
|
+ class="enterAvatar"
|
|
|
+ :src="getUserAvatar(item?.userInfoVo?.userInfoResp?.avatar, item?.userInfoVo?.userInfoResp?.sex)"
|
|
|
+ ></image>
|
|
|
+ </uni-badge>
|
|
|
+ </template>
|
|
|
+
|
|
|
</view>
|
|
|
<view class="box-content">
|
|
|
<view class="box-content-names">
|
|
|
- <view class="name">{{ item.name }}</view>
|
|
|
- <view class="time">{{ item.updateTime }}</view>
|
|
|
+ <view class="name">
|
|
|
+ {{ item.thatName }}
|
|
|
+ <text class="nameSub">{{ item.enterpriseAnotherName }}</text>
|
|
|
+ <span class="line" v-if="item.postNameCn && item.enterpriseAnotherName"></span>
|
|
|
+ <text class="nameSub">{{ item.postNameCn }}</text>
|
|
|
+ </view>
|
|
|
+ <!-- <view class="time">{{ item.updateTime }}</view> -->
|
|
|
</view>
|
|
|
- <view class="box-content-text">{{ item.history }}</view>
|
|
|
+ <view class="box-content-text">{{ timesTampChange(+item.timestamp.padEnd(13, '0')) }}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<image
|
|
@@ -31,7 +47,8 @@ import { getAccessToken } from '@/utils/request'
|
|
|
import { showAuthModal } from '@/hooks/useModal'
|
|
|
import { getConversationSync } from '@/api/common'
|
|
|
import { onShow } from '@dcloudio/uni-app'
|
|
|
-
|
|
|
+import { getUserAvatar } from '@/utils/avatar'
|
|
|
+import { timesTampChange } from '@/utils/date'
|
|
|
import { userStore } from '@/store/user'
|
|
|
|
|
|
const useUserStore = userStore()
|
|
@@ -52,9 +69,14 @@ onShow(() => {
|
|
|
|
|
|
|
|
|
|
|
|
-const handleTo = (item) => {
|
|
|
+const handleTo = ({ userInfoVo, thatName, postNameCn, enterpriseAnotherName }) => {
|
|
|
+ const id = `id=${userInfoVo.userInfoResp.userId}`
|
|
|
+ const name = `name=${thatName}`
|
|
|
+ const postName = `postName=${postNameCn}`
|
|
|
+ const enterpriseName = `enterpriseName=${enterpriseAnotherName}`
|
|
|
+ const enterpriseId = `enterpriseId=${userInfoVo?.userInfoResp?.enterpriseId}`
|
|
|
uni.navigateTo({
|
|
|
- url: `/pagesA/chart/index?id=${item.id}&name=${item.name}`
|
|
|
+ url: `/pagesA/chart/index?${id}&${name}&${postName}&${enterpriseName}&${enterpriseId}`
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -69,11 +91,18 @@ const handleTo = (item) => {
|
|
|
|
|
|
async function init () {
|
|
|
try {
|
|
|
- const resp = await getConversationSync({ msg_count: 1 })
|
|
|
- if (!resp) {
|
|
|
+ const { data } = await getConversationSync({ msg_count: 1 })
|
|
|
+ if (!data || !data.length) {
|
|
|
return
|
|
|
}
|
|
|
- console.log(resp)
|
|
|
+ items.value = data.map(item => {
|
|
|
+ return {
|
|
|
+ thatName: item.userInfoVo ? (item.userInfoVo.userInfoResp.name ? item.userInfoVo.userInfoResp.name : '游客') : '系统消息',
|
|
|
+ enterpriseAnotherName: item.userInfoVo?.userInfoResp?.enterpriseAnotherName ?? '',
|
|
|
+ postNameCn: item.userInfoVo?.userInfoResp?.postNameCn ?? '',
|
|
|
+ ...item
|
|
|
+ }
|
|
|
+ })
|
|
|
} catch (error) {
|
|
|
|
|
|
}
|
|
@@ -93,6 +122,7 @@ async function init () {
|
|
|
&-header {
|
|
|
width: 120rpx;
|
|
|
height: 100%;
|
|
|
+ position: relative;
|
|
|
}
|
|
|
&-content {
|
|
|
flex: 1;
|
|
@@ -109,6 +139,18 @@ async function init () {
|
|
|
overflow: hidden;
|
|
|
white-space: nowrap;
|
|
|
text-overflow: ellipsis;
|
|
|
+ .nameSub {
|
|
|
+ font-size: 0.75em;
|
|
|
+ color: #999;
|
|
|
+ }
|
|
|
+ .line {
|
|
|
+ display: inline-block;
|
|
|
+ width: 2rpx;
|
|
|
+ height: 24rpx;
|
|
|
+ vertical-align: middle;
|
|
|
+ background-color: #e0e0e0;
|
|
|
+ margin: 0 6rpx;
|
|
|
+ }
|
|
|
}
|
|
|
.time {
|
|
|
color: #999;
|