Skip to content

Commit

Permalink
修改移动端部分交互
Browse files Browse the repository at this point in the history
Close #58
  • Loading branch information
TransparentLC committed Nov 15, 2024
1 parent 825c82d commit 1083dc5
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 8 deletions.
4 changes: 2 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"dependencies": {
"axios": "^1.7.7",
"core-js": "^3.38.1",
"core-js": "^3.39.0",
"vue": "^2.7.16",
"vue-axios": "^2.1.5",
"vue-linkify": "^1.0.1",
Expand All @@ -24,7 +24,7 @@
"cross-env": "^7.0.3",
"fs-extra": "^11.2.0",
"glob": "^11.0.0",
"sass": "~1.79.5",
"sass": "^1.81.0",
"sass-loader": "^10.5.2",
"typeface-roboto": "^1.1.13",
"vue-cli-plugin-vuetify": "^2.5.8",
Expand Down
5 changes: 4 additions & 1 deletion client/src/components/SendFile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
color="primary"
large
class="d-block mx-auto"
@click="$refs.selectFile.click()"
@click="focus"
>
<div title="支持拖拽和 Ctrl+V 粘贴截图">
选择要发送的文件<span class="d-none d-xl-inline">(支持拖拽和 Ctrl+V 粘贴截图)</span>
Expand Down Expand Up @@ -110,6 +110,9 @@ export default {
},
},
methods: {
focus() {
this.$refs.selectFile.click();
},
/**
* @param {File[]} files
*/
Expand Down
4 changes: 4 additions & 0 deletions client/src/components/SendText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<div>
<div class="headline text--primary mb-4">发送文本</div>
<v-textarea
ref="textarea"
no-resize
outlined
dense
Expand All @@ -25,6 +26,9 @@
export default {
name: 'send-text',
methods: {
focus() {
this.$refs.textarea.focus();
},
send() {
this.$http.post(
'text',
Expand Down
23 changes: 19 additions & 4 deletions client/src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
<v-icon>{{mdiPlus}}</v-icon>
</v-btn>
</template>
<v-btn fab dark small color="primary" @click="dialog = true; mode = 'file'">
<v-btn fab dark small color="primary" @click="dialog = true; mode = 'file'; $nextTick(() => $refs.dialogFile.focus())">
<v-icon>{{mdiFileDocumentOutline}}</v-icon>
</v-btn>
<v-btn fab dark small color="primary" @click="dialog = true; mode = 'text'">
<v-btn fab dark small color="primary" @click="dialog = true; mode = 'text'; $nextTick(() => $refs.dialogText.focus())">
<v-icon>{{mdiText}}</v-icon>
</v-btn>
</v-speed-dial>
Expand All @@ -59,8 +59,8 @@
</v-toolbar>
<v-card-text class="px-4">
<div class="my-4">
<send-text v-if="mode === 'text'"></send-text>
<send-file v-if="mode === 'file'"></send-file>
<send-text ref="dialogText" v-if="mode === 'text'"></send-text>
<send-file ref="dialogFile" v-if="mode === 'file'"></send-file>
</div>
</v-card-text>
</v-card>
Expand Down Expand Up @@ -98,5 +98,20 @@ export default {
mdiClose,
};
},
methods: {
closeDialog() {
this.dialog = false;
},
},
watch: {
dialog(newval) {
if (newval) {
history.pushState(null, null, location.href);
addEventListener('popstate', this.closeDialog);
} else {
removeEventListener('popstate', this.closeDialog);
}
},
},
}
</script>
2 changes: 1 addition & 1 deletion server-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
"koa-static": "^5.0.0",
"koa-websocket": "^7.0.0",
"sharp": "^0.33.5",
"ua-parser-js": "2.0.0-beta.3"
"ua-parser-js": "2.0.0-rc.3"
}
}

0 comments on commit 1083dc5

Please sign in to comment.