@vtj/local 0.13.1 → 0.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -533,6 +533,629 @@ async function getUniConfig(dsl) {
533
533
  };
534
534
  }
535
535
 
536
+ const webPageJson = {
537
+ name: "LaunchPage",
538
+ locked: false,
539
+ inject: [],
540
+ state: {
541
+ quickActions: {
542
+ type: "JSExpression",
543
+ value: "[\n { icon: this.$libs.VtjIcons.HomeFilled, label: '\u9996\u9875', action: 'home' },\n { icon: this.$libs.VtjIcons.Setting, label: '\u8BBE\u7F6E', action: 'settings' },\n { icon: this.$libs.VtjIcons.Help, label: '\u5E2E\u52A9', action: 'help' }\n]"
544
+ }
545
+ },
546
+ lifeCycles: {},
547
+ methods: {
548
+ handleLogin: {
549
+ type: "JSFunction",
550
+ value: "() => {\n\n this.$libs.ElementPlus.ElMessage({ message: 'login' })\n}"
551
+ },
552
+ handleRegister: {
553
+ type: "JSFunction",
554
+ value: "() => {\n this.$libs.ElementPlus.ElMessage({ message: 'register' })\n}"
555
+ },
556
+ handleQuickAction: {
557
+ type: "JSFunction",
558
+ value: "(action) => {\n this.$libs.ElementPlus.ElMessage({ message: action.action })\n}"
559
+ },
560
+ handleAbout: {
561
+ type: "JSFunction",
562
+ value: "() => {\n this.$libs.ElementPlus.ElMessage({ message: 'about' })\n}"
563
+ },
564
+ handleTerms: {
565
+ type: "JSFunction",
566
+ value: "() => {\n this.$libs.ElementPlus.ElMessage({ message: 'terms' })\n}"
567
+ },
568
+ handlePrivacy: {
569
+ type: "JSFunction",
570
+ value: "() => {\n\n this.$libs.ElementPlus.ElMessage({ message: 'privacy' })\n}"
571
+ }
572
+ },
573
+ computed: {},
574
+ watch: [],
575
+ css: ".launch-page {\n display: flex;\n flex-direction: column;\n height: 100%;\n background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);\n padding: 20px;\n text-align: center;\n box-sizing: border-box;\n}\n\n.header {\n margin-top: 80px;\n margin-bottom: 60px;\n}\n\n.logo {\n border-radius: 50%;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);\n margin-bottom: 20px;\n}\n\n.title {\n font-size: 2.5rem;\n color: #333;\n margin-bottom: 10px;\n}\n\n.subtitle {\n font-size: 1.2rem;\n color: #666;\n}\n\n.main {\n flex: 1;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n}\n\n.action-buttons {\n display: flex;\n gap: 20px;\n margin-bottom: 60px;\n}\n\n.action-button {\n min-width: 150px;\n}\n\n.quick-actions {\n display: flex;\n gap: 40px;\n margin-bottom: 40px;\n}\n\n.quick-action {\n display: flex;\n flex-direction: column;\n align-items: center;\n cursor: pointer;\n transition: all 0.3s ease;\n color: #555;\n}\n\n.quick-action:hover {\n transform: translateY(-5px);\n color: #409eff;\n}\n\n.action-icon {\n margin-bottom: 8px;\n}\n\n.footer {\n margin-top: auto;\n padding: 20px 0;\n color: #666;\n font-size: 0.9rem;\n}\n\n.footer-links {\n display: flex;\n justify-content: center;\n gap: 20px;\n margin-top: 10px;\n}\n\n.footer-links a {\n color: #666;\n text-decoration: none;\n}\n\n.footer-links a:hover {\n color: #409eff;\n text-decoration: underline;\n}",
576
+ props: [],
577
+ emits: [],
578
+ slots: [],
579
+ dataSources: {},
580
+ __VTJ_BLOCK__: true,
581
+ __VERSION__: "1754535531764",
582
+ id: "18o4hf0s",
583
+ nodes: [
584
+ {
585
+ id: "18neu6td",
586
+ name: "div",
587
+ from: "",
588
+ invisible: false,
589
+ locked: false,
590
+ children: [
591
+ {
592
+ id: "28neu6td",
593
+ name: "header",
594
+ from: "",
595
+ invisible: false,
596
+ locked: false,
597
+ children: [
598
+ {
599
+ id: "38neu6td",
600
+ name: "img",
601
+ from: "",
602
+ invisible: false,
603
+ locked: false,
604
+ children: [],
605
+ props: {
606
+ src: "https://picsum.photos/120/120?random=1",
607
+ alt: "App Logo",
608
+ class: "logo"
609
+ },
610
+ directives: [],
611
+ events: {}
612
+ },
613
+ {
614
+ id: "48neu6td",
615
+ name: "h1",
616
+ from: "",
617
+ invisible: false,
618
+ locked: false,
619
+ children: "\u6B22\u8FCE\u4F7F\u7528\u6211\u4EEC\u7684\u5E94\u7528",
620
+ props: {
621
+ class: "title"
622
+ },
623
+ directives: [],
624
+ events: {}
625
+ },
626
+ {
627
+ id: "58neu6td",
628
+ name: "p",
629
+ from: "",
630
+ invisible: false,
631
+ locked: false,
632
+ children: "\u8BA9\u5DE5\u4F5C\u66F4\u9AD8\u6548\uFF0C\u8BA9\u751F\u6D3B\u66F4\u7B80\u5355",
633
+ props: {
634
+ class: "subtitle"
635
+ },
636
+ directives: [],
637
+ events: {}
638
+ }
639
+ ],
640
+ props: {
641
+ class: "header"
642
+ },
643
+ directives: [],
644
+ events: {}
645
+ },
646
+ {
647
+ id: "68neu6td",
648
+ name: "main",
649
+ from: "",
650
+ invisible: false,
651
+ locked: false,
652
+ children: [
653
+ {
654
+ id: "78neu6te",
655
+ name: "div",
656
+ from: "",
657
+ invisible: false,
658
+ locked: false,
659
+ children: [
660
+ {
661
+ id: "88neu6te",
662
+ name: "ElButton",
663
+ from: "",
664
+ invisible: false,
665
+ locked: false,
666
+ children: " \u7ACB\u5373\u767B\u5F55 ",
667
+ props: {
668
+ type: "primary",
669
+ size: "large",
670
+ class: "action-button"
671
+ },
672
+ directives: [],
673
+ events: {
674
+ click: {
675
+ name: "click",
676
+ handler: {
677
+ type: "JSFunction",
678
+ value: "this.handleLogin"
679
+ },
680
+ modifiers: {}
681
+ }
682
+ }
683
+ },
684
+ {
685
+ id: "98neu6te",
686
+ name: "ElButton",
687
+ from: "",
688
+ invisible: false,
689
+ locked: false,
690
+ children: " \u6CE8\u518C\u8D26\u53F7 ",
691
+ props: {
692
+ size: "large",
693
+ class: "action-button"
694
+ },
695
+ directives: [],
696
+ events: {
697
+ click: {
698
+ name: "click",
699
+ handler: {
700
+ type: "JSFunction",
701
+ value: "this.handleRegister"
702
+ },
703
+ modifiers: {}
704
+ }
705
+ }
706
+ }
707
+ ],
708
+ props: {
709
+ class: "action-buttons"
710
+ },
711
+ directives: [],
712
+ events: {}
713
+ },
714
+ {
715
+ id: "a8neu6te",
716
+ name: "div",
717
+ from: "",
718
+ invisible: false,
719
+ locked: false,
720
+ children: [
721
+ {
722
+ id: "b8neu6te",
723
+ name: "div",
724
+ from: "",
725
+ invisible: false,
726
+ locked: false,
727
+ children: [
728
+ {
729
+ id: "c8neu6te",
730
+ name: "XIcon",
731
+ from: "@vtj/ui",
732
+ invisible: false,
733
+ locked: false,
734
+ children: [],
735
+ props: {
736
+ icon: {
737
+ type: "JSExpression",
738
+ value: "this.context.action.icon"
739
+ },
740
+ size: {
741
+ type: "JSExpression",
742
+ value: "24"
743
+ },
744
+ class: "action-icon"
745
+ },
746
+ directives: [],
747
+ events: {}
748
+ },
749
+ {
750
+ id: "d8neu6te",
751
+ name: "span",
752
+ from: "",
753
+ invisible: false,
754
+ locked: false,
755
+ children: {
756
+ type: "JSExpression",
757
+ value: "this.context.action.label"
758
+ },
759
+ props: {},
760
+ directives: [],
761
+ events: {}
762
+ }
763
+ ],
764
+ props: {
765
+ key: {
766
+ type: "JSExpression",
767
+ value: "this.context.index"
768
+ },
769
+ class: "quick-action"
770
+ },
771
+ directives: [
772
+ {
773
+ id: "k8neu6uf",
774
+ name: "vFor",
775
+ value: {
776
+ type: "JSExpression",
777
+ value: "this.state.quickActions"
778
+ },
779
+ iterator: {
780
+ item: "action",
781
+ index: "index"
782
+ }
783
+ }
784
+ ],
785
+ events: {
786
+ click: {
787
+ name: "click",
788
+ handler: {
789
+ type: "JSFunction",
790
+ value: "($event) => {\n this.handleQuickAction(this.context.action);\n}"
791
+ },
792
+ modifiers: {}
793
+ }
794
+ }
795
+ }
796
+ ],
797
+ props: {
798
+ class: "quick-actions"
799
+ },
800
+ directives: [],
801
+ events: {}
802
+ }
803
+ ],
804
+ props: {
805
+ class: "main"
806
+ },
807
+ directives: [],
808
+ events: {}
809
+ },
810
+ {
811
+ id: "e8neu6te",
812
+ name: "footer",
813
+ from: "",
814
+ invisible: false,
815
+ locked: false,
816
+ children: [
817
+ {
818
+ id: "f8neu6te",
819
+ name: "p",
820
+ from: "",
821
+ invisible: false,
822
+ locked: false,
823
+ children: "\xA9 2023 \u6211\u4EEC\u7684\u5E94\u7528. \u4FDD\u7559\u6240\u6709\u6743\u5229.",
824
+ props: {},
825
+ directives: [],
826
+ events: {}
827
+ },
828
+ {
829
+ id: "g8neu6te",
830
+ name: "div",
831
+ from: "",
832
+ invisible: false,
833
+ locked: false,
834
+ children: [
835
+ {
836
+ id: "h8neu6te",
837
+ name: "a",
838
+ from: "",
839
+ invisible: false,
840
+ locked: false,
841
+ children: "\u5173\u4E8E\u6211\u4EEC",
842
+ props: {
843
+ href: "#"
844
+ },
845
+ directives: [],
846
+ events: {
847
+ click: {
848
+ name: "click",
849
+ handler: {
850
+ type: "JSFunction",
851
+ value: "this.handleAbout"
852
+ },
853
+ modifiers: {
854
+ prevent: true
855
+ }
856
+ }
857
+ }
858
+ },
859
+ {
860
+ id: "i8neu6te",
861
+ name: "a",
862
+ from: "",
863
+ invisible: false,
864
+ locked: false,
865
+ children: "\u670D\u52A1\u6761\u6B3E",
866
+ props: {
867
+ href: "#"
868
+ },
869
+ directives: [],
870
+ events: {
871
+ click: {
872
+ name: "click",
873
+ handler: {
874
+ type: "JSFunction",
875
+ value: "this.handleTerms"
876
+ },
877
+ modifiers: {
878
+ prevent: true
879
+ }
880
+ }
881
+ }
882
+ },
883
+ {
884
+ id: "j8neu6te",
885
+ name: "a",
886
+ from: "",
887
+ invisible: false,
888
+ locked: false,
889
+ children: "\u9690\u79C1\u653F\u7B56",
890
+ props: {
891
+ href: "#"
892
+ },
893
+ directives: [],
894
+ events: {
895
+ click: {
896
+ name: "click",
897
+ handler: {
898
+ type: "JSFunction",
899
+ value: "this.handlePrivacy"
900
+ },
901
+ modifiers: {
902
+ prevent: true
903
+ }
904
+ }
905
+ }
906
+ }
907
+ ],
908
+ props: {
909
+ class: "footer-links"
910
+ },
911
+ directives: [],
912
+ events: {}
913
+ }
914
+ ],
915
+ props: {
916
+ class: "footer"
917
+ },
918
+ directives: [],
919
+ events: {}
920
+ }
921
+ ],
922
+ props: {
923
+ class: "launch-page"
924
+ },
925
+ directives: [],
926
+ events: {}
927
+ }
928
+ ]
929
+ };
930
+
931
+ const h5PageJson = {
932
+ name: "LaunchPage",
933
+ locked: false,
934
+ inject: [],
935
+ state: {},
936
+ lifeCycles: {},
937
+ methods: {
938
+ enterApp: {
939
+ type: "JSFunction",
940
+ value: "() => {\n this.$libs.vant.showToast({ message: 'click' })\n}"
941
+ }
942
+ },
943
+ computed: {},
944
+ watch: [],
945
+ css: ".launch-page {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n height: 100vh;\n background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);\n color: white;\n text-align: center;\n padding: 0 20px;\n}\n.logo-container {\n margin-bottom: 30px;\n}\n.logo {\n width: 150px;\n height: 150px;\n border-radius: 30px;\n box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);\n}\n.app-name {\n font-size: 28px;\n font-weight: bold;\n margin-bottom: 10px;\n}\n.app-slogan {\n font-size: 16px;\n margin-bottom: 40px;\n opacity: 0.8;\n}\n.enter-btn {\n width: 200px;\n height: 50px;\n font-size: 16px;\n font-weight: bold;\n}",
946
+ props: [],
947
+ emits: [],
948
+ slots: [],
949
+ dataSources: {},
950
+ __VTJ_BLOCK__: true,
951
+ __VERSION__: "1754534257948",
952
+ id: "18o4l37b",
953
+ nodes: [
954
+ {
955
+ id: "18o4mfc2",
956
+ name: "div",
957
+ from: "",
958
+ invisible: false,
959
+ locked: false,
960
+ children: [
961
+ {
962
+ id: "28o4mfc2",
963
+ name: "div",
964
+ from: "",
965
+ invisible: false,
966
+ locked: false,
967
+ children: [
968
+ {
969
+ id: "38o4mfc3",
970
+ name: "img",
971
+ from: "",
972
+ invisible: false,
973
+ locked: false,
974
+ children: [],
975
+ props: {
976
+ src: "https://picsum.photos/150/150?random=1",
977
+ alt: "App Logo",
978
+ class: "logo"
979
+ },
980
+ directives: [],
981
+ events: {}
982
+ }
983
+ ],
984
+ props: {
985
+ class: "logo-container"
986
+ },
987
+ directives: [],
988
+ events: {}
989
+ },
990
+ {
991
+ id: "48o4mfc3",
992
+ name: "h1",
993
+ from: "",
994
+ invisible: false,
995
+ locked: false,
996
+ children: "\u6B22\u8FCE\u4F7F\u7528",
997
+ props: {
998
+ class: "app-name"
999
+ },
1000
+ directives: [],
1001
+ events: {}
1002
+ },
1003
+ {
1004
+ id: "58o4mfc3",
1005
+ name: "p",
1006
+ from: "",
1007
+ invisible: false,
1008
+ locked: false,
1009
+ children: "\u5F00\u542F\u60A8\u7684\u5168\u65B0\u4F53\u9A8C",
1010
+ props: {
1011
+ class: "app-slogan"
1012
+ },
1013
+ directives: [],
1014
+ events: {}
1015
+ },
1016
+ {
1017
+ id: "68o4mfc3",
1018
+ name: "VanButton",
1019
+ from: "",
1020
+ invisible: false,
1021
+ locked: false,
1022
+ children: " \u7ACB\u5373\u4F53\u9A8C ",
1023
+ props: {
1024
+ type: "primary",
1025
+ round: "",
1026
+ class: "enter-btn"
1027
+ },
1028
+ directives: [],
1029
+ events: {
1030
+ click: {
1031
+ name: "click",
1032
+ handler: {
1033
+ type: "JSFunction",
1034
+ value: "this.enterApp"
1035
+ },
1036
+ modifiers: {}
1037
+ }
1038
+ }
1039
+ }
1040
+ ],
1041
+ props: {
1042
+ class: "launch-page"
1043
+ },
1044
+ directives: [],
1045
+ events: {}
1046
+ }
1047
+ ]
1048
+ };
1049
+
1050
+ const uniappPageJson = {
1051
+ name: "LaunchPage",
1052
+ locked: false,
1053
+ inject: [],
1054
+ state: {
1055
+ countDown: {
1056
+ type: "JSExpression",
1057
+ value: "3"
1058
+ }
1059
+ },
1060
+ lifeCycles: {},
1061
+ methods: {
1062
+ enterApp: {
1063
+ type: "JSFunction",
1064
+ value: "() => {\n this.$libs.UniH5.uni.showToast({ title: 'clicked!' })\n}"
1065
+ }
1066
+ },
1067
+ computed: {},
1068
+ watch: [],
1069
+ css: ".launch-page {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n height: 100vh;\n background: linear-gradient(135deg, #6e8efb, #a777e3);\n}\n\n.logo-container {\n margin-bottom: 40px;\n}\n\n.logo {\n width: 150px;\n height: 150px;\n border-radius: 30px;\n box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);\n}\n\n.app-name {\n font-size: 28px;\n color: white;\n font-weight: bold;\n margin-bottom: 60px;\n text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);\n}\n\n.enter-btn {\n padding: 12px 40px;\n background-color: white;\n color: #6e8efb;\n border-radius: 25px;\n font-weight: bold;\n box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);\n transition: all 0.3s ease;\n}\n\n.enter-btn:active {\n transform: scale(0.95);\n}",
1070
+ props: [],
1071
+ emits: [],
1072
+ slots: [],
1073
+ dataSources: {},
1074
+ __VTJ_BLOCK__: true,
1075
+ __VERSION__: "1754534945746",
1076
+ id: "18o4xz29",
1077
+ nodes: [
1078
+ {
1079
+ id: "18o4z7x6",
1080
+ name: "View",
1081
+ from: "",
1082
+ invisible: false,
1083
+ locked: false,
1084
+ children: [
1085
+ {
1086
+ id: "28o4z7x6",
1087
+ name: "View",
1088
+ from: "",
1089
+ invisible: false,
1090
+ locked: false,
1091
+ children: [
1092
+ {
1093
+ id: "38o4z7x6",
1094
+ name: "Image",
1095
+ from: "",
1096
+ invisible: false,
1097
+ locked: false,
1098
+ children: [],
1099
+ props: {
1100
+ class: "logo",
1101
+ src: "https://picsum.photos/200/200?random=1",
1102
+ alt: "App Logo"
1103
+ },
1104
+ directives: [],
1105
+ events: {}
1106
+ }
1107
+ ],
1108
+ props: {
1109
+ class: "logo-container"
1110
+ },
1111
+ directives: [],
1112
+ events: {}
1113
+ },
1114
+ {
1115
+ id: "48o4z7x6",
1116
+ name: "View",
1117
+ from: "",
1118
+ invisible: false,
1119
+ locked: false,
1120
+ children: "\u6211\u7684\u5E94\u7528",
1121
+ props: {
1122
+ class: "app-name"
1123
+ },
1124
+ directives: [],
1125
+ events: {}
1126
+ },
1127
+ {
1128
+ id: "58o4z7x6",
1129
+ name: "View",
1130
+ from: "",
1131
+ invisible: false,
1132
+ locked: false,
1133
+ children: " \u7ACB\u5373\u4F53\u9A8C ",
1134
+ props: {
1135
+ class: "enter-btn"
1136
+ },
1137
+ directives: [],
1138
+ events: {
1139
+ click: {
1140
+ name: "click",
1141
+ handler: {
1142
+ type: "JSFunction",
1143
+ value: "this.enterApp"
1144
+ },
1145
+ modifiers: {}
1146
+ }
1147
+ }
1148
+ }
1149
+ ],
1150
+ props: {
1151
+ class: "launch-page"
1152
+ },
1153
+ directives: [],
1154
+ events: {}
1155
+ }
1156
+ ]
1157
+ };
1158
+
536
1159
  let isInit = false;
537
1160
  let _platform = "web";
538
1161
  async function saveLogs(e, opts) {
@@ -611,12 +1234,32 @@ async function init(_body, opts) {
611
1234
  }
612
1235
  return success(dsl);
613
1236
  } else {
1237
+ const launchPage = {
1238
+ id: node.uid(),
1239
+ dir: false,
1240
+ layout: false,
1241
+ name: "LaunchPage",
1242
+ title: "\u542F\u52A8\u9875",
1243
+ icon: "",
1244
+ mask: false,
1245
+ hidden: false,
1246
+ raw: false,
1247
+ pure: true,
1248
+ cache: false,
1249
+ needLogin: false,
1250
+ style: platform === "uniapp" ? {
1251
+ navigationStyle: "custom"
1252
+ } : {},
1253
+ type: "page"
1254
+ };
614
1255
  const model = new core.ProjectModel({
615
1256
  id,
616
1257
  name,
617
1258
  description,
618
1259
  platform,
619
- blocks: plugins
1260
+ blocks: plugins,
1261
+ pages: [launchPage],
1262
+ homepage: launchPage.id
620
1263
  });
621
1264
  dsl = model.toDsl();
622
1265
  if (platform === "uniapp") {
@@ -624,6 +1267,28 @@ async function init(_body, opts) {
624
1267
  }
625
1268
  repository.save(id, dsl);
626
1269
  dsl.__BASE_PATH__ = opts.staticBase;
1270
+ let page;
1271
+ if (platform === "web") {
1272
+ page = new core.BlockModel(
1273
+ Object.assign(webPageJson, { id: launchPage.id, name: launchPage.name })
1274
+ );
1275
+ }
1276
+ if (platform === "h5") {
1277
+ page = new core.BlockModel(
1278
+ Object.assign(h5PageJson, { id: launchPage.id, name: launchPage.name })
1279
+ );
1280
+ }
1281
+ if (platform === "uniapp") {
1282
+ page = new core.BlockModel(
1283
+ Object.assign(uniappPageJson, {
1284
+ id: launchPage.id,
1285
+ name: launchPage.name
1286
+ })
1287
+ );
1288
+ }
1289
+ if (page) {
1290
+ await saveFile(page.toDsl(), opts);
1291
+ }
627
1292
  return success(dsl);
628
1293
  }
629
1294
  }
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  import { build } from 'vite';
2
2
  import { copyPlugin, staticPlugin } from '@vtj/cli';
3
- import { pathExistsSync, ensureFileSync, writeJsonSync, readJsonSync, removeSync, outputFileSync, readdirSync, moveSync, upperFirstCamelCase, camelCase, fs, timestamp, uuid } from '@vtj/node';
3
+ import { pathExistsSync, ensureFileSync, writeJsonSync, readJsonSync, removeSync, outputFileSync, readdirSync, moveSync, upperFirstCamelCase, camelCase, fs, timestamp, uuid, uid } from '@vtj/node';
4
4
  import { resolve, join } from 'path';
5
5
  import bodyParser from 'body-parser';
6
6
  import formidable from 'formidable';
7
- import { ProjectModel } from '@vtj/core';
7
+ import { ProjectModel, BlockModel } from '@vtj/core';
8
8
  import { tsFormatter, cssFormatter, vueFormatter, generator, createEmptyPage } from '@vtj/coder';
9
9
  import { parseUniApp, parseVue as parseVue$1 } from '@vtj/parser';
10
10
 
@@ -526,6 +526,629 @@ async function getUniConfig(dsl) {
526
526
  };
527
527
  }
528
528
 
529
+ const webPageJson = {
530
+ name: "LaunchPage",
531
+ locked: false,
532
+ inject: [],
533
+ state: {
534
+ quickActions: {
535
+ type: "JSExpression",
536
+ value: "[\n { icon: this.$libs.VtjIcons.HomeFilled, label: '\u9996\u9875', action: 'home' },\n { icon: this.$libs.VtjIcons.Setting, label: '\u8BBE\u7F6E', action: 'settings' },\n { icon: this.$libs.VtjIcons.Help, label: '\u5E2E\u52A9', action: 'help' }\n]"
537
+ }
538
+ },
539
+ lifeCycles: {},
540
+ methods: {
541
+ handleLogin: {
542
+ type: "JSFunction",
543
+ value: "() => {\n\n this.$libs.ElementPlus.ElMessage({ message: 'login' })\n}"
544
+ },
545
+ handleRegister: {
546
+ type: "JSFunction",
547
+ value: "() => {\n this.$libs.ElementPlus.ElMessage({ message: 'register' })\n}"
548
+ },
549
+ handleQuickAction: {
550
+ type: "JSFunction",
551
+ value: "(action) => {\n this.$libs.ElementPlus.ElMessage({ message: action.action })\n}"
552
+ },
553
+ handleAbout: {
554
+ type: "JSFunction",
555
+ value: "() => {\n this.$libs.ElementPlus.ElMessage({ message: 'about' })\n}"
556
+ },
557
+ handleTerms: {
558
+ type: "JSFunction",
559
+ value: "() => {\n this.$libs.ElementPlus.ElMessage({ message: 'terms' })\n}"
560
+ },
561
+ handlePrivacy: {
562
+ type: "JSFunction",
563
+ value: "() => {\n\n this.$libs.ElementPlus.ElMessage({ message: 'privacy' })\n}"
564
+ }
565
+ },
566
+ computed: {},
567
+ watch: [],
568
+ css: ".launch-page {\n display: flex;\n flex-direction: column;\n height: 100%;\n background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);\n padding: 20px;\n text-align: center;\n box-sizing: border-box;\n}\n\n.header {\n margin-top: 80px;\n margin-bottom: 60px;\n}\n\n.logo {\n border-radius: 50%;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);\n margin-bottom: 20px;\n}\n\n.title {\n font-size: 2.5rem;\n color: #333;\n margin-bottom: 10px;\n}\n\n.subtitle {\n font-size: 1.2rem;\n color: #666;\n}\n\n.main {\n flex: 1;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n}\n\n.action-buttons {\n display: flex;\n gap: 20px;\n margin-bottom: 60px;\n}\n\n.action-button {\n min-width: 150px;\n}\n\n.quick-actions {\n display: flex;\n gap: 40px;\n margin-bottom: 40px;\n}\n\n.quick-action {\n display: flex;\n flex-direction: column;\n align-items: center;\n cursor: pointer;\n transition: all 0.3s ease;\n color: #555;\n}\n\n.quick-action:hover {\n transform: translateY(-5px);\n color: #409eff;\n}\n\n.action-icon {\n margin-bottom: 8px;\n}\n\n.footer {\n margin-top: auto;\n padding: 20px 0;\n color: #666;\n font-size: 0.9rem;\n}\n\n.footer-links {\n display: flex;\n justify-content: center;\n gap: 20px;\n margin-top: 10px;\n}\n\n.footer-links a {\n color: #666;\n text-decoration: none;\n}\n\n.footer-links a:hover {\n color: #409eff;\n text-decoration: underline;\n}",
569
+ props: [],
570
+ emits: [],
571
+ slots: [],
572
+ dataSources: {},
573
+ __VTJ_BLOCK__: true,
574
+ __VERSION__: "1754535531764",
575
+ id: "18o4hf0s",
576
+ nodes: [
577
+ {
578
+ id: "18neu6td",
579
+ name: "div",
580
+ from: "",
581
+ invisible: false,
582
+ locked: false,
583
+ children: [
584
+ {
585
+ id: "28neu6td",
586
+ name: "header",
587
+ from: "",
588
+ invisible: false,
589
+ locked: false,
590
+ children: [
591
+ {
592
+ id: "38neu6td",
593
+ name: "img",
594
+ from: "",
595
+ invisible: false,
596
+ locked: false,
597
+ children: [],
598
+ props: {
599
+ src: "https://picsum.photos/120/120?random=1",
600
+ alt: "App Logo",
601
+ class: "logo"
602
+ },
603
+ directives: [],
604
+ events: {}
605
+ },
606
+ {
607
+ id: "48neu6td",
608
+ name: "h1",
609
+ from: "",
610
+ invisible: false,
611
+ locked: false,
612
+ children: "\u6B22\u8FCE\u4F7F\u7528\u6211\u4EEC\u7684\u5E94\u7528",
613
+ props: {
614
+ class: "title"
615
+ },
616
+ directives: [],
617
+ events: {}
618
+ },
619
+ {
620
+ id: "58neu6td",
621
+ name: "p",
622
+ from: "",
623
+ invisible: false,
624
+ locked: false,
625
+ children: "\u8BA9\u5DE5\u4F5C\u66F4\u9AD8\u6548\uFF0C\u8BA9\u751F\u6D3B\u66F4\u7B80\u5355",
626
+ props: {
627
+ class: "subtitle"
628
+ },
629
+ directives: [],
630
+ events: {}
631
+ }
632
+ ],
633
+ props: {
634
+ class: "header"
635
+ },
636
+ directives: [],
637
+ events: {}
638
+ },
639
+ {
640
+ id: "68neu6td",
641
+ name: "main",
642
+ from: "",
643
+ invisible: false,
644
+ locked: false,
645
+ children: [
646
+ {
647
+ id: "78neu6te",
648
+ name: "div",
649
+ from: "",
650
+ invisible: false,
651
+ locked: false,
652
+ children: [
653
+ {
654
+ id: "88neu6te",
655
+ name: "ElButton",
656
+ from: "",
657
+ invisible: false,
658
+ locked: false,
659
+ children: " \u7ACB\u5373\u767B\u5F55 ",
660
+ props: {
661
+ type: "primary",
662
+ size: "large",
663
+ class: "action-button"
664
+ },
665
+ directives: [],
666
+ events: {
667
+ click: {
668
+ name: "click",
669
+ handler: {
670
+ type: "JSFunction",
671
+ value: "this.handleLogin"
672
+ },
673
+ modifiers: {}
674
+ }
675
+ }
676
+ },
677
+ {
678
+ id: "98neu6te",
679
+ name: "ElButton",
680
+ from: "",
681
+ invisible: false,
682
+ locked: false,
683
+ children: " \u6CE8\u518C\u8D26\u53F7 ",
684
+ props: {
685
+ size: "large",
686
+ class: "action-button"
687
+ },
688
+ directives: [],
689
+ events: {
690
+ click: {
691
+ name: "click",
692
+ handler: {
693
+ type: "JSFunction",
694
+ value: "this.handleRegister"
695
+ },
696
+ modifiers: {}
697
+ }
698
+ }
699
+ }
700
+ ],
701
+ props: {
702
+ class: "action-buttons"
703
+ },
704
+ directives: [],
705
+ events: {}
706
+ },
707
+ {
708
+ id: "a8neu6te",
709
+ name: "div",
710
+ from: "",
711
+ invisible: false,
712
+ locked: false,
713
+ children: [
714
+ {
715
+ id: "b8neu6te",
716
+ name: "div",
717
+ from: "",
718
+ invisible: false,
719
+ locked: false,
720
+ children: [
721
+ {
722
+ id: "c8neu6te",
723
+ name: "XIcon",
724
+ from: "@vtj/ui",
725
+ invisible: false,
726
+ locked: false,
727
+ children: [],
728
+ props: {
729
+ icon: {
730
+ type: "JSExpression",
731
+ value: "this.context.action.icon"
732
+ },
733
+ size: {
734
+ type: "JSExpression",
735
+ value: "24"
736
+ },
737
+ class: "action-icon"
738
+ },
739
+ directives: [],
740
+ events: {}
741
+ },
742
+ {
743
+ id: "d8neu6te",
744
+ name: "span",
745
+ from: "",
746
+ invisible: false,
747
+ locked: false,
748
+ children: {
749
+ type: "JSExpression",
750
+ value: "this.context.action.label"
751
+ },
752
+ props: {},
753
+ directives: [],
754
+ events: {}
755
+ }
756
+ ],
757
+ props: {
758
+ key: {
759
+ type: "JSExpression",
760
+ value: "this.context.index"
761
+ },
762
+ class: "quick-action"
763
+ },
764
+ directives: [
765
+ {
766
+ id: "k8neu6uf",
767
+ name: "vFor",
768
+ value: {
769
+ type: "JSExpression",
770
+ value: "this.state.quickActions"
771
+ },
772
+ iterator: {
773
+ item: "action",
774
+ index: "index"
775
+ }
776
+ }
777
+ ],
778
+ events: {
779
+ click: {
780
+ name: "click",
781
+ handler: {
782
+ type: "JSFunction",
783
+ value: "($event) => {\n this.handleQuickAction(this.context.action);\n}"
784
+ },
785
+ modifiers: {}
786
+ }
787
+ }
788
+ }
789
+ ],
790
+ props: {
791
+ class: "quick-actions"
792
+ },
793
+ directives: [],
794
+ events: {}
795
+ }
796
+ ],
797
+ props: {
798
+ class: "main"
799
+ },
800
+ directives: [],
801
+ events: {}
802
+ },
803
+ {
804
+ id: "e8neu6te",
805
+ name: "footer",
806
+ from: "",
807
+ invisible: false,
808
+ locked: false,
809
+ children: [
810
+ {
811
+ id: "f8neu6te",
812
+ name: "p",
813
+ from: "",
814
+ invisible: false,
815
+ locked: false,
816
+ children: "\xA9 2023 \u6211\u4EEC\u7684\u5E94\u7528. \u4FDD\u7559\u6240\u6709\u6743\u5229.",
817
+ props: {},
818
+ directives: [],
819
+ events: {}
820
+ },
821
+ {
822
+ id: "g8neu6te",
823
+ name: "div",
824
+ from: "",
825
+ invisible: false,
826
+ locked: false,
827
+ children: [
828
+ {
829
+ id: "h8neu6te",
830
+ name: "a",
831
+ from: "",
832
+ invisible: false,
833
+ locked: false,
834
+ children: "\u5173\u4E8E\u6211\u4EEC",
835
+ props: {
836
+ href: "#"
837
+ },
838
+ directives: [],
839
+ events: {
840
+ click: {
841
+ name: "click",
842
+ handler: {
843
+ type: "JSFunction",
844
+ value: "this.handleAbout"
845
+ },
846
+ modifiers: {
847
+ prevent: true
848
+ }
849
+ }
850
+ }
851
+ },
852
+ {
853
+ id: "i8neu6te",
854
+ name: "a",
855
+ from: "",
856
+ invisible: false,
857
+ locked: false,
858
+ children: "\u670D\u52A1\u6761\u6B3E",
859
+ props: {
860
+ href: "#"
861
+ },
862
+ directives: [],
863
+ events: {
864
+ click: {
865
+ name: "click",
866
+ handler: {
867
+ type: "JSFunction",
868
+ value: "this.handleTerms"
869
+ },
870
+ modifiers: {
871
+ prevent: true
872
+ }
873
+ }
874
+ }
875
+ },
876
+ {
877
+ id: "j8neu6te",
878
+ name: "a",
879
+ from: "",
880
+ invisible: false,
881
+ locked: false,
882
+ children: "\u9690\u79C1\u653F\u7B56",
883
+ props: {
884
+ href: "#"
885
+ },
886
+ directives: [],
887
+ events: {
888
+ click: {
889
+ name: "click",
890
+ handler: {
891
+ type: "JSFunction",
892
+ value: "this.handlePrivacy"
893
+ },
894
+ modifiers: {
895
+ prevent: true
896
+ }
897
+ }
898
+ }
899
+ }
900
+ ],
901
+ props: {
902
+ class: "footer-links"
903
+ },
904
+ directives: [],
905
+ events: {}
906
+ }
907
+ ],
908
+ props: {
909
+ class: "footer"
910
+ },
911
+ directives: [],
912
+ events: {}
913
+ }
914
+ ],
915
+ props: {
916
+ class: "launch-page"
917
+ },
918
+ directives: [],
919
+ events: {}
920
+ }
921
+ ]
922
+ };
923
+
924
+ const h5PageJson = {
925
+ name: "LaunchPage",
926
+ locked: false,
927
+ inject: [],
928
+ state: {},
929
+ lifeCycles: {},
930
+ methods: {
931
+ enterApp: {
932
+ type: "JSFunction",
933
+ value: "() => {\n this.$libs.vant.showToast({ message: 'click' })\n}"
934
+ }
935
+ },
936
+ computed: {},
937
+ watch: [],
938
+ css: ".launch-page {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n height: 100vh;\n background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);\n color: white;\n text-align: center;\n padding: 0 20px;\n}\n.logo-container {\n margin-bottom: 30px;\n}\n.logo {\n width: 150px;\n height: 150px;\n border-radius: 30px;\n box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);\n}\n.app-name {\n font-size: 28px;\n font-weight: bold;\n margin-bottom: 10px;\n}\n.app-slogan {\n font-size: 16px;\n margin-bottom: 40px;\n opacity: 0.8;\n}\n.enter-btn {\n width: 200px;\n height: 50px;\n font-size: 16px;\n font-weight: bold;\n}",
939
+ props: [],
940
+ emits: [],
941
+ slots: [],
942
+ dataSources: {},
943
+ __VTJ_BLOCK__: true,
944
+ __VERSION__: "1754534257948",
945
+ id: "18o4l37b",
946
+ nodes: [
947
+ {
948
+ id: "18o4mfc2",
949
+ name: "div",
950
+ from: "",
951
+ invisible: false,
952
+ locked: false,
953
+ children: [
954
+ {
955
+ id: "28o4mfc2",
956
+ name: "div",
957
+ from: "",
958
+ invisible: false,
959
+ locked: false,
960
+ children: [
961
+ {
962
+ id: "38o4mfc3",
963
+ name: "img",
964
+ from: "",
965
+ invisible: false,
966
+ locked: false,
967
+ children: [],
968
+ props: {
969
+ src: "https://picsum.photos/150/150?random=1",
970
+ alt: "App Logo",
971
+ class: "logo"
972
+ },
973
+ directives: [],
974
+ events: {}
975
+ }
976
+ ],
977
+ props: {
978
+ class: "logo-container"
979
+ },
980
+ directives: [],
981
+ events: {}
982
+ },
983
+ {
984
+ id: "48o4mfc3",
985
+ name: "h1",
986
+ from: "",
987
+ invisible: false,
988
+ locked: false,
989
+ children: "\u6B22\u8FCE\u4F7F\u7528",
990
+ props: {
991
+ class: "app-name"
992
+ },
993
+ directives: [],
994
+ events: {}
995
+ },
996
+ {
997
+ id: "58o4mfc3",
998
+ name: "p",
999
+ from: "",
1000
+ invisible: false,
1001
+ locked: false,
1002
+ children: "\u5F00\u542F\u60A8\u7684\u5168\u65B0\u4F53\u9A8C",
1003
+ props: {
1004
+ class: "app-slogan"
1005
+ },
1006
+ directives: [],
1007
+ events: {}
1008
+ },
1009
+ {
1010
+ id: "68o4mfc3",
1011
+ name: "VanButton",
1012
+ from: "",
1013
+ invisible: false,
1014
+ locked: false,
1015
+ children: " \u7ACB\u5373\u4F53\u9A8C ",
1016
+ props: {
1017
+ type: "primary",
1018
+ round: "",
1019
+ class: "enter-btn"
1020
+ },
1021
+ directives: [],
1022
+ events: {
1023
+ click: {
1024
+ name: "click",
1025
+ handler: {
1026
+ type: "JSFunction",
1027
+ value: "this.enterApp"
1028
+ },
1029
+ modifiers: {}
1030
+ }
1031
+ }
1032
+ }
1033
+ ],
1034
+ props: {
1035
+ class: "launch-page"
1036
+ },
1037
+ directives: [],
1038
+ events: {}
1039
+ }
1040
+ ]
1041
+ };
1042
+
1043
+ const uniappPageJson = {
1044
+ name: "LaunchPage",
1045
+ locked: false,
1046
+ inject: [],
1047
+ state: {
1048
+ countDown: {
1049
+ type: "JSExpression",
1050
+ value: "3"
1051
+ }
1052
+ },
1053
+ lifeCycles: {},
1054
+ methods: {
1055
+ enterApp: {
1056
+ type: "JSFunction",
1057
+ value: "() => {\n this.$libs.UniH5.uni.showToast({ title: 'clicked!' })\n}"
1058
+ }
1059
+ },
1060
+ computed: {},
1061
+ watch: [],
1062
+ css: ".launch-page {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n height: 100vh;\n background: linear-gradient(135deg, #6e8efb, #a777e3);\n}\n\n.logo-container {\n margin-bottom: 40px;\n}\n\n.logo {\n width: 150px;\n height: 150px;\n border-radius: 30px;\n box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);\n}\n\n.app-name {\n font-size: 28px;\n color: white;\n font-weight: bold;\n margin-bottom: 60px;\n text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);\n}\n\n.enter-btn {\n padding: 12px 40px;\n background-color: white;\n color: #6e8efb;\n border-radius: 25px;\n font-weight: bold;\n box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);\n transition: all 0.3s ease;\n}\n\n.enter-btn:active {\n transform: scale(0.95);\n}",
1063
+ props: [],
1064
+ emits: [],
1065
+ slots: [],
1066
+ dataSources: {},
1067
+ __VTJ_BLOCK__: true,
1068
+ __VERSION__: "1754534945746",
1069
+ id: "18o4xz29",
1070
+ nodes: [
1071
+ {
1072
+ id: "18o4z7x6",
1073
+ name: "View",
1074
+ from: "",
1075
+ invisible: false,
1076
+ locked: false,
1077
+ children: [
1078
+ {
1079
+ id: "28o4z7x6",
1080
+ name: "View",
1081
+ from: "",
1082
+ invisible: false,
1083
+ locked: false,
1084
+ children: [
1085
+ {
1086
+ id: "38o4z7x6",
1087
+ name: "Image",
1088
+ from: "",
1089
+ invisible: false,
1090
+ locked: false,
1091
+ children: [],
1092
+ props: {
1093
+ class: "logo",
1094
+ src: "https://picsum.photos/200/200?random=1",
1095
+ alt: "App Logo"
1096
+ },
1097
+ directives: [],
1098
+ events: {}
1099
+ }
1100
+ ],
1101
+ props: {
1102
+ class: "logo-container"
1103
+ },
1104
+ directives: [],
1105
+ events: {}
1106
+ },
1107
+ {
1108
+ id: "48o4z7x6",
1109
+ name: "View",
1110
+ from: "",
1111
+ invisible: false,
1112
+ locked: false,
1113
+ children: "\u6211\u7684\u5E94\u7528",
1114
+ props: {
1115
+ class: "app-name"
1116
+ },
1117
+ directives: [],
1118
+ events: {}
1119
+ },
1120
+ {
1121
+ id: "58o4z7x6",
1122
+ name: "View",
1123
+ from: "",
1124
+ invisible: false,
1125
+ locked: false,
1126
+ children: " \u7ACB\u5373\u4F53\u9A8C ",
1127
+ props: {
1128
+ class: "enter-btn"
1129
+ },
1130
+ directives: [],
1131
+ events: {
1132
+ click: {
1133
+ name: "click",
1134
+ handler: {
1135
+ type: "JSFunction",
1136
+ value: "this.enterApp"
1137
+ },
1138
+ modifiers: {}
1139
+ }
1140
+ }
1141
+ }
1142
+ ],
1143
+ props: {
1144
+ class: "launch-page"
1145
+ },
1146
+ directives: [],
1147
+ events: {}
1148
+ }
1149
+ ]
1150
+ };
1151
+
529
1152
  let isInit = false;
530
1153
  let _platform = "web";
531
1154
  async function saveLogs(e, opts) {
@@ -604,12 +1227,32 @@ async function init(_body, opts) {
604
1227
  }
605
1228
  return success(dsl);
606
1229
  } else {
1230
+ const launchPage = {
1231
+ id: uid(),
1232
+ dir: false,
1233
+ layout: false,
1234
+ name: "LaunchPage",
1235
+ title: "\u542F\u52A8\u9875",
1236
+ icon: "",
1237
+ mask: false,
1238
+ hidden: false,
1239
+ raw: false,
1240
+ pure: true,
1241
+ cache: false,
1242
+ needLogin: false,
1243
+ style: platform === "uniapp" ? {
1244
+ navigationStyle: "custom"
1245
+ } : {},
1246
+ type: "page"
1247
+ };
607
1248
  const model = new ProjectModel({
608
1249
  id,
609
1250
  name,
610
1251
  description,
611
1252
  platform,
612
- blocks: plugins
1253
+ blocks: plugins,
1254
+ pages: [launchPage],
1255
+ homepage: launchPage.id
613
1256
  });
614
1257
  dsl = model.toDsl();
615
1258
  if (platform === "uniapp") {
@@ -617,6 +1260,28 @@ async function init(_body, opts) {
617
1260
  }
618
1261
  repository.save(id, dsl);
619
1262
  dsl.__BASE_PATH__ = opts.staticBase;
1263
+ let page;
1264
+ if (platform === "web") {
1265
+ page = new BlockModel(
1266
+ Object.assign(webPageJson, { id: launchPage.id, name: launchPage.name })
1267
+ );
1268
+ }
1269
+ if (platform === "h5") {
1270
+ page = new BlockModel(
1271
+ Object.assign(h5PageJson, { id: launchPage.id, name: launchPage.name })
1272
+ );
1273
+ }
1274
+ if (platform === "uniapp") {
1275
+ page = new BlockModel(
1276
+ Object.assign(uniappPageJson, {
1277
+ id: launchPage.id,
1278
+ name: launchPage.name
1279
+ })
1280
+ );
1281
+ }
1282
+ if (page) {
1283
+ await saveFile(page.toDsl(), opts);
1284
+ }
620
1285
  return success(dsl);
621
1286
  }
622
1287
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vtj/local",
3
3
  "private": false,
4
- "version": "0.13.1",
4
+ "version": "0.13.3",
5
5
  "type": "module",
6
6
  "keywords": [
7
7
  "低代码引擎",
@@ -22,10 +22,10 @@
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
24
  "formidable": "~3.5.1",
25
- "@vtj/coder": "~0.13.1",
26
- "@vtj/core": "~0.13.1",
27
- "@vtj/node": "~0.12.4",
28
- "@vtj/parser": "~0.13.1"
25
+ "@vtj/coder": "~0.13.3",
26
+ "@vtj/core": "~0.13.3",
27
+ "@vtj/parser": "~0.13.3",
28
+ "@vtj/node": "~0.12.4"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/formidable": "~3.4.5",