perf: 兼容iPad端

This commit is contained in:
kuaifan 2022-02-10 21:03:36 +08:00
parent 5324861f16
commit feed984ba8
7 changed files with 26 additions and 11 deletions

View File

@ -45,13 +45,14 @@ export default {
}, },
computed: { computed: {
...mapState([ ...mapState([
'isDesktop',
'wsOpenNum', 'wsOpenNum',
]), ]),
repoTitle() { repoTitle() {
return this.repoStatus == 2 ? '更新客户端' : '客户端下载'; return this.repoStatus == 2 ? '更新客户端' : '客户端下载';
}, },
showButton() { 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: { watch: {

View File

@ -520,6 +520,15 @@
return (ua.match(/Chrome/i) + '' === 'chrome'); 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 * @param obj

View File

@ -159,10 +159,10 @@ export default {
computed: { computed: {
...mapState([ ...mapState([
'isDesktop',
'userId', 'userId',
'cacheDialogs', 'cacheDialogs',
'dialogMsgs', 'dialogMsgs',
'windowMax768',
]), ]),
dialogData() { dialogData() {
@ -181,7 +181,7 @@ export default {
}, },
isAutoBottom() { isAutoBottom() {
if (this.windowMax768 && this.inputFocus) { if (this.inputFocus && !this.isDesktop) {
return false; return false;
} }
return this.autoBottom return this.autoBottom
@ -268,7 +268,7 @@ export default {
text: this.msgText, text: this.msgText,
}, },
}); });
if (this.windowMax768) { if (!this.isDesktop) {
this.$refs.input.blur(); this.$refs.input.blur();
} }
this.autoToBottom(); this.autoToBottom();
@ -368,7 +368,7 @@ export default {
userid: this.userId, userid: this.userId,
msg: { }, msg: { },
}); });
if (this.windowMax768) { if (!this.isDesktop) {
this.$refs.input.blur(); this.$refs.input.blur();
} }
this.autoToBottom(); this.autoToBottom();

View File

@ -91,7 +91,7 @@
<Draggable <Draggable
:list="columnList" :list="columnList"
:animation="150" :animation="150"
:disabled="sortDisabled || windowMax768" :disabled="sortDisabled || !isDesktop"
class="column-list" class="column-list"
tag="ul" tag="ul"
draggable=".column-item" draggable=".column-item"
@ -146,7 +146,7 @@
<Draggable <Draggable
:list="column.tasks" :list="column.tasks"
:animation="150" :animation="150"
:disabled="sortDisabled || windowMax768" :disabled="sortDisabled || !isDesktop"
class="task-list" class="task-list"
draggable=".task-draggable" draggable=".task-draggable"
group="task" group="task"
@ -528,8 +528,8 @@ export default {
computed: { computed: {
...mapState([ ...mapState([
'isDesktop',
'windowWidth', 'windowWidth',
'windowMax768',
'userId', 'userId',
'cacheDialogs', 'cacheDialogs',

View File

@ -61,6 +61,7 @@
<Draggable <Draggable
:list="data.project_flow_item" :list="data.project_flow_item"
:animation="150" :animation="150"
:disabled="!isDesktop"
class="taskflow-config-table-list-wrapper" class="taskflow-config-table-list-wrapper"
tag="div" tag="div"
draggable=".column-border" draggable=".column-border"
@ -172,6 +173,7 @@
<script> <script>
import Draggable from "vuedraggable"; import Draggable from "vuedraggable";
import UserInput from "../../../components/UserInput"; import UserInput from "../../../components/UserInput";
import {mapState} from "vuex";
export default { export default {
name: "ProjectWorkflow", name: "ProjectWorkflow",
@ -199,7 +201,7 @@ export default {
}, },
computed: { computed: {
...mapState(['isDesktop'])
}, },
watch: { watch: {

View File

@ -30,7 +30,7 @@
:plugins="taskPlugins" :plugins="taskPlugins"
:options="taskOptions" :options="taskOptions"
:option-full="taskOptionFull" :option-full="taskOptionFull"
:placeholder="$L($store.state.windowMax768 ? '详细描述,选填...' : '详细描述,选填...(点击右键使用工具栏)')" :placeholder="$L(isDesktop ? '详细描述,选填...(点击右键使用工具栏)' : '详细描述,选填...')"
:placeholderFull="$L('详细描述...')" :placeholderFull="$L('详细描述...')"
inline/> inline/>
</div> </div>
@ -232,7 +232,7 @@ export default {
}, },
computed: { computed: {
...mapState(['userId', 'cacheProjects', 'projectId', 'cacheColumns', 'taskPriority']), ...mapState(['isDesktop', 'userId', 'cacheProjects', 'projectId', 'cacheColumns', 'taskPriority']),
taskDays() { taskDays() {
const {times} = this.addData; const {times} = this.addData;

View File

@ -1,4 +1,7 @@
const stateData = { const stateData = {
// 是否桌面端
isDesktop: $A.isDesktop(),
// 浏览器宽度 // 浏览器宽度
windowWidth: window.innerWidth, windowWidth: window.innerWidth,