mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-14 12:42:51 +00:00
no message
This commit is contained in:
parent
7957353c3f
commit
94fd3197b3
@ -672,15 +672,18 @@ class DialogController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @api {get} api/dialog/msg/search 14. 搜索消息位置
|
* @api {get} api/dialog/msg/search 14. 搜索消息
|
||||||
*
|
*
|
||||||
* @apiDescription 需要token身份
|
* @apiDescription 需要token身份
|
||||||
* @apiVersion 1.0.0
|
* @apiVersion 1.0.0
|
||||||
* @apiGroup dialog
|
* @apiGroup dialog
|
||||||
* @apiName msg__search
|
* @apiName msg__search
|
||||||
*
|
*
|
||||||
* @apiParam {Number} dialog_id 对话ID
|
|
||||||
* @apiParam {String} key 搜索关键词
|
* @apiParam {String} key 搜索关键词
|
||||||
|
* @apiParam {Number} [dialog_id] 对话ID(存在则搜索消息在对话的位置)
|
||||||
|
* @apiParam {Number} [take] 搜索数量
|
||||||
|
* - dialog_id > 0, 默认:200,最大:200
|
||||||
|
* - dialog_id <= 0, 默认:20,最大:50
|
||||||
*
|
*
|
||||||
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
||||||
* @apiSuccess {String} msg 返回信息(错误描述)
|
* @apiSuccess {String} msg 返回信息(错误描述)
|
||||||
@ -688,59 +691,38 @@ class DialogController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
public function msg__search()
|
public function msg__search()
|
||||||
{
|
{
|
||||||
User::auth();
|
$user = User::auth();
|
||||||
//
|
//
|
||||||
$dialog_id = intval(Request::input('dialog_id'));
|
|
||||||
$key = trim(Request::input('key'));
|
$key = trim(Request::input('key'));
|
||||||
|
$dialogId = intval(Request::input('dialog_id'));
|
||||||
//
|
//
|
||||||
if (empty($key)) {
|
if (empty($key)) {
|
||||||
return Base::retError('关键词不能为空');
|
return Base::retError('关键词不能为空');
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
WebSocketDialog::checkDialog($dialog_id);
|
if ($dialogId > 0) {
|
||||||
//
|
// 搜索位置
|
||||||
$data = WebSocketDialogMsg::whereDialogId($dialog_id)
|
WebSocketDialog::checkDialog($dialogId);
|
||||||
->where('key', 'LIKE', "%{$key}%")
|
//
|
||||||
->take(200)
|
$data = WebSocketDialogMsg::whereDialogId($dialogId)
|
||||||
->pluck('id');
|
->where('key', 'LIKE', "%{$key}%")
|
||||||
return Base::retSuccess('success', compact('data'));
|
->take(Base::getPaginate(200, 200, 'take'))
|
||||||
}
|
->pluck('id');
|
||||||
|
return Base::retSuccess('success', compact('data'));
|
||||||
/**
|
} else {
|
||||||
* @api {get} api/dialog/msg/esearch 15. 搜索消息
|
// 搜索消息
|
||||||
*
|
$list = [];
|
||||||
* @apiDescription 需要token身份
|
$searchResults = ZincSearchDialogMsg::search($user->userid, $key, 0, Base::getPaginate(50, 20, 'take'));
|
||||||
* @apiVersion 1.0.0
|
if ($searchResults) {
|
||||||
* @apiGroup dialog
|
foreach ($searchResults as $item) {
|
||||||
* @apiName msg__esearch
|
if ($dialog = WebSocketDialog::find($item['id'])) {
|
||||||
*
|
$dialog = array_merge($dialog->toArray(), $item);
|
||||||
* @apiParam {String} key 搜索关键词
|
$list[] = WebSocketDialog::synthesizeData($dialog, $user->userid);
|
||||||
* @apiParam {Number} [pagesize] 每页显示数量,默认:20,最大:50
|
}
|
||||||
*
|
|
||||||
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
|
||||||
* @apiSuccess {String} msg 返回信息(错误描述)
|
|
||||||
* @apiSuccess {Object} data 返回数据
|
|
||||||
*/
|
|
||||||
public function msg__esearch()
|
|
||||||
{
|
|
||||||
$user = User::auth();
|
|
||||||
//
|
|
||||||
$key = trim(Request::input('key'));
|
|
||||||
$list = [];
|
|
||||||
//
|
|
||||||
$searchResults = ZincSearchDialogMsg::search($user->userid, $key, 0, Base::getPaginate(50, 20));
|
|
||||||
if ($searchResults) {
|
|
||||||
foreach ($searchResults as $item) {
|
|
||||||
if ($dialog = WebSocketDialog::find($item['id'])) {
|
|
||||||
$dialog = array_merge($dialog->toArray(), $item);
|
|
||||||
$list[] = WebSocketDialog::synthesizeData($dialog, $user->userid);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return Base::retSuccess('success', ['data' => $list]);
|
||||||
}
|
}
|
||||||
//
|
|
||||||
return Base::retSuccess('success', [
|
|
||||||
'data' => $list,
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -37,11 +37,6 @@ use App\Module\Base;
|
|||||||
*/
|
*/
|
||||||
class UserDelete extends AbstractModel
|
class UserDelete extends AbstractModel
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* 昵称
|
|
||||||
* @param $value
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getCacheAttribute($value)
|
public function getCacheAttribute($value)
|
||||||
{
|
{
|
||||||
if (!is_array($value)) {
|
if (!is_array($value)) {
|
||||||
@ -65,13 +60,25 @@ class UserDelete extends AbstractModel
|
|||||||
*/
|
*/
|
||||||
public static function userid2basic($userid)
|
public static function userid2basic($userid)
|
||||||
{
|
{
|
||||||
$row = self::whereUserid($userid)->first();
|
return \Cache::remember("UserDelete:{$userid}", now()->addDays(3), function () use ($userid) {
|
||||||
if (empty($row) || empty($row->cache)) {
|
$row = self::whereUserid($userid)->first();
|
||||||
return null;
|
if (empty($row) || empty($row->cache)) {
|
||||||
}
|
return null;
|
||||||
$cache = $row->cache;
|
}
|
||||||
$cache = array_intersect_key($cache, array_flip(array_merge(User::$basicField, ['department_name'])));
|
$cache = $row->cache;
|
||||||
$cache['delete_at'] = $row->created_at->toDateTimeString();
|
$cache = array_intersect_key($cache, array_flip(array_merge(User::$basicField, ['department_name'])));
|
||||||
return $cache;
|
$cache['delete_at'] = $row->created_at->toDateTimeString();
|
||||||
|
return $cache;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* userid 获取 昵称
|
||||||
|
* @param $userid
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function userid2nickname($userid)
|
||||||
|
{
|
||||||
|
return self::userid2basic($userid)['nickname'] ?? '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -298,7 +298,8 @@ class WebSocketDialog extends AbstractModel
|
|||||||
$data['is_disable'] = $basic->isDisable(true);
|
$data['is_disable'] = $basic->isDisable(true);
|
||||||
$data['quick_msgs'] = UserBot::quickMsgs($basic->email);
|
$data['quick_msgs'] = UserBot::quickMsgs($basic->email);
|
||||||
} else {
|
} else {
|
||||||
$data['name'] = 'non-existent';
|
$data['name'] = UserDelete::userid2nickname($dialog_user->userid) ?: '[Delete]';
|
||||||
|
$data['is_disable'] = 1;
|
||||||
$data['dialog_delete'] = 1;
|
$data['dialog_delete'] = 1;
|
||||||
}
|
}
|
||||||
$data['dialog_user'] = $dialog_user;
|
$data['dialog_user'] = $dialog_user;
|
||||||
|
|||||||
@ -50,7 +50,7 @@
|
|||||||
<div v-else class="search-list">
|
<div v-else class="search-list">
|
||||||
<ul v-for="data in list" :key="data.type">
|
<ul v-for="data in list" :key="data.type">
|
||||||
<li v-if="!action" class="item-label">{{$L(data.name)}}</li>
|
<li v-if="!action" class="item-label">{{$L(data.name)}}</li>
|
||||||
<li v-for="item in data.items" :key="item.id" @click="onClick(item)">
|
<li v-for="item in data.items" @click="onClick(item)">
|
||||||
<div class="item-icon">
|
<div class="item-icon">
|
||||||
<div v-if="item.icons[0]==='file'" :class="`no-dark-content file-icon ${item.icons[1]}`"></div>
|
<div v-if="item.icons[0]==='file'" :class="`no-dark-content file-icon ${item.icons[1]}`"></div>
|
||||||
<i v-else-if="item.icons[0]==='department'" class="taskfont icon-avatar department"></i>
|
<i v-else-if="item.icons[0]==='department'" class="taskfont icon-avatar department"></i>
|
||||||
@ -317,9 +317,11 @@ export default {
|
|||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
|
|
||||||
echoSearch(items) {
|
echoSearch(items, key = 'id') {
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
const index = this.searchResults.findIndex(({id, type}) => id === item.id && type === item.type)
|
const index = this.searchResults.findIndex(result => {
|
||||||
|
return result[key] === item[key] && result.type === item.type
|
||||||
|
})
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
this.searchResults.splice(index, 1, item)
|
this.searchResults.splice(index, 1, item)
|
||||||
} else {
|
} else {
|
||||||
@ -432,10 +434,10 @@ export default {
|
|||||||
searchMessage(key) {
|
searchMessage(key) {
|
||||||
this.loadIng++;
|
this.loadIng++;
|
||||||
this.$store.dispatch("call", {
|
this.$store.dispatch("call", {
|
||||||
url: 'dialog/msg/esearch',
|
url: 'dialog/msg/search',
|
||||||
data: {
|
data: {
|
||||||
key,
|
key,
|
||||||
pagesize: this.action ? 50 : 10,
|
take: this.action ? 50 : 10,
|
||||||
},
|
},
|
||||||
}).then(({data}) => {
|
}).then(({data}) => {
|
||||||
const items = data.data.map(item => {
|
const items = data.data.map(item => {
|
||||||
@ -469,10 +471,11 @@ export default {
|
|||||||
desc: $A.getMsgSimpleDesc(item.last_msg),
|
desc: $A.getMsgSimpleDesc(item.last_msg),
|
||||||
activity: item.last_at,
|
activity: item.last_at,
|
||||||
|
|
||||||
|
searchMsgId: item.search_msg_id,
|
||||||
rawData: item,
|
rawData: item,
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
this.echoSearch(items)
|
this.echoSearch(items, 'searchMsgId')
|
||||||
}).finally(_ => {
|
}).finally(_ => {
|
||||||
this.loadIng--;
|
this.loadIng--;
|
||||||
})
|
})
|
||||||
|
|||||||
@ -8,8 +8,8 @@
|
|||||||
<p>{{$L('昵称')}}: {{user.nickname}}<em v-if="user.delete_at" class="deleted no-dark-content">{{$L('已删除')}}</em><em v-else-if="user.disable_at" class="disabled no-dark-content">{{$L('已离职')}}</em></p>
|
<p>{{$L('昵称')}}: {{user.nickname}}<em v-if="user.delete_at" class="deleted no-dark-content">{{$L('已删除')}}</em><em v-else-if="user.disable_at" class="disabled no-dark-content">{{$L('已离职')}}</em></p>
|
||||||
<p class="department-name" :title="user.department_name || ''">{{$L('部门')}}: {{user.department_name || '-'}}</p>
|
<p class="department-name" :title="user.department_name || ''">{{$L('部门')}}: {{user.department_name || '-'}}</p>
|
||||||
<p>{{$L('职位/职称')}}: {{user.profession || '-'}}</p>
|
<p>{{$L('职位/职称')}}: {{user.profession || '-'}}</p>
|
||||||
<p v-if="user.delete_at"><strong>{{$L('删除时间')}}: {{user.delete_at}}</strong></p>
|
<p v-if="user.delete_at"><strong>{{$L('删除时间')}}: {{$A.newDateString(user.delete_at, 'YYYY-MM-DD HH:mm')}}</strong></p>
|
||||||
<p v-else-if="user.disable_at"><strong>{{$L('离职时间')}}: {{user.disable_at}}</strong></p>
|
<p v-else-if="user.disable_at"><strong>{{$L('离职时间')}}: {{$A.newDateString(user.disable_at, 'YYYY-MM-DD HH:mm')}}</strong></p>
|
||||||
<slot name="end"/>
|
<slot name="end"/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
10
resources/assets/js/functions/common.js
vendored
10
resources/assets/js/functions/common.js
vendored
@ -2249,16 +2249,16 @@ const timezone = require("dayjs/plugin/timezone");
|
|||||||
timezoneDifference: 0,
|
timezoneDifference: 0,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对象中有Date格式的转成指定格式
|
* 对象中有Date格式的转成指定格式
|
||||||
* @param value
|
* @param value 支持类型:dayjs、Date、string
|
||||||
* @param format 默认格式:YYYY-MM-DD HH:mm:ss
|
* @param format 默认格式:YYYY-MM-DD HH:mm:ss
|
||||||
* @returns {*}
|
* @returns {*}
|
||||||
*/
|
*/
|
||||||
newDateString(value, format = "YYYY-MM-DD HH:mm:ss") {
|
newDateString(value, format = "YYYY-MM-DD HH:mm:ss") {
|
||||||
if (value === null) {
|
if (value === null) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
if (value instanceof dayjs || value instanceof Date) {
|
if (value instanceof dayjs || value instanceof Date || $A.isDateString(value)) {
|
||||||
value = $A.dayjs(value).format(format);
|
value = $A.dayjs(value).format(format);
|
||||||
} else if ($A.isJson(value)) {
|
} else if ($A.isJson(value)) {
|
||||||
value = Object.assign({}, value)
|
value = Object.assign({}, value)
|
||||||
@ -2308,7 +2308,7 @@ const timezone = require("dayjs/plugin/timezone");
|
|||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
isDateString(value) {
|
isDateString(value) {
|
||||||
return typeof value === "string" && /^\d{4}-\d{2}-\d{2}( \d{2}(:\d{2}(:\d{2})?)?)?$/i.test(value);
|
return typeof value === "string" && /^\d{4}[/-]\d{2}[/-]\d{2}(\s+\d{2}(:\d{2}(:\d{2})?)?)?$/i.test(value);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
82
resources/assets/js/functions/eeui.js
vendored
82
resources/assets/js/functions/eeui.js
vendored
@ -22,7 +22,7 @@
|
|||||||
eeuiModulePromise(name = 'eeui') {
|
eeuiModulePromise(name = 'eeui') {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
const eeui = this.eeuiModule(name);
|
const eeui = $A.eeuiModule(name);
|
||||||
if (!eeui) {
|
if (!eeui) {
|
||||||
return reject({msg: "module not found"});
|
return reject({msg: "module not found"});
|
||||||
}
|
}
|
||||||
@ -35,33 +35,33 @@
|
|||||||
|
|
||||||
// 获取eeui版本号
|
// 获取eeui版本号
|
||||||
eeuiAppVersion() {
|
eeuiAppVersion() {
|
||||||
return this.eeuiModule()?.getVersion();
|
return $A.eeuiModule()?.getVersion();
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取本地软件版本号
|
// 获取本地软件版本号
|
||||||
eeuiAppLocalVersion() {
|
eeuiAppLocalVersion() {
|
||||||
return this.eeuiModule()?.getLocalVersion();
|
return $A.eeuiModule()?.getLocalVersion();
|
||||||
},
|
},
|
||||||
|
|
||||||
// Alert
|
// Alert
|
||||||
eeuiAppAlert(object, callback) {
|
eeuiAppAlert(object, callback) {
|
||||||
if (typeof callback !== "function") callback = _ => {};
|
if (typeof callback !== "function") callback = _ => {};
|
||||||
this.eeuiModule()?.alert(object, callback);
|
$A.eeuiModule()?.alert(object, callback);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Toast
|
// Toast
|
||||||
eeuiAppToast(object) {
|
eeuiAppToast(object) {
|
||||||
this.eeuiModule()?.toast(object);
|
$A.eeuiModule()?.toast(object);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 相对地址基于当前地址补全
|
// 相对地址基于当前地址补全
|
||||||
eeuiAppRewriteUrl(val) {
|
eeuiAppRewriteUrl(val) {
|
||||||
return this.eeuiModule()?.rewriteUrl(val);
|
return $A.eeuiModule()?.rewriteUrl(val);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取页面信息
|
// 获取页面信息
|
||||||
eeuiAppGetPageInfo(pageName) {
|
eeuiAppGetPageInfo(pageName) {
|
||||||
return this.eeuiModule()?.getPageInfo(pageName || "");
|
return $A.eeuiModule()?.getPageInfo(pageName || "");
|
||||||
},
|
},
|
||||||
|
|
||||||
// 打开app新页面
|
// 打开app新页面
|
||||||
@ -73,55 +73,55 @@
|
|||||||
callback = object.callback;
|
callback = object.callback;
|
||||||
delete object.callback
|
delete object.callback
|
||||||
}
|
}
|
||||||
this.eeuiModule()?.openPage(Object.assign({
|
$A.eeuiModule()?.openPage(Object.assign({
|
||||||
softInputMode: "resize",
|
softInputMode: "resize",
|
||||||
}, object), callback);
|
}, object), callback);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 使用系统浏览器打开网页
|
// 使用系统浏览器打开网页
|
||||||
eeuiAppOpenWeb(url) {
|
eeuiAppOpenWeb(url) {
|
||||||
this.eeuiModule()?.openWeb(url)
|
$A.eeuiModule()?.openWeb(url)
|
||||||
},
|
},
|
||||||
|
|
||||||
// 拦截返回按键事件(仅支持android、iOS无效)
|
// 拦截返回按键事件(仅支持android、iOS无效)
|
||||||
eeuiAppSetPageBackPressed(object, callback) {
|
eeuiAppSetPageBackPressed(object, callback) {
|
||||||
if (typeof callback !== "function") callback = _ => {};
|
if (typeof callback !== "function") callback = _ => {};
|
||||||
this.eeuiModule()?.setPageBackPressed(object, callback);
|
$A.eeuiModule()?.setPageBackPressed(object, callback);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 返回手机桌面
|
// 返回手机桌面
|
||||||
eeuiAppGoDesktop() {
|
eeuiAppGoDesktop() {
|
||||||
this.eeuiModule()?.goDesktop();
|
$A.eeuiModule()?.goDesktop();
|
||||||
},
|
},
|
||||||
|
|
||||||
// 打开屏幕常亮
|
// 打开屏幕常亮
|
||||||
eeuiAppKeepScreenOn() {
|
eeuiAppKeepScreenOn() {
|
||||||
this.eeuiModule()?.keepScreenOn();
|
$A.eeuiModule()?.keepScreenOn();
|
||||||
},
|
},
|
||||||
|
|
||||||
// 关闭屏幕常亮
|
// 关闭屏幕常亮
|
||||||
eeuiAppKeepScreenOff() {
|
eeuiAppKeepScreenOff() {
|
||||||
this.eeuiModule()?.keepScreenOff();
|
$A.eeuiModule()?.keepScreenOff();
|
||||||
},
|
},
|
||||||
|
|
||||||
// 隐藏软键盘
|
// 隐藏软键盘
|
||||||
eeuiAppKeyboardHide() {
|
eeuiAppKeyboardHide() {
|
||||||
this.eeuiModule()?.keyboardHide();
|
$A.eeuiModule()?.keyboardHide();
|
||||||
},
|
},
|
||||||
|
|
||||||
// 给app发送消息
|
// 给app发送消息
|
||||||
eeuiAppSendMessage(object) {
|
eeuiAppSendMessage(object) {
|
||||||
this.eeuiModule("webview")?.sendMessage(object);
|
$A.eeuiModule("webview")?.sendMessage(object);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 设置浏览器地址
|
// 设置浏览器地址
|
||||||
eeuiAppSetUrl(url) {
|
eeuiAppSetUrl(url) {
|
||||||
this.eeuiModule("webview")?.setUrl(url);
|
$A.eeuiModule("webview")?.setUrl(url);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 扫码
|
// 扫码
|
||||||
eeuiAppScan(callback) {
|
eeuiAppScan(callback) {
|
||||||
this.eeuiModule()?.openScaner({}, (res) => {
|
$A.eeuiModule()?.openScaner({}, (res) => {
|
||||||
switch (res.status) {
|
switch (res.status) {
|
||||||
case "success":
|
case "success":
|
||||||
callback(res.text);
|
callback(res.text);
|
||||||
@ -132,55 +132,55 @@
|
|||||||
|
|
||||||
// 检查更新
|
// 检查更新
|
||||||
eeuiAppCheckUpdate() {
|
eeuiAppCheckUpdate() {
|
||||||
this.eeuiModule()?.checkUpdate();
|
$A.eeuiModule()?.checkUpdate();
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取主题名称 light|dark
|
// 获取主题名称 light|dark
|
||||||
eeuiAppGetThemeName() {
|
eeuiAppGetThemeName() {
|
||||||
return this.eeuiModule()?.getThemeName();
|
return $A.eeuiModule()?.getThemeName();
|
||||||
},
|
},
|
||||||
|
|
||||||
// 判断软键盘是否可见
|
// 判断软键盘是否可见
|
||||||
eeuiAppKeyboardStatus() {
|
eeuiAppKeyboardStatus() {
|
||||||
return this.eeuiModule()?.keyboardStatus();
|
return $A.eeuiModule()?.keyboardStatus();
|
||||||
},
|
},
|
||||||
|
|
||||||
// 设置全局变量
|
// 设置全局变量
|
||||||
eeuiAppSetVariate(key, value) {
|
eeuiAppSetVariate(key, value) {
|
||||||
this.eeuiModule()?.setVariate(key, value);
|
$A.eeuiModule()?.setVariate(key, value);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取全局变量
|
// 获取全局变量
|
||||||
eeuiAppGetVariate(key, defaultVal = "") {
|
eeuiAppGetVariate(key, defaultVal = "") {
|
||||||
return this.eeuiModule()?.getVariate(key, defaultVal);
|
return $A.eeuiModule()?.getVariate(key, defaultVal);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 设置缓存数据
|
// 设置缓存数据
|
||||||
eeuiAppSetCachesString(key, value, expired = 0) {
|
eeuiAppSetCachesString(key, value, expired = 0) {
|
||||||
this.eeuiModule()?.setCachesString(key, value, expired);
|
$A.eeuiModule()?.setCachesString(key, value, expired);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取缓存数据
|
// 获取缓存数据
|
||||||
eeuiAppGetCachesString(key, defaultVal = "") {
|
eeuiAppGetCachesString(key, defaultVal = "") {
|
||||||
return this.eeuiModule()?.getCachesString(key, defaultVal);
|
return $A.eeuiModule()?.getCachesString(key, defaultVal);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 是否长按内容震动(仅支持android、iOS无效)
|
// 是否长按内容震动(仅支持android、iOS无效)
|
||||||
eeuiAppSetHapticBackEnabled(val) {
|
eeuiAppSetHapticBackEnabled(val) {
|
||||||
this.eeuiModule("webview").setHapticBackEnabled(val);
|
$A.eeuiModule("webview").setHapticBackEnabled(val);
|
||||||
},
|
},
|
||||||
|
|
||||||
// 禁止长按选择(仅支持android、iOS无效)
|
// 禁止长按选择(仅支持android、iOS无效)
|
||||||
eeuiAppSetDisabledUserLongClickSelect(val) {
|
eeuiAppSetDisabledUserLongClickSelect(val) {
|
||||||
const webview = this.eeuiModule("webview");
|
const webview = $A.eeuiModule("webview");
|
||||||
this.__disabledUserLongClickSelectTimer && clearTimeout(this.__disabledUserLongClickSelectTimer);
|
$A.__disabledUserLongClickSelectTimer && clearTimeout($A.__disabledUserLongClickSelectTimer);
|
||||||
if (!/^\d+$/.test(val)) {
|
if (!/^\d+$/.test(val)) {
|
||||||
webview.setDisabledUserLongClickSelect(val);
|
webview.setDisabledUserLongClickSelect(val);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
webview.setDisabledUserLongClickSelect(true);
|
webview.setDisabledUserLongClickSelect(true);
|
||||||
this.__disabledUserLongClickSelectTimer = setTimeout(() => {
|
$A.__disabledUserLongClickSelectTimer = setTimeout(() => {
|
||||||
this.__disabledUserLongClickSelectTimer = null;
|
$A.__disabledUserLongClickSelectTimer = null;
|
||||||
webview.setDisabledUserLongClickSelect(false);
|
webview.setDisabledUserLongClickSelect(false);
|
||||||
}, val);
|
}, val);
|
||||||
},
|
},
|
||||||
@ -188,26 +188,26 @@
|
|||||||
|
|
||||||
// 复制文本
|
// 复制文本
|
||||||
eeuiAppCopyText(text) {
|
eeuiAppCopyText(text) {
|
||||||
this.eeuiModule()?.copyText(text)
|
$A.eeuiModule()?.copyText(text)
|
||||||
},
|
},
|
||||||
|
|
||||||
// 设置是否禁止滚动
|
// 设置是否禁止滚动
|
||||||
eeuiAppSetScrollDisabled(disabled) {
|
eeuiAppSetScrollDisabled(disabled) {
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
this.__setScrollDisabledNum++
|
$A.__setScrollDisabledNum++
|
||||||
} else {
|
} else {
|
||||||
this.__setScrollDisabledNum--
|
$A.__setScrollDisabledNum--
|
||||||
}
|
}
|
||||||
this.eeuiModule("webview")?.setScrollEnabled(this.__setScrollDisabledNum <= 0);
|
$A.eeuiModule("webview")?.setScrollEnabled($A.__setScrollDisabledNum <= 0);
|
||||||
},
|
},
|
||||||
__setScrollDisabledNum: 0,
|
__setScrollDisabledNum: 0,
|
||||||
|
|
||||||
// 设置应用程序级别的摇动撤销(仅支持iOS、android无效)
|
// 设置应用程序级别的摇动撤销(仅支持iOS、android无效)
|
||||||
eeuiAppShakeToEditEnabled(enabled) {
|
eeuiAppShakeToEditEnabled(enabled) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
this.eeuiModule()?.shakeToEditOn();
|
$A.eeuiModule()?.shakeToEditOn();
|
||||||
} else {
|
} else {
|
||||||
this.eeuiModule()?.shakeToEditOff();
|
$A.eeuiModule()?.shakeToEditOff();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -215,7 +215,7 @@
|
|||||||
eeuiAppGetLatestPhoto(expiration = 60, timeout = 10) {
|
eeuiAppGetLatestPhoto(expiration = 60, timeout = 10) {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
const eeui = await this.eeuiModule();
|
const eeui = await $A.eeuiModule();
|
||||||
|
|
||||||
const timer = timeout > 0 ? setTimeout(() => {
|
const timer = timeout > 0 ? setTimeout(() => {
|
||||||
reject({msg: "timeout"});
|
reject({msg: "timeout"});
|
||||||
@ -233,10 +233,10 @@
|
|||||||
if (expiration > 0 && (result.created + expiration) < $A.dayjs().unix()) {
|
if (expiration > 0 && (result.created + expiration) < $A.dayjs().unix()) {
|
||||||
return reject({msg: "photo expired"});
|
return reject({msg: "photo expired"});
|
||||||
}
|
}
|
||||||
if (this.__latestPhotoCreated && this.__latestPhotoCreated === result.created) {
|
if ($A.__latestPhotoCreated && $A.__latestPhotoCreated === result.created) {
|
||||||
return reject({msg: "photo expired"});
|
return reject({msg: "photo expired"});
|
||||||
}
|
}
|
||||||
this.__latestPhotoCreated = result.created;
|
$A.__latestPhotoCreated = result.created;
|
||||||
resolve(result);
|
resolve(result);
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@ -250,7 +250,7 @@
|
|||||||
eeuiAppUploadPhoto(params, timeout = 30) {
|
eeuiAppUploadPhoto(params, timeout = 30) {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
const eeui = await this.eeuiModulePromise();
|
const eeui = await $A.eeuiModulePromise();
|
||||||
|
|
||||||
const timer = timeout > 0 ? setTimeout(() => {
|
const timer = timeout > 0 ? setTimeout(() => {
|
||||||
reject({msg: "timeout"});
|
reject({msg: "timeout"});
|
||||||
@ -291,7 +291,7 @@
|
|||||||
eeuiAppCancelUploadPhoto(id) {
|
eeuiAppCancelUploadPhoto(id) {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
const eeui = await this.eeuiModulePromise();
|
const eeui = await $A.eeuiModulePromise();
|
||||||
eeui.cancelUploadPhoto(id, result => {
|
eeui.cancelUploadPhoto(id, result => {
|
||||||
if (result.status !== 'success') {
|
if (result.status !== 'success') {
|
||||||
return reject({msg: result.error || "cancel failed"});
|
return reject({msg: result.error || "cancel failed"});
|
||||||
@ -308,7 +308,7 @@
|
|||||||
eeuiAppGetSafeAreaInsets() {
|
eeuiAppGetSafeAreaInsets() {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
const eeui = await this.eeuiModulePromise();
|
const eeui = await $A.eeuiModulePromise();
|
||||||
eeui.getSafeAreaInsets(result => {
|
eeui.getSafeAreaInsets(result => {
|
||||||
if (result.status !== 'success') {
|
if (result.status !== 'success') {
|
||||||
return reject({msg: result.error || "get failed"});
|
return reject({msg: result.error || "get failed"});
|
||||||
|
|||||||
@ -29,17 +29,17 @@
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<span>{{$L('最后在线')}}: </span>
|
<span>{{$L('最后在线')}}: </span>
|
||||||
{{userData.line_at ? $A.dayjs(userData.line_at).format("YYYY-MM-DD HH:mm") : '-'}}
|
{{$A.newDateString(userData.line_at, 'YYYY-MM-DD HH:mm') || '-'}}
|
||||||
</li>
|
</li>
|
||||||
<li v-if="userData.delete_at">
|
<li v-if="userData.delete_at">
|
||||||
<strong><span>{{$L('删除时间')}}: </span>{{userData.delete_at}}</strong>
|
<strong><span>{{$L('删除时间')}}: </span>{{$A.newDateString(userData.delete_at, 'YYYY-MM-DD HH:mm')}}</strong>
|
||||||
</li>
|
</li>
|
||||||
<li v-else-if="userData.disable_at">
|
<li v-else-if="userData.disable_at">
|
||||||
<strong><span>{{$L('离职时间')}}: </span>{{userData.disable_at}}</strong>
|
<strong><span>{{$L('离职时间')}}: </span>{{$A.newDateString(userData.disable_at, 'YYYY-MM-DD HH:mm')}}</strong>
|
||||||
</li>
|
</li>
|
||||||
</template>
|
</template>
|
||||||
</ul>
|
</ul>
|
||||||
<Button icon="md-chatbubbles" :disabled="userData.delete_at" @click="onOpenDialog">{{ $L('开始聊天') }}</Button>
|
<Button icon="md-chatbubbles" :disabled="!!userData.delete_at" @click="onOpenDialog">{{ $L('开始聊天') }}</Button>
|
||||||
</div>
|
</div>
|
||||||
</ModalAlive>
|
</ModalAlive>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user