forked from bailicangdu/vue2-manage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5e7884d
commit 02df894
Showing
36 changed files
with
22,936 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
build/*.js | ||
config/*.js | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,34 @@ | ||
// http://eslint.org/docs/user-guide/configuring | ||
|
||
module.exports = { | ||
root: true, | ||
parser: 'babel-eslint', | ||
parserOptions: { | ||
sourceType: 'module' | ||
}, | ||
env: { | ||
browser: true, | ||
}, | ||
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style | ||
extends: 'standard', | ||
// required to lint *.vue files | ||
plugins: [ | ||
'html' | ||
], | ||
// add your custom rules here | ||
'rules': { | ||
// allow paren-less arrow functions | ||
'arrow-parens': 0, | ||
// allow async-await | ||
'generator-star-spacing': 0, | ||
// allow debugger during development | ||
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0 | ||
} | ||
root: true, | ||
parser: 'babel-eslint', | ||
parserOptions: { | ||
sourceType: 'module' | ||
}, | ||
env: { | ||
browser: true, | ||
node: true | ||
}, | ||
extends: 'eslint:recommended', | ||
// required to lint *.vue files | ||
plugins: [ | ||
'html' | ||
], | ||
// check if imports actually resolve | ||
'settings': { | ||
'import/resolver': { | ||
'webpack': { | ||
'config': 'build/webpack.base.conf.js' | ||
} | ||
} | ||
}, | ||
// add your custom rules here | ||
'rules': { | ||
// allow paren-less arrow functions | ||
'arrow-parens': 0, | ||
// allow async-await | ||
'generator-star-spacing': 0, | ||
// allow debugger during development | ||
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, | ||
"indent": ["error", "tab"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,15 @@ | ||
<template> | ||
<div id="app"> | ||
<img src="./assets/logo.png"> | ||
<router-view></router-view> | ||
</div> | ||
<div id="app"> | ||
<router-view></router-view> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'app' | ||
} | ||
export default { | ||
} | ||
</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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,16 @@ | ||
<template> | ||
<div class="hello"> | ||
<h1>{{ msg }}</h1> | ||
<h2>Essential Links</h2> | ||
<ul> | ||
<li><a href="https://vuejs.org" target="_blank">Core Docs</a></li> | ||
<li><a href="https://forum.vuejs.org" target="_blank">Forum</a></li> | ||
<li><a href="https://gitter.im/vuejs/vue" target="_blank">Gitter Chat</a></li> | ||
<li><a href="https://twitter.com/vuejs" target="_blank">Twitter</a></li> | ||
<br> | ||
<li><a href="http://vuejs-templates.github.io/webpack/" target="_blank">Docs for This Template</a></li> | ||
</ul> | ||
<h2>Ecosystem</h2> | ||
<ul> | ||
<li><a href="http://router.vuejs.org/" target="_blank">vue-router</a></li> | ||
<li><a href="http://vuex.vuejs.org/" target="_blank">vuex</a></li> | ||
<li><a href="http://vue-loader.vuejs.org/" target="_blank">vue-loader</a></li> | ||
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank">awesome-vue</a></li> | ||
</ul> | ||
dsfsfsdfsd | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'hello', | ||
data () { | ||
return { | ||
msg: 'Welcome to Your Vue.js App' | ||
export default { | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<!-- Add "scoped" attribute to limit CSS to this component only --> | ||
<style scoped> | ||
h1, h2 { | ||
font-weight: normal; | ||
} | ||
|
||
ul { | ||
list-style-type: none; | ||
padding: 0; | ||
} | ||
|
||
li { | ||
display: inline-block; | ||
margin: 0 10px; | ||
} | ||
<style scoped> | ||
a { | ||
color: #42b983; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* 配置编译环境和线上环境之间的切换 | ||
* | ||
* baseUrl: 域名地址 | ||
* routerMode: 路由模式 | ||
* | ||
*/ | ||
let baseUrl; | ||
let routerMode; | ||
|
||
if (process.env.NODE_ENV == 'development') { | ||
baseUrl = ''; | ||
routerMode = 'hash' | ||
}else{ | ||
baseUrl = 'http://cangdu.org'; | ||
routerMode = 'hash' | ||
} | ||
|
||
export { | ||
baseUrl, | ||
routerMode, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import { baseUrl } from '@/env' | ||
|
||
export default async(type = 'GET', url = '', data = {}, method = 'fetch') => { | ||
type = type.toUpperCase(); | ||
url = baseUrl + url; | ||
|
||
if (type == 'GET') { | ||
let dataStr = ''; //数据拼接字符串 | ||
Object.keys(data).forEach(key => { | ||
dataStr += key + '=' + data[key] + '&'; | ||
}) | ||
|
||
if (dataStr !== '') { | ||
dataStr = dataStr.substr(0, dataStr.lastIndexOf('&')); | ||
url = url + '?' + dataStr; | ||
} | ||
} | ||
|
||
if (window.fetch && method == 'fetch') { | ||
let requestConfig = { | ||
credentials: 'include', | ||
method: type, | ||
headers: { | ||
'Accept': 'application/json', | ||
'Content-Type': 'application/json' | ||
}, | ||
mode: "cors", | ||
cache: "force-cache" | ||
} | ||
|
||
if (type == 'POST') { | ||
Object.defineProperty(requestConfig, 'body', { | ||
value: JSON.stringify(data) | ||
}) | ||
} | ||
|
||
try { | ||
var response = await fetch(url, requestConfig); | ||
var responseJson = await response.json(); | ||
} catch (error) { | ||
throw new Error(error) | ||
} | ||
return responseJson | ||
} else { | ||
return new Promise((resolve, reject) => { | ||
let requestObj; | ||
if (window.XMLHttpRequest) { | ||
requestObj = new XMLHttpRequest(); | ||
} else { | ||
requestObj = new ActiveXObject; | ||
} | ||
|
||
let sendData = ''; | ||
if (type == 'POST') { | ||
sendData = JSON.stringify(data); | ||
} | ||
|
||
requestObj.open(type, url, true); | ||
requestObj.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); | ||
requestObj.send(sendData); | ||
|
||
requestObj.onreadystatechange = () => { | ||
if (requestObj.readyState == 4) { | ||
if (requestObj.status == 200) { | ||
let obj = requestObj.response | ||
if (typeof obj !== 'object') { | ||
obj = JSON.parse(obj); | ||
} | ||
resolve(obj) | ||
} else { | ||
reject(requestObj) | ||
} | ||
} | ||
} | ||
}) | ||
} | ||
} |
Oops, something went wrong.