-
Notifications
You must be signed in to change notification settings - Fork 7
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
Showing
45 changed files
with
1,557 additions
and
161 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,34 +1,41 @@ | ||
# winter-app | ||
# element-admin | ||
|
||
## Project setup | ||
|
||
``` | ||
yarn install | ||
``` | ||
|
||
### Compiles and hot-reloads for development | ||
|
||
``` | ||
yarn run serve | ||
``` | ||
|
||
### Compiles and minifies for production | ||
|
||
``` | ||
yarn run build | ||
``` | ||
|
||
### Run your tests | ||
|
||
``` | ||
yarn run test | ||
``` | ||
|
||
### Lints and fixes files | ||
|
||
``` | ||
yarn run lint | ||
``` | ||
|
||
### Run your unit tests | ||
|
||
``` | ||
yarn run test:unit | ||
``` | ||
|
||
### Customize configuration | ||
|
||
See [Configuration Reference](https://cli.vuejs.org/config/). |
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
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,29 +1,14 @@ | ||
<template> | ||
<div id="app"> | ||
<div id="nav"> | ||
<router-link to="/">Home</router-link> | | ||
<router-link to="/about">About</router-link> | ||
</div> | ||
<router-view/> | ||
</div> | ||
</template> | ||
|
||
<style lang="scss"> | ||
#app { | ||
font-family: 'Avenir', Helvetica, Arial, sans-serif; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
text-align: center; | ||
color: #2c3e50; | ||
} | ||
#nav { | ||
padding: 30px; | ||
a { | ||
font-weight: bold; | ||
color: #2c3e50; | ||
&.router-link-exact-active { | ||
color: #42b983; | ||
} | ||
} | ||
} | ||
</style> | ||
|
||
<script> | ||
export default { | ||
name: 'App' | ||
} | ||
</script> |
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,104 @@ | ||
import { delay, checkCode } from '@/utils/request' | ||
|
||
/* start of mocking user */ | ||
const users = { | ||
admin: { | ||
id: 100001, | ||
name: 'Administrator', | ||
roles: ['USER', 'ADMIN'] | ||
}, | ||
codetrial: { | ||
id: 100001, | ||
name: 'Codetrial', | ||
roles: ['USER'] | ||
} | ||
} | ||
|
||
export async function getUser(username) { | ||
await delay(200) | ||
|
||
const user = users[username] | ||
const response = user | ||
? { | ||
status: '1', | ||
data: user | ||
} | ||
: { | ||
status: '1100', | ||
message: 'Wrong user or password' | ||
} | ||
|
||
return Promise.resolve(response).then(checkCode) | ||
} | ||
/* end of mocking user */ | ||
|
||
/* start of mocking example list */ | ||
const exampleSource = Array(235) | ||
.fill(1) | ||
.map((element, index) => { | ||
const personal = index % 2 === 0 | ||
return { | ||
id: index + 10000, | ||
name: `Example - ${index} - ${personal ? 'felixpy' : 'codetrial'}`, | ||
type: personal ? 1 : 2, | ||
status: index % 5 === 0 ? 0 : 1, | ||
url: personal ? 'https://felixpy.com' : 'https://codetrial.github.io', | ||
createUser: 100001, | ||
createUserName: 'Felix Yang', | ||
updateUser: 100001, | ||
updateUserName: 'Felix Yang', | ||
createTime: '2018-12-22 11:00:00', | ||
updateTime: '2018-12-22 11:00:00' | ||
} | ||
}) | ||
|
||
export async function getExampleList({ filter = {}, page = {} }) { | ||
const { pageNo = 1, pageSize = 20 } = page | ||
const offset = (pageNo - 1) * pageSize | ||
let list = exampleSource | ||
let total = exampleSource.length | ||
|
||
// filter | ||
Object.keys(filter).forEach(key => { | ||
const filterValue = filter[key] | ||
if (filterValue != null && filterValue.length) { | ||
list = list.filter(item => { | ||
if (Array.isArray(filterValue)) { | ||
return filterValue.map(String).indexOf(String(item[key])) > -1 | ||
} | ||
return String(item[key]) === String(filterValue) | ||
}) | ||
} | ||
}) | ||
|
||
total = list.length | ||
|
||
// sort | ||
list = list.sort((a, b) => { | ||
const { order, orderBy } = page | ||
|
||
if (!order || !orderBy) { | ||
return | ||
} | ||
|
||
const diff = (order === 'descending' ? -1 : 1) * (a[orderBy] - b[orderBy]) | ||
return diff > 0 ? 1 : -1 | ||
}) | ||
|
||
// pagination | ||
list = list.slice(offset, offset + pageSize) | ||
|
||
await delay(1000) | ||
|
||
return Promise.resolve({ | ||
status: '1', | ||
data: { | ||
list, | ||
page: { | ||
...page, | ||
total | ||
} | ||
} | ||
}).then(checkCode) | ||
} | ||
/* end of mocking example list */ |
This file was deleted.
Oops, something went wrong.
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,15 @@ | ||
<template> | ||
<div class="error-page"> | ||
<div class="error-page__tip">403 Forbidden</div> | ||
</div> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
@import './index'; | ||
</style> | ||
|
||
<script> | ||
export default { | ||
name: 'Forbidden' | ||
} | ||
</script> |
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,15 @@ | ||
<template> | ||
<div class="error-page"> | ||
<div class="error-page__tip">404 Not Found</div> | ||
</div> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
@import './index'; | ||
</style> | ||
|
||
<script> | ||
export default { | ||
name: 'NotFound' | ||
} | ||
</script> |
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,15 @@ | ||
<template> | ||
<div class="error-page"> | ||
<div class="error-page__tip">500 Internal Server Error</div> | ||
</div> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
@import './index'; | ||
</style> | ||
|
||
<script> | ||
export default { | ||
name: 'InternalServerError' | ||
} | ||
</script> |
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,5 @@ | ||
import Forbidden from './403.vue' | ||
import NotFound from './404.vue' | ||
import InternalServerError from './500.vue' | ||
|
||
export { Forbidden, NotFound, InternalServerError } |
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,9 @@ | ||
.error-page { | ||
padding: 100px 0; | ||
|
||
.error-page__tip { | ||
font-size: 48px; | ||
font-weight: bold; | ||
text-align: center; | ||
} | ||
} |
Oops, something went wrong.