Commit 0ea16ebb authored by 刘怀志's avatar 刘怀志

banner暂存

parent fa426a9f
...@@ -14,7 +14,7 @@ import Qs from 'qs' ...@@ -14,7 +14,7 @@ import Qs from 'qs'
// 1. 查询banner管理列表 // 1. 查询banner管理列表
export function listCmsBanner(query) { export function listCmsBanner(query) {
return request({ return request({
url: '/cmsbanner/queryCmsBannerByPagination', url: '/cmsbanner/queryCmsBannerByPaginationForWx',
method: 'get', method: 'get',
params: query params: query
}) })
...@@ -40,10 +40,9 @@ export function addCmsBanner(data) { ...@@ -40,10 +40,9 @@ export function addCmsBanner(data) {
// 4. 修改banner管理 // 4. 修改banner管理
export function updateCmsBanner(data) { export function updateCmsBanner(data) {
const businessId = data.businessId
data = Qs.stringify(data) data = Qs.stringify(data)
return request({ return request({
url: '/cmsbanner/update/' + businessId, url: '/cmsbanner/updateCmsBannerById',
method: 'put', method: 'put',
data data
}) })
...@@ -66,3 +65,12 @@ export function exportCmsBanner(query) { ...@@ -66,3 +65,12 @@ export function exportCmsBanner(query) {
responseType: 'blob' responseType: 'blob'
}) })
} }
export function assignBannerToBusiness(data) {
data = Qs.stringify(data)
return request({
url: '/cmsbanner/assignBannerToBusiness',
method: 'post',
data: data
})
}
...@@ -81,14 +81,7 @@ ...@@ -81,14 +81,7 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="分类" prop="type" :show-overflow-tooltip="true" width="130px"> <el-table-column label="名称" prop="bannerName" :show-overflow-tooltip="true" width="130px">
<template slot-scope="scope">
<span v-if="scope.row.type=='0'">课程资源</span>
<span v-else-if="scope.row.type=='1'">其他资源</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="名称" prop="bannerName" :show-overflow-tooltip="true" width="130px">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.bannerName || '-' }} {{ scope.row.bannerName || '-' }}
</template> </template>
...@@ -165,18 +158,11 @@ ...@@ -165,18 +158,11 @@
<!-- 添加或修改banner管理配置对话框 --> <!-- 添加或修改banner管理配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="90px"> <el-form ref="form" :model="form" :rules="rules" size="small" label-width="90px">
<el-form-item label="分类:" prop="type" >
<!-- <el-input v-model.trim="form.type" show-word-limit :maxlength="32" placeholder="请输入类型" />-->
<el-select v-model.trim="form.type" show-word-limit placeholder="请输入类型" style="width: 100%">
<el-option label="课程资源" value="0" />
<el-option label="其他资源" value="1" />
</el-select>
</el-form-item>
<el-form-item label="名称:" prop="bannerName"> <el-form-item label="名称:" prop="bannerName">
<el-input v-model.trim="form.bannerName" show-word-limit :maxlength="500" placeholder="请输入banner名字" /> <el-input v-model.trim="form.bannerName" show-word-limit :maxlength="500" placeholder="请输入banner名字" />
</el-form-item> </el-form-item>
<el-form-item label="图片:" prop="bannerPicture"> <el-form-item label="图片:" prop="bannerPicture">
<el-input v-model="form.bannerPicture" style="display: none"></el-input> <el-input v-model="form.bannerPicture" style="display: none" />
<el-upload <el-upload
class="avatar-uploader" class="avatar-uploader"
action="#" action="#"
...@@ -245,16 +231,16 @@ ...@@ -245,16 +231,16 @@
import commonField from '@/utils/commonField' import commonField from '@/utils/commonField'
import { import {
addCmsBanner, addCmsBanner, assignBannerToBusiness,
delCmsBanner, exportCmsBanner, delCmsBanner, exportCmsBanner,
getCmsBanner, getCmsBanner,
listCmsBanner, listCmsBanner,
updateCmsBanner updateCmsBanner
} from '@/api/contentManagement/cmsBanner' } from '@/api/contentManagement/cmsBanner'
import { uploadPublic } from '@/api/contentManagement/sysContest' import { uploadPublic } from '@/api/contentManagement/sysContest'
import {mapGetters} from "vuex"; import { mapGetters } from 'vuex'
import {listAllShop} from "@/api/sysUnit"; import { listAllShop } from '@/api/sysUnit'
import {shareShop} from "@/api/contentManagement/sysContentNewsInformation"; import { shareShop } from '@/api/contentManagement/sysContentNewsInformation'
export default { export default {
name: 'CmsBanner', name: 'CmsBanner',
data() { data() {
...@@ -346,18 +332,17 @@ export default { ...@@ -346,18 +332,17 @@ export default {
if (pass) { if (pass) {
this.shareShopLoading = true this.shareShopLoading = true
const temp = { const temp = {
newsVideoId: this.ruleForm.row, businessId: this.ruleForm.row,
unitId: this.ruleForm.shops.join(','), unitIds: this.ruleForm.shops.join(',')
type: '0'
} }
shareShop(temp).then(response => { assignBannerToBusiness(temp).then(response => {
if (response.code === 200) { if (response.code === 200) {
this.$message({ this.$message({
message: '修改成功', message: '修改成功',
type: 'success' type: 'success'
}) })
this.shareShopDiaLog = false this.shareShopDiaLog = false
this.loadData() this.getList()
} }
this.shareShopLoading = false this.shareShopLoading = false
}).catch(e => { this.shareShopLoading = false }) }).catch(e => { this.shareShopLoading = false })
...@@ -374,8 +359,8 @@ export default { ...@@ -374,8 +359,8 @@ export default {
}) })
}, },
handleShareShop(row) { handleShareShop(row) {
if (row.unitId) { if (row.unitIds) {
this.ruleForm.shops = JSON.parse(row.unitId) this.ruleForm.shops = row.unitIds.split(',').map(item => parseInt(item.trim(), 10))
} else { } else {
this.ruleForm.shops = [] this.ruleForm.shops = []
} }
...@@ -421,7 +406,7 @@ export default { ...@@ -421,7 +406,7 @@ export default {
formData.append('file', file.file) formData.append('file', file.file)
formData.append('temp', 'CmsBanner') formData.append('temp', 'CmsBanner')
uploadPublic(formData).then(res => { uploadPublic(formData).then(res => {
console.log('url',res.data.url) console.log('url', res.data.url)
this.imageUrl = res.data.url this.imageUrl = res.data.url
this.showImg = true this.showImg = true
this.form.bannerPicture = res.data.businessId this.form.bannerPicture = res.data.businessId
...@@ -449,8 +434,8 @@ export default { ...@@ -449,8 +434,8 @@ export default {
this.loading = true this.loading = true
listCmsBanner(this.queryParams).then( listCmsBanner(this.queryParams).then(
response => { response => {
this.cmsBannerList = response.rows this.cmsBannerList = response.data.records
this.total = response.total this.total = response.data.total
this.loading = false this.loading = false
} }
) )
...@@ -505,13 +490,9 @@ export default { ...@@ -505,13 +490,9 @@ export default {
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset() this.reset()
const id = row.businessId this.form = { ...row }
getCmsBanner(id).then(response => { this.open = true
this.form = response.data this.title = '修改banner'
this.imageUrl = response.data.url
this.open = true
this.title = '修改banner'
})
}, },
// 改变状态 // 改变状态
handleStatusChange(row) { handleStatusChange(row) {
...@@ -536,7 +517,11 @@ export default { ...@@ -536,7 +517,11 @@ export default {
this.$refs['form'].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
if (this.form.businessId !== undefined) { if (this.form.businessId !== undefined) {
updateCmsBanner(this.form).then(response => { const temp = {
bannerId: this.form.businessId,
...this.form
}
updateCmsBanner(temp).then(response => {
this.msgSuccess('修改成功') this.msgSuccess('修改成功')
this.open = false this.open = false
this.getList() this.getList()
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
</el-form> </el-form>
</div> </div>
<div style="padding:5px 10px"> <div style="padding:5px 10px">
<div class="tableTitle">点击量管理</div> <div class="tableTitle">推广次数管理</div>
<el-table v-loading="fullscreenLoading" :data="tableData" border sortable="true"> <el-table v-loading="fullscreenLoading" :data="tableData" border sortable="true">
<span slot="empty">{{ tableDataTips }}</span> <span slot="empty">{{ tableDataTips }}</span>
<el-table-column align="left" prop="id" label="序号" width="50px"> <el-table-column align="left" prop="id" label="序号" width="50px">
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
{{ scope.row.phone || '-' }} {{ scope.row.phone || '-' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="点击量" prop="clickThroughRate" :show-overflow-tooltip="true"> <el-table-column label="推广次数" prop="clickThroughRate" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.edit === '0'"> {{ scope.row.clickThroughRate || '-' }}</span> <span v-if="scope.row.edit === '0'"> {{ scope.row.clickThroughRate || '-' }}</span>
<el-input-number <el-input-number
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
controls-position="right" controls-position="right"
:step="1" :step="1"
step-strictly step-strictly
placeholder="点击量" placeholder="推广次数"
clearable clearable
:maxlength="30" :maxlength="30"
size="small" size="small"
......
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
<span>{{ scope.row.releaseDate }}</span> <span>{{ scope.row.releaseDate }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="left" prop="readNum" label="点击量" show-overflow-tooltip> <el-table-column align="left" prop="readNum" label="推广次数" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.readNum }}</span> <span>{{ scope.row.readNum }}</span>
</template> </template>
......
...@@ -117,7 +117,7 @@ ...@@ -117,7 +117,7 @@
<span>{{ scope.row.releaseTime }}</span> <span>{{ scope.row.releaseTime }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="left" prop="readNum" label="点击量" show-overflow-tooltip> <el-table-column align="left" prop="readNum" label="推广次数" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.readNum }}</span> <span>{{ scope.row.readNum }}</span>
</template> </template>
......
...@@ -16,6 +16,7 @@ import 'echarts/lib/component/visualMap' ...@@ -16,6 +16,7 @@ import 'echarts/lib/component/visualMap'
import 'echarts/lib/component/dataset' import 'echarts/lib/component/dataset'
import 'echarts/map/js/world' import 'echarts/map/js/world'
import 'zrender/lib/svg/svg' import 'zrender/lib/svg/svg'
import { listAllShop } from '@/api/sysUnit'
export default { export default {
name: 'dashboard', name: 'dashboard',
...@@ -31,6 +32,9 @@ export default { ...@@ -31,6 +32,9 @@ export default {
data.push([r, i]) data.push([r, i])
} }
return { return {
companyName: '',
deptList: [],
queryShop: true,
dashboard: { dashboard: {
orderCount: 0, orderCount: 0,
userCount: 0 userCount: 0
...@@ -45,7 +49,7 @@ export default { ...@@ -45,7 +49,7 @@ export default {
trigger: 'axis' trigger: 'axis'
}, },
legend: { legend: {
data: ['代言人绑定人数', '抖音绑定人数', '抖音视频数量', '员工人数', '文章点击量'] data: ['代言人绑定人数', '抖音绑定人数', '抖音视频数量', '员工人数', '文章推广次数']
}, },
grid: { grid: {
left: '3%', left: '3%',
...@@ -61,7 +65,7 @@ export default { ...@@ -61,7 +65,7 @@ export default {
xAxis: { xAxis: {
type: 'category', type: 'category',
boundaryGap: false, boundaryGap: false,
data: [ '周一', '周二', '周三', '周四', '周五', '周六', '周日'] data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
}, },
yAxis: { yAxis: {
type: 'value' type: 'value'
...@@ -92,7 +96,7 @@ export default { ...@@ -92,7 +96,7 @@ export default {
data: [320, 332, 301, 334, 390, 330, 320] data: [320, 332, 301, 334, 390, 330, 320]
}, },
{ {
name: '文章点击量', name: '文章推广次数',
type: 'line', type: 'line',
stack: '总量', stack: '总量',
data: [820, 932, 901, 934, 1290, 1330, 1320] data: [820, 932, 901, 934, 1290, 1330, 1320]
...@@ -113,7 +117,7 @@ export default { ...@@ -113,7 +117,7 @@ export default {
{ name: '绑定人数', max: 16000 }, { name: '绑定人数', max: 16000 },
{ name: '视频数量', max: 30000 }, { name: '视频数量', max: 30000 },
{ name: '员工人数', max: 38000 }, { name: '员工人数', max: 38000 },
{ name: '点击量', max: 52000 }, { name: '推广次数', max: 52000 },
{ name: '文章数量', max: 25000 } { name: '文章数量', max: 25000 }
] ]
}, },
...@@ -191,7 +195,7 @@ export default { ...@@ -191,7 +195,7 @@ export default {
name: 'xxxx有限公司运营报表' name: 'xxxx有限公司运营报表'
} }
], ],
company: 'xxxx有限公司运营报表', company: '',
tableData: [{ tableData: [{
date: '2016-05-02', date: '2016-05-02',
name: '王小虎', name: '王小虎',
...@@ -213,12 +217,14 @@ export default { ...@@ -213,12 +217,14 @@ export default {
}, },
computed: { computed: {
...mapGetters([ ...mapGetters([
'name' 'name',
'roles',
'deptId'
]) ])
}, },
created() { created() {
this.fetchData() this.fetchData()
this.getDeptList()
}, },
mounted() { mounted() {
// 绑定echart图表跟随窗口大小自动缩放 // 绑定echart图表跟随窗口大小自动缩放
...@@ -231,7 +237,29 @@ export default { ...@@ -231,7 +237,29 @@ export default {
}) })
}, },
methods: { methods: {
getDeptList() {
listAllShop().then(res => {
if (res.code === 200) {
this.deptList = res.data
this.company = this.deptList[0].businessId
this.companyName = this.deptList[0].unitName
this.roleFunction()
}
})
},
fetchData() { fetchData() {
},
roleFunction() {
if (this.roles[0].roleKey !== 'admin') {
console.log('this.roles', this.roles)
this.queryShop = false
this.company = this.deptId
this.deptList.forEach(item => {
if (item.businessId === this.deptId) {
this.companyName = item.unitName
}
})
}
} }
} }
} }
<template> <template>
<div class="dashboard-container" id="dashboard"> <div class="dashboard-container" id="dashboard">
<div class="dashboard-text"> <div class="dashboard-text">
xxxx有限公司运营报表 {{companyName}}运营报表
<el-select v-model="company" placeholder="选择公司"> <el-select v-model="company" :disabled="!queryShop" filterable placeholder="请选择所属商家">
<el-option <el-option
v-for="item in options" v-for="(item,index) in deptList"
:key="item.id" :key="index"
:label="item.name" :label="item.unitName"
:value="item.id"> :value="item.businessId"
</el-option> />
</el-select> </el-select>
</div> </div>
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
</div> </div>
</el-col> </el-col>
<el-col :span="12" > <el-col :span="12" >
<div class="card-panel-text">点击量</div> <div class="card-panel-text">推广次数</div>
<div class="card-panel-num"> <div class="card-panel-num">
{{dashboard.orderCount}} {{dashboard.orderCount}}
</div> </div>
...@@ -116,7 +116,6 @@ ...@@ -116,7 +116,6 @@
</div> </div>
</template> </template>
<script src="./dashboard.js"></script> <script src="./dashboard.js"></script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
.el-row{ .el-row{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment