mirror of
https://github.com/kuaifan/dootask.git
synced 2026-03-17 19:23:26 +00:00
perf: 个人对话窗口支持拨打电话
This commit is contained in:
parent
c13f8bbcc0
commit
82fad2c17d
@ -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. 打开会话
|
* @api {get} api/dialog/open/user 07. 打开会话
|
||||||
*
|
*
|
||||||
|
|||||||
@ -62,6 +62,10 @@
|
|||||||
<i class="taskfont"></i>
|
<i class="taskfont"></i>
|
||||||
{{$L('新会议')}}
|
{{$L('新会议')}}
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="dialogData.type === 'user' && $isEEUiApp" class="chat-input-popover-item" @click="onToolbar('call')">
|
||||||
|
<i class="taskfont"></i>
|
||||||
|
{{$L('拨打电话')}}
|
||||||
|
</div>
|
||||||
<div class="chat-input-popover-item" @click="onToolbar('image')">
|
<div class="chat-input-popover-item" @click="onToolbar('image')">
|
||||||
<i class="taskfont"></i>
|
<i class="taskfont"></i>
|
||||||
{{$L('发送图片')}}
|
{{$L('发送图片')}}
|
||||||
@ -870,6 +874,7 @@ export default {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'call':
|
||||||
case 'image':
|
case 'image':
|
||||||
case 'file':
|
case 'file':
|
||||||
this.$emit('on-more', action)
|
this.$emit('on-more', action)
|
||||||
@ -1113,7 +1118,6 @@ export default {
|
|||||||
const {owner_id, type} = this.dialogData
|
const {owner_id, type} = this.dialogData
|
||||||
const permission = type === 'group' && [0, this.userId].includes(owner_id)
|
const permission = type === 'group' && [0, this.userId].includes(owner_id)
|
||||||
if (this.taskId > 0 || permission) {
|
if (this.taskId > 0 || permission) {
|
||||||
console.log(this.dialogData);
|
|
||||||
this.__getMoreTimer && clearTimeout(this.__getMoreTimer)
|
this.__getMoreTimer && clearTimeout(this.__getMoreTimer)
|
||||||
this.__getMoreTimer = setTimeout(_ => {
|
this.__getMoreTimer = setTimeout(_ => {
|
||||||
this.$store.dispatch("call", {
|
this.$store.dispatch("call", {
|
||||||
|
|||||||
@ -1221,11 +1221,42 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
onEventMore(e) {
|
onEventMore(e) {
|
||||||
if (['image', 'file'].includes(e)) {
|
switch (e) {
|
||||||
|
case 'call':
|
||||||
|
this.onCallTel()
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'image':
|
||||||
|
case 'file':
|
||||||
this.$refs.chatUpload.handleClick()
|
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) {
|
onEventEmojiVisibleChange(val) {
|
||||||
if (val && this.windowSmall) {
|
if (val && this.windowSmall) {
|
||||||
this.onToBottom();
|
this.onToBottom();
|
||||||
|
|||||||
6
resources/assets/js/store/actions.js
vendored
6
resources/assets/js/store/actions.js
vendored
@ -28,10 +28,10 @@ export default {
|
|||||||
//
|
//
|
||||||
const cloneParams = $A.cloneJSON(params);
|
const cloneParams = $A.cloneJSON(params);
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
if (params.spinner === true) {
|
if (params.spinner === true || (typeof params.spinner === "number" && params.spinner > 0)) {
|
||||||
const {before, complete, spinnerDelay} = params;
|
const {before, complete} = params;
|
||||||
params.before = () => {
|
params.before = () => {
|
||||||
dispatch("showSpinner", spinnerDelay)
|
dispatch("showSpinner", typeof params.spinner === "number" ? params.spinner : 0)
|
||||||
typeof before === "function" && before()
|
typeof before === "function" && before()
|
||||||
};
|
};
|
||||||
//
|
//
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user