Authored by htoo

Merge branch 'develop' of git.yoho.cn:fe/ufo-platform-fe into develop

 Conflicts:
	src/views/resource-list/index.vue
... ... @@ -5,8 +5,8 @@ class ResourceApi extends Api {
super();
}
list() {
return this._post('/ufoPlatform/resource/getResources', { size: 200 });
list(params) {
return this._post('/ufoPlatform/resource/getResources', params);
}
info(id) {
... ...
... ... @@ -16,10 +16,10 @@
<!-- 一张图、两张图 自定义图片高度、宽度 -->
<Form v-if="isCustomImgSize" :label-width="50" class="size-container">
<Form-item label="宽度:">
<Input placeholder="请输入图片宽度" v-model="imgSize.width"/>
<Input placeholder="请输入图片宽度" v-model="width"/>
</Form-item>
<Form-item label="高度:">
<Input placeholder="请输入图片高度" v-model="imgSize.height"/>
<Input placeholder="请输入图片高度" v-model="height"/>
</Form-item>
</Form>
<table class="banner-table">
... ... @@ -95,10 +95,8 @@ export default {
type_: this.size || "0",
value_: this.handleData(util.clone(this.value)),
itemStyle: "",
imgSize: {
height: '',
width: '',
}
height: '',
width: '',
};
},
methods: {
... ... @@ -271,7 +269,8 @@ export default {
for (const i of Object.keys(temp)) {
result[i] = temp[i];
if(this.isCustomImgSize) {
result[i].imgSize = this.imgSize;
result[i].height = this.height;
result[i].width = this.width;
}
}
... ... @@ -291,10 +290,8 @@ export default {
},
reSetType() {
this.type_ = "0";
this.imgSize = {
height: '',
width: ''
}
this.height = '';
this.width = ''
},
reset() {
this.value_ = [];
... ... @@ -306,10 +303,13 @@ export default {
// console.log(newVal);
this.type_ = this.size || "0";
this.value_ = this.handleData(util.clone(newVal));
this.height = '';
this.width = '';
if(this.isCustomImgSize) {
const {imgSize} = this.value[0] || {};
if(imgSize) {
this.imgSize = imgSize;
const {height = '', width = ''} = this.value[0] || {};
if(height || width) {
this.height = height;
this.width = width;
}
}
}
... ...
... ... @@ -8,8 +8,8 @@ class ResourceService extends Service {
this.api = new ResourceApi();
}
list() {
return this.api.list();
list(params) {
return this.api.list(params);
}
info(id) {
... ...
... ... @@ -224,10 +224,8 @@
url: ''
},
// 图片高度|宽度
imgSize: {
height: '',
width: ''
}
height: '',
width: ''
},
},
type: 3,
... ... @@ -250,10 +248,8 @@
url: ''
},
// 图片高度|宽度
imgSize: {
height: '',
width: ''
}
height: '',
width: ''
},
'1': {
alt: '',
... ... @@ -268,10 +264,8 @@
url: ''
},
// 图片高度|宽度
imgSize: {
height: '',
width: ''
}
height: '',
width: ''
},
},
type: 4,
... ...
<template>
<LayoutContent :breads="[{title: '资源位列表'}]">
<div>
<i-button type="primary" @click="showAddResourcePanel(true)">添加资源位</i-button>
</div>
<LayoutTable :columns="columns" :data="data">
<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="code">
<i-input placeholder="code码" v-model="filter.code"></i-input>
</i-form-item>
<i-form-item prop="platformId">
<i-select placeholder="平台" v-model="filter.platformId" style="width: 100px;">
<i-option value="1">App</i-option>
<i-option value="2">小程序</i-option>
<i-option value="3">H5</i-option>
</i-select>
</i-form-item>
<!-- <i-form-item prop="time">
<i-date-picker type="datetimerange" v-model="filter.time" placeholder="开始-结束时间" format="yyyy-MM-dd HH:mm" style="width: 250px"></i-date-picker>
</i-form-item> -->
</i-form>
</LayoutFilter>
<LayoutTools>
<i-button type="primary" @click="showAddResourcePannel(true)">添加资源位</i-button>
</LayoutTools>
<LayoutTable
:columns="columns"
:page="page"
:total="total"
@on-page-change="onPageChange"
:data="data">
</LayoutTable>
<!--添加资源位弹出层-->
<div v-if="showAddPan" class="resource-add-container">
<i-card class="resource-add-card">
<p slot="title">添加资源位</p>
<a href="javascript:void(0)" slot="extra" @click="showAddResourcePanel(false)">
<a href="javascript:void(0)" slot="extra" @click="showAddResourcePannel(false)">
<i-icon type="ios-close" size="24"></i-icon>
</a>
<div class="resource-add-content">
... ... @@ -38,7 +68,6 @@
</i-card>
</div>
</LayoutContent>
</template>
<script>
... ... @@ -51,27 +80,37 @@ export default {
name: 'resourcelist',
data() {
return {
filter: {
id: '',
name: '',
code: '',
platformId: '',
// time: ['', '']
},
page: 1,
total: 0,
data: [],
columns: [{
title: 'ID',
key: 'id',
width: 100
width: 80
}, {
title: '资源名称',
key: 'name',
width: 200
width: 200,
align: 'center',
}, {
title: '平台',
key: 'platform',
width: 100,
width: 120
}, {
title: '位置码',
key: 'code',
width: 300
align: 'center',
}, {
title: '创建时间',
key: 'createTime',
width: 200,
align: 'center',
render: (h, {row}) => {
/*return (
<div>{dayjs.unix(row.createTime).format('YYYY-MM-DD HH:mm:ss')}</div>
... ... @@ -80,7 +119,6 @@ export default {
}
}, {
title: '操作',
width: 270,
align: 'center',
render: (h, {row}) => {
/*return (
... ... @@ -105,17 +143,28 @@ export default {
this.fetchData();
},
methods: {
onToEditor({id, name, sortId, platform, code}) {
onPageChange(page) {
this.fetchData(this.filter, page);
},
onClear() {
this.$refs.filterForm.resetFields();
this.fetchData(this.filter);
},
onFilter() {
this.fetchData(this.filter);
},
onToEditor({id, name, sortId, platform}) {
if (sortId === 2) {
util.jumpUrl(`resource-edit.html?id=${id}&name=${name}&platform=${platform}`);
} else if(sortId === 3) {
util.jumpUrl(`resource-edit-new.html?id=${id}&name=${name}&platform=${platform}&code=${code}`);
util.jumpUrl(`resource-edit-new.html?id=${id}&name=${name}&platform=${platform}`);
}
},
async fetchData() {
async fetchData(params, page = 1) {
this.page = page;
this.$Loading.start();
const result = await this.resourceService.list();
const result = await this.resourceService.list({page, ...params});
if (result.code === 200) {
for (let i = 0; i < result.data.length; i++) {
... ... @@ -124,14 +173,15 @@ export default {
result.data[i].showEditButton = 'none';
}
}
this.data = result.data;
this.total = result.data.total;
this.data = result.data.list || [];
this.$Loading.finish();
} else {
result.message && this.$Message.warning(result.message);
this.$Loading.error();
}
},
showAddResourcePanel(show) {
showAddResourcePannel(show) {
this.showAddPan = show;
},
saveResource() {
... ... @@ -150,7 +200,7 @@ export default {
if (result && result.code === 200) {
self.showAddPan = false;
self.$Message.success('保存成功!');
self.fetchData();
self.fetchData(this.filter);
self.platform = '1';
self.editResourceId = 0;
self.resourceName = '';
... ... @@ -164,7 +214,7 @@ export default {
this.platform = ['0', 'APP', '小程序', 'H5'].indexOf(data.platform).toString();
this.resourceName = data.name;
this.editResourceId = data.id;
this.showAddResourcePanel(true);
this.showAddResourcePannel(true);
}
}
};
... ... @@ -198,7 +248,7 @@ export default {
.ivu-row:hover {
background-color: #aefdff;
}
.ivu-col {
text-align: center;
height: 50px;
... ... @@ -208,9 +258,4 @@ export default {
.ivu-col:nth-child(odd) {
border-right: 1px solid #e4e4e4;
}
.ivu-card-body {
margin: 0;
padding: 0;
}
</style>
... ...