diff --git a/resources/assets/js/components/AppDown.vue b/resources/assets/js/components/AppDown.vue index 6fb95964..ad35065d 100644 --- a/resources/assets/js/components/AppDown.vue +++ b/resources/assets/js/components/AppDown.vue @@ -45,13 +45,14 @@ export default { }, computed: { ...mapState([ + 'isDesktop', 'wsOpenNum', ]), repoTitle() { return this.repoStatus == 2 ? '更新客户端' : '客户端下载'; }, showButton() { - return this.repoStatus && !this.$store.state.windowMax768 && ['login', 'manage-dashboard'].includes(this.$route.name) + return this.repoStatus && this.isDesktop && ['login', 'manage-dashboard'].includes(this.$route.name) } }, watch: { diff --git a/resources/assets/js/functions/common.js b/resources/assets/js/functions/common.js index 0c9200f8..9719bc86 100755 --- a/resources/assets/js/functions/common.js +++ b/resources/assets/js/functions/common.js @@ -520,6 +520,15 @@ return (ua.match(/Chrome/i) + '' === 'chrome'); }, + /** + * 是否桌面端 + * @returns {boolean} + */ + isDesktop(){ + let ua = typeof window !== 'undefined' && window.navigator.userAgent; + return !ua.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i); + }, + /** * 获取对象 * @param obj diff --git a/resources/assets/js/pages/manage/components/DialogWrapper.vue b/resources/assets/js/pages/manage/components/DialogWrapper.vue index 0991c733..cb11e970 100644 --- a/resources/assets/js/pages/manage/components/DialogWrapper.vue +++ b/resources/assets/js/pages/manage/components/DialogWrapper.vue @@ -159,10 +159,10 @@ export default { computed: { ...mapState([ + 'isDesktop', 'userId', 'cacheDialogs', 'dialogMsgs', - 'windowMax768', ]), dialogData() { @@ -181,7 +181,7 @@ export default { }, isAutoBottom() { - if (this.windowMax768 && this.inputFocus) { + if (this.inputFocus && !this.isDesktop) { return false; } return this.autoBottom @@ -268,7 +268,7 @@ export default { text: this.msgText, }, }); - if (this.windowMax768) { + if (!this.isDesktop) { this.$refs.input.blur(); } this.autoToBottom(); @@ -368,7 +368,7 @@ export default { userid: this.userId, msg: { }, }); - if (this.windowMax768) { + if (!this.isDesktop) { this.$refs.input.blur(); } this.autoToBottom(); diff --git a/resources/assets/js/pages/manage/components/ProjectList.vue b/resources/assets/js/pages/manage/components/ProjectList.vue index f3ea3f64..32c557a4 100644 --- a/resources/assets/js/pages/manage/components/ProjectList.vue +++ b/resources/assets/js/pages/manage/components/ProjectList.vue @@ -91,7 +91,7 @@ import Draggable from "vuedraggable"; import UserInput from "../../../components/UserInput"; +import {mapState} from "vuex"; export default { name: "ProjectWorkflow", @@ -199,7 +201,7 @@ export default { }, computed: { - + ...mapState(['isDesktop']) }, watch: { diff --git a/resources/assets/js/pages/manage/components/TaskAdd.vue b/resources/assets/js/pages/manage/components/TaskAdd.vue index d8179214..cb9abb06 100644 --- a/resources/assets/js/pages/manage/components/TaskAdd.vue +++ b/resources/assets/js/pages/manage/components/TaskAdd.vue @@ -30,7 +30,7 @@ :plugins="taskPlugins" :options="taskOptions" :option-full="taskOptionFull" - :placeholder="$L($store.state.windowMax768 ? '详细描述,选填...' : '详细描述,选填...(点击右键使用工具栏)')" + :placeholder="$L(isDesktop ? '详细描述,选填...(点击右键使用工具栏)' : '详细描述,选填...')" :placeholderFull="$L('详细描述...')" inline/> @@ -232,7 +232,7 @@ export default { }, computed: { - ...mapState(['userId', 'cacheProjects', 'projectId', 'cacheColumns', 'taskPriority']), + ...mapState(['isDesktop', 'userId', 'cacheProjects', 'projectId', 'cacheColumns', 'taskPriority']), taskDays() { const {times} = this.addData; diff --git a/resources/assets/js/store/state.js b/resources/assets/js/store/state.js index b199af2b..978467ee 100644 --- a/resources/assets/js/store/state.js +++ b/resources/assets/js/store/state.js @@ -1,4 +1,7 @@ const stateData = { + // 是否桌面端 + isDesktop: $A.isDesktop(), + // 浏览器宽度 windowWidth: window.innerWidth,