master
parent
1387ad6137
commit
27bdea1e26
@ -0,0 +1,60 @@
|
||||
package xyz.wbsite.dbtool.javafx.ctrl;
|
||||
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.TextField;
|
||||
|
||||
public class VueOptionController {
|
||||
|
||||
@FXML
|
||||
private TextField name;
|
||||
@FXML
|
||||
private CheckBox elementUI;
|
||||
@FXML
|
||||
private CheckBox iView;
|
||||
@FXML
|
||||
private Button ok;
|
||||
@FXML
|
||||
private Button cancel;
|
||||
|
||||
public Button getOk() {
|
||||
return ok;
|
||||
}
|
||||
|
||||
public void setOk(Button ok) {
|
||||
this.ok = ok;
|
||||
}
|
||||
|
||||
public Button getCancel() {
|
||||
return cancel;
|
||||
}
|
||||
|
||||
public void setCancel(Button cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
|
||||
public TextField getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(TextField name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public CheckBox getElementUI() {
|
||||
return elementUI;
|
||||
}
|
||||
|
||||
public void setElementUI(CheckBox elementUI) {
|
||||
this.elementUI = elementUI;
|
||||
}
|
||||
|
||||
public CheckBox getiView() {
|
||||
return iView;
|
||||
}
|
||||
|
||||
public void setiView(CheckBox iView) {
|
||||
this.iView = iView;
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package xyz.wbsite.dbtool.javafx.manger.callable;
|
||||
|
||||
import xyz.wbsite.dbtool.javafx.manger.FreeMarkerManager;
|
||||
import xyz.wbsite.dbtool.javafx.manger.ManagerFactory;
|
||||
import xyz.wbsite.dbtool.javafx.manger.ProjectManager;
|
||||
import xyz.wbsite.dbtool.javafx.po.AbstractDBmapper;
|
||||
import xyz.wbsite.dbtool.javafx.po.AndroidOption;
|
||||
import xyz.wbsite.dbtool.javafx.po.VueOption;
|
||||
import xyz.wbsite.dbtool.javafx.tool.Tool;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.regex.Matcher;
|
||||
|
||||
import static xyz.wbsite.dbtool.javafx.tool.Tool.clear;
|
||||
|
||||
public class VueCallable implements Callable {
|
||||
|
||||
private String path;
|
||||
private VueOption option;
|
||||
|
||||
private FreeMarkerManager freeMarkerManager;
|
||||
|
||||
public VueCallable(@NotNull String path, VueOption option) {
|
||||
this.path = path;
|
||||
this.option = option;
|
||||
this.freeMarkerManager = ManagerFactory.getFreeMarkerManager();
|
||||
}
|
||||
|
||||
private AbstractDBmapper dBmapper;
|
||||
|
||||
public Boolean call() throws Exception {
|
||||
File app = new File(path, option.projectName);
|
||||
if (!app.exists()) {
|
||||
app.mkdirs();
|
||||
} else {
|
||||
clear(app);
|
||||
}
|
||||
|
||||
// 目录生成
|
||||
File src = new File(app, "src");
|
||||
src.mkdirs();
|
||||
File assets = new File(src, "assets");
|
||||
assets.mkdirs();
|
||||
File components = new File(src, "components");
|
||||
components.mkdirs();
|
||||
File plugins = new File(src, "plugins");
|
||||
plugins.mkdirs();
|
||||
File publics = new File(app, "public");
|
||||
publics.mkdirs();
|
||||
|
||||
{
|
||||
HashMap<String, Object> ctx = new HashMap<String, Object>();
|
||||
ctx.put("appName", option.projectName);
|
||||
freeMarkerManager.outputTemp(new File(app, "package.json"), "Vue/package.json", ctx);
|
||||
freeMarkerManager.outputTemp(new File(app, "package-lock.json"), "Vue/package-lock.json", ctx);
|
||||
freeMarkerManager.outputTemp(new File(app, "README.md"), "Vue/README.md", ctx);
|
||||
Tool.outputResource("Vue/babel.config.js", new File(app, "babel.config.js"));
|
||||
|
||||
//public
|
||||
Tool.outputResource("Vue/public/favicon.ico", new File(publics, "favicon.ico"));
|
||||
Tool.outputResource("Vue/public/index.html", new File(publics, "index.html"));
|
||||
|
||||
//src
|
||||
freeMarkerManager.outputTemp(new File(src, "App.vue"), "Vue/src/App.vue", ctx);
|
||||
Tool.outputResource("Vue/src/main.js", new File(src, "main.js"));
|
||||
Tool.outputResource("Vue/src/router.js", new File(src, "router.js"));
|
||||
Tool.outputResource("Vue/src/assets/logo.png", new File(assets, "logo.png"));
|
||||
Tool.outputResource("Vue/src/components/HelloWorld.vue", new File(components, "HelloWorld.vue"));
|
||||
Tool.outputResource("Vue/src/plugins/element.js", new File(plugins, "element.js"));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package xyz.wbsite.dbtool.javafx.po;
|
||||
|
||||
public class VueOption {
|
||||
public String projectName;
|
||||
public boolean elementui;
|
||||
public boolean iView;
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<BorderPane prefHeight="170.0" prefWidth="300.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="xyz.wbsite.dbtool.javafx.ctrl.VueOptionController">
|
||||
<center>
|
||||
<VBox prefHeight="120" prefWidth="300">
|
||||
<children>
|
||||
<GridPane prefHeight="50.0" prefWidth="300.0" BorderPane.alignment="CENTER">
|
||||
<columnConstraints>
|
||||
<ColumnConstraints hgrow="SOMETIMES" prefWidth="80.0"/>
|
||||
<ColumnConstraints hgrow="SOMETIMES" prefWidth="200.0"/>
|
||||
</columnConstraints>
|
||||
<rowConstraints>
|
||||
<RowConstraints maxHeight="40.0" minHeight="40.0" prefHeight="40.0" vgrow="SOMETIMES"/>
|
||||
</rowConstraints>
|
||||
<children>
|
||||
<Label text="项目名称" GridPane.halignment="CENTER" GridPane.rowIndex="0"
|
||||
GridPane.valignment="CENTER"/>
|
||||
<TextField fx:id="name" text="my-app" GridPane.columnIndex="1" GridPane.rowIndex="0"/>
|
||||
</children>
|
||||
<opaqueInsets>
|
||||
<Insets/>
|
||||
</opaqueInsets>
|
||||
<VBox.margin>
|
||||
<Insets left="10.0" right="10.0"/>
|
||||
</VBox.margin>
|
||||
</GridPane>
|
||||
|
||||
<HBox prefHeight="50.0" prefWidth="300.0">
|
||||
<children>
|
||||
<CheckBox fx:id="elementUI" mnemonicParsing="false" selected="false" text="ElementUI">
|
||||
</CheckBox>
|
||||
<CheckBox fx:id="iView" mnemonicParsing="false" selected="false" text="iView">
|
||||
</CheckBox>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="3.0" left="30.0" right="10.0" top="10.0"/>
|
||||
</padding>
|
||||
</HBox>
|
||||
</children>
|
||||
</VBox>
|
||||
</center>
|
||||
<bottom>
|
||||
<Pane prefHeight="50.0" prefWidth="300.0" BorderPane.alignment="CENTER">
|
||||
<children>
|
||||
<Button fx:id="ok" layoutX="75.0" layoutY="9.0" mnemonicParsing="false" text="确认"/>
|
||||
<Button fx:id="cancel" layoutX="185.0" layoutY="9.0" mnemonicParsing="false" text="取消"/>
|
||||
</children>
|
||||
</Pane>
|
||||
</bottom>
|
||||
</BorderPane>
|
@ -1,29 +0,0 @@
|
||||
# Built application files
|
||||
*.apk
|
||||
*.ap_
|
||||
|
||||
# Files for the Dalvik VM
|
||||
*.dex
|
||||
|
||||
# Java class files
|
||||
*.class
|
||||
|
||||
# Generated files
|
||||
bin/
|
||||
gen/
|
||||
|
||||
# Gradle files
|
||||
.gradle/
|
||||
build/
|
||||
|
||||
# Local configuration file (sdk path, etc)
|
||||
local.properties
|
||||
|
||||
# Proguard folder generated by Eclipse
|
||||
proguard/
|
||||
|
||||
#Log Files
|
||||
*.log
|
||||
|
||||
*.iml
|
||||
|
@ -0,0 +1,29 @@
|
||||
# ${appName}
|
||||
|
||||
## Project setup
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
### Compiles and hot-reloads for development
|
||||
```
|
||||
npm run serve
|
||||
```
|
||||
|
||||
### Compiles and minifies for production
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
### Run your tests
|
||||
```
|
||||
npm run test
|
||||
```
|
||||
|
||||
### Lints and fixes files
|
||||
```
|
||||
npm run lint
|
||||
```
|
||||
|
||||
### Customize configuration
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
'@vue/app'
|
||||
]
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "${appName}",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build",
|
||||
"lint": "vue-cli-service lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"core-js": "^2.6.5",
|
||||
"element-ui": "^2.4.5",
|
||||
"vue": "^2.6.10",
|
||||
"vue-router": "^3.0.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "^3.7.0",
|
||||
"@vue/cli-plugin-eslint": "^3.7.0",
|
||||
"@vue/cli-service": "^3.7.0",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"eslint": "^5.16.0",
|
||||
"eslint-plugin-vue": "^5.0.0",
|
||||
"vue-cli-plugin-element": "^1.0.1",
|
||||
"vue-template-compiler": "^2.5.21"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"env": {
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
"plugin:vue/essential",
|
||||
"eslint:recommended"
|
||||
],
|
||||
"rules": {},
|
||||
"parserOptions": {
|
||||
"parser": "babel-eslint"
|
||||
}
|
||||
},
|
||||
"postcss": {
|
||||
"plugins": {
|
||||
"autoprefixer": {}
|
||||
}
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%",
|
||||
"last 2 versions"
|
||||
]
|
||||
}
|
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title>${appName}</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but my-app doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<img src="./assets/logo.png">
|
||||
<div>
|
||||
<p>
|
||||
If Element is successfully added to this project, you'll see an
|
||||
<code v-text="'<el-button>'"></code>
|
||||
below
|
||||
</p>
|
||||
<el-button>el-button</el-button>
|
||||
</div>
|
||||
|
||||
<router-view></router-view>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'app'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
#app {
|
||||
font-family: 'Avenir', Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-align: center;
|
||||
color: #2c3e50;
|
||||
margin-top: 60px;
|
||||
}
|
||||
</style>
|
After Width: | Height: | Size: 6.7 KiB |
@ -0,0 +1,66 @@
|
||||
<template>
|
||||
<div class="hello">
|
||||
<h1>{{ msg }}</h1>
|
||||
|
||||
<p>
|
||||
For a guide and recipes on how to configure / customize this project,<br>
|
||||
check out the
|
||||
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
|
||||
</p>
|
||||
|
||||
<h3>Installed CLI Plugins</h3>
|
||||
<ul>
|
||||
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank"
|
||||
rel="noopener">babel</a></li>
|
||||
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank"
|
||||
rel="noopener">eslint</a></li>
|
||||
</ul>
|
||||
<h3>Essential Links</h3>
|
||||
<ul>
|
||||
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
|
||||
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
|
||||
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
|
||||
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
|
||||
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
|
||||
</ul>
|
||||
<h3>Ecosystem</h3>
|
||||
<ul>
|
||||
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
|
||||
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
|
||||
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank"
|
||||
rel="noopener">vue-devtools</a></li>
|
||||
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
|
||||
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'HelloWorld',
|
||||
props: {
|
||||
msg: String
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped>
|
||||
h3 {
|
||||
margin: 40px 0 0;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
li {
|
||||
display: inline-block;
|
||||
margin: 0 10px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #42b983;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,11 @@
|
||||
import Vue from 'vue'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import './plugins/element.js'
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
new Vue({
|
||||
router,
|
||||
render: h => h(App),
|
||||
}).$mount('#app')
|
@ -0,0 +1,5 @@
|
||||
import Vue from 'vue'
|
||||
import Element from 'element-ui'
|
||||
import 'element-ui/lib/theme-chalk/index.css'
|
||||
|
||||
Vue.use(Element)
|
@ -0,0 +1,15 @@
|
||||
import Vue from 'vue'
|
||||
import Router from 'vue-router'
|
||||
import HelloWorld from './components/HelloWorld'//首页
|
||||
|
||||
Vue.use(Router)
|
||||
|
||||
export default new Router({
|
||||
routes: [
|
||||
{//首页
|
||||
path: '/',
|
||||
name: 'HelloWorld',
|
||||
component: HelloWorld
|
||||
}
|
||||
]
|
||||
})
|
Loading…
Reference in new issue