Commit de522b61 by liimin

初始化

1 parent 227329ab
import {
demo
} from './brand'
// import {
// demo
// } from './voice'
// } from './brand'
import {
voiceList,
manufacturers
} from './voice'
export {
demo
voiceList,
manufacturers
}
import {
GlAxios
} from 'glsx-vue-common'
const path = '/admin-operating-auth/user'
const __sDemo = `${path}/demo`
const path = ''
const __sVoiceList = `${path}/voiceList`
const __sGetManufacturer = `${path}/manufacturers`
const demo = {
p: [__sDemo],
req: params => GlAxios.post(__sDemo, params)
/**
* 获取语音活动列表
*/
const voiceList = {
p: [__sVoiceList],
req: params => GlAxios.get(__sVoiceList, params)
}
/**
* 获取品牌厂商
*/
const manufacturers = {
p: [__sGetManufacturer],
req: params => GlAxios.get(__sGetManufacturer, params)
}
export {
demo
voiceList,
manufacturers
}
......@@ -7,7 +7,7 @@ import 'glsx-vue-components/dist/glsx-vue-components.css'
// import axios from 'axios'
Vue.use(GlsxVueComponents)
import './date.js'
var mixin = {
mounted() {
const _this = this
......@@ -32,7 +32,7 @@ var mixin = {
}
}
const URL = ' http://192.168.3.171:7300/mock/5be17454f31545347559d499/config'
const getConfig = (url = URL + '/authority_common') => {
const getConfig = (url = URL + '/ai_manager_config') => {
return new Promise(resolve => {
const xhr = new XMLHttpRequest()
xhr.onreadystatechange = () => {
......
function format(formatStr) {
const date = this
var zeroize = function(value, length) {
let zeros = ''
if (!length) length = 2
value = value.toString()
for (let i = 0; i < (length - value.length); i++) {
zeros += '0'
}
return zeros + value
}
return formatStr.replace(/"[^"]*"|'[^']*'|\b(?:d{1,4}|M{1,4}|yy(?:yy)?|([hHmstT])\1?|[lLZ])\b/g, function($0) {
switch ($0) {
case 'd': return date.getDate()
case 'dd': return zeroize(date.getDate())
case 'ddd': return ['Sun', 'Mon', 'Tue', 'Wed', 'Thr', 'Fri', 'Sat'][date.getDay()]
case 'dddd': return ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][date.getDay()]
case 'M': return date.getMonth() + 1
case 'MM': return zeroize(date.getMonth() + 1)
case 'MMM': return ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][date.getMonth()]
case 'MMMM': return ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'][date.getMonth()]
case 'yy': return date.getFullYear().substr(2)
case 'yyyy': return date.getFullYear()
case 'h': return date.getHours() % 12 || 12
case 'hh': return zeroize(date.getHours() % 12 || 12)
case 'H': return date.getHours()
case 'HH': return zeroize(date.getHours())
case 'm': return date.getMinutes()
case 'mm': return zeroize(date.getMinutes())
case 's': return date.getSeconds()
case 'ss': return zeroize(date.getSeconds())
case 'l': return date.getMilliseconds()
case 'll': return zeroize(date.getMilliseconds())
case 'tt': return date.getHours() < 12 ? 'am' : 'pm'
case 'TT': return date.getHours() < 12 ? 'AM' : 'PM'
}
})
}
const time = Date
time.prototype.format = format
import NoticeMixin from './notice'
export {
NoticeMixin
}
/*
* @Author: limin
* @Date: 2018-07-01 01:36:03
* @Last Modified by: limin
* @Last Modified time: 2019-01-17 15:32:43
*/
export default {
name: 'NoticeMixin',
methods: {
warning(message) {
this.$notify({
type: 'warning',
title: message
})
},
success(message) {
this.$notify({
type: 'success',
title: message || '操作成功'
})
},
error(message) {
this.$notify({
type: 'error',
title: message || '操作失败'
})
}
}
}
<!-- -->
<template>
<div class="channelUpdateDialog">
<gl-dialog
:title="title"
:visible.sync="updateVisible"
:before-close="handleClose"
>
<gl-form
:model="updateForm"
label-width="120px"
:rules="updateRules"
>
<gl-form-item
label="渠道名称:"
prop="channelName"
>
<gl-input
name="channelName"
v-validate="'required'"
data-vv-as="渠道名称"
v-model="updateForm.channelName"
></gl-input>
<!-- <span v-show="errorBags.has('channelName')" class="error">
{{ errorBags.first('channelName') }}
</span> -->
</gl-form-item>
<gl-form-item
label="渠道编号:"
prop="merchantId"
>
<gl-input
name="merchantId"
v-validate="'required'"
data-vv-as="渠道编号"
v-model="updateForm.merchantId"
></gl-input>
<!-- <span v-show="errorBags.has('merchantId')" class="error">
{{ errorBags.first('merchantId') }}
</span> -->
</gl-form-item>
<gl-form-item
label="渠道地址:"
prop="channelUrl"
>
<gl-input
name="channelUrl"
v-validate="'required'"
data-vv-as="渠道地址"
v-model="updateForm.channelUrl"
></gl-input>
<!-- <gl-input-tree v-model="updateForm.channelUrl"></gl-input-tree> -->
<!-- <span v-show="errorBags.has('channelUrl')" class="error">
{{ errorBags.first('channelUrl') }}
</span> -->
</gl-form-item>
<gl-form-item
label="模板选择:"
prop="moduleList"
>
<gl-tree
node-key="id"
v-model="updateForm.moduleList"
:data="allModulelist"
:default-checked-keys="updateForm.moduleList"
:props="props"
show-checkbox
@check="handleModuleChange"
style="height:180px; overflow-y:auto;"
name="moduleList"
v-validate="'required'"
data-vv-as="模板"
>
</gl-tree>
<!-- <span v-show="errorBags.has('moduleList')" class="error">
{{ errorBags.first('moduleList') }}
</span> -->
</gl-form-item>
</gl-form>
<div
slot="footer"
class="dialog-footer"
>
<gl-button
type="primary"
:loading="updateLoading"
@click="handleSubmit"
>提交</gl-button>
<gl-button @click="handleClose">取消</gl-button>
</div>
</gl-dialog>
</div>
</template>
<script>
export default {
name: 'Edit',
props: {
updateVisible: Boolean,
updateLoading: Boolean,
updateForm: Object,
allModulelist: Array
},
watch: {
updateVisible(val) {
this.$validator.errors.clear()
},
updateForm(val) {
this.title = !val.merchantId ? '新增活动' : '编辑活动'
}
},
data() {
return {
title: '',
props: {
children: 'children',
label: 'label'
},
updateRules: {
channelName: [{ required: true }],
merchantId: [{ required: true }],
channelUrl: [{ required: true }],
moduleList: [{ required: true }]
}
}
},
methods: {
handleModuleChange(params, checked) {
// console.log(checked.checkedKeys)
this.updateForm.moduleList = checked.checkedKeys
},
handleSubmit() {
this.$validator.validateAll().then(result => {
result && this.$emit('updateClose', this.updateForm)
})
},
handleClose() {
this.$emit('updateClose')
}
}
}
</script>
<style>
.channelUpdateDialog .dialog-footer {
margin-top: -40px;
}
</style>
\ No newline at end of file
<!-- -->
<template>
<div>
<a href="http://www.glsx.com.cn/">广联赛讯主页1</a>
<div class="voice">
<div class="default">
<gl-form
:inline="true"
:model="searchCondition"
>
<gl-form-item>
<gl-input
v-model="searchCondition.content"
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="handleSearch"
>搜索</gl-button>
</gl-form-item>
<gl-form-item style="float:right;">
<gl-button
class="newButton"
type="primary"
@click="dialog"
>添加活动</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>
<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>
</template>
<script>
import Edit from './Edit'
// import { fn, treeCheckKeys, deleteEmptyAttribute } from '@/common/common'
import { voiceList, manufacturers } from '@/api'
import { NoticeMixin } from '@/mixins'
export default {
name: 'channel',
components: {
Edit
},
watch: {
'searchCondition.content'(val) {
!val && this.loadingGetList()
}
},
mixins: [NoticeMixin],
data() {
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: 'manufacturer'
},
{
label: '渠道商',
prop: 'channel'
},
{
label: '活动标题',
prop: 'title'
},
{
label: '关键词',
prop: 'keyword'
},
{
label: '提示方式',
prop: 'notice'
},
{
label: '活动截止时间',
prop: 'endTime',
formatter: cellValue => {
if (cellValue.endTime) {
return new Date(cellValue.endTime).format('yyyy-MM-dd')
}
}
},
{
label: '触发次数',
prop: 'triCount'
},
{
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: [
{
label: '编辑',
type: 'text',
callback: (index, rows) => {
this.dialog(index)
}
},
{
type: 'primary',
icon: 'el-icon-edit',
callback: (index, rows) => this.dialog(index)
},
{
type: 'primary',
icon: 'el-icon-delete',
callback: (index, rows) => {
this.$confirm('确定要删除该语音活动吗?', '', {
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)
voiceList
.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()
},
recordVisibleChange() {
this.recordVisible = !this.recordVisible
}
}
}
</script>
<style scoped>
<style rel="stylesheet/scss" lang="scss" >
.voice {
.cell {
.el-button {
padding: 2px 10px;
}
}
}
</style>
module.exports = {
index: '主页',
'customer/glsx': '广联赛讯'
'customer/voice': '语音活动管理',
'customer/brand': '品牌表情管理'
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!