diff --git a/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/constant/CommonConstants.java b/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/constant/CommonConstants.java
index 7926ece5a..987337d68 100644
--- a/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/constant/CommonConstants.java
+++ b/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/constant/CommonConstants.java
@@ -70,6 +70,11 @@ public interface CommonConstants {
*/
String FRONT_END_PROJECT = "pigx-ui";
+ /**
+ * 移动端工程名
+ */
+ String UNI_END_PROJECT = "pigx-app";
+
/**
* 后端工程名
*/
diff --git a/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/constant/enums/StyleTypeEnum.java b/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/constant/enums/StyleTypeEnum.java
index b92180589..90e9f516d 100644
--- a/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/constant/enums/StyleTypeEnum.java
+++ b/pigx-common/pigx-common-core/src/main/java/com/pig4cloud/pigx/common/core/constant/enums/StyleTypeEnum.java
@@ -21,7 +21,12 @@ public enum StyleTypeEnum {
/**
* 前端类型-element 风格
*/
- ELEMENT("1", "element 风格");
+ ELEMENT("1", "element 风格"),
+
+ /**
+ * 前端风格-uview 风格
+ */
+ UVIEW("2", "uview 风格");
/**
* 类型
diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/entity/GenConfig.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/entity/GenConfig.java
index dd6bf91a9..8091a825f 100644
--- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/entity/GenConfig.java
+++ b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/entity/GenConfig.java
@@ -62,7 +62,7 @@ public class GenConfig {
private String comments;
/**
- * 代码风格 0 - avue 1 - element
+ * 代码风格 0 - avue 1 - element 2 - uview
*/
private String style;
diff --git a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GenUtils.java b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GenUtils.java
index 804bcbddc..646430727 100644
--- a/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GenUtils.java
+++ b/pigx-visual/pigx-codegen/src/main/java/com/pig4cloud/pigx/codegen/util/GenUtils.java
@@ -89,6 +89,14 @@ public class GenUtils {
private final String AVUE_CRUD_JS_VM = "avue/crud.js.vm";
+ private final String UVIEW_API_JS_VM = "uview/api.js.vm";
+
+ private final String UVIEW_FORM_VUE_VM = "uview/form.vue.vm";
+
+ private final String UVIEW_INDEX_VUE_VM = "uview/index.vue.vm";
+
+ private final String UVIEW_PAGE_JSON_VM = "uview/page.json.vm";
+
/**
* 配置
* @param config
@@ -103,15 +111,22 @@ public class GenUtils {
templates.add("template/ServiceImpl.java.vm");
templates.add("template/Controller.java.vm");
templates.add("template/menu.sql.vm");
- templates.add("template/avue/api.js.vm");
if (StyleTypeEnum.AVUE.getStyle().equals(config.getStyle())) {
templates.add("template/avue/index.vue.vm");
templates.add("template/avue/crud.js.vm");
+ templates.add("template/avue/api.js.vm");
}
- else {
+ else if (StyleTypeEnum.ELEMENT.getStyle().equals(config.getStyle())) {
templates.add("template/element/index.vue.vm");
templates.add("template/element/form.vue.vm");
+ templates.add("template/avue/api.js.vm");
+ }
+ else {
+ templates.add("template/uview/api.js.vm");
+ templates.add("template/uview/form.vue.vm");
+ templates.add("template/uview/index.vue.vm");
+ templates.add("template/uview/page.json.vm");
}
return templates;
@@ -406,6 +421,25 @@ public class GenUtils {
+ className.toLowerCase() + "-form.vue";
}
+ if (template.contains(UVIEW_INDEX_VUE_VM)) {
+ return CommonConstants.UNI_END_PROJECT + File.separator + "pages" + File.separator + moduleName
+ + File.separator + className.toLowerCase() + File.separator + className.toLowerCase()
+ + "-index.vue";
+ }
+
+ if (template.contains(UVIEW_FORM_VUE_VM)) {
+ return CommonConstants.UNI_END_PROJECT + File.separator + "pages" + File.separator + moduleName
+ + File.separator + className.toLowerCase() + File.separator + className.toLowerCase() + "-form.vue";
+ }
+
+ if (template.contains(UVIEW_API_JS_VM)) {
+ return CommonConstants.UNI_END_PROJECT + File.separator + "common" + File.separator + "http.api.js";
+ }
+
+ if (template.contains(UVIEW_PAGE_JSON_VM)) {
+ return "page.json";
+ }
+
return null;
}
diff --git a/pigx-visual/pigx-codegen/src/main/resources/template/uview/api.js.vm b/pigx-visual/pigx-codegen/src/main/resources/template/uview/api.js.vm
new file mode 100644
index 000000000..16798df41
--- /dev/null
+++ b/pigx-visual/pigx-codegen/src/main/resources/template/uview/api.js.vm
@@ -0,0 +1,18 @@
+// 以下内容请复制到http.api.js中
+pigx${className}: {
+ // 分页
+ #[[fetchList: (params={}) => vm.$u.get]]#('/${moduleName}/${pathName}/page',params),
+
+ // 新增
+ #[[addObj: (obj={}) => vm.$u.post]]#('/${moduleName}/${pathName}', obj),
+
+ // 修改
+ #[[putObj: (obj={}) => vm.$u.put]]#('/${moduleName}/${pathName}',obj),
+
+ // 删除
+ #[[delObj: (id) => vm.$u.delete]]#('/${moduleName}/${pathName}/'+id),
+
+ // 查询
+ #[[getObj: (id) => vm.$u.get]]#('/${moduleName}/${pathName}/' + id)
+}
+
diff --git a/pigx-visual/pigx-codegen/src/main/resources/template/uview/form.vue.vm b/pigx-visual/pigx-codegen/src/main/resources/template/uview/form.vue.vm
new file mode 100644
index 000000000..116fc394a
--- /dev/null
+++ b/pigx-visual/pigx-codegen/src/main/resources/template/uview/form.vue.vm
@@ -0,0 +1,86 @@
+
+
+
+#foreach($column in $columns)
+#if($column.columnName != $pk.columnName)
+
+
+
+#end
+#end
+
+
+
+
+
+
+
diff --git a/pigx-visual/pigx-codegen/src/main/resources/template/uview/index.vue.vm b/pigx-visual/pigx-codegen/src/main/resources/template/uview/index.vue.vm
new file mode 100644
index 000000000..4ab6cd599
--- /dev/null
+++ b/pigx-visual/pigx-codegen/src/main/resources/template/uview/index.vue.vm
@@ -0,0 +1,122 @@
+
+
+
+
+
+
+ {{item.${pk.lowerAttrName}}}
+
+ 创建时间: {{item.createTime}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pigx-visual/pigx-codegen/src/main/resources/template/uview/page.json.vm b/pigx-visual/pigx-codegen/src/main/resources/template/uview/page.json.vm
new file mode 100644
index 000000000..6ba4471b5
--- /dev/null
+++ b/pigx-visual/pigx-codegen/src/main/resources/template/uview/page.json.vm
@@ -0,0 +1,17 @@
+// 以下内容请复制到pages.json
+"pages": [
+
+ /**${comments}**/
+ {
+ "path": "pages/${moduleName}/${pathName}/${pathName}+'-index.vue'",
+ "style": {
+ "navigationBarTitleText": "${comments}"
+ }
+ },
+ {
+ "path": "pages/${moduleName}/${pathName}/${pathName}+'-form.vue'",
+ "style": {
+ "navigationBarTitleText": "${comments}详情"
+ }
+ }
+}
\ No newline at end of file