diff --git a/app/Http/Controllers/Api/DialogController.php b/app/Http/Controllers/Api/DialogController.php
index a0a913ee7..40b4efc26 100755
--- a/app/Http/Controllers/Api/DialogController.php
+++ b/app/Http/Controllers/Api/DialogController.php
@@ -247,6 +247,53 @@ class DialogController extends AbstractController
]);
}
+ /**
+ * @api {get} api/dialog/tel 06. 获取对方联系电话
+ *
+ * @apiDescription 需要token身份
+ * @apiVersion 1.0.0
+ * @apiGroup dialog
+ * @apiName tel
+ *
+ * @apiParam {Number} dialog_id 会话ID
+ *
+ * @apiSuccess {Number} ret 返回状态码(1正确、0错误)
+ * @apiSuccess {String} msg 返回信息(错误描述)
+ * @apiSuccess {Object} data 返回数据
+ */
+ public function tel()
+ {
+ $user = User::auth();
+ //
+ $dialog_id = intval(Request::input('dialog_id'));
+ //
+ $dialog = WebSocketDialog::checkDialog($dialog_id);
+ if ($dialog->type !== 'user') {
+ return Base::retError("会话类型错误");
+ }
+ $dialogUser = $dialog->dialogUser->where('userid', '!=', $user->userid)->first();
+ if (empty($dialogUser)) {
+ return Base::retError("会话对象不存在");
+ }
+ $callUser = User::find($dialogUser->userid);
+ if (empty($callUser) || empty($callUser->tel)) {
+ return Base::retError("对方未设置联系电话");
+ }
+ //
+ $add = null;
+ $res = WebSocketDialogMsg::sendMsg(null, $dialog->id, 'notice', [
+ 'notice' => $user->nickname . " 查看了 " . $callUser->nickname . " 的联系电话"
+ ]);
+ if (Base::isSuccess($res)) {
+ $add = $res['data'];
+ }
+ //
+ return Base::retSuccess("success", [
+ 'tel' => $callUser->tel,
+ 'add' => $add ?: null
+ ]);
+ }
+
/**
* @api {get} api/dialog/open/user 07. 打开会话
*
diff --git a/resources/assets/js/pages/manage/components/ChatInput/index.vue b/resources/assets/js/pages/manage/components/ChatInput/index.vue
index ba873677c..1e9a935ac 100755
--- a/resources/assets/js/pages/manage/components/ChatInput/index.vue
+++ b/resources/assets/js/pages/manage/components/ChatInput/index.vue
@@ -62,6 +62,10 @@
{{$L('新会议')}}
+
+
+ {{$L('拨打电话')}}
+
{{$L('发送图片')}}
@@ -870,6 +874,7 @@ export default {
});
break;
+ case 'call':
case 'image':
case 'file':
this.$emit('on-more', action)
@@ -1113,7 +1118,6 @@ export default {
const {owner_id, type} = this.dialogData
const permission = type === 'group' && [0, this.userId].includes(owner_id)
if (this.taskId > 0 || permission) {
- console.log(this.dialogData);
this.__getMoreTimer && clearTimeout(this.__getMoreTimer)
this.__getMoreTimer = setTimeout(_ => {
this.$store.dispatch("call", {
diff --git a/resources/assets/js/pages/manage/components/DialogWrapper.vue b/resources/assets/js/pages/manage/components/DialogWrapper.vue
index 866e52ab9..1e9d1f65f 100644
--- a/resources/assets/js/pages/manage/components/DialogWrapper.vue
+++ b/resources/assets/js/pages/manage/components/DialogWrapper.vue
@@ -1221,11 +1221,42 @@ export default {
},
onEventMore(e) {
- if (['image', 'file'].includes(e)) {
- this.$refs.chatUpload.handleClick()
+ switch (e) {
+ case 'call':
+ this.onCallTel()
+ break;
+
+ case 'image':
+ case 'file':
+ this.$refs.chatUpload.handleClick()
+ break;
}
},
+ onCallTel() {
+ this.$store.dispatch("call", {
+ url: 'dialog/tel',
+ data: {
+ dialog_id: this.dialogId,
+ },
+ spinner: 300,
+ }).then(({data}) => {
+ if (data.tel) {
+ $A.eeuiAppSendMessage({
+ action: 'callTel',
+ tel: data.tel
+ });
+ }
+ if (data.add) {
+ this.$store.dispatch("saveDialogMsg", data.add);
+ this.$store.dispatch("updateDialogLastMsg", data.add);
+ this.onActive();
+ }
+ }).catch(({msg}) => {
+ $A.modalError(msg);
+ });
+ },
+
onEventEmojiVisibleChange(val) {
if (val && this.windowSmall) {
this.onToBottom();
diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js
index 5900a4ddf..78ba509f7 100644
--- a/resources/assets/js/store/actions.js
+++ b/resources/assets/js/store/actions.js
@@ -28,10 +28,10 @@ export default {
//
const cloneParams = $A.cloneJSON(params);
return new Promise(function (resolve, reject) {
- if (params.spinner === true) {
- const {before, complete, spinnerDelay} = params;
+ if (params.spinner === true || (typeof params.spinner === "number" && params.spinner > 0)) {
+ const {before, complete} = params;
params.before = () => {
- dispatch("showSpinner", spinnerDelay)
+ dispatch("showSpinner", typeof params.spinner === "number" ? params.spinner : 0)
typeof before === "function" && before()
};
//