mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 03:01:12 +00:00
no message
This commit is contained in:
parent
13e1415355
commit
a4cb5d1b14
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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. 获取设备列表
|
||||
*
|
||||
|
||||
@ -165,7 +165,7 @@ export default {
|
||||
}
|
||||
}
|
||||
}).catch(_ => {
|
||||
|
||||
// console.log('获取版本失败')
|
||||
})
|
||||
//
|
||||
this.__checkVersion && clearTimeout(this.__checkVersion)
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
</div>
|
||||
<div class="time">
|
||||
<EPopover placement="bottom-start" trigger="click">
|
||||
<div class="time-popover">
|
||||
<div class="setting-device-popover">
|
||||
<p>{{$L('登录时间')}}: {{device.created_at}}</p>
|
||||
<p>{{$L('更新时间')}}: {{device.updated_at}}</p>
|
||||
<p>{{$L('过期时间')}}: {{device.expired_at}}</p>
|
||||
@ -30,107 +30,6 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.setting-device {
|
||||
> 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;
|
||||
}
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
}
|
||||
|
||||
.current {
|
||||
color: #595959;
|
||||
}
|
||||
|
||||
.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.time-popover {
|
||||
> p {
|
||||
line-height: 26px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'SettingDevice',
|
||||
@ -152,8 +51,8 @@ export default {
|
||||
url: 'users/device/list',
|
||||
}).then(({data}) => {
|
||||
this.devices = data.list
|
||||
if (typeof this.$parent.updateDeviceNum === "function") {
|
||||
this.$parent.updateDeviceNum(this.devices.length);
|
||||
if (typeof this.$parent.updateDeviceCount === "function") {
|
||||
this.$parent.updateDeviceCount(this.devices.length);
|
||||
}
|
||||
}).catch(() => {
|
||||
this.devices = []
|
||||
|
||||
@ -19,14 +19,14 @@
|
||||
@click="toggleRoute(item.path)">
|
||||
<template v-if="item.path === 'device'">
|
||||
<AutoTip>{{$L(item.name)}}</AutoTip>
|
||||
<span v-if="deviceNum > 0" class="op-8">{{deviceNum}}</span>
|
||||
<span v-if="deviceCount > 0" class="op-8">{{deviceCount}}</span>
|
||||
</template>
|
||||
<template v-else-if="item.path === 'version'">
|
||||
<AutoTip disabled>{{$L(item.name)}}</AutoTip>
|
||||
<Badge v-if="!!clientNewVersion" :text="clientNewVersion"/>
|
||||
</template>
|
||||
<template v-else-if="item.path === 'version-show'">
|
||||
<AutoTip>{{$L(item.name)}}: {{version}}</AutoTip>
|
||||
<AutoTip>{{$L(item.name)}}: {{clientVersion}}</AutoTip>
|
||||
</template>
|
||||
<span v-else>{{$L(item.name)}}</span>
|
||||
</li>
|
||||
@ -55,19 +55,20 @@ export default {
|
||||
components: {MobileNavTitle},
|
||||
data() {
|
||||
return {
|
||||
deviceNum: 0,
|
||||
version: window.systemInfo.version
|
||||
deviceCount: 0,
|
||||
serverVersion: null,
|
||||
clientVersion: window.systemInfo.version,
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
if (this.$isEEUiApp) {
|
||||
this.version = `${window.systemInfo.version} (${$A.eeuiAppLocalVersion()})`
|
||||
this.clientVersion = `${window.systemInfo.version} (${$A.eeuiAppLocalVersion()})`
|
||||
}
|
||||
},
|
||||
|
||||
activated() {
|
||||
this.getDeviceNum();
|
||||
this.getVersion();
|
||||
},
|
||||
|
||||
computed: {
|
||||
@ -221,15 +222,12 @@ export default {
|
||||
const array = [
|
||||
`${this.$L('服务器')}: ${$A.getDomain($A.mainUrl())}`
|
||||
]
|
||||
await this.$store.dispatch("showSpinner", 600)
|
||||
try {
|
||||
const version = await this.getServerVersion()
|
||||
array.push(`${this.$L('服务器版本')}: v${version}`)
|
||||
} catch (e) {
|
||||
if (this.serverVersion) {
|
||||
array.push(`${this.$L('服务器版本')}: v${this.serverVersion}`)
|
||||
} else {
|
||||
array.push(`${this.$L('服务器版本')}: ` + this.$L('获取失败'))
|
||||
}
|
||||
await this.$store.dispatch("hiddenSpinner")
|
||||
array.push(`${this.$L('客户端版本')}: v${this.version}`)
|
||||
array.push(`${this.$L('客户端版本')}: v${this.clientVersion}`)
|
||||
//
|
||||
$A.modalInfo({
|
||||
language: false,
|
||||
@ -238,33 +236,23 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
getDeviceNum() {
|
||||
getVersion() {
|
||||
this.versionTimer && clearTimeout(this.versionTimer)
|
||||
this.versionTimer = setTimeout(() => {
|
||||
this.$store.dispatch("call", {
|
||||
url: 'users/device/count',
|
||||
url: 'system/version',
|
||||
}).then(({data}) => {
|
||||
this.updateDeviceNum(data.count)
|
||||
this.serverVersion = data.version
|
||||
this.deviceCount = data.device_count
|
||||
}).catch(() => {
|
||||
this.updateDeviceNum(0)
|
||||
// console.log('获取版本失败')
|
||||
})
|
||||
}, this.versionTimer ? 1000 : 0)
|
||||
},
|
||||
|
||||
updateDeviceNum(num) {
|
||||
this.deviceNum = num
|
||||
updateDeviceCount(num) {
|
||||
this.deviceCount = num
|
||||
},
|
||||
|
||||
getServerVersion() {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (/^\d+\.\d+\.\d+$/.test(this.systemConfig.server_version)) {
|
||||
resolve(this.systemConfig.server_version)
|
||||
return;
|
||||
}
|
||||
axios.get($A.apiUrl('system/version')).then(({status, data}) => {
|
||||
if (status === 200) {
|
||||
resolve(data.version)
|
||||
}
|
||||
}).catch(reject)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
122
resources/assets/sass/pages/page-setting.scss
vendored
122
resources/assets/sass/pages/page-setting.scss
vendored
@ -343,25 +343,124 @@
|
||||
}
|
||||
|
||||
.setting-device {
|
||||
> 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.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;
|
||||
}
|
||||
}
|
||||
|
||||
.current {
|
||||
color: #595959;
|
||||
}
|
||||
|
||||
.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 {
|
||||
@ -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: "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user