@@ -8,25 +8,42 @@ import { ReleasesConfig } from '@client/utils/data.config';
88import { ElMessage } from ' element-plus' ;
99
1010@Options ({
11- components: {
12-
13- },
11+ components: {},
1412})
1513export default class DownloadButton extends Vue {
1614 @Prop ({ type: String , required: true }) platform! : string ;
1715 @Prop ({ type: String , required: true }) arch! : string ;
1816 @Prop ({ type: Boolean , default: false }) isHome: Boolean ;
1917 @Prop ({ type: String , required: true }) version! : string ;
2018
19+ // 检测是否为移动设备
20+ get isMobileDevice(): boolean {
21+ if (typeof navigator === ' undefined' ) return false ;
22+ return / Android| webOS| iPhone| iPad| iPod| BlackBerry| IEMobile| Opera Mini/ i .test (navigator .userAgent );
23+ }
24+
2125 get isSupportedPlatform(): boolean {
26+ // 只有在主页时才考虑移动设备检测
27+ if (this .isHome && this .isMobileDevice ) {
28+ return false ;
29+ }
2230 return this .platform === ' windows' || this .platform === ' mac' ;
2331 }
2432
2533 get isUnsupportedPlatform(): boolean {
34+ // 只有在主页时才考虑移动设备,releases页面按正常平台逻辑
35+ if (this .isHome && this .isMobileDevice ) {
36+ return true ;
37+ }
2638 return this .platform !== ' windows' && this .platform !== ' mac' ;
2739 }
2840
2941 get platformName(): string {
42+ // 只有在主页时才显示移动设备名称
43+ if (this .isHome && this .isMobileDevice ) {
44+ return ' 移动设备' ;
45+ }
46+
3047 // 确保服务端和客户端返回一致的平台名称
3148 switch (this .platform ) {
3249 case ' mac' :
@@ -39,6 +56,11 @@ export default class DownloadButton extends Vue {
3956 }
4057
4158 get platformImage(): string {
59+ // 只有在主页时,移动设备才显示通用下载图标
60+ if (this .isHome && this .isMobileDevice ) {
61+ return download ;
62+ }
63+
4264 switch (this .platform ) {
4365 case ' windows' :
4466 return windows ;
@@ -50,9 +72,13 @@ export default class DownloadButton extends Vue {
5072 }
5173
5274 private handleDownload() {
75+ if (this .isMobileDevice ) {
76+ this .$router .push ({ name: ' Releases' });
77+ return ;
78+ }
5379 const releasesConfig = new ReleasesConfig (this .version );
5480 let downloadLink = releasesConfig .downloadSingleSystemLink (this .platform , this .arch );
55- ElMessage (' 下载开始,请稍后 ...' );
81+ ElMessage (' 下载开始,请稍候 ...' );
5682 window .open (downloadLink , ' _parent' );
5783 }
5884}
0 commit comments