|
@@ -56,7 +56,7 @@
|
|
|
</template>
|
|
</template>
|
|
|
<template v-else>
|
|
<template v-else>
|
|
|
<div class="card-title">{{ msg.title || msg.content.title }}</div>
|
|
<div class="card-title">{{ msg.title || msg.content.title }}</div>
|
|
|
- <img :src="base_img_url2 + (msg.coverUrl || msg.content.coverUrl) + resize" alt="" />
|
|
|
|
|
|
|
+ <img :src="handleImgUrl(msg.coverUrl || msg.content.coverUrl)" alt="" />
|
|
|
</template>
|
|
</template>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
@@ -246,9 +246,7 @@ watch(nameVal, (newVal) => {
|
|
|
|
|
|
|
|
//聊天会话
|
|
//聊天会话
|
|
|
const createSession = (targetUserId, callback) => {
|
|
const createSession = (targetUserId, callback) => {
|
|
|
- // 先保存当前的对话样式消息 要注释
|
|
|
|
|
- // const dialogMessages = messages.value.filter((msg) => msg.messageType === "dialog");
|
|
|
|
|
-
|
|
|
|
|
|
|
+ nameVal.value = '';
|
|
|
VE_API.bbs.createSession({ farmId: farmVal.value, targetUserId }).then(({ data, code }) => {
|
|
VE_API.bbs.createSession({ farmId: farmVal.value, targetUserId }).then(({ data, code }) => {
|
|
|
if (code === 0) {
|
|
if (code === 0) {
|
|
|
nameVal.value = data.session.targetUserName;
|
|
nameVal.value = data.session.targetUserName;
|
|
@@ -281,11 +279,6 @@ const createSession = (targetUserId, callback) => {
|
|
|
};
|
|
};
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- // // 重新添加对话样式消息 要注释
|
|
|
|
|
- // if (dialogMessages.length > 0) {
|
|
|
|
|
- // messages.value = [...messages.value, ...dialogMessages];
|
|
|
|
|
- // }
|
|
|
|
|
-
|
|
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
scrollToBottom();
|
|
scrollToBottom();
|
|
|
}, 300);
|
|
}, 300);
|
|
@@ -348,7 +341,7 @@ watch(
|
|
|
const imgArr = JSON.parse(params.executeEvidence);
|
|
const imgArr = JSON.parse(params.executeEvidence);
|
|
|
message.coverUrl = imgArr[imgArr.length - 1];
|
|
message.coverUrl = imgArr[imgArr.length - 1];
|
|
|
}
|
|
}
|
|
|
- console.log('params.imageList', params.imageList)
|
|
|
|
|
|
|
+
|
|
|
if(params.imageList && params.imageList.length) {
|
|
if(params.imageList && params.imageList.length) {
|
|
|
const img = params.imageList[params.imageList.length - 1];
|
|
const img = params.imageList[params.imageList.length - 1];
|
|
|
if (img.cloudFilename) {
|
|
if (img.cloudFilename) {
|
|
@@ -372,7 +365,7 @@ watch(
|
|
|
if(params.type === 'reviewWork') {
|
|
if(params.type === 'reviewWork') {
|
|
|
message.cardType = 'reviewWork';
|
|
message.cardType = 'reviewWork';
|
|
|
message.title = '向您分享了农事执行成果'
|
|
message.title = '向您分享了农事执行成果'
|
|
|
- message.linkUrl = `/review_work?json=${JSON.stringify({id: params.id})}`;
|
|
|
|
|
|
|
+ message.linkUrl = `/review_work?json=${JSON.stringify({id: params.id,goBack: true})}`;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if(params.type === 'remindExecute' || params.type === 'remindUser') {
|
|
if(params.type === 'remindExecute' || params.type === 'remindUser') {
|
|
@@ -385,7 +378,7 @@ watch(
|
|
|
message.linkUrl = `/completed_work?json=${JSON.stringify(jsonParams)}`;
|
|
message.linkUrl = `/completed_work?json=${JSON.stringify(jsonParams)}`;
|
|
|
} else if(params.type === 'remindUser') {
|
|
} else if(params.type === 'remindUser') {
|
|
|
message.title = '请您尽快完成复核';
|
|
message.title = '请您尽快完成复核';
|
|
|
- message.linkUrl = `/review_work?json=${JSON.stringify({id:params.id})}`;
|
|
|
|
|
|
|
+ message.linkUrl = `/review_work?json=${JSON.stringify({id:params.id,goBack: true})}`;
|
|
|
}
|
|
}
|
|
|
message.cardType = params.type
|
|
message.cardType = params.type
|
|
|
}
|
|
}
|
|
@@ -471,6 +464,10 @@ const initMqtt = () => {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
if (obj.senderId === receiverIdVal.value) {
|
|
if (obj.senderId === receiverIdVal.value) {
|
|
|
|
|
+ // 检查是否已存在相同 id 的消息,避免重复添加
|
|
|
|
|
+ if (obj.id && messages.value.some(msg => msg.id === obj.id)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
if (obj.messageType === "image") {
|
|
if (obj.messageType === "image") {
|
|
|
if (obj.image && (obj.image.url || obj.image.originUrl)) {
|
|
if (obj.image && (obj.image.url || obj.image.originUrl)) {
|
|
|
obj.content = obj.image.url || obj.image.originUrl;
|
|
obj.content = obj.image.url || obj.image.originUrl;
|
|
@@ -482,6 +479,8 @@ const initMqtt = () => {
|
|
|
console.error(e, "e");
|
|
console.error(e, "e");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ }else{
|
|
|
|
|
+ obj.content = JSON.parse(obj.content);
|
|
|
}
|
|
}
|
|
|
obj.receiverId = curUserId;
|
|
obj.receiverId = curUserId;
|
|
|
(obj.sender = obj.senderId === curUserId ? "sent" : "received"), (obj.senderIcon = senderIcon.value);
|
|
(obj.sender = obj.senderId === curUserId ? "sent" : "received"), (obj.senderIcon = senderIcon.value);
|
|
@@ -703,31 +702,23 @@ const route = useRoute();
|
|
|
|
|
|
|
|
// 获取农场列表
|
|
// 获取农场列表
|
|
|
function getFarmList() {
|
|
function getFarmList() {
|
|
|
- if(curRole.value == 2) {
|
|
|
|
|
- return VE_API.user.userList().then(({ data }) => {
|
|
|
|
|
- options.value = data.map(item => ({
|
|
|
|
|
- id: item.farmId,
|
|
|
|
|
- name: item.farmName,
|
|
|
|
|
- }));
|
|
|
|
|
|
|
+ let params = {
|
|
|
|
|
+ agriculturalQuery: false,
|
|
|
|
|
+ }
|
|
|
|
|
+ if(curRole.value == 2){
|
|
|
|
|
+ params.userId = props.userId;
|
|
|
|
|
+ }
|
|
|
|
|
+ return VE_API.farm.userFarmSelectOption(params).then(({ data }) => {
|
|
|
|
|
+ options.value = data || [];
|
|
|
|
|
+ if (data && data.length > 0) {
|
|
|
|
|
+ const defaultOption = data.find((item) => item.defaultOption === true);
|
|
|
if(route.query.farmId) {
|
|
if(route.query.farmId) {
|
|
|
farmVal.value = Number(route.query.farmId);
|
|
farmVal.value = Number(route.query.farmId);
|
|
|
}else{
|
|
}else{
|
|
|
- farmVal.value = data[0].farmId;
|
|
|
|
|
|
|
+ farmVal.value = defaultOption ? defaultOption.id : data[0].id;
|
|
|
}
|
|
}
|
|
|
- });
|
|
|
|
|
- }else{
|
|
|
|
|
- return VE_API.farm.userFarmSelectOption({ agriculturalQuery: false }).then(({ data }) => {
|
|
|
|
|
- options.value = data || [];
|
|
|
|
|
- if (data && data.length > 0) {
|
|
|
|
|
- const defaultOption = data.find((item) => item.defaultOption === true);
|
|
|
|
|
- if(route.query.farmId) {
|
|
|
|
|
- farmVal.value = Number(route.query.farmId);
|
|
|
|
|
- }else{
|
|
|
|
|
- farmVal.value = defaultOption ? defaultOption.id : data[0].id;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const curRole = ref(null);
|
|
const curRole = ref(null);
|