Commit 0b0f68f4 by cwq0219

联调

1 parent 522ce35c
import request from './request' import request from './request'
import axios from 'axios'
import {
baseConfig
} from '@/main'
export const BASE_DATA_URL = 'fims.configuration.from.conftype' export const BASE_DATA_URL = 'fims.configuration.from.conftype'
...@@ -8,6 +12,19 @@ export function customerList(data) { ...@@ -8,6 +12,19 @@ export function customerList(data) {
return request(data) return request(data)
} }
// 重置密码
export function resetPassword(data) {
data.method = 'customermgr/reset'
return request(data)
}
// 停用/启用
// 0 停用 1 正常 2 待审核 3 审核未通过
export function customerChangeStatus(data) {
data.method = 'customermgr/startandstop'
return request(data, 'post')
}
// 设备管理 // 设备管理
export function deviceList(data) { export function deviceList(data) {
data.method = 'devicemgr/getDeviceMgrList' data.method = 'devicemgr/getDeviceMgrList'
...@@ -38,6 +55,12 @@ export function apiList(data) { ...@@ -38,6 +55,12 @@ export function apiList(data) {
return request(data) return request(data)
} }
// API列表-启用/停用
export function apiStartandStartAndStop(data) {
data.method = 'apimgr/startandstop'
return request(data, 'post')
}
// API调用记录 // API调用记录
export function apiRecordList(data) { export function apiRecordList(data) {
data.method = 'apicallmgr/getApiCallMgrList' data.method = 'apicallmgr/getApiCallMgrList'
...@@ -50,3 +73,35 @@ export function appMarketList(data) { ...@@ -50,3 +73,35 @@ export function appMarketList(data) {
return request(data) return request(data)
} }
// APP营销-上架/下架
export function appStartandstop(data) {
data.method = 'admgr/startandstop'
return request(data, 'post')
}
// 图片上传
export function uploadImg(data) {
return axios({
url: baseConfig.axios.baseURL + 'file/uploadFile',
method: 'post',
data: data
})
}
// 图片删除
export function deleteImg(data) {
data.method = 'file/deleteFile'
return request(data, 'post')
}
// APP营销 - 新增
export function appAdd(data) {
data.method = 'admgr/insertAd'
return request(data, 'post')
}
// APP营销 - 编辑
export function appEdit(data) {
data.method = 'admgr/updateAd'
return request(data, 'post')
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: limin * @Author: limin
* @Date: 2019-08-26 18:02:41 * @Date: 2019-08-26 18:02:41
* @Last Modified by: chenwq * @Last Modified by: chenwq
* @Last Modified time: 2020-12-18 15:29:30 * @Last Modified time: 2020-12-22 11:54:03
*/ */
import axios from '@/plugin/axios' import axios from '@/plugin/axios'
......
...@@ -37,6 +37,10 @@ export default { ...@@ -37,6 +37,10 @@ export default {
type: Object, type: Object,
default: null default: null
}, },
showBtnName: {
type: Array,
default: []
},
data: Object data: Object
}, },
functional: true, // 开启函数化组件 functional: true, // 开启函数化组件
...@@ -49,8 +53,17 @@ export default { ...@@ -49,8 +53,17 @@ export default {
* data 点击按钮时 需要得到的参数 比如 table 中的 当前行数据 row * data 点击按钮时 需要得到的参数 比如 table 中的 当前行数据 row
* mapping 非必填 但: 当列表中的操作选项 根据 某个字段 变化的话 必填 且 必须 注明 field: 字段名 * mapping 非必填 但: 当列表中的操作选项 根据 某个字段 变化的话 必填 且 必须 注明 field: 字段名
* label 当传入label 字段时 标识明确指定渲染该label 的按钮 * label 当传入label 字段时 标识明确指定渲染该label 的按钮
* size 按钮样式,默认mini
* showBtnName 按需显示按钮
*/ */
const { category, data, mapping, label } = ctx.props const {
category,
data,
mapping,
label,
size,
showBtnName
} = ctx.props
let curBtns = [] let curBtns = []
/** /**
* 判断一个按钮(btn)是否存在与当前行(data) 的映射关系(mapping)中 * 判断一个按钮(btn)是否存在与当前行(data) 的映射关系(mapping)中
...@@ -81,11 +94,13 @@ export default { ...@@ -81,11 +94,13 @@ export default {
* 循环最终显示的按钮列表 * 循环最终显示的按钮列表
* 并渲染到页面 * 并渲染到页面
*/ */
curBtns.forEach(btn => curBtns = showBtnName.length ? curBtns.filter(item => showBtnName.includes(item.label)) : curBtns
curBtns.forEach(btn => {
__aBtns.push(h('el-button', { __aBtns.push(h('el-button', {
props: { props: {
type: btn.type || (btn.category === 'Button' ? '' : 'text'), type: btn.type || (btn.category === 'Button' ? '' : 'text'),
icon: btn.icon ? `el-icon-${btn.icon}` : '' icon: btn.icon ? `el-icon-${btn.icon}` : '',
size: size
}, },
style: { style: {
color: btn.color color: btn.color
...@@ -93,7 +108,8 @@ export default { ...@@ -93,7 +108,8 @@ export default {
on: { on: {
click: (e) => btn.handle && _this[btn.handle](data, e) click: (e) => btn.handle && _this[btn.handle](data, e)
} }
}, [btn.label]))) }, [btn.ruleObj ? btn.ruleObj.rule[data[btn.ruleObj.attr]] : btn.label]))
return h('div', {}, [...__aBtns, ctx.children]) })
return h('span', {}, [...__aBtns, ctx.children])
} }
} }
...@@ -4,7 +4,7 @@ import { ...@@ -4,7 +4,7 @@ import {
Message Message
} from 'element-ui' } from 'element-ui'
import util from '@/libs/util' import util from '@/libs/util'
import router from '@/router' // import router from '@/router'
// import { // import {
// LogExternals // LogExternals
// } from '@/common/constants' // } from '@/common/constants'
...@@ -58,20 +58,7 @@ service.interceptors.request.use( ...@@ -58,20 +58,7 @@ service.interceptors.request.use(
config => { config => {
return new Promise(async resolve => { return new Promise(async resolve => {
await store.commit('d2admin/loading/set', true) await store.commit('d2admin/loading/set', true)
// const uuid = util.cookies.get('uuid') console.log(config)
// 如果请求链接不在排除列表 (排除列表: 登录 基础数据) 并且cookie 过期(判断是否长时间未操作)
// if (!LogExternals.some(u => u === url || (params && u === params.method)) && !uuid) {
// await store.dispatch('d2admin/account/logout')
// router.replace('/login')
// }
// if (uuid) { // 判断 cookie 是否存在 存在则更新时间 避免登出时 记录空值
// const inExpiresMinutes = new Date(new Date().getTime() + expiresMinute * 60 * 1000)
// util.cookies.set('uuid', uuid, {
// expires: inExpiresMinutes
// })
// }
// config.url = baseConfig.axios.baseURL + config.url
// config.timeout = baseConfig.axios.timeout
resolve(config) resolve(config)
}) })
}, },
......
...@@ -75,7 +75,11 @@ export const resources = { ...@@ -75,7 +75,11 @@ export const resources = {
authId: '10201', authId: '10201',
parentId: '102', parentId: '102',
label: '重置密码', label: '重置密码',
handle: 'handleReset' handle: 'handleResetPassword',
ruleObj: {
attr: 'status',
rule: { 0: '重置密码', 1: '重置密码', 2: '' }
}
}, { }, {
authId: '10202', authId: '10202',
parentId: '102', parentId: '102',
...@@ -83,7 +87,16 @@ export const resources = { ...@@ -83,7 +87,16 @@ export const resources = {
handle: 'handleUpOrDown', handle: 'handleUpOrDown',
ruleObj: { ruleObj: {
attr: 'status', attr: 'status',
rule: { 0: '启用', 1: '停用' } rule: { 0: '启用', 1: '停用', 2: '' }
}
}, {
authId: '10203',
parentId: '102',
label: '审核通过',
handle: 'handleExamine',
ruleObj: {
attr: 'status',
rule: { 0: '', 1: '', 2: '审核通过' }
} }
} }
], ],
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<d2-container> <d2-container>
<d2-table-header title="API列表"></d2-table-header> <d2-table-header title="API列表"></d2-table-header>
<d2-table <d2-table
ref="apiList"
:hasNum="false" :hasNum="false"
:searchForm="searchForm" :searchForm="searchForm"
:tableParams="tableParams" :tableParams="tableParams"
...@@ -18,7 +19,7 @@ ...@@ -18,7 +19,7 @@
</template> </template>
<script> <script>
import { apiList } from '@api/api' import { apiList, apiStartandStartAndStop } from '@api/api'
export default { export default {
name: 'apiList', name: 'apiList',
data() { data() {
...@@ -75,13 +76,30 @@ export default { ...@@ -75,13 +76,30 @@ export default {
} }
}, },
components: {},
computed: {},
mounted() { }, mounted() { },
methods: {} methods: {
messageConfirm(txt, fn, title = '提示', type) {
this.$confirm(txt, title, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: type || 'warning'
}).then(() => {
fn()
})
},
handleUpOrDown(row) {
this.messageConfirm('是否' + (row.status ? '停用' : '启用') + '?', () => {
apiStartandStartAndStop({
id: row.id,
status: row.status === 1 ? 0 : 1
}).then(res => {
this.notice.okTips()
this.$refs.apiList.refreshTable()
})
})
}
}
} }
</script> </script>
......
...@@ -24,6 +24,10 @@ ...@@ -24,6 +24,10 @@
:size="$store.state.d2admin.size.value" :size="$store.state.d2admin.size.value"
:id="tableParams.btnId" :id="tableParams.btnId"
>查询</el-button> >查询</el-button>
<el-button
:size="$store.state.d2admin.size.value"
@click="handleRest"
>重置</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<d2-table <d2-table
...@@ -88,8 +92,8 @@ export default { ...@@ -88,8 +92,8 @@ export default {
beforeSearchFn() { beforeSearchFn() {
return new Promise(resolve => { return new Promise(resolve => {
if (this.accessTime && this.accessTime.length) { if (this.accessTime && this.accessTime.length) {
this.searchForm.registerStartTime = new Date(this.accessTime[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00' this.searchForm.accessStartTime = new Date(this.accessTime[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
this.searchForm.registerEndTime = new Date(this.accessTime[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59' this.searchForm.accessEndTime = new Date(this.accessTime[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
} }
resolve() resolve()
}) })
......
<!-- app营销管理 --> <!-- app营销管理 -->
<template> <template>
<d2-container> <d2-container class="app-market">
<d2-table-header title="广告列表"> <d2-table-header title="广告列表">
<auth-button category="Button"></auth-button> <auth-button category="Button"></auth-button>
</d2-table-header> </d2-table-header>
<d2-table <d2-table
ref="appMarket"
:hasNum="false" :hasNum="false"
:searchForm="searchForm" :searchForm="searchForm"
:tableParams="tableParams" :tableParams="tableParams"
...@@ -22,17 +23,161 @@ ...@@ -22,17 +23,161 @@
:data="scope.scope" :data="scope.scope"
></auth-button> ></auth-button>
</d2-table> </d2-table>
<d2-dialog
:title="title"
:isVisible="editVisible"
@closeDialog="handleClose"
@confirmDialog="handleConfirm"
>
<el-form
:model="editData"
:rules="editRules"
ref="editForm"
label-width="120PX"
>
<el-form-item
label="标题:"
prop="title"
>
<el-input
v-model="editData.title"
placeholder="请输入标题"
></el-input>
</el-form-item>
<el-form-item
label="位置:"
prop="position"
>
<el-select
v-model="editData.position"
placeholder="请选择位置"
>
<el-option
v-for="item in positionList"
:key="item.conId"
:value="item.confId"
:label="item.confLabel"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
label="图片:"
prop="image"
>
<div
v-if="!editData.image"
class="activity-img img-w-h"
>
<div class="add">+</div>
<span class="number">0/1</span>
<input
type="file"
name='thumbUrl'
id="file"
ref="file"
class="activity-img img-w-h"
accept="image/png, image/jpeg, image/gif, image/jpg"
@click="handleAddClick"
@change="e => handleImgChange(e, item)"
style="opacity: 0;"
>
</div>
<div
class="muti-imgs img-w-h"
v-else
>
<img
class="img-w-h"
:src="editData.image"
/>
<span class="img-btns">
<span class="btn-item">
<i
@click='handleImgDelete'
class="el-icon-delete"
></i>
<i
@click="handleImgLook(editData.image)"
class="el-icon-zoom-in"
></i>
</span>
</span>
</div>
</el-form-item>
<el-form-item
label="打开界面:"
prop="interfaceType"
>
<el-radio
v-model="editData.interfaceType"
label="1"
>APP</el-radio>
<el-radio
v-model="editData.interfaceType"
label="2"
>H5</el-radio>
</el-form-item>
<el-form-item
label="界面参数:"
prop="interfaceUrl"
>
<el-input
v-model="editData.interfaceUrl"
placeholder="请输入界面参数"
></el-input>
</el-form-item>
</el-form>
</d2-dialog>
<el-dialog :visible.sync="lookImgVisible">
<img
width="100%"
:src="imageUrl"
alt="图片"
>
</el-dialog>
</d2-container> </d2-container>
</template> </template>
<script> <script>
import { appMarketList } from '@api/api' import _ from 'lodash'
import { appMarketList, appStartandstop, uploadImg, deleteImg, appAdd, appEdit } from '@api/api'
export default { export default {
name: 'appMarket', name: 'appMarket',
data() { data() {
return { return {
searchForm: {}, searchForm: {},
getListApi: appMarketList, getListApi: appMarketList,
apiName: {
'add': appAdd,
'edit': appEdit
},
lookImgVisible: false,
// 弹窗
title: '新增',
editVisible: false,
addOrEdit: 'add',
editData: {
image: '',
interfaceType: '1'
},
editRules: {
title: [{ required: true, message: '请输入标题', trigger: 'blur' }],
image: [{ required: true, message: '请选择图片', trigger: 'change' }],
interfaceType: [{ required: true, message: '请选择打开界面', trigger: 'change' }],
interfaceUrl: [{ required: true, message: '请输入界面参数', trigger: 'blur' }]
},
positionList: [{
confId: '1',
confLabel: '商城banner'
}, {
confId: '2',
confLabel: '智能-家'
}, {
confId: '3',
confLabel: '启动页'
}],
tableParams: { tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000), btnId: new Date().getTime() + parseInt(Math.random() * 1000),
listName: 'list', listName: 'list',
...@@ -79,7 +224,7 @@ export default { ...@@ -79,7 +224,7 @@ export default {
formatter: (cellValue) => { formatter: (cellValue) => {
return { return {
0: '下架', 0: '下架',
1: '上架' 1: '正常'
}[cellValue.status] }[cellValue.status]
} }
}] }]
...@@ -89,7 +234,89 @@ export default { ...@@ -89,7 +234,89 @@ export default {
mounted() { }, mounted() { },
methods: {} methods: {
messageConfirm(txt, fn, title = '提示', type) {
this.$confirm(txt, title, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: type || 'warning'
}).then(() => {
fn()
})
},
handleAdd() {
this.title = '新增'
this.addOrEdit = 'add'
this.handleClose()
},
handleEdit(row) {
// console.log(row)
this.title = '编辑'
this.addOrEdit = 'edit'
this.editData = _.cloneDeep(row)
this.editData.position = this.editData.position ? (this.editData.position + '') : ''
this.editData.interfaceType = this.editData.interfaceType ? (this.editData.interfaceType + '') : ''
delete this.editData.status
this.editVisible = !this.editVisible
},
handleUpOrDown(row) {
// console.log(row)
this.messageConfirm('是否' + (row.status ? '下架' : '上架') + '?', () => {
appStartandstop({
id: row.id,
status: row.status === 1 ? 0 : 1
}).then(res => {
this.notice.okTips()
this.$refs.appMarket.refreshTable()
})
})
},
handleAddClick() {
document.getElementById('file').value = null
},
handleImgChange(e, targetItem) {
var o = new FormData()
o.append('file', e.target.files[0])
uploadImg(o).then(res => {
if (res.data.code === 200) {
this.$refs.editForm.clearValidate('image')
this.editData.image = res.data.data
} else {
this.notice.errorTips()
}
})
},
// 图片删除
handleImgDelete(targetItem) {
deleteImg({ fileUrl: this.editData.image }).then(res => { })
this.editData.image = ''
},
// 图片查看
handleImgLook(src) {
this.lookImgVisible = true
this.imageUrl = src
},
handleClose() {
this.editData = {
image: '',
interfaceType: '1'
}
this.$refs.editForm && this.$refs.editForm.resetFields()
this.editVisible = !this.editVisible
},
handleConfirm() {
this.$refs.editForm.validate(valid => {
if (valid) {
console.log(this.addOrEdit)
this.apiName[this.addOrEdit](this.editData).then(res => {
this.notice.okTips()
this.handleClose()
this.$refs.appMarket.refreshTable()
})
}
})
}
}
} }
</script> </script>
...@@ -98,4 +325,71 @@ export default { ...@@ -98,4 +325,71 @@ export default {
width: 80px; width: 80px;
height: 80px; height: 80px;
} }
.app-market .activity-img {
position: relative;
color: #999999;
border: 1px dashed #d9d9d9;
cursor: pointer;
}
.app-market .activity-img .add {
position: absolute;
top: 40%;
font-size: 40px;
left: 50%;
transform: translate3d(-50%, -50%, 0);
}
.app-market .activity-img .number {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
}
.app-market .img-btns {
display: none;
height: 100%;
position: absolute;
width: 88px;
height: 88px;
left: 0;
top: 0;
z-index: 2;
color: #fff;
background: rgba(0, 0, 0, 0.5);
}
.app-market .el-icon-delete,
.app-market .el-icon-zoom-in {
cursor: pointer;
}
.app-market .img-btns .btn-item {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.muti-imgs .img-btns .btn-item {
display: flex;
width: 70%;
justify-content: space-around;
}
.muti-imgs:hover .img-btns {
display: block;
}
.app-market .img-w-h {
width: 88px;
height: 88px;
}
.app-market .activity-img {
position: relative;
color: #999999;
border: 1px dashed #d9d9d9;
cursor: pointer;
}
</style> </style>
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
<d2-container> <d2-container>
<d2-table-header title="客户列表"></d2-table-header> <d2-table-header title="客户列表"></d2-table-header>
<d2-table <d2-table
ref="customerTable"
:hasNum="false" :hasNum="false"
:searchForm="searchForm" :searchForm="searchForm"
:tableParams="tableParams" :tableParams="tableParams"
...@@ -18,7 +19,7 @@ ...@@ -18,7 +19,7 @@
</template> </template>
<script> <script>
import { customerList } from '@api/api' import { customerList, resetPassword, customerChangeStatus } from '@api/api'
export default { export default {
name: 'customer', name: 'customer',
data() { data() {
...@@ -71,6 +72,46 @@ export default { ...@@ -71,6 +72,46 @@ export default {
mounted() { }, mounted() { },
methods: { methods: {
messageConfirm(txt, fn, title = '提示', type) {
this.$confirm(txt, title, {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: type || 'warning'
}).then(() => {
fn()
})
},
handleResetPassword(row) {
this.messageConfirm('是否重置密码?', () => {
resetPassword({ id: row.id }).then(res => {
this.notice.okTips()
})
})
},
// 停用/启用
handleUpOrDown(row) {
this.messageConfirm('是否' + (row.status ? '停用' : '启用') + '?', () => {
customerChangeStatus({
id: row.id,
status: row.status === 1 ? 0 : 1
}).then(res => {
this.notice.okTips()
this.$refs.customerTable.refreshTable()
})
})
},
// 审核
handleExamine(row) {
this.messageConfirm('是否审核通过?', () => {
customerChangeStatus({
id: row.id,
status: 1
}).then(res => {
this.notice.okTips()
this.$refs.customerTable.refreshTable()
})
})
}
} }
} }
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
</el-form-item> </el-form-item>
<el-form-item label="激活时间:"> <el-form-item label="激活时间:">
<el-date-picker <el-date-picker
v-model="registerTime" v-model="activateTime"
:size="$store.state.d2admin.size.value" :size="$store.state.d2admin.size.value"
type="daterange" type="daterange"
range-separator="至" range-separator="至"
...@@ -75,7 +75,7 @@ export default { ...@@ -75,7 +75,7 @@ export default {
data() { data() {
return { return {
searchForm: {}, searchForm: {},
registerTime: [], activateTime: [],
getListApi: deviceList, getListApi: deviceList,
tableParams: { tableParams: {
btnId: new Date().getTime() + parseInt(Math.random() * 1000), btnId: new Date().getTime() + parseInt(Math.random() * 1000),
...@@ -129,15 +129,15 @@ export default { ...@@ -129,15 +129,15 @@ export default {
methods: { methods: {
beforeSearchFn() { beforeSearchFn() {
return new Promise(resolve => { return new Promise(resolve => {
if (this.registerTime && this.registerTime.length) { if (this.activateTime && this.activateTime.length) {
this.searchForm.registerStartTime = new Date(this.registerTime[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00' this.searchForm.activatStartTime = new Date(this.activateTime[0]).toLocaleDateString().replace(/\//g, '-') + ' 00:00:00'
this.searchForm.registerEndTime = new Date(this.registerTime[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59' this.searchForm.activatEndTime = new Date(this.activateTime[1]).toLocaleDateString().replace(/\//g, '-') + ' 23:59:59'
} }
resolve() resolve()
}) })
}, },
handleRest() { handleRest() {
this.registerTime = [] this.activateTime = []
this.searchForm = {} this.searchForm = {}
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!