diff --git a/app/Http/Controllers/Api/DialogController.php b/app/Http/Controllers/Api/DialogController.php
index c81103203..82fa9234c 100755
--- a/app/Http/Controllers/Api/DialogController.php
+++ b/app/Http/Controllers/Api/DialogController.php
@@ -1377,7 +1377,7 @@ class DialogController extends AbstractController
* @apiParam {Number} lat 纬度
* @apiParam {String} title 位置名称
* @apiParam {String} [address] 位置地址
- * @apiParam {String} [preview] 预览图片(url)
+ * @apiParam {String} [thumb] 预览图片(url)
*
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
* @apiSuccess {String} msg 返回信息(错误描述)
@@ -1393,7 +1393,7 @@ class DialogController extends AbstractController
$lat = floatval(Request::input('lat'));
$title = trim(Request::input('title'));
$address = trim(Request::input('address'));
- $preview = trim(Request::input('preview'));
+ $thumb = trim(Request::input('thumb'));
//
if (empty($lng) || $lng < -180 || $lng > 180
|| empty($lat) || $lat < -90 || $lat > 90) {
@@ -1412,7 +1412,7 @@ class DialogController extends AbstractController
'lat' => $lat,
'title' => $title,
'address' => $address,
- 'preview' => $preview,
+ 'thumb' => $thumb,
];
return WebSocketDialogMsg::sendMsg(null, $dialog_id, 'location', $msgData, $user->userid);
}
diff --git a/app/Models/WebSocketDialogMsg.php b/app/Models/WebSocketDialogMsg.php
index 504a0612e..5b6d79f23 100644
--- a/app/Models/WebSocketDialogMsg.php
+++ b/app/Models/WebSocketDialogMsg.php
@@ -167,6 +167,10 @@ class WebSocketDialogMsg extends AbstractModel
}
break;
+ case 'location':
+ $msg['thumb'] = Base::fillUrl($msg['thumb'] ?: "images/other/location.jpg");
+ break;
+
case 'template':
if ($msg['data']['thumb']) {
$msg['data']['thumb']['url'] = Base::fillUrl($msg['data']['thumb']['url']);
@@ -582,6 +586,10 @@ class WebSocketDialogMsg extends AbstractModel
$action = Doo::translate("语音");
return "[{$action}]";
+ case 'location':
+ $action = Doo::translate("位置");
+ return "[{$action}] " . Base::cutStr($data['msg']['title'], 50);
+
case 'meeting':
$action = Doo::translate("会议");
return "[{$action}] " . Base::cutStr($data['msg']['name'], 50);
@@ -996,17 +1004,21 @@ class WebSocketDialogMsg extends AbstractModel
$mtype = 'image';
}
} elseif ($type === 'location') {
- if (preg_match('/^https*:\/\//', $msg['preview'])) {
- $preview = file_get_contents($msg['preview']);
- if (empty($preview)) {
+ if (preg_match('/^https*:\/\//', $msg['thumb'])) {
+ $thumb = file_get_contents($msg['thumb']);
+ if (empty($thumb)) {
throw new ApiException('获取地图快照失败');
}
- $filePath = "uploads/chat/" . date("Ym") . "/" . $dialog_id . "/" . md5s($msg['preview']) . ".jpg";
- Base::makeDir(dirname(public_path($filePath)));
- if (!Base::saveContentImage(public_path($filePath), $preview, 90)) {
+ $fileUrl = "uploads/chat/" . date("Ym") . "/" . $dialog_id . "/" . md5s($msg['thumb']) . ".jpg";
+ $filePath = public_path($fileUrl);
+ Base::makeDir(dirname($filePath));
+ if (!Base::saveContentImage($filePath, $thumb, 90)) {
throw new ApiException('保存地图快照失败');
}
- $msg['preview'] = $filePath;
+ $imageSize = getimagesize($filePath);
+ $msg['thumb'] = $fileUrl;
+ $msg['width'] = $imageSize[0];
+ $msg['height'] = $imageSize[1];
}
}
if ($push_silence === null) {
diff --git a/public/images/other/location.jpg b/public/images/other/location.jpg
new file mode 100644
index 000000000..e643e5f97
Binary files /dev/null and b/public/images/other/location.jpg differ
diff --git a/resources/assets/js/functions/web.js b/resources/assets/js/functions/web.js
index c54d14fea..e27b40b17 100755
--- a/resources/assets/js/functions/web.js
+++ b/resources/assets/js/functions/web.js
@@ -406,6 +406,8 @@ import {MarkdownPreview} from "../store/markdown";
return `[${$A.L('接龙')}]` + $A.getMsgTextPreview(data.msg, imgClassName)
case 'record':
return `[${$A.L('语音')}]`
+ case 'location':
+ return `[${$A.L('位置')}] ${$A.cutString(data.msg.title, 50)}`
case 'meeting':
return `[${$A.L('会议')}] ${$A.cutString(data.msg.name, 50)}`
case 'file':
@@ -1020,15 +1022,15 @@ import {MarkdownPreview} from "../store/markdown";
will-change: transform;
}
- [style*="background:url"] *,
- [style*="background-image:url"] *,
- [style*="background: url"] *,
- [style*="background-image: url"] *,
input,
- [background] *,
.no-dark-content img,
.no-dark-content canvas,
- .no-dark-content svg image {
+ .no-dark-content svg image,
+ .no-dark-content [style*="background:url"],
+ .no-dark-content [style*="background-image:url"],
+ .no-dark-content [style*="background: url"],
+ .no-dark-content [style*="background-image: url"],
+ .no-dark-content [background] {
${this.utils.noneFilter()}
}
diff --git a/resources/assets/js/pages/manage/components/DialogView/index.vue b/resources/assets/js/pages/manage/components/DialogView/index.vue
index 7f29e6f94..9bd789dff 100644
--- a/resources/assets/js/pages/manage/components/DialogView/index.vue
+++ b/resources/assets/js/pages/manage/components/DialogView/index.vue
@@ -31,6 +31,8 @@
+
+
@@ -178,6 +180,7 @@ import longpress from "../../../../directives/longpress";
import TextMsg from "./text.vue";
import FileMsg from "./file.vue";
import RecordMsg from "./record.vue";
+import LocationMsg from "./location.vue";
import MeetingMsg from "./meet.vue";
import WordChainMsg from "./word-chain.vue";
import VoteMsg from "./vote.vue";
@@ -194,6 +197,7 @@ export default {
VoteMsg,
WordChainMsg,
MeetingMsg,
+ LocationMsg,
RecordMsg,
TextMsg,
FileMsg,
diff --git a/resources/assets/js/pages/manage/components/DialogView/location.vue b/resources/assets/js/pages/manage/components/DialogView/location.vue
new file mode 100644
index 000000000..161c1b729
--- /dev/null
+++ b/resources/assets/js/pages/manage/components/DialogView/location.vue
@@ -0,0 +1,28 @@
+
+
+
{{msg.title}}
+
{{msg.address}}
+
+
+
+
diff --git a/resources/assets/js/pages/manage/components/DialogWrapper.vue b/resources/assets/js/pages/manage/components/DialogWrapper.vue
index 10b27a340..47b3f5a76 100644
--- a/resources/assets/js/pages/manage/components/DialogWrapper.vue
+++ b/resources/assets/js/pages/manage/components/DialogWrapper.vue
@@ -1767,13 +1767,14 @@ export default {
$A.modalError(`你选择的位置「${data.title}」不在签到范围内`)
return
}
- const preview = $A.urlAddParams('https://api.map.baidu.com/staticimage/v2', {
+ const thumb = $A.urlAddParams('https://api.map.baidu.com/staticimage/v2', {
ak: item.config.key,
center: `${item.config.lng},${item.config.lat}`,
+ markers: `${item.config.lng},${item.config.lat}`,
width: 800,
height: 480,
- zoom: 17,
- copyright: 1
+ zoom: 19,
+ copyright: 1,
})
this.sendLocationMsg({
type: 'bd',
@@ -1781,7 +1782,7 @@ export default {
lat: data.point.lat,
title: data.title,
address: data.address || '',
- preview
+ thumb
})
})
return;
diff --git a/resources/assets/sass/dark.scss b/resources/assets/sass/dark.scss
index bbba3f1ec..fa2b13f7f 100644
--- a/resources/assets/sass/dark.scss
+++ b/resources/assets/sass/dark.scss
@@ -215,6 +215,7 @@ body.dark-mode-reverse {
.dialog-content {
.content-text,
.content-record,
+ .content-location,
.content-meeting,
.content-template {
color: #ffffff !important;
diff --git a/resources/assets/sass/pages/components/dialog-wrapper.scss b/resources/assets/sass/pages/components/dialog-wrapper.scss
index 47f72a86a..096c84355 100644
--- a/resources/assets/sass/pages/components/dialog-wrapper.scss
+++ b/resources/assets/sass/pages/components/dialog-wrapper.scss
@@ -1098,6 +1098,42 @@
}
}
+ .content-location {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ color: $primary-title-color;
+ width: 260px;
+ max-width: 100%;
+ .location-title {
+ width: 100%;
+ font-size: 14px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+ .location-address {
+ width: 100%;
+ font-size: 12px;
+ opacity: 0.6;
+ word-break: break-all;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
+ }
+ .location-preview {
+ width: calc(100% + 16px);
+ height: 110px;
+ margin: 4px -8px -8px;
+ border-radius: 0 0 6px 6px;
+ background-repeat: no-repeat;
+ background-size: cover;
+ background-position: center;
+ }
+ }
+
.content-meeting {
padding: 4px 6px;
color: $primary-title-color;
@@ -1722,6 +1758,10 @@
}
}
+ .content-location {
+ color: #ffffff;
+ }
+
.content-meeting {
color: #ffffff;
@@ -2572,6 +2612,7 @@ body.window-portrait {
.dialog-item {
.dialog-view {
&.text,
+ &.location,
&.template {
max-width: calc(100% - 80px);
}
diff --git a/resources/assets/statics/public/images/other/location.jpg b/resources/assets/statics/public/images/other/location.jpg
new file mode 100644
index 000000000..e643e5f97
Binary files /dev/null and b/resources/assets/statics/public/images/other/location.jpg differ