no message

This commit is contained in:
kuaifan 2021-06-25 18:01:59 +08:00
parent 9e1dd940b8
commit d246199a5e
12 changed files with 147 additions and 76 deletions

View File

@ -2,10 +2,10 @@
directory=/var/www directory=/var/www
# 生产环境 # 生产环境
#command=php bin/laravels start -i command=php bin/laravels start -i
# 开发环境 # 开发环境
command=./bin/inotify ./app #command=./bin/inotify ./app
numprocs=1 numprocs=1
autostart=true autostart=true

56
nativefier.js vendored
View File

@ -1,25 +1,61 @@
const nativefier = require('nativefier').default; const nativefier = require('nativefier').default;
const inquirer = require('inquirer');
const config = require('./package.json'); const config = require('./package.json');
const options = { const options = {
name: config.name, name: config.name,
version: config.version, appVersion: config.version,
targetUrl: 'http://127.0.0.1:2222', buildVersion: config.version,
arch: 'arm64',
out: './build', out: './build',
icon: './resources/assets/statics/public/images/logo-app.png', icon: './resources/assets/statics/public/images/logo-app.png',
bounce: false,
counter: true,
clearCache: false, clearCache: false,
disableDevTools: false, disableDevTools: true,
disableContextMenu: false, disableContextMenu: true,
fileDownloadOptions: { fileDownloadOptions: {
saveAs: true, saveAs: true,
}, },
}; };
nativefier(options, function (error, appPath) { const questions = [
if (error) { {
console.error(error); type: 'input',
} else { name: 'targetUrl',
console.log('App has been nativefied to', appPath); message: "请输入网站地址",
validate: function (value) {
return value !== ''
}
}, {
type: 'list',
name: 'platform',
message: "选择操作系统平台",
choices: [{
name: "MacOS Intel",
value: {
platform: 'mac',
arch: 'x64',
}
}, {
name: "MacOS Arm64",
value: {
platform: 'mac',
arch: 'arm64',
}
}, {
name: "Window x86_64",
value: {
platform: 'windows',
arch: 'x64',
}
}]
} }
];
inquirer.prompt(questions).then(answers => {
nativefier(Object.assign(options, answers.platform, {
targetUrl: answers.targetUrl
}), (error) => {
error && console.error(error)
});
}); });

View File

@ -1,6 +1,6 @@
{ {
"name": "DooTask", "name": "DooTask",
"version": "0.0.2", "version": "0.2.12",
"description": "DooTask is task management system", "description": "DooTask is task management system",
"scripts": { "scripts": {
"dev": "npm run development", "dev": "npm run development",
@ -16,6 +16,7 @@
"cross-env": "^7.0.2", "cross-env": "^7.0.2",
"css-loader": "^5.2.6", "css-loader": "^5.2.6",
"file-loader": "^6.2.0", "file-loader": "^6.2.0",
"inquirer": "^8.1.1",
"internal-ip": "^6.2.0", "internal-ip": "^6.2.0",
"jquery": "^3.5.1", "jquery": "^3.5.1",
"laravel-mix": "^6.0.6", "laravel-mix": "^6.0.6",

View File

@ -71,7 +71,7 @@ Vue.prototype.goForward = function(location, isReplace) {
if (typeof location === 'string') location = {name: location}; if (typeof location === 'string') location = {name: location};
if (isReplace === true) { if (isReplace === true) {
app.$router.replace(location).then(() => {}); app.$router.replace(location).then(() => {});
}else{ } else {
app.$router.push(location).then(() => {}); app.$router.push(location).then(() => {});
} }
}; };

View File

@ -1,70 +1,69 @@
<template> <template>
<h1 v-if="false"><slot/></h1> <div v-if="false"></div>
</template> </template>
<script> <script>
export default { export default {
name: 'PageTitle', name: 'PageTitle',
props: { props: {
title: { title: {
type: [String, Number], type: [String, Number],
default: '' default: ''
},
}, },
},
data() { data() {
return { return {
pagePath: '' pagePath: ''
} }
}, },
mounted () {
activated() {
this.updateTitle()
},
watch: {
title: {
handler() {
this.initTitle()
},
immediate: true
}
},
methods: {
initTitle() {
this.pagePath = this.$route.path; this.pagePath = this.$route.path;
this.updateTitle() this.updateTitle()
}, },
beforeUpdate () {
this.updateTitle() updateTitle() {
}, if (this.pagePath == '') {
activated() { return;
this.updateTitle() }
}, let pageTitle = this.title;
watch: { let {title} = document;
title() { if (pageTitle !== title && this.pagePath === this.$route.path) {
this.pagePath = this.$route.path; this.setPageTile(pageTitle);
this.updateTitle()
} }
}, },
methods: {
updateTitle () { setPageTile(title) {
let pageTitle; document.title = title;
if (this.title) { let mobile = navigator.userAgent.toLowerCase();
pageTitle = this.title; if (/iphone|ipad|ipod/.test(mobile)) {
} else { let iframe = document.createElement('iframe');
let slots = this.$slots.default; iframe.style.display = 'none';
if (typeof slots === 'undefined' || slots.length < 1 || typeof slots[0].text !== 'string') { let iframeCallback = function () {
return; setTimeout(function () {
} iframe.removeEventListener('load', iframeCallback);
let {text} = slots[0]; document.body.removeChild(iframe)
pageTitle = text; }, 0)
} };
let {title} = document; iframe.addEventListener('load', iframeCallback);
if (pageTitle !== title && this.pagePath === this.$route.path) this.setTile(pageTitle); document.body.appendChild(iframe)
},
setTile(title) {
document.title = title;
let mobile = navigator.userAgent.toLowerCase();
if (/iphone|ipad|ipod/.test(mobile)) {
let iframe = document.createElement('iframe');
iframe.style.display = 'none';
let iframeCallback = function () {
setTimeout(function () {
iframe.removeEventListener('load', iframeCallback);
document.body.removeChild(iframe)
}, 0)
};
iframe.addEventListener('load', iframeCallback);
document.body.appendChild(iframe)
}
} }
} }
} }
}
</script> </script>

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="page-login"> <div class="page-login">
<PageTitle>{{$L('登录页面')}}</PageTitle> <PageTitle :title="$L('登录')"/>
<div class="login-body"> <div class="login-body">
<div class="login-logo"></div> <div class="login-logo"></div>
<div class="login-box"> <div class="login-box">

View File

@ -155,6 +155,8 @@ export default {
archivedProjectShow: false, archivedProjectShow: false,
titleInterval: null,
natificationHidden: false, natificationHidden: false,
natificationReady: false, natificationReady: false,
notificationClass: null, notificationClass: null,
@ -165,12 +167,14 @@ export default {
this.$store.dispatch("getUserInfo"); this.$store.dispatch("getUserInfo");
this.$store.dispatch("getTaskPriority"); this.$store.dispatch("getTaskPriority");
// //
this.startCountTitle();
this.notificationInit(); this.notificationInit();
this.onVisibilityChange(); this.onVisibilityChange();
}, },
deactivated() { deactivated() {
this.addShow = false; this.addShow = false;
clearInterval(this.titleInterval);
}, },
computed: { computed: {
@ -324,6 +328,38 @@ export default {
} }
}, },
startCountTitle() {
this.titleInterval = setInterval(() => {
let {title} = document;
let newTitle = title.replace(/^(.*?)\((\d+)\)$/g, "$1")
if (this.userId) {
if (this.msgAllUnread > 0) {
newTitle+= " (" + this.msgAllUnread + ")"
}
}
if (title != newTitle) {
this.setPageTile(newTitle);
}
}, 500)
},
setPageTile(title) {
document.title = title;
let mobile = navigator.userAgent.toLowerCase();
if (/iphone|ipad|ipod/.test(mobile)) {
let iframe = document.createElement('iframe');
iframe.style.display = 'none';
let iframeCallback = function () {
setTimeout(function () {
iframe.removeEventListener('load', iframeCallback);
document.body.removeChild(iframe)
}, 0)
};
iframe.addEventListener('load', iframeCallback);
document.body.appendChild(iframe)
}
},
notificationInit() { notificationInit() {
this.notificationClass = new notificationKoro(this.$L("打开通知成功")); this.notificationClass = new notificationKoro(this.$L("打开通知成功"));
if (this.notificationClass.support) { if (this.notificationClass.support) {

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="page-calendar"> <div class="page-calendar">
<PageTitle>{{$L('日历')}}</PageTitle> <PageTitle :title="$L('日历')"/>
<div class="calendar-head"> <div class="calendar-head">
<div class="calendar-titbox"> <div class="calendar-titbox">
<div class="calendar-title"> <div class="calendar-title">

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="page-dashboard"> <div class="page-dashboard">
<PageTitle>{{$L('仪表盘')}}</PageTitle> <PageTitle :title="$L('仪表盘')"/>
<div class="dashboard-wrapper"> <div class="dashboard-wrapper">
<div class="dashboard-hello">{{$L('欢迎您,' + userInfo.nickname)}}</div> <div class="dashboard-hello">{{$L('欢迎您,' + userInfo.nickname)}}</div>
<div class="dashboard-desc">{{$L('以下是你当前的任务统计数据')}}</div> <div class="dashboard-desc">{{$L('以下是你当前的任务统计数据')}}</div>

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="page-messenger"> <div class="page-messenger">
<PageTitle>{{$L('消息')}}</PageTitle> <PageTitle :title="$L('消息')"/>
<div class="messenger-wrapper"> <div class="messenger-wrapper">
<div class="messenger-select"> <div class="messenger-select">
<div class="messenger-search"> <div class="messenger-search">

View File

@ -1,6 +1,5 @@
<template> <template>
<div class="page-project"> <div class="page-project">
<PageTitle>{{$L('项目面板')}}</PageTitle>
<ProjectList/> <ProjectList/>
<ProjectDialog v-if="tablePanel('chat')"/> <ProjectDialog v-if="tablePanel('chat')"/>
</div> </div>

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="page-setting"> <div class="page-setting">
<PageTitle :title="$L(titleNameRoute || '设置')"/> <PageTitle :title="$L(titleNameRoute)"/>
<div class="setting-head"> <div class="setting-head">
<div class="setting-titbox"> <div class="setting-titbox">
<div class="setting-title"> <div class="setting-title">
@ -58,7 +58,7 @@ export default {
return true; return true;
} }
}) })
return name; return name || '设置';
} }
}, },
watch: { watch: {