Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
yangzhiyue committed Jul 25, 2019
1 parent 5111a12 commit 01f25c7
Show file tree
Hide file tree
Showing 12 changed files with 273 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
> 1%
last 2 versions
not ie <= 8
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[*]
charset = utf-8
indent_style = space

[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
VUE_APP_HOST=
VUE_APP_MN_CONFIG_PREFIX=/api/rest_j/v1/
VUE_APP_MN_CONFIG_SOCKET=/ws/api/entrance/connect
69 changes: 69 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'@vue/standard'
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'key-spacing': ['error'],
'keyword-spacing': ['error'],
'standard/no-callback-literal': 0,
'handle-callback-err': 0,
'no-return-assign': 0,
'eqeqeq': 0,
'comma-dangle': 0,
'semi': 0,
'space-before-function-paren': 0,
'keyword-spacing': 0,
'no-useless-escape': 0,
'no-invalid-this': 0,
'operator-linebreak': 0,
'indent': [
'error',
4,
{
'SwitchCase': 1
}
],
'no-const-assign': 'warn',
'no-this-before-super': 'warn',
'no-undef': 2,
'no-unreachable': 'warn',
'no-unused-vars': 'warn',
'constructor-super': 'warn',
'valid-typeof': 'warn',
'one-var': 'warn',
'max-len': 'off',
'no-trailing-spaces': 'off',
'require-jsdoc': 'warn',
'camelcase': 'warn',
'no-invalid-this': 'warn',
'linebreak-style': 0,
'vue/no-parsing-error': [2, {
'x-invalid-end-tag': false,
'invalid-first-character-of-tag-name': false
}],
'no-tabs': 0,
'vue/html-indent': [2, 2, {
'attribute': 1,
'closeBracket': 0,
'alignAttributesVertically': false
}],
'vue/require-default-prop': 0,
'vue/component-name-in-template-casing': 0,
'vue/html-closing-bracket-spacing': 0,
'vue/html-closing-bracket-newline': 0,
'vue/singleline-html-element-content-newline': 0,
'vue/multiline-html-element-content-newline': 0,
'vue/attributes-order': 0,
'vue/html-self-closing': 0
},
parserOptions: {
parser: 'babel-eslint'
}
}
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* text=auto
* text eol=lf
*.png binary
*.gif binary
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.DS_Store
.vscode
.cache
.idea/

node_modules/
dist/

.package-lock.json
.env.development
5 changes: 5 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/app'
]
}
2 changes: 2 additions & 0 deletions mock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module.exports = function (app, Mock) {
}
47 changes: 47 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "dws",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"fix": "eslint --ext .js,.vue src --fix"
},
"dependencies": {
"axios": "^0.16.2",
"babel-polyfill": "^6.26.0",
"core-js": "^2.6.5",
"dexie": "^2.0.4",
"dt-sql-parser": "^1.1.10",
"highlight.js": "^9.12.0",
"iview": "^3.4.1",
"lodash": "^4.17.10",
"md5": "^2.2.1",
"mitt": "^1.1.3",
"moment": "^2.22.2",
"monaco-editor": "^0.15.1",
"reconnecting-websocket": "^4.1.10",
"sql-formatter": "^2.1.0",
"vue": "^2.6.6",
"vue-router": "^3.0.1",
"vuescroll": "^4.10.5"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.8.0",
"@vue/cli-plugin-eslint": "^3.8.0",
"@vue/cli-service": "^3.8.0",
"@vue/eslint-config-standard": "^4.0.0",
"babel-eslint": "^10.0.1",
"copy-webpack-plugin": "^4.5.2",
"eslint": "^5.16.0",
"eslint-config-google": "^0.13.0",
"eslint-plugin-prettier": "^3.1.0",
"eslint-plugin-vue": "^5.0.0",
"monaco-editor-webpack-plugin": "^1.7.0",
"node-sass": "^4.9.0",
"sass-loader": "^7.1.0",
"vue-cli-plugin-mockjs": "^0.1.3",
"vue-template-compiler": "^2.6.10"
}
}
5 changes: 5 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
plugins: {
autoprefixer: {}
}
}
30 changes: 30 additions & 0 deletions vue.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// vue.config.js
let CopyWebpackPlugin = require('copy-webpack-plugin')
let path = require('path')
module.exports = {
configureWebpack: {
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': path.resolve(__dirname, './src'),
'@js': path.resolve(__dirname, './src/js'),
'@assets': path.resolve(__dirname, './src/assets')
}
},
plugins: [
// 忽略moment的locale文件夹,然后再main.js中手动加载 ‘moment/locale/zh-cn'
// new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)
new CopyWebpackPlugin([{
from: 'node_modules/monaco-editor/dev/vs',
to: 'static/vs',
}]),
]
},
// 选项...
pluginOptions: {
mock: {
entry: 'mock.js',
power: false
}
}
}
86 changes: 86 additions & 0 deletions 编译文档中文版.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# 编译文档中文版

## 启动流程

### 一、安装Node.js
将Node.js下载到电脑本地,安装即可。下载地址:[http://nodejs.cn/download/](http://nodejs.cn/download/) (建议使用最新的稳定版本)
**该步骤仅第一次使用时需要执行。**

### 二、安装项目
在终端命令行中执行以下指令:

```
git clone ${ipAddress}
cd wds-ide
npm install
```

指令简介:
1. 将项目包从远程仓库拉取到电脑本地:git clone ${ipAddress}
2. 进入项目包根目录:cd wds-ide
3. 安装项目所需依赖:npm install

**该步骤仅第一次使用时需要执行。**

### 三、配置
您需要在代码中进行一些配置,如后端接口地址,后端socket地址等,如根目录下的.env.development文件:

```
// 后端接口地址
VUE_APP_MN_CONFIG_PREFIX=http://yourIp:yourPort/yourPath
// 后端socket地址
VUE_APP_MN_CONFIG_SOCKET=/yourSocketPath
```

配置的具体解释可参考vue-cli官方文档:[环境变量和模式](https://cli.vuejs.org/zh/guide/mode-and-env.html#%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F%E5%92%8C%E6%A8%A1%E5%BC%8F)

### 打包项目
您可以通过在终端命令行执行以下指令对项目进行打包,生成压缩后的代码:

```
npm run build
```

该指令成功执行后,项目根目录下会出现一个名叫 “dist” 的文件夹,该文件夹即为打包好的代码。您可以直接将该文件夹放进您的静态服务器中。

### 运行项目
如果您想在本地浏览器上运行该项目并且改动代码查看效果,需要在终端命令行中执行以下指令:

```
npm run serve
```

在浏览器中(建议Chrome浏览器)通过链接访问应用:[http://localhost:8080/](http://localhost:8080/) .
当您使用该方式运行项目时,您对代码的改动产生的效果,会动态体现在浏览器上。

**注意:因为项目采用前后端分离开发,所以在本地浏览器上运行时,需要对浏览器进行设置跨域才能访问后端接口:**

比如chrome浏览器:
windows系统下的配置方式:
1. 关闭所有的chrome浏览器。
2. 新建一个chrome快捷方式,右键“属性”,“快捷方式”选项卡里选择“目标”,添加  --args --disable-web-security --user-data-dir=C:\MyChromeDevUserData
3. 通过快捷方式打开chrome浏览器
mac系统下的配置方式:
在终端命令行执行以下命令(需要替换路径中的yourname,若还不生效请检查您机器上MyChromeDevUserData文件夹的位置并将路径复制到下面指令的“--user-data-dir=”后面)

```
open -n /Applications/Google\ Chrome.app/ --args --disable-web-security --user-data-dir=/Users/yourname/MyChromeDevUserData/
```


### 常见问题

#### npm install无法成功
如果遇到该情况,可以使用国内的淘宝npm镜像:

```
npm install -g cnpm --registry=https://registry.npm.taobao.org
```

接着,通过执行以下指令代替npm install指令

```
cnpm install
```

注意,项目启动和打包时,仍然可以使用npm run build和npm run serve指令

0 comments on commit 01f25c7

Please sign in to comment.