From a4cb5d1b1450fdc25b83997e539f43f415de28a4 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Sat, 19 Apr 2025 19:29:58 +0800 Subject: [PATCH] no message --- app/Http/Controllers/Api/SystemController.php | 14 +- app/Http/Controllers/Api/UsersController.php | 21 --- .../assets/js/components/RightBottom.vue | 2 +- .../assets/js/pages/manage/setting/device.vue | 107 +------------ .../assets/js/pages/manage/setting/index.vue | 62 +++----- resources/assets/sass/pages/page-setting.scss | 148 ++++++++++++++++-- 6 files changed, 176 insertions(+), 178 deletions(-) diff --git a/app/Http/Controllers/Api/SystemController.php b/app/Http/Controllers/Api/SystemController.php index 3b8024e33..90b58c343 100755 --- a/app/Http/Controllers/Api/SystemController.php +++ b/app/Http/Controllers/Api/SystemController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers\Api; +use App\Models\UserDevice; use App\Models\WebSocketDialog; use App\Models\WebSocketDialogMsg; use Request; @@ -1445,23 +1446,29 @@ class SystemController extends AbstractController * * @apiSuccessExample {json} Success-Response: { - "version": "0.0.1", + "device_count": 3, // 设备数量 + "version": "0.0.1", // 服务端版本号 "publish": { "provider": "generic", "url": "" } } + // 如果header请求中存在version字段,则返回数据包裹在 {ret:1,data:{},msg:"success"} 中 */ public function version() { - $url = url(''); $package = Base::getPackage(); $array = [ + 'device_count' => 0, 'version' => Base::getVersion(), 'publish' => [], ]; + if (Doo::userId()) { + $array['device_count'] = UserDevice::whereUserid(Doo::userId())->count(); + } if (is_array($package['app'])) { $i = 0; + $url = url(''); foreach ($package['app'] as $item) { $urls = $item['urls'] && is_array($item['urls']) ? $item['urls'] : $item['url']; if (is_array($item['publish']) && ($i === 0 || Base::hostContrast($url, $urls))) { @@ -1470,6 +1477,9 @@ class SystemController extends AbstractController $i++; } } + if (Request::hasHeader('version')) { + return Base::retSuccess('success', $array); + } return $array; } diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php index 96c86ae8d..9e3426120 100755 --- a/app/Http/Controllers/Api/UsersController.php +++ b/app/Http/Controllers/Api/UsersController.php @@ -2443,27 +2443,6 @@ class UsersController extends AbstractController return Base::retSuccess('success', $data); } - /** - * @api {get} api/users/device/count 38. 获取设备数量 - * - * @apiDescription 需要token身份 - * @apiVersion 1.0.0 - * @apiGroup users - * @apiName device__count - * - * @apiSuccess {Number} ret 返回状态码(1正确、0错误) - * @apiSuccess {String} msg 返回信息(错误描述) - * @apiSuccess {Object} data 返回数据 - */ - public function device__count() - { - $user = User::auth(); - // - return Base::retSuccess('success', [ - 'count' => UserDevice::whereUserid($user->userid)->count() - ]); - } - /** * @api {get} api/users/device/list 39. 获取设备列表 * diff --git a/resources/assets/js/components/RightBottom.vue b/resources/assets/js/components/RightBottom.vue index 5837726d2..e1cdd7eae 100644 --- a/resources/assets/js/components/RightBottom.vue +++ b/resources/assets/js/components/RightBottom.vue @@ -165,7 +165,7 @@ export default { } } }).catch(_ => { - + // console.log('获取版本失败') }) // this.__checkVersion && clearTimeout(this.__checkVersion) diff --git a/resources/assets/js/pages/manage/setting/device.vue b/resources/assets/js/pages/manage/setting/device.vue index fdef8d9c7..582d9ef77 100644 --- a/resources/assets/js/pages/manage/setting/device.vue +++ b/resources/assets/js/pages/manage/setting/device.vue @@ -12,7 +12,7 @@
-
+

{{$L('登录时间')}}: {{device.created_at}}

{{$L('更新时间')}}: {{device.updated_at}}

{{$L('过期时间')}}: {{device.expired_at}}

@@ -30,107 +30,6 @@
- - diff --git a/resources/assets/sass/pages/page-setting.scss b/resources/assets/sass/pages/page-setting.scss index a64609c50..e961a18f4 100755 --- a/resources/assets/sass/pages/page-setting.scss +++ b/resources/assets/sass/pages/page-setting.scss @@ -343,27 +343,126 @@ } .setting-device { - .icon { - > span { - &.android { - background-image: url("../images/device/android.svg"); + > ul { + display: flex; + flex-direction: column; + gap: 16px; + + > li { + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + gap: 8px; + padding: 24px; + border-radius: 12px; + background: rgba(79, 89, 102, .04); + + .icon { + align-self: flex-start; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + height: 24px; + + > span { + width: 20px; + height: 20px; + + &.android { + background-image: url("../images/device/android.svg"); + } + + &.apple { + background-image: url("../images/device/apple.svg"); + } + + &.macos { + background-image: url("../images/device/macos.svg"); + } + + &.window { + background-image: url("../images/device/window.svg"); + } + + &.web { + background-image: url("../images/device/web.svg"); + } + } } - &.apple { - background-image: url("../images/device/apple.svg"); + + .info { + flex: 1 1 auto; + display: flex; + justify-content: center; + align-items: center; + flex-direction: column; + gap: 6px; + + .title { + width: 100%; + font-size: 16px; + line-height: 24px; + display: flex; + flex-direction: row; + align-items: center; + gap: 2px; + justify-content: flex-start; + color: #262626; + + .name { + font-weight: 500; + } + + .device { + &:before { + content: "("; + } + + &:after { + content: ")"; + } + } + } + + .time { + width: 100%; + font-size: 14px; + line-height: 22px; + color: #8a939d; + cursor: pointer; + } } - &.macos { - background-image: url("../images/device/macos.svg"); + + .current { + color: #595959; } - &.window { - background-image: url("../images/device/window.svg"); - } - &.web { - background-image: url("../images/device/web.svg"); + + .ivu-btn { + background: #d9d9dd; + border-color: #d9d9dd; + color: #262626; + box-shadow: none; + height: 36px; + padding: 0 12px; + border-radius: 12px; + + &:hover { + background: rgba(217, 217, 221, 0.8); + border-color: rgba(217, 217, 221, 0.8); + } } } } } +.setting-device-popover { + > p { + line-height: 26px; + } +} + body.window-portrait { .page-setting { background-color: #f8f8f8; @@ -469,4 +568,27 @@ body.window-portrait { } } } + + .setting-device { + padding: 16px !important; + > ul { + > li { + padding: 20px; + + .info { + .title { + flex-direction: column; + align-items: flex-start; + .device { + opacity: 0.6; + &:before, + &:after { + content: ""; + } + } + } + } + } + } + } }