mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-11 18:42:54 +00:00
feat:1.会话列表右键添加标记颜色的选项
This commit is contained in:
parent
7c72003b91
commit
3ae3acf705
@ -80,7 +80,7 @@ class DialogController extends AbstractController
|
|||||||
return Base::retError('请输入搜索关键词');
|
return Base::retError('请输入搜索关键词');
|
||||||
}
|
}
|
||||||
// 搜索会话
|
// 搜索会话
|
||||||
$dialogs = WebSocketDialog::select(['web_socket_dialogs.*', 'u.top_at', 'u.mark_unread', 'u.silence', 'u.updated_at as user_at'])
|
$dialogs = WebSocketDialog::select(['web_socket_dialogs.*', 'u.top_at', 'u.mark_unread', 'u.silence', 'u.color', 'u.updated_at as user_at'])
|
||||||
->join('web_socket_dialog_users as u', 'web_socket_dialogs.id', '=', 'u.dialog_id')
|
->join('web_socket_dialog_users as u', 'web_socket_dialogs.id', '=', 'u.dialog_id')
|
||||||
->where('web_socket_dialogs.name', 'LIKE', "%{$key}%")
|
->where('web_socket_dialogs.name', 'LIKE', "%{$key}%")
|
||||||
->where('u.userid', $user->userid)
|
->where('u.userid', $user->userid)
|
||||||
@ -117,7 +117,7 @@ class DialogController extends AbstractController
|
|||||||
}
|
}
|
||||||
// 搜索消息会话
|
// 搜索消息会话
|
||||||
if (count($list) < 20) {
|
if (count($list) < 20) {
|
||||||
$msgs = WebSocketDialog::select(['web_socket_dialogs.*', 'u.top_at', 'u.mark_unread', 'u.silence', 'u.updated_at as user_at', 'm.id as search_msg_id'])
|
$msgs = WebSocketDialog::select(['web_socket_dialogs.*', 'u.top_at', 'u.mark_unread', 'u.silence', 'u.color', 'u.updated_at as user_at', 'm.id as search_msg_id'])
|
||||||
->join('web_socket_dialog_users as u', 'web_socket_dialogs.id', '=', 'u.dialog_id')
|
->join('web_socket_dialog_users as u', 'web_socket_dialogs.id', '=', 'u.dialog_id')
|
||||||
->join('web_socket_dialog_msgs as m', 'web_socket_dialogs.id', '=', 'm.dialog_id')
|
->join('web_socket_dialog_msgs as m', 'web_socket_dialogs.id', '=', 'm.dialog_id')
|
||||||
->where('u.userid', $user->userid)
|
->where('u.userid', $user->userid)
|
||||||
@ -154,7 +154,7 @@ class DialogController extends AbstractController
|
|||||||
//
|
//
|
||||||
$dialog_id = intval(Request::input('dialog_id'));
|
$dialog_id = intval(Request::input('dialog_id'));
|
||||||
//
|
//
|
||||||
$item = WebSocketDialog::select(['web_socket_dialogs.*', 'u.top_at', 'u.mark_unread', 'u.silence', 'u.updated_at as user_at'])
|
$item = WebSocketDialog::select(['web_socket_dialogs.*', 'u.top_at', 'u.mark_unread', 'u.silence', 'u.color', 'u.updated_at as user_at'])
|
||||||
->join('web_socket_dialog_users as u', 'web_socket_dialogs.id', '=', 'u.dialog_id')
|
->join('web_socket_dialog_users as u', 'web_socket_dialogs.id', '=', 'u.dialog_id')
|
||||||
->where('web_socket_dialogs.id', $dialog_id)
|
->where('web_socket_dialogs.id', $dialog_id)
|
||||||
->where('u.userid', $user->userid)
|
->where('u.userid', $user->userid)
|
||||||
@ -1542,6 +1542,47 @@ class DialogController extends AbstractController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @api {get} api/dialog/msg/color 30. 设置颜色
|
||||||
|
*
|
||||||
|
* @apiDescription 需要token身份
|
||||||
|
* @apiVersion 1.0.0
|
||||||
|
* @apiGroup dialog
|
||||||
|
* @apiName msg__color
|
||||||
|
*
|
||||||
|
* @apiParam {Number} dialog_id 会话ID
|
||||||
|
* @apiParam {String} color 颜色
|
||||||
|
*
|
||||||
|
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
||||||
|
* @apiSuccess {String} msg 返回信息(错误描述)
|
||||||
|
* @apiSuccess {Object} data 返回数据
|
||||||
|
*/
|
||||||
|
public function msg__color()
|
||||||
|
{
|
||||||
|
$user = User::auth();
|
||||||
|
|
||||||
|
$dialogId = intval(Request::input('dialog_id'));
|
||||||
|
$color = Request::input('color','');
|
||||||
|
$dialogUser = WebSocketDialogUser::whereUserid($user->userid)->whereDialogId($dialogId)->first();
|
||||||
|
if (!$dialogUser) {
|
||||||
|
return Base::retError("会话不存在");
|
||||||
|
}
|
||||||
|
//
|
||||||
|
$dialogData = WebSocketDialog::find($dialogId);
|
||||||
|
if (empty($dialogData)) {
|
||||||
|
return Base::retError("会话不存在");
|
||||||
|
}
|
||||||
|
//
|
||||||
|
$dialogUser->color = $color;
|
||||||
|
$dialogUser->save();
|
||||||
|
//
|
||||||
|
$data = [
|
||||||
|
'id' => $dialogId,
|
||||||
|
'color' => $color
|
||||||
|
];
|
||||||
|
return Base::retSuccess("success", $data);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {get} api/dialog/group/add 33. 新增群组
|
* @api {get} api/dialog/group/add 33. 新增群组
|
||||||
*
|
*
|
||||||
|
|||||||
@ -76,7 +76,7 @@ class WebSocketDialog extends AbstractModel
|
|||||||
*/
|
*/
|
||||||
public function getDialogList($userid, $updated = "", $deleted = "")
|
public function getDialogList($userid, $updated = "", $deleted = "")
|
||||||
{
|
{
|
||||||
$builder = WebSocketDialog::select(['web_socket_dialogs.*', 'u.top_at', 'u.mark_unread', 'u.silence', 'u.updated_at as user_at'])
|
$builder = WebSocketDialog::select(['web_socket_dialogs.*', 'u.top_at', 'u.mark_unread', 'u.silence', 'u.color', 'u.updated_at as user_at'])
|
||||||
->join('web_socket_dialog_users as u', 'web_socket_dialogs.id', '=', 'u.dialog_id')
|
->join('web_socket_dialog_users as u', 'web_socket_dialogs.id', '=', 'u.dialog_id')
|
||||||
->where('u.userid', $userid);
|
->where('u.userid', $userid);
|
||||||
if ($updated) {
|
if ($updated) {
|
||||||
|
|||||||
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddWebSocketDialogUsersColor extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Schema::table('web_socket_dialog_users', function (Blueprint $table) {
|
||||||
|
if (!Schema::hasColumn('web_socket_dialog_users', 'color')) {
|
||||||
|
$table->string('color', 20)->nullable()->default('')->after('important')->comment('颜色');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
Schema::table('web_socket_dialog_users', function (Blueprint $table) {
|
||||||
|
$table->dropColumn("color");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -175,10 +175,13 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
scrollTo(type) {
|
scrollTo(type) {
|
||||||
$A.scrollToView(this.$refs[`type_${type}`][0], {
|
let refs = this.$refs[`type_${type}`]
|
||||||
behavior: 'smooth',
|
if (refs) {
|
||||||
inline: 'end',
|
$A.scrollToView(refs[0], {
|
||||||
});
|
behavior: 'smooth',
|
||||||
|
inline: 'end',
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
openTask(task) {
|
openTask(task) {
|
||||||
|
|||||||
@ -63,7 +63,8 @@
|
|||||||
dialog_id: dialog.id,
|
dialog_id: dialog.id,
|
||||||
search_msg_id: dialog.search_msg_id
|
search_msg_id: dialog.search_msg_id
|
||||||
})"
|
})"
|
||||||
v-longpress="handleLongpress">
|
v-longpress="handleLongpress"
|
||||||
|
:style="{'background-color':dialog.color}">
|
||||||
<template v-if="dialog.type=='group'">
|
<template v-if="dialog.type=='group'">
|
||||||
<EAvatar v-if="dialog.avatar" class="img-avatar" :src="dialog.avatar" :size="42"></EAvatar>
|
<EAvatar v-if="dialog.avatar" class="img-avatar" :src="dialog.avatar" :size="42"></EAvatar>
|
||||||
<i v-else-if="dialog.group_type=='department'" class="taskfont icon-avatar department"></i>
|
<i v-else-if="dialog.group_type=='department'" class="taskfont icon-avatar department"></i>
|
||||||
@ -157,6 +158,11 @@
|
|||||||
<DropdownItem @click.native="handleSilenceClick" :disabled="silenceDisabled(operateItem)">
|
<DropdownItem @click.native="handleSilenceClick" :disabled="silenceDisabled(operateItem)">
|
||||||
{{ $L(operateItem.silence ? '允许消息通知' : '消息免打扰') }}
|
{{ $L(operateItem.silence ? '允许消息通知' : '消息免打扰') }}
|
||||||
</DropdownItem>
|
</DropdownItem>
|
||||||
|
<DropdownItem @click.native="handleColorClick(c.color)" v-for="(c, k) in taskColorList" :key="'c_' + k" :divided="k==0" v-if="k<6" >
|
||||||
|
<div class="item">
|
||||||
|
<i class="taskfont" :style="{color:c.color||'#f9f9f9'}" v-html="c.color == operateItem.color ? '' : ''"></i>{{$L(c.name)}}
|
||||||
|
</div>
|
||||||
|
</DropdownItem>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
</div>
|
</div>
|
||||||
@ -267,7 +273,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['cacheDialogs', 'loadDialogs', 'dialogId', 'messengerSearchKey', 'appNotificationPermission']),
|
...mapState(['cacheDialogs', 'loadDialogs', 'dialogId', 'messengerSearchKey', 'appNotificationPermission', 'taskColorList']),
|
||||||
|
|
||||||
routeName() {
|
routeName() {
|
||||||
return this.$route.name
|
return this.$route.name
|
||||||
@ -917,6 +923,20 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleColorClick(color) {
|
||||||
|
this.$store.dispatch("call", {
|
||||||
|
url: 'dialog/msg/color',
|
||||||
|
data: {
|
||||||
|
dialog_id: this.operateItem.id,
|
||||||
|
color: color
|
||||||
|
},
|
||||||
|
}).then(({data}) => {
|
||||||
|
this.$store.dispatch("saveDialog", data);
|
||||||
|
}).catch(({msg}) => {
|
||||||
|
$A.modalError(msg);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
updateDialogs(timeout) {
|
updateDialogs(timeout) {
|
||||||
this.__updateDialogs && clearTimeout(this.__updateDialogs)
|
this.__updateDialogs && clearTimeout(this.__updateDialogs)
|
||||||
if (timeout > -1) {
|
if (timeout > -1) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user