Authored by htoooth

Merge branch 'master' of http://git.yoho.cn/fe/ufo-platform-fe

... ... @@ -3,5 +3,8 @@
["es2015", {
"modules": false
}]
],
"plugins": [
"transform-vue-jsx"
]
}
\ No newline at end of file
... ...
This diff could not be displayed because it is too large.
... ... @@ -29,7 +29,9 @@
"babel": "^6.23.0",
"babel-core": "^6.23.1",
"babel-loader": "^7.1.2",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-runtime": "^6.12.0",
"babel-plugin-transform-vue-jsx": "^3.7.0",
"babel-preset-es2015": "^6.9.0",
"babel-runtime": "^6.11.6",
"css-loader": "^0.28.7",
... ...
... ... @@ -4,8 +4,8 @@ class Api {
constructor() {
}
_get(url, data, debug = false) {
if (debug) {
_get(url, data) {
if (!PRODUCTION) {
data = Object.assign({}, data, {
debug: 'XYZ'
});
... ... @@ -14,8 +14,8 @@ class Api {
return util.ajax.get(url, data).then(result => result.data);
}
_post(url, data, debug = false, json = false) {
if (debug) {
_post(url, data, json = false) {
if (!PRODUCTION) {
url += '?debug=XYZ';
}
... ... @@ -30,7 +30,9 @@ class Api {
const params = new URLSearchParams();
for (let i of Object.keys(data)) {
params.append(i, data[i]);
if (data[i]) {
params.append(i, data[i]);
}
}
return params;
... ...
... ... @@ -12,11 +12,11 @@ class ResourceApi extends Api {
}
editResource(data) {
return this._post('/ufoPlatform/resource/editResourceContentData', data, true);
return this._post('/ufoPlatform/resource/editResourceContentData', data);
}
editGoodsPool(data) {
return this._post('/ufoPlatform/resource/batchEditResourceGoodsPool', data, true, true);
return this._post('/ufoPlatform/resource/batchEditResourceGoodsPool', data, true);
}
}
... ...
... ... @@ -3,10 +3,18 @@ import iView from 'iview';
import 'iview/dist/styles/iview.css';
import emitter from './mixins/emitter';
import bus from './bus';
import components from './views/components'
import './statics/base.scss'
Vue.use(iView);
Vue.prototype.$bus = bus;
Object.keys(components).forEach(cm => {
Object.keys(components[cm]).forEach(ck => {
Vue.component(components[cm][ck].name, components[cm][ck])
})
})
Vue.mixin(emitter);
export default (App) => {
... ...
body, html {
width: 100%;
height: 100%;
}
\ No newline at end of file
... ...
... ... @@ -5,14 +5,10 @@
<title>iView project</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
<link rel="stylesheet" href="<%= htmlWebpackPlugin.files.css[0] %>">
<link rel="stylesheet" href="<%= htmlWebpackPlugin.files.css[1] %>">
</head>
<body>
<div id="app"></div>
<script type="text/javascript" src="<%= htmlWebpackPlugin.files.js[0] %>"></script>
<script type="text/javascript" src="<%= htmlWebpackPlugin.files.js[1] %>"></script>
</body>
</html>
\ No newline at end of file
... ...
import Layout from './layout'
export default {
Layout
}
\ No newline at end of file
... ...
<template>
<div class="filter-item">
<slot></slot>
</div>
</template>
<script>
export default {
name: 'FilterItem',
}
</script>
<style lang="scss" scoped>
.filter-item {
display: inline-block;
margin-right: 10px;
vertical-align: top
}
</style>
... ...
import LayoutContent from './layout-content'
import LayoutFilter from './layout-filter'
import LayoutTable from './layout-table'
import LayoutTools from './layout-tools'
import FilterItem from './filter-item'
export default {
LayoutContent,
LayoutFilter,
LayoutTable,
LayoutTools,
FilterItem
}
\ No newline at end of file
... ...
<template>
<div class="layout-content">
<i-card class="layout-card">
<slot></slot>
</i-card>
</div>
</template>
<script>
export default {
name: 'LayoutContent'
}
</script>
<style lang="scss" scoped>
.layout-content {
width: 100%;
height: 100%;
background: #f5f7f9;
display: flex;
overflow: auto;
padding: 18px;
.layout-card {
width: 100%;
}
}
</style>
... ...
<template>
<div class="layout-filter">
<div class="filter-box">
<slot></slot>
</div>
<i-button type="primary" @click="onFilter">筛选</i-button>
<i-button type="warning" @click="onClear">清空</i-button>
</div>
</template>
<script>
export default {
name: 'LayoutFilter',
methods: {
onFilter() {
this.$emit('on-filter')
},
onClear() {
this.$emit('on-clear')
}
}
}
</script>
<style lang="scss" scoped>
.layout-filter {
padding: 10px 0;
.filter-box {
display: inline-block;
vertical-align: top
}
/deep/ .ivu-form-item {
margin-bottom: 0;
}
}
</style>
... ...
<template>
<div class="layout-table">
<slot></slot>
<div class="footer">
<slot name="footer"></slot>
</div>
</div>
</template>
<script>
export default {
name: 'LayoutTable'
}
</script>
<style lang="scss" scoped>
.layout-table {
.footer {
padding: 10px 0;
text-align: right;
}
}
</style>
... ...
<template>
<div class="layout-tools">
<slot></slot>
</div>
</template>
<script>
export default {
name: 'LayoutTools'
}
</script>
<style lang="scss" scoped>
.layout-tools {
padding: 10px 0;
}
</style>
... ...
<template>
<LayoutContent>
<LayoutFilter @on-filter="onFilter" @on-clear="onClear">
<i-form ref="filterForm" inline :model="filter">
<i-form-item prop="id">
<i-input placeholder="输入ID" v-model="filter.id"></i-input>
</i-form-item>
<i-form-item prop="name">
<i-input placeholder="输入券名称" v-model="filter.name"></i-input>
</i-form-item>
<i-form-item prop="status">
<i-select v-model="filter.status" style="width: 100px;">
<i-option :value="0">全部</i-option>
<i-option :value="1">未生效</i-option>
<i-option :value="2">生效中</i-option>
<i-option :value="3">已过期</i-option>
<i-option :value="4">已作废</i-option>
</i-select>
</i-form-item>
<i-form-item prop="time">
<i-date-picker type="datetimerange" v-model="filter.time" width="300" placeholder="开始-结束时间" format="yyyy-MM-dd HH:mm" style="width: 250px"></i-date-picker>
</i-form-item>
</i-form>
</LayoutFilter>
<LayoutTools>
<i-button type="success" icon="md-add">新增优惠券</i-button>
</LayoutTools>
<LayoutTable>
<i-table :columns="columns" :data="data"></i-table>
<template slot="footer" class="btns">
<i-button type="primary" icon="ios-cloud-download">导出</i-button>
</template>
</LayoutTable>
</LayoutContent>
</template>
<script>
export default {
import {Button} from 'iview'
import Api from '@/api/api'
const api = new Api()
export default {
name: 'CouponPage',
data() {
return {
filter: {
id: '',
name: '',
status: 0,
time: ['', '']
},
data: [{}],
columns: [{
title: 'ID',
key: 'id'
}, {
title: '券名称',
key: 'id'
}, {
title: '数量',
key: 'id'
}, {
title: '使用期限',
key: 'id'
}, {
title: '优惠券说明',
width: 300,
key: 'id'
}, {
title: '状态',
key: 'id'
}, {
title: '操作',
width: 270,
render() {
return (
<div>
<i-button type="success" size="small">查看详情</i-button>&nbsp;
<i-button type="primary" size="small">修改</i-button>&nbsp;
<i-button type="error" size="small">作废</i-button>&nbsp;
<i-button type="warning" size="small">发放记录</i-button>
</div>
);
}
}]
}
},
methods: {
onFilter() {
this.fetchData(this.filter)
},
onClear() {
this.$refs.filterForm.resetFields()
this.fetchData(this.filter)
},
fetchData(params) {
api._post('/ufoPlatform/coupon/queryCoupons', {
id: params.id || void 0,
name: params.name || void 0,
status: params.status || void 0,
startTime: params.time[0] || void 0,
endTime: params.time[1] || void 0,
}, true)
}
}
}
</script>
... ...
... ... @@ -6,7 +6,7 @@ module.exports = {
entry: {
'app-home': './src/main-home-page',
'app-sort': './src/main-sort-page',
vendors: './src/vendors'
'coupon': './src/main-coupon-page',
},
output: {
path: path.join(__dirname, './dist')
... ... @@ -18,12 +18,12 @@ module.exports = {
loader: 'vue-loader',
options: {
loaders: {
less: ExtractTextPlugin.extract({
use: ['css-loader?minimize', 'autoprefixer-loader', 'less-loader'],
sass: ExtractTextPlugin.extract({
use: ['css-loader?minimize', 'autoprefixer-loader', 'sass-loader'],
fallback: 'vue-style-loader'
}),
css: ExtractTextPlugin.extract({
use: ['css-loader', 'autoprefixer-loader', 'less-loader'],
use: ['css-loader', 'autoprefixer-loader', 'sass-loader'],
fallback: 'vue-style-loader'
})
}
... ... @@ -32,7 +32,7 @@ module.exports = {
{
loader: 'iview-loader',
options: {
prefix: false
prefix: true
}
}
]
... ... @@ -55,9 +55,9 @@ module.exports = {
},
{
test: /\.sass/,
test: /\.scss/,
use: ExtractTextPlugin.extract({
use: ['autoprefixer-loader', 'sass-loader'],
use: ['css-loader', 'autoprefixer-loader', 'sass-loader'],
fallback: 'style-loader'
})
},
... ...
... ... @@ -11,13 +11,16 @@ fs.open('./src/config/env.js', 'w', function(err, fd) {
});
module.exports = merge(webpackBaseConfig, {
devtool: '#source-map',
// devtool: '#source-map',
output: {
publicPath: '/dist/',
filename: '[name].js',
chunkFilename: '[name].chunk.js'
},
plugins: [
new webpack.DefinePlugin({
PRODUCTION: 'false'
}),
new ExtractTextPlugin({
filename: '[name].css',
allChunks: true
... ... @@ -27,30 +30,34 @@ module.exports = merge(webpackBaseConfig, {
filename: 'vendors.js'
}),
new HtmlWebpackPlugin({
filename: '../index_home.html',
filename: 'index_home.html',
template: './src/template/index.ejs',
inject: false,
inject: true,
chunks: ['vendors', 'app-home']
}),
new HtmlWebpackPlugin({
filename: '../index_sort.html',
filename: 'index_sort.html',
template: './src/template/index.ejs',
inject: false,
inject: true,
chunks: ['vendors', 'app-sort']
}),
new HtmlWebpackPlugin({
filename: '../coupon.html',
filename: 'coupon.html',
template: './src/template/index.ejs',
inject: false,
inject: true,
chunks: ['vendors', 'coupon']
})
],
devServer: {
openPage: 'index_home.html',
openPage: 'dist/coupon.html',
proxy: {
'/ufoPlatform/**': {
target: 'http://java-ufo-platform.test3.ingress.dev.yohocorp.com',
changeOrigin: true
},
'/ufoPlatform': {
target: 'http://java-ufo-platform.test3.ingress.dev.yohocorp.com',
changeOrigin: true
}
},
headers: {
... ...
... ... @@ -17,6 +17,9 @@ module.exports = merge(webpackBaseConfig, {
chunkFilename: '[name].[hash].chunk.js'
},
plugins: [
new webpack.DefinePlugin({
PRODUCTION: 'true'
}),
new ExtractTextPlugin({
filename: '[name].[hash].css',
allChunks: true
... ...
This diff could not be displayed because it is too large.