class="add-code nl-21 ol-21">
+
+{{#if style}}
+<style lang="scss" scoped>
+
+</style>
+{{/if}}
@@ -0,0 +1,55 @@ |
||
| 1 |
+const { notEmpty } = require('../utils.js')
|
|
| 2 |
+ |
|
| 3 |
+module.exports = {
|
|
| 4 |
+ description: 'generate a view', |
|
| 5 |
+ prompts: [{
|
|
| 6 |
+ type: 'input', |
|
| 7 |
+ name: 'name', |
|
| 8 |
+ message: 'view name please', |
|
| 9 |
+ validate: notEmpty('name')
|
|
| 10 |
+ }, |
|
| 11 |
+ {
|
|
| 12 |
+ type: 'checkbox', |
|
| 13 |
+ name: 'blocks', |
|
| 14 |
+ message: 'Blocks:', |
|
| 15 |
+ choices: [{
|
|
| 16 |
+ name: '<template>', |
|
| 17 |
+ value: 'template', |
|
| 18 |
+ checked: true |
|
| 19 |
+ }, |
|
| 20 |
+ {
|
|
| 21 |
+ name: '<script>', |
|
| 22 |
+ value: 'script', |
|
| 23 |
+ checked: true |
|
| 24 |
+ }, |
|
| 25 |
+ {
|
|
| 26 |
+ name: 'style', |
|
| 27 |
+ value: 'style', |
|
| 28 |
+ checked: true |
|
| 29 |
+ } |
|
| 30 |
+ ], |
|
| 31 |
+ validate(value) {
|
|
| 32 |
+ if (value.indexOf('script') === -1 && value.indexOf('template') === -1) {
|
|
| 33 |
+ return 'View require at least a <script> or <template> tag.' |
|
| 34 |
+ } |
|
| 35 |
+ return true |
|
| 36 |
+ } |
|
| 37 |
+ } |
|
| 38 |
+ ], |
|
| 39 |
+ actions: data => {
|
|
| 40 |
+ const name = '{{name}}'
|
|
| 41 |
+ const actions = [{
|
|
| 42 |
+ type: 'add', |
|
| 43 |
+ path: `src/views/${name}/index.vue`,
|
|
| 44 |
+ templateFile: 'plop-templates/view/index.hbs', |
|
| 45 |
+ data: {
|
|
| 46 |
+ name: name, |
|
| 47 |
+ template: data.blocks.includes('template'),
|
|
| 48 |
+ script: data.blocks.includes('script'),
|
|
| 49 |
+ style: data.blocks.includes('style')
|
|
| 50 |
+ } |
|
| 51 |
+ }] |
|
| 52 |
+ |
|
| 53 |
+ return actions |
|
| 54 |
+ } |
|
| 55 |
+} |
@@ -0,0 +1,9 @@ |
||
| 1 |
+const viewGenerator = require('./plop-templates/view/prompt')
|
|
| 2 |
+const componentGenerator = require('./plop-templates/component/prompt')
|
|
| 3 |
+const storeGenerator = require('./plop-templates/store/prompt.js')
|
|
| 4 |
+ |
|
| 5 |
+module.exports = function(plop) {
|
|
| 6 |
+ plop.setGenerator('view', viewGenerator)
|
|
| 7 |
+ plop.setGenerator('component', componentGenerator)
|
|
| 8 |
+ plop.setGenerator('store', storeGenerator)
|
|
| 9 |
+} |
@@ -0,0 +1,5 @@ |
||
| 1 |
+module.exports = {
|
|
| 2 |
+ plugins: {
|
|
| 3 |
+ autoprefixer: {}
|
|
| 4 |
+ } |
|
| 5 |
+} |
@@ -0,0 +1,15 @@ |
||
| 1 |
+<!DOCTYPE html> |
|
| 2 |
+<html> |
|
| 3 |
+ <head> |
|
| 4 |
+ <meta charset="utf-8"> |
|
| 5 |
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
|
| 6 |
+ <meta name="renderer" content="webkit"> |
|
| 7 |
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> |
|
| 8 |
+ <link rel="icon" href="<%= BASE_URL %>favicon.ico"> |
|
| 9 |
+ <title><%= webpackConfig.name %></title> |
|
| 10 |
+ </head> |
|
| 11 |
+ <body> |
|
| 12 |
+ <div id="app"></div> |
|
| 13 |
+ <!-- built files will be auto injected --> |
|
| 14 |
+ </body> |
|
| 15 |
+</html> |
@@ -0,0 +1,11 @@ |
||
| 1 |
+<template> |
|
| 2 |
+ <div id="app"> |
|
| 3 |
+ <router-view /> |
|
| 4 |
+ </div> |
|
| 5 |
+</template> |
|
| 6 |
+ |
|
| 7 |
+<script> |
|
| 8 |
+export default {
|
|
| 9 |
+ name: 'App' |
|
| 10 |
+} |
|
| 11 |
+</script> |
@@ -0,0 +1,13 @@ |
||
| 1 |
+import request from '@/utils/request' |
|
| 2 |
+import store from '@/store' |
|
| 3 |
+import qs from 'qs' |
|
| 4 |
+ |
|
| 5 |
+export function fetchDashboard(data) {
|
|
| 6 |
+ data['brand_id'] = 'ywkRTh5vtswRvhh8uLvTTQ' |
|
| 7 |
+ data['admin_id'] = store.getters.token |
|
| 8 |
+ return request({
|
|
| 9 |
+ url: '/admin/dashboard', |
|
| 10 |
+ method: 'post', |
|
| 11 |
+ data: qs.stringify(data) |
|
| 12 |
+ }) |
|
| 13 |
+} |
@@ -0,0 +1,21 @@ |
||
| 1 |
+import request from '@/utils/request' |
|
| 2 |
+import store from '@/store' |
|
| 3 |
+import qs from 'qs' |
|
| 4 |
+ |
|
| 5 |
+export function fetchList(data) {
|
|
| 6 |
+ data['admin_id'] = store.getters.token |
|
| 7 |
+ return request({
|
|
| 8 |
+ url: '/admin/order/list', |
|
| 9 |
+ method: 'post', |
|
| 10 |
+ data: qs.stringify(data) |
|
| 11 |
+ }) |
|
| 12 |
+} |
|
| 13 |
+ |
|
| 14 |
+export function updateOrder(data) {
|
|
| 15 |
+ data['admin_id'] = store.getters.token |
|
| 16 |
+ return request({
|
|
| 17 |
+ url: '/admin/order/update', |
|
| 18 |
+ method: 'post', |
|
| 19 |
+ data: qs.stringify(data) |
|
| 20 |
+ }) |
|
| 21 |
+} |
@@ -0,0 +1,25 @@ |
||
| 1 |
+import request from '@/utils/request' |
|
| 2 |
+import qs from 'qs' |
|
| 3 |
+ |
|
| 4 |
+export function login(data) {
|
|
| 5 |
+ return request({
|
|
| 6 |
+ url: '/admin/login', |
|
| 7 |
+ method: 'post', |
|
| 8 |
+ data: qs.stringify(data) |
|
| 9 |
+ }) |
|
| 10 |
+} |
|
| 11 |
+ |
|
| 12 |
+export function getInfo(token) {
|
|
| 13 |
+ return request({
|
|
| 14 |
+ url: '/vue-element-admin/user/info', |
|
| 15 |
+ method: 'get', |
|
| 16 |
+ params: { token }
|
|
| 17 |
+ }) |
|
| 18 |
+} |
|
| 19 |
+ |
|
| 20 |
+export function logout() {
|
|
| 21 |
+ return request({
|
|
| 22 |
+ url: '/vue-element-admin/user/logout', |
|
| 23 |
+ method: 'post' |
|
| 24 |
+ }) |
|
| 25 |
+} |
@@ -0,0 +1 @@ |