Commit 4a9d971c by liimin
2 parents 78149b59 b0539321
import { import {
GlAxios GlAxios
} from 'glsx-vue-common' } from 'glsx-vue-common'
const path = '/admin-operating-auth/user' const path = 'admin-ddh-aimanager/ip/expression'
const __sDemo = `${path}/demo` const __brandList = `${path}/brandList`
const __grayscaleuser = `${path}/download/grayscaleuser`
const demo = { const getBrandList = {
p: [__sDemo], p: [__brandList],
req: params => GlAxios.post(__sDemo, params) req: params => GlAxios.get(__brandList, { params })
} }
const grayscaleuser = {
p: [__grayscaleuser],
req: params => GlAxios.get(__grayscaleuser, { params })
}
export { export {
demo getBrandList,
grayscaleuser
} }
// import { import {
// demo getBrandList,
// } from './brand' grayscaleuser
} from './brand'
import { import {
voiceList, voiceList,
...@@ -9,5 +10,7 @@ import { ...@@ -9,5 +10,7 @@ import {
export { export {
voiceList, voiceList,
manufacturers manufacturers,
getBrandList,
grayscaleuser
} }
<template>
<div>
<gl-dialog
class="backgroundDialog"
:title="backgroundDialogTitle"
:visible.sync="updateBackgroundVisible"
width="40%"
append-to-body>
<gl-form :model="updateBackgroundForm" label-width="120px">
<gl-form-item label="背景名称" prop="backgroundName">
<gl-input name="backgroundName" v-validate="'required'" data-vv-as="背景名称" placeholder="请输入表情名称" v-model="updateBackgroundForm.backgroundName"></gl-input>
<!-- <span v-show="errorBags.has('backgroundName')" class="error">
{{ errorBags.first('backgroundName') }}
</span> -->
</gl-form-item>
<gl-form-item label="背景图片" prop="backgroundPic">
<gl-upload
class="avatar-uploader"
:action="uploadAction"
name="file"
:show-file-list="false"
:on-success="success_pic"
:before-upload="beforeUpload">
<img v-if="updateBackgroundForm.backgroundPath" :src="updateBackgroundForm.backgroundPath" class="avatar">
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</gl-upload>
<!-- <span v-show="errorBags.has('backgroundPic')" class="error">
{{ errorBags.first('backgroundPic') }}
</span> -->
</gl-form-item>
<gl-form-item label="有效期" prop="periodOfValidity">
<gl-date-picker
v-model="times"
type="datetimerange"
format="yyyy-MM-dd"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期">
</gl-date-picker>
<!-- <span v-show="errorBags.has('periodOfValidity')" class="error">
{{ errorBags.first('periodOfValidity') }}
</span> -->
</gl-form-item>
</gl-form>
<span slot="footer" class="dialog-footer">
<gl-button type="primary" @click="submit" :loading="updateBackgroundLoading">确 定</gl-button>
<gl-button @click="closeBackground">取 消</gl-button>
</span>
</gl-dialog>
</div>
</template>
<script>
export default {
name: 'AddActivityBackground',
props: {
updateBackgroundVisible: Boolean,
updateBackgroundLoading: Boolean,
updateBackgroundDate: Object,
allModulelist: Array
},
watch: {
// updateBackgroundVisible(val) {
// this.$validator.errors.clear()
// },
updateBackgroundDate(val) {
console.log('aaa:' + val)
this.backgroundDialogTitle = !val.id ? '添加活动背景' : '编辑活动背景'
}
},
data() {
return {
backgroundDialogTitle: '添加活动背景',
times: [],
updateBackgroundForm: {
backgroundName: '',
backgroundPath: '',
beginTime: '',
endTime: ''
},
uploadAction: '',
imageUrl: ''
}
},
mounted() {
this.uploadAction = `${
this.$get_session_common_config().axios.baseURL
}/admin-ddh-aimanager/file/upload?preFileName=AI`
},
methods: {
beforeUpload(file) {
const fileType = ['image/jpeg', 'image/jpg', 'image/gif', 'image/png']
const isFileType = fileType.includes(file.type)
const isSize = file.size / 1024 / 1024 < 1
!isFileType && this.$message.error('上传背景图片只能是 JPG, JPGE, GIF或PNG 格式!')
!isSize && this.$message.error('上传背景图片大小不能超过1MB')
return isFileType && isSize
},
success_pic(res) {
this.updateBackgroundForm.backgroundPath = res.data.fileUrl
},
submit() {
console.log(this.updateBackgroundForm)
console.log(this.times[0].format('yyyy-MM-dd'))
this.updateBackgroundForm.beginTime = this.times[0].format('yyyy-MM-dd')
this.updateBackgroundForm.endTime = this.times[1].format('yyyy-MM-dd')
// this.addTagList.forEach((item, index) => {
// if (item.check) {
// addTag.label.push(item)
// }
// })
// this.$emit('addTag', addTag)
// delete addTag.check
},
closeBackground() {
this.$emit('closeBackground')
}
// cancel() {
// this.addTag.subscript.newCheck = false
// this.addTag.subscript.hotCheck = false
// this.addTag.subscript.sub = ''
// },
// newTag() {
// this.addTag.subscript.newCheck = true
// this.addTag.subscript.hotCheck = false
// this.addTag.subscript.sub = 'new'
// },
// hotTag() {
// this.addTag.subscript.newCheck = false
// this.addTag.subscript.hotCheck = true
// this.addTag.subscript.sub = 'hot'
// },
// handleAddTag(index) {
// var obj = this.addTagList[index]
// obj.check = !obj.check
// this.$set(this.addTagList, index, obj)
// }
}
}
</script>
<style rel="stylesheet/scss" lang="scss">
$pic-width:100px;
.backgroundDialog {
.dialog-footer {
margin-top: -40px;
}
.avatar-uploader .el-upload {
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
overflow: hidden;
}
.avatar-uploader .el-upload:hover {
border-color: #409EFF;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: $pic-width;
height: $pic-width;
line-height: $pic-width;
text-align: center;
}
.avatar {
width: $pic-width;
height:$pic-width;
display: block;
}
}
</style>
<!-- -->
<template> <template>
<div> <div class="brand">
<a href="http://www.glsx.com.cn/">广联赛讯主页1</a> <div class="default">
<gl-form
:inline="true"
:model="searchCondition"
>
<gl-form-item>
<gl-input
v-model="searchCondition.brand"
class="input-with-select"
placeholder="请输入品牌"
clearable
/>
</gl-form-item>
<gl-form-item>
<gl-select
v-model="searchCondition.manufacturer"
placeholder="请选择品牌厂商"
>
<gl-option
v-for="item in manufacturers"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</gl-select>
</gl-form-item>
<gl-form-item>
<gl-button
type="primary"
@click="getList"
>搜索</gl-button>
</gl-form-item>
<gl-form-item style="float:right;">
<gl-button
class="newButton"
type="primary"
@click="dialog"
>添加品牌IP</gl-button>
</gl-form-item>
</gl-form>
</div>
<edit
:updateVisible="updateVisible"
:allModulelist="allModulelist"
:updateLoading="updateLoading"
:updateForm="updateForm"
@updateClose="updateDialogClose"
/>
<gl-table
:table="tableData"
v-loading="tableLoading"
>
<gl-table-column align="center" v-for="(i, index) in tableData.column" :key="index" :label='i.label' :prop='i.prop' :width='i.width' >
<template slot-scope="scope">
<template v-if='i.prop === "ipbg"'>
<img class="tableImg" :src="tableData.data[scope.scope.$index][i.prop]">
</template>
<template v-else>
{{tableData.data[scope.scope.$index][i.prop]}}
</template>
</template>
</gl-table-column>
</gl-table>
<gl-pagination
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pageNum"
:page-sizes="[10,20,30,40]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="total"
>
</gl-pagination>
</div> </div>
</template> </template>
<script> <script>
import Edit from './Edit'
// import { fn, treeCheckKeys, deleteEmptyAttribute } from '@/common/common'
import { getBrandList, manufacturers } from '@/api'
import { NoticeMixin } from '@/mixins'
export default { export default {
name: 'channel',
components: {
Edit
},
watch: {
'searchCondition.content'(val) {
!val && this.loadingGetList()
}
},
mixins: [NoticeMixin],
data() { data() {
return { return {
searchCondition: {
manufacturer: '',
content: ''
},
pageNum: 1,
pageSize: 10,
total: 10,
/* 组件params-start */
updateVisible: false,
// updateParams: this.$deep_clone(channelStructrue),
allModulelist: [],
recordVisible: false,
/* 组件params-end */
/* loadingParams-start */
tableLoading: false,
updateLoading: false,
recordLoading: false,
manufacturers: [],
updateForm: {},
/* loadingParams-end */
tableData: {
border: true,
align: 'center',
// height: parseInt(this.$client_height() - 140),
data: [],
column: [
{
label: '品牌厂商',
prop: 'brand'
},
{
label: '渠道商',
prop: 'channel'
},
{
label: '默认IP表情',
prop: 'ipbq'
},
{
label: '默认IP背景',
prop: 'ipbg'
},
{
label: '变更时间',
prop: 'changeTime',
formatter: cellValue => {
if (cellValue.changeTime) {
return new Date(cellValue.changeTime).format('yyyy-MM-dd')
}
}
},
{
label: '操作人',
prop: 'createdBy'
}
],
number: {
label: '序号',
width: '50px',
index: index => {
++index
return index < 10 && index > 0 ? '0' + index : index
}
},
console: {
show: true,
label: '操作',
prop: 'options',
button: [
{
type: 'primary',
icon: 'el-icon-edit',
callback: (index, rows) => this.dialog(index)
},
{
type: 'primary',
icon: 'el-icon-delete',
callback: (index, rows) => {
this.$confirm('确定要删除该品牌IP表情吗?', '', {
type: 'warning'
})
.then(() => {
this.tableLoading = true
this.deleteChannel(rows[index].id)
})
.catch(err => this.error(err))
}
}
]
}
}
}
},
mounted() {
this.getList()
this.getManufacturer()
},
methods: {
loadingGetList() {
this.tableLoading = true
this.getList()
},
/* 接口请求-start */
getParams() {
return Object.assign(
{
pageNum: this.pageNum,
pageSize: this.pageSize
},
this.searchCondition
)
},
getList() {
const params = this.getParams()
// params = deleteEmptyAttribute(params)
getBrandList
.req(params)
.then(res => {
this.total = res.total
this.tableData.data = res.list
this.tableLoading = false
})
.catch(err => {
this.tableLoading = false
this.error(err)
})
},
updateChannel(params) {
// updateChannel
// .req(params)
// .then(res => {
// notice.okTips()
// this.loadingGetList()
// this.updateVisibleChange()
// })
// .catch(err => {
// this.updateLoading = false
// notice.errorTips(err)
// })
},
deleteChannel(params) {
// deleteChannel
// .req({ id: params })
// .then(res => {
// notice.okTips(res)
// this.loadingGetList()
// })
// .catch(err => {
// notice.errorTips(err)
// })
},
channelLog(params) {
// this.recordVisibleChange()
// channelLog
// .req({ channelId: params })
// .then(res => {
// // notice.okTips(res)
// this.recordTable.list = res.list
// this.recordTable.total = res.total
// this.recordLoading = false
// // console.log(this.recordTable)
// // this.recordVisibleChange()
// })
// .catch(err => {
// notice.errorTips(err)
// })
},
getManufacturer() {
manufacturers
.req({})
.then(res => (this.manufacturers = res.list))
.catch(err => this.error(err))
},
/* 接口请求-end */
handleSearch() {
this.loadingGetList()
},
handleSizeChange(val) {
this.pageSize = val
this.loadingGetList()
},
handleCurrentChange(val) {
this.pageNum = val
this.loadingGetList()
},
updateVisibleChange() {
this.updateVisible = !this.updateVisible
this.updateLoading = false
// if(!this.updateVisible) {
// this.allModulelist = []
// this.updateParams = this.$deep_clone(channelStructrue)
// }
},
dialog(index) {
this.updateVisible = !this.updateVisible
},
updateDialogClose(updateData) {
// this.updateLoading = true
// updateData ? this.updateChannel(updateData) : this.updateVisibleChange()
this.updateVisible = !this.updateVisible
},
recordVisibleChange() {
this.recordVisible = !this.recordVisible
} }
} }
} }
</script> </script>
<style scoped>
<style rel="stylesheet/scss" lang="scss" >
.brand {
.cell {
.el-button {
padding: 2px 10px;
}
}
}
.tableImg{
width: 36px;
height: 36px;
cursor: pointer;
}
</style> </style>
...@@ -21,7 +21,7 @@ module.exports = { ...@@ -21,7 +21,7 @@ module.exports = {
}, },
devServer: { devServer: {
port: 8085, port: 8085,
host: 'localhost', host: '192.168.2.36',
open: true, open: true,
proxy: { proxy: {
'/api': { '/api': {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!