Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wqw #1447

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

wqw #1447

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@

> This template is Vue 2.0 compatible. For Vue 1.x use this command: `vue init webpack#1.0 my-project`


# Vue-cli 3 is here, so this template is now considered deprecated.

This template was the main template for vue-cli verison 2.*.

Now that we have released a [stable version of vue-cli 3](https://cli.vuejs.org), which incorporates all features that this template offers (and much more), we think that this template doesn't have any significant use for the future, so we won't put much resource in developing it further.

We will try and fix major issues should they arise, but not much more.

Feel free to fork this template if you want to keep it alive.

## Documentation

- [For this template](http://vuejs-templates.github.io/webpack): common questions specific to this template are answered and each part is described in greater detail
Expand Down
2 changes: 1 addition & 1 deletion docs/backend.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const path = require('path')

module.exports = {
dev: {
/ Paths
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {},
Expand Down
8 changes: 4 additions & 4 deletions docs/env.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ So, the environment variables are:

As we can see, `test.env` inherits the `dev.env` and the `dev.env` inherits the `prod.env`.

### Usage
### Usage

It is simple to use the environment variables in your code. For example:
It is simple to use the environment variables in your code. For example:

```js
Vue.config.productionTip = process.env.NODE_ENV === 'production'
```js
Vue.config.productionTip = process.env.NODE_ENV === 'production'
```
3 changes: 2 additions & 1 deletion docs/linter.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ You can run the following command to let eslint fix any errors it finds (if it c
npm run lint -- --fix
```

*(The `--` in the middle is necessary to ensure the `--fix` option is passdd to `eslint`, not to `npm`. It can be omitted whne using yarn)*
*(The `--` in the middle is necessary to ensure the `--fix` option is passed to `eslint`, not to `npm`. It can be omitted when using yarn)*


8 changes: 4 additions & 4 deletions docs/pre-processors.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Pre-Processors

This boilerplate has pre-configured CSS extraction for most popular CSS pre-processors including LESS, SASS, Stylus, and PostCSS. To use a pre-processor, all you need to do is install the appropriate webpack loader for it. For example, to use SASS:
This boilerplate has pre-configured CSS extraction for most popular CSS pre-processors including LESS, Sass, Stylus, and PostCSS. To use a pre-processor, all you need to do is install the appropriate webpack loader for it. For example, to use Sass:

``` bash
npm install sass-loader node-sass --save-dev
Expand All @@ -14,11 +14,11 @@ Once installed, you can use the pre-processors inside your `*.vue` components us

``` html
<style lang="scss">
/* write SASS! */
/* write Sass! */
</style>
```

### A note on SASS syntax
### A note on Sass syntax

- `lang="scss"` corresponds to the CSS-superset syntax (with curly braces and semicolons).
- `lang="sass"` corresponds to the indentation-based syntax.
Expand All @@ -27,7 +27,7 @@ Once installed, you can use the pre-processors inside your `*.vue` components us

Styles in `*.vue` files and style files (`*.css`, `*.scss` etc) are piped through PostCSS by default, so you don't need to use a specific loader for it.

You can simply add PostCSS plugins you want to use to the `.postcssrc.js`file in your project's root directory:
You can simply add PostCSS plugins you want to use to the `.postcssrc.js` file in your project's root directory:

``` js
// https://github.com/michael-ciniawsky/postcss-load-config
Expand Down
4 changes: 2 additions & 2 deletions docs/structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
│ │ ├── eslintrc # config file for eslint with extra settings only for unit tests
│ │ ├── index.js # test build entry file
│ │ ├── jest.conf.js # Config file when using Jest for unit tests
│ │ ── karma.conf.js # test runner config file when using Karma for unit tests
│ │ ── setup.js # file that runs before Jest runs your unit tests
│ │ ── karma.conf.js # test runner config file when using Karma for unit tests
│ │ ── setup.js # file that runs before Jest runs your unit tests
│ └── e2e/ # e2e tests
│ │   ├── specs/ # test spec files
│ │   ├── custom-assertions/ # custom assertions for e2e tests
Expand Down
7 changes: 1 addition & 6 deletions meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module.exports = {
type: 'string',
required: false,
message: 'Project description',
default: 'A Vue.js project',
default: 'tuhu-yewu-vue-cli',
},
author: {
when: 'isNotTest',
Expand Down Expand Up @@ -116,11 +116,6 @@ module.exports = {
value: 'jest',
short: 'jest',
},
{
name: 'Karma and Mocha',
value: 'karma',
short: 'karma',
},
{
name: 'none (configure it yourself)',
value: 'noTest',
Expand Down
6 changes: 3 additions & 3 deletions scenarios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ With the code from `index.js`, we insert those answers into the metalsmith metad

## The scenarios

We currently have 3 scenrios set up:
We currently have 3 scenarios set up:

1. 'minimal': it basically answers "no" to ever choice, so no router, no elint, no tests
1. 'minimal': it basically answers "no" to ever choice, so no router, no eslint, no tests
2. 'full': It answers "yes" to every choice. With router, with linting (standard), with full tests (jest & e2e)
3. 'full-airbnb-karma': like 'full', but using airbnb eslint config instead od standard and karma instead of jest for unnit tests.
3. 'full-airbnb-karma': like 'full', but using airbnb eslint config instead of standard and karma instead of jest for unit tests.

Other permutations might be worth testing to secure against edge cases, but this gives us a decent level of security over common combinations.

Expand Down
12 changes: 12 additions & 0 deletions template/config/getIPAdress.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
exports.getIPAdress = function() {
var interfaces = require('os').networkInterfaces()
for (var devName in interfaces) {
var iface = interfaces[devName]
for (var i = 0; i < iface.length; i++) {
var alias = iface[i]
if (alias.family === 'IPv4' && alias.address !== '127.0.0.1' && !alias.internal) {
return alias.address
}
}
}
}
3 changes: 2 additions & 1 deletion template/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// see http://vuejs-templates.github.io/webpack for documentation.

const path = require('path')
const getIP = require('./getIPAdress')

module.exports = {
dev: {
Expand All @@ -13,7 +14,7 @@ module.exports = {
proxyTable: {},

// Various Dev Server settings
host: 'localhost', // can be overwritten by process.env.HOST
host: getIP.getIPAdress(), // can be overwritten by process.env.HOST
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: false,
errorOverlay: true,
Expand Down
27 changes: 7 additions & 20 deletions template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@
"build": "node build/build.js"
},
"dependencies": {
"vuex": "^3.0.1",
"vue": "^2.5.2"{{#router}},
"vue-router": "^3.0.1"{{/router}}
},
"devDependencies": {
"axios": "^0.18.0",
{{#lint}}
"babel-eslint": "^8.2.1",
"babel-eslint": "^7.2.3",
"eslint": "^4.15.0",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1",
Expand All @@ -56,25 +58,6 @@
"jest-serializer-vue": "^0.3.0",
"vue-jest": "^1.0.2",
{{/if_eq}}
{{#if_eq runner "karma"}}
"cross-env": "^5.0.1",
"karma": "^1.4.1",
"karma-coverage": "^1.1.1",
"karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.2",
"karma-phantomjs-shim": "^1.4.0",
"karma-sinon-chai": "^1.3.1",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "0.0.31",
"karma-webpack": "^2.0.2",
"mocha": "^3.2.0",
"chai": "^4.1.2",
"sinon": "^4.0.0",
"sinon-chai": "^2.8.0",
"inject-loader": "^3.0.0",
"babel-plugin-istanbul": "^4.1.1",
"phantomjs-prebuilt": "^2.1.14",
{{/if_eq}}
{{#e2e}}
"babel-register": "^6.22.0",
"chromedriver": "^2.27.2",
Expand Down Expand Up @@ -103,6 +86,10 @@
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.8",
"postcss-url": "^7.2.1",
"node-sass": "^4.9.0",
"sass-loader": "^7.0.3",
"element": "^0.1.4",
"element-ui": "^2.4.1",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"optimize-css-assets-webpack-plugin": "^3.2.0",
Expand Down
25 changes: 1 addition & 24 deletions template/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,34 +1,11 @@
<template>
<div id="app">
<img src="./assets/logo.png">
{{#router}}
<router-view/>
{{else}}
<HelloWorld/>
{{/router}}
</div>
</template>

<script>
{{#unless router}}
import HelloWorld from './components/HelloWorld'

{{/unless}}
export default {
name: 'App'{{#router}}{{else}},
components: {
HelloWorld
}{{/router}}
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>
20 changes: 20 additions & 0 deletions template/src/api/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
let PURCHASE_HOST
let host = window.location.host
if (host.match(/ut\.tuhu\.cn$/)) { // UT环境
PURCHASE_HOST = 'https://purchaseapiut.tuhu.cn'
} else {
if (host.match(/\.tuhu\.cn$/)) { // 线上环境
PURCHASE_HOST = 'https://purchaseapi.tuhu.cn'
} else if (host.match(/\.tuhu\.work$/)) { // WORK环境
PURCHASE_HOST = 'https://purchaseapi.tuhu.work'
} else { // DEV环境
PURCHASE_HOST = 'https://purchaseapi.tuhu.work'
}
}

export default {
getMenuList: `${PURCHASE_HOST}/menu/getMenuList`, // 获取左菜单接口

// demo页面接口
getOperatingActivityList: `${PURCHASE_HOST}/api/operatingActivity/getOperatingActivityList`
}
24 changes: 24 additions & 0 deletions template/src/api/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import request from '@/utils/request'
import config from './config'

/**
* 接口API通用方法
* params {
* url: '', 请求url(对应api连接的别名)
* method: '', 请求方法
* data, 请求数据
* headers 请求头(根据需要),也可在oxios中全局设置header
* joinId 拼接url后面的id(非必填)
* }
*/
export async function APISERVER (param) {
if (!config[param.url]) {
throw new Error('请配置接口URL')
} else {
let opt = {method: param.method}
opt = (param && param.data) ? Object.assign({}, opt, {data: param.data}) : opt
opt = (param && param.headers) ? Object.assign({}, opt, {headers: param.headers}) : opt
let url = (param && param.joinId) ? config[param.url] + '/' + param.joinId : config[param.url]
return request(url, opt)
}
}
Binary file added template/src/assets/img/close.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added template/src/assets/img/left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added template/src/assets/img/other.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions template/src/assets/img/phone.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added template/src/assets/img/refresh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added template/src/assets/img/right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added template/src/assets/img/whiteClose.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added template/src/assets/img/zjsjx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed template/src/assets/logo.png
Binary file not shown.
22 changes: 22 additions & 0 deletions template/src/assets/style/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@import 'transition';

body {
margin: 0px;
height: 100%;
width: 100%;
-moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif;
}
html{
height: 100%;
overflow: auto;
width: 100%;
box-sizing: border-box;
}
ul, ul li{
margin: 0;
padding: 0;
list-style: none;
}
47 changes: 47 additions & 0 deletions template/src/assets/style/transition.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//globl transition css

/*fade*/
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.28s;
}

.fade-enter,
.fade-leave-active {
opacity: 0;
}

/*fade-transform*/
.fade-transform-leave-active,
.fade-transform-enter-active {
transition: all .5s;
}
.fade-transform-enter {
opacity: 0;
transform: translateX(-30px);
}
.fade-transform-leave-to {
opacity: 0;
transform: translateX(30px);
}

/*breadtab transition*/
.breadtab-enter-active,
.breadtab-leave-active {
transition: all .5s;
}

.breadtab-enter,
.breadtab-leave-active {
opacity: 0;
transform: translateX(20px);
}

.breadtab-move {
transition: all .5s;
}

.breadtab-leave-active {
position: absolute;
}

Loading