diff --git a/app/Http/Controllers/Api/SystemController.php b/app/Http/Controllers/Api/SystemController.php
index 632ca8e2..e40470d2 100755
--- a/app/Http/Controllers/Api/SystemController.php
+++ b/app/Http/Controllers/Api/SystemController.php
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Api;
use App\Models\User;
use App\Module\Base;
use Request;
+use Response;
/**
* @apiDefine system
@@ -196,6 +197,81 @@ class SystemController extends AbstractController
return Base::getIpInfo(Request::input("ip"));
}
+ /**
+ * @api {get} api/system/get/appinfo 06. 获取应用下载信息
+ *
+ * @apiVersion 1.0.0
+ * @apiGroup system
+ * @apiName get__appinfo
+ *
+ * @apiSuccess {Number} ret 返回状态码(1正确、0错误)
+ * @apiSuccess {String} msg 返回信息(错误描述)
+ * @apiSuccess {Object} data 返回数据
+ */
+ public function get__appinfo() {
+ $array = [
+ 'name' => '',
+ 'version' => '',
+ 'list' => [],
+ ];
+ //
+ $file = base_path("electron/package.json");
+ $dist = base_path("electron/dist");
+ if (file_exists($file)) {
+ $packageArray = json_decode(file_get_contents($file), true);
+ $array['name'] = $packageArray['name'] ?? 'No app';
+ $array['version'] = $packageArray['version'] ?? '';
+ //
+ $list = [
+ [
+ 'icon' => 'logo-apple',
+ 'name' => 'macOS Intel',
+ 'file' => "{$array['name']}-{$array['version']}-mac.zip"
+ ],
+ [
+ 'icon' => 'logo-apple',
+ 'name' => 'macOS M1',
+ 'file' => "{$array['name']}-{$array['version']}-arm64-mac.zip"
+ ],
+ [
+ 'icon' => 'logo-windows',
+ 'name' => 'Windows x64',
+ 'file' => "{$array['name']} Setup {$array['version']}.exe"
+ ]
+ ];
+ foreach ($list as $item) {
+ if (file_exists("{$dist}/{$item['file']}")) {
+ $item['url'] = Base::fillUrl('api/system/get/appdown?file=' . urlencode($item['file']));
+ $item['size'] = filesize("{$dist}/{$item['file']}");
+ $array['list'][] = $item;
+ }
+ }
+ }
+ //
+ if (count($array['list']) == 0) {
+ return Base::retError('No file');
+ }
+ return Base::retSuccess('success', $array);
+ }
+
+ /**
+ * @api {get} api/system/get/appdown 06. 下载应用
+ *
+ * @apiVersion 1.0.0
+ * @apiGroup system
+ * @apiName get__appdown
+ *
+ * @apiParam {String} file 文件名称
+ */
+ public function get__appdown() {
+ $file = Request::input("file");
+ $path = base_path("electron/dist/" . $file);
+ if (!file_exists($path)) {
+ return Base::ajaxError("No file");
+ }
+ return Response::download($path);
+ }
+
/**
* @api {post} api/system/imgupload 10. 上传图片
*
diff --git a/electron/package.json b/electron/package.json
index 4e13c4d8..7e4b2dd1 100644
--- a/electron/package.json
+++ b/electron/package.json
@@ -1,6 +1,6 @@
{
"name": "DooTask",
- "version": "0.3.4",
+ "version": "0.3.10",
"description": "DooTask is task management system.",
"main": "main.js",
"license": "MIT",
diff --git a/resources/assets/js/pages/download.vue b/resources/assets/js/pages/download.vue
new file mode 100644
index 00000000..4870b527
--- /dev/null
+++ b/resources/assets/js/pages/download.vue
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
{{name}}
+
v{{version}}
+
+
+
+
+
+
diff --git a/resources/assets/js/pages/login.vue b/resources/assets/js/pages/login.vue
index fb16414c..3716e017 100644
--- a/resources/assets/js/pages/login.vue
+++ b/resources/assets/js/pages/login.vue
@@ -38,6 +38,9 @@
+
+
+
@@ -55,6 +58,13 @@ export default {
password: '',
password2: '',
code: '',
+
+ downList: []
+ }
+ },
+ mounted() {
+ if (!this.isElectron) {
+ this.getAppInfo();
}
},
computed: {
@@ -63,6 +73,14 @@ export default {
}
},
methods: {
+ getAppInfo() {
+ this.$store.dispatch("call", {
+ url: 'system/get/appinfo',
+ }).then(({data}) => {
+ this.downList = data.list;
+ });
+ },
+
forgotPassword() {
$A.modalWarning("请联系管理员!");
},
diff --git a/resources/assets/js/pages/manage/dashboard.vue b/resources/assets/js/pages/manage/dashboard.vue
index e13d3d54..2ae83072 100644
--- a/resources/assets/js/pages/manage/dashboard.vue
+++ b/resources/assets/js/pages/manage/dashboard.vue
@@ -91,6 +91,9 @@
+
+
+
@@ -107,7 +110,9 @@ export default {
active: false,
dashboard: 'today',
- taskLoad: {}
+ taskLoad: {},
+
+ downList: []
}
},
@@ -115,6 +120,9 @@ export default {
this.nowInterval = setInterval(() => {
this.nowTime = Math.round(new Date().getTime() / 1000);
}, 1000)
+ if (!this.isElectron) {
+ this.getAppInfo();
+ }
},
destroyed() {
@@ -206,6 +214,18 @@ export default {
},
methods: {
+ getAppInfo() {
+ this.$store.dispatch("call", {
+ url: 'system/get/appinfo',
+ }).then(({data}) => {
+ this.downList = data.list;
+ });
+ },
+
+ goDownApp() {
+ this.goForward({path: '/manage/download'});
+ },
+
getTask() {
let data = {complete: "no"};
switch (this.dashboard) {
diff --git a/resources/assets/js/routes.js b/resources/assets/js/routes.js
index cefe808a..cdc50a00 100755
--- a/resources/assets/js/routes.js
+++ b/resources/assets/js/routes.js
@@ -68,8 +68,18 @@ export default [
path: 'file',
component: () => import('./pages/manage/file.vue'),
},
+ {
+ name: 'manage-download',
+ path: 'download',
+ component: () => import('./pages/download.vue'),
+ },
]
},
+ {
+ name: 'download',
+ path: '/download',
+ component: () => import('./pages/download.vue'),
+ },
{
name: 'login',
path: '/login',
diff --git a/resources/assets/sass/pages/_.scss b/resources/assets/sass/pages/_.scss
index 77226ae0..e3f50996 100755
--- a/resources/assets/sass/pages/_.scss
+++ b/resources/assets/sass/pages/_.scss
@@ -1,6 +1,7 @@
@import "common";
@import "page-calendar";
@import "page-dashboard";
+@import "page-download";
@import "page-file";
@import "page-login";
@import "page-manage";
diff --git a/resources/assets/sass/pages/page-dashboard.scss b/resources/assets/sass/pages/page-dashboard.scss
index 51b38e94..c5fac768 100644
--- a/resources/assets/sass/pages/page-dashboard.scss
+++ b/resources/assets/sass/pages/page-dashboard.scss
@@ -149,6 +149,12 @@
}
}
}
+ .download-app {
+ position: absolute;
+ bottom: 26px;
+ right: 26px;
+ z-index: 1;
+ }
.nopage {
width: 100%;
height: 100%;
diff --git a/resources/assets/sass/pages/page-download.scss b/resources/assets/sass/pages/page-download.scss
new file mode 100644
index 00000000..f18f838f
--- /dev/null
+++ b/resources/assets/sass/pages/page-download.scss
@@ -0,0 +1,214 @@
+.page-download {
+ overflow: auto;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ .download-load {
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ z-index: 1;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ }
+ .download-body {
+ position: relative;
+ margin-top: 50px;
+ .orb-canvas-1 {
+ position: absolute;
+ top: 0;
+ left: 50%;
+ width: 500px;
+ height: 500px;
+ z-index: -1;
+ background: linear-gradient(rgba(186, 117, 255, 0.49) 26.56%, rgb(57, 19, 184) 100%);
+ opacity: .1;
+ transform: translate(-50%, 0) rotate(-90deg);
+ margin-top: 20px;
+ margin-left: -50px;
+ border-radius: 24% 76% 35% 65% / 27% 36% 64% 73%;
+ }
+ .orb-canvas-2 {
+ position: absolute;
+ top: 0;
+ left: 50%;
+ width: 500px;
+ height: 500px;
+ background: linear-gradient(rgba(47, 184, 255, 0.42) 31.77%, rgb(158, 236, 217) 100%);
+ z-index: -1;
+ animation: 25s ease 0s infinite alternate none running izRuqW;
+ opacity: .1;
+ transform: translate(-50%, 0) rotate(-90deg);
+ margin-top: 120px;
+ margin-left: 50px;
+ border-radius: 51% 49% 58% 42% / 34% 78% 22% 66%;
+ }
+ .download-name {
+ color: #2A2A2A;
+ text-align: center;
+ font-size: 24px;
+ padding-top: 64px;
+ line-height: 1;
+ }
+ .download-version {
+ color: #8a919c;
+ text-align: center;
+ font-size: 14px;
+ padding-top: 20px;
+ line-height: 1;
+ }
+ .download-list {
+ margin-top: 100px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ > li {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ list-style: none;
+ background: rgba(255,255,255,.7);
+ border-radius: 20px;
+ overflow: hidden;
+ margin: 0 12px;
+ padding: 30px 46px;
+ position: relative;
+ z-index: 5;
+ box-shadow: 0 30px 70px 0 rgba(223, 227, 234, 0.5);
+ .app-icon,
+ .app-name,
+ .app-size {
+ transition: all 0.3s ease-in-out;
+ }
+ .app-icon {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ height: 60px;
+ > i {
+ font-size: 60px;
+ &.ivu-icon-logo-windows {
+ font-size: 52px;
+ }
+ }
+ }
+ .app-name {
+ margin-top: 15px;
+ font-size: 18px;
+ }
+ .app-size {
+ margin-top: 15px;
+ opacity: 0.6;
+ }
+ .app-button {
+ margin-top: 22px;
+ > a {
+ display: inline-block;
+ position: relative;
+ z-index: 1;
+ line-height: 32px;
+ border-radius: 6px;
+ text-align: center;
+ padding: 0 18px;
+ text-transform: capitalize;
+ transition: all 0.3s ease-in-out;
+ color: #8bcf70;
+ border: 1px solid #8bcf70;
+ &:before {
+ content: '';
+ position: absolute;
+ width: 100%;
+ height: 100%;
+ top: 0;
+ left: 0;
+ border-radius: 36px;
+ transition: all 0.3s ease-in-out;
+ transform: scale(0,1);
+ z-index: -1;
+ }
+ &:hover {
+ &:before {
+ border-radius: 4px;
+ background: #ffffff;
+ transform: scale(1);
+ }
+ }
+ }
+ }
+ &:before {
+ content: '';
+ position: absolute;
+ z-index: -1;
+ width: 100%;
+ height: 100%;
+ top:0;
+ left:0;
+ background: linear-gradient( 130deg, rgb(131,239,146) 0%, rgb(0,211,139) 100%);
+ opacity: 0;
+ transition: all 0.3s ease-in-out;
+ }
+ &:after {
+ content: '';
+ position: absolute;
+ width: 160px;
+ height: 160px;
+ border-radius: 50%;
+ background: rgba(255,255,255,0.13);
+ z-index: -1;
+ top:-80px;
+ right: -80px;
+ opacity: 0;
+ transform: scale(0.2);
+ transition: all 0.3s ease-in-out;
+ }
+ &:hover {
+ .app-icon,
+ .app-name,
+ .app-size {
+ color: #ffffff
+ }
+ .app-button {
+ > a {
+ color: #ffffff;
+ border-color: #ffffff;
+ &:hover {
+ color: #0de49d;
+ }
+ }
+ }
+ &:before {
+ opacity: 1;
+ }
+ &:after {
+ opacity: 1;
+ transform: scale(1);
+ transition-duration: 1s;
+ }
+ }
+ }
+ @media (max-width: 720px) {
+ flex-direction: column;
+ > li {
+ padding: 52px 64px;
+ margin-bottom: 32px;
+ }
+ }
+ }
+ }
+ &.manage-box-view {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ .download-body {
+ transform: translateY(-16%);
+ .download-name {
+ padding-top: 16%;
+ }
+ }
+ }
+}
+
diff --git a/resources/assets/sass/pages/page-login.scss b/resources/assets/sass/pages/page-login.scss
index 52982961..f0a3e723 100644
--- a/resources/assets/sass/pages/page-login.scss
+++ b/resources/assets/sass/pages/page-login.scss
@@ -104,4 +104,10 @@
}
}
}
+ .download-app {
+ position: absolute;
+ bottom: 26px;
+ right: 26px;
+ z-index: 1;
+ }
}