初始化

This commit is contained in:
aixianling
2021-12-14 18:36:19 +08:00
parent 9afa4101b6
commit a8dff862d2
327 changed files with 88702 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
<template>
<div class="AppMediaManage">
<keep-alive :include="['List']">
<component ref="component" :is="component" @change="onChange" :params="params" :instance="instance" :dict="dict"></component>
</keep-alive>
</div>
</template>
<script>
import List from './components/List'
import Add from './components/Add'
export default {
label: '媒资管理',
name: 'AppMediaManage',
props: {
instance: Function,
dict: Object,
},
data() {
return {
component: 'List',
params: {},
include: [],
}
},
components: {
Add,
List
},
methods: {
onChange(data) {
if (data.type === 'add') {
this.component = 'Add'
this.params = data.params
}
if (data.type == 'list') {
this.component = 'List'
this.params = data.params
this.$nextTick(() => {
if (data.isRefresh) {
this.$refs.component.getList()
}
})
}
},
},
}
</script>
<style lang="scss">
.AppMediaManage {
height: 100%;
background: #f3f6f9;
overflow: auto;
}
</style>

View File

@@ -0,0 +1,189 @@
<template>
<section style="height: 100%">
<ai-detail class="Add">
<!-- 返回按钮 -->
<template #title>
<ai-title title="添加媒资信息" isShowBack isShowBottomBorder @onBackClick="cancel(false)"></ai-title>
</template>
<template #content>
<el-form :model="formData" :rules="formRules" ref="ruleForm" label-width="150px" label-suffix="" align-items="center">
<ai-bar title="基础信息"></ai-bar>
<div class="flex">
<el-form-item label="媒资类型" prop="type" class="buildingTypes">
<el-radio-group v-model="formData.type">
<el-radio label='1'>音频广播</el-radio>
<el-radio label='3'>文本广播</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="媒资名称" prop="name" class="buildingTypes">
<el-input size="small" v-model="formData.name" placeholder="请输入" maxlength="30" show-word-limit></el-input>
</el-form-item>
<el-form-item label="文本内容" prop="content" class="buildingTypes" v-if="formData.type == 3">
<el-input size="small" type="textarea" :rows="2" v-model="formData.content" placeholder="请输入" maxlength="12000" show-word-limit></el-input>
</el-form-item>
<el-form-item label="上传音频" prop="file" class="buildingTypes" v-if="formData.type == 1">
<ai-uploader
:isShowTip="true"
:instance="instance"
v-model="formData.file"
fileType="file"
acceptType=".mp3"
:limit="1">
<template slot="tips">最多上传1个附件,单个文件最大10MB<br/>支持.mp3格式
</template>
</ai-uploader>
<ai-audio :src="formData.file[0].url" style="width: 40px;height: 40px;margin-top:20px;" v-if="formData.file.length"></ai-audio>
</el-form-item>
</div>
</el-form>
</template>
<template #footer>
<el-button @click="cancel">取消</el-button>
<el-button type="primary" @click="confirm()">提交</el-button>
</template>
</ai-detail>
</section>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'Add',
components: {},
props: {
dict: Object,
params: Object,
instance: Function,
},
data() {
return {
formData: {
type: '1',
name: '',
content: '',
file: [],
url: ''
},
formRules: {
name: [
{ required: true, message: '请输入媒资名称', trigger: 'change' }
],
content: [
{ required: true, message: '请输入文本内容', trigger: 'change' }
],
file: [
{ required: true, message: '请上传音频', trigger: 'change' }
],
},
}
},
computed: {
...mapState(['user']),
},
created() {
this.instance.defaults.timeout = 6000000
},
methods: {
confirm() {
this.$refs['ruleForm'].validate((valid) => {
if (valid) {
if(this.formData.file.length) {
this.formData.url = this.formData.file[0].url
}
this.instance.post(`/app/appdlbresource/addResource`, {...this.formData}).then((res) => {
if (res.code == 0) {
this.$message.success('提交成功')
setTimeout(() => {
this.cancel(true)
}, 1000)
}
})
}
})
},
// 返回按钮
cancel(isRefresh) {
this.$emit('change', {
type: 'list',
isRefresh: !!isRefresh,
})
},
},
}
</script>
<style lang="scss" scoped>
.Add {
height: 100%;
.ai-detail__title {
background-color: #fff;
}
.ai-detail__content {
.ai-detail__content--wrapper {
.el-form {
background-color: #fff;
padding: 0 60px;
.flex {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.el-form-item {
width: 48%;
}
.buildingTypes {
width: 100%;
}
}
}
}
}
}
::v-deep .mapDialog {
.el-dialog__body {
padding: 0;
.ai-dialog__content {
padding: 0;
}
.ai-dialog__content--wrapper {
padding: 0 !important;
position: relative;
}
#map {
width: 100%;
height: 420px;
}
.searchPlaceInput {
position: absolute;
width: 250px;
top: 30px;
left: 25px;
}
#searchPlaceOutput {
position: absolute;
width: 250px;
left: 25px;
height: initial;
top: 80px;
background: white;
z-index: 250;
max-height: 300px;
overflow-y: auto;
.auto-item {
text-align: left;
font-size: 14px;
padding: 8px;
box-sizing: border-box;
}
}
}
}
</style>

View File

@@ -0,0 +1,178 @@
<template>
<section class="AppPetitionManage">
<ai-list>
<ai-title slot="title" title="媒资管理" isShowBottomBorder/>
<template #content>
<ai-search-bar bottomBorder>
<template slot="left">
<ai-select v-model="search.type" placeholder="媒资类型" clearable :selectList="$dict.getDict('dlbResourceType')"
@change=";(page.current = 1), getList()"></ai-select>
</template>
<template slot="right">
<el-input v-model="search.name" size="small" placeholder="媒资名称" clearable
@keyup.enter.native=";(page.current = 1), getList()"
@clear=";(page.current = 1), (search.name = ''), getList()" suffix-icon="iconfont iconSearch"/>
</template>
</ai-search-bar>
<ai-search-bar class="ai-search-ba mar-t10">
<template slot="left">
<el-button icon="iconfont iconAdd" type="primary" size="small" @click="onAdd('')">添加</el-button>
<el-button icon="iconfont iconDelete" size="small" @click="removeAll" :disabled="ids.length == 0">删除
</el-button>
</template>
</ai-search-bar>
<ai-table :tableData="tableData" :col-configs="colConfigs" :total="total" ref="aitableex"
:current.sync="page.current" :size.sync="page.size" @getList="getList"
@selection-change="(v) => (ids = v.map((e) => e.id))">
<el-table-column slot="content" label="内容" width="200" show-overflow-tooltip>
<template slot-scope="{ row }">
<span type="text" v-if="row.type == 3">{{ row.content }}</span>
<ai-audio v-else-if="row.type == 1 && row.url" :src="row.url" skin="flat"/>
</template>
</el-table-column>
<el-table-column slot="options" label="操作" align="center" width="180" fixed="right">
<template slot-scope="{ row }">
<el-button type="text" @click="remove(row.id)">删除</el-button>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</section>
</template>
<script>
import {mapState} from 'vuex'
export default {
name: 'List',
props: {
dict: Object,
instance: Function,
params: Object,
},
data() {
return {
isAdd: false,
page: {
current: 1,
size: 10,
},
total: 0,
search: {
type: '',
name: '',
},
id: '',
ids: [],
colConfigs: [
{type: 'selection', width: 100, align: 'center'},
{
prop: 'name',
label: '媒资名称',
},
{
prop: 'type',
label: '媒资类型',
width: '100',
align: 'center',
render: (h, {row}) => {
return h('span', null, this.dict.getLabel('dlbResourceType', row.type))
},
},
{
slot: 'content',
},
{prop: 'createTime', label: '创建时间', align: 'center'},
{
prop: 'createUserName',
label: '创建人',
align: 'center',
},
// { prop: 'liveBuildingArea', label: '状态', align: 'center',width: 120 },
// { prop: 'liveBuildingArea', label: '发布次数', align: 'center',width: 120 },
{
slot: 'options',
label: '操作',
align: 'center',
},
],
tableData: [],
areaId: '',
}
},
computed: {
...mapState(['user']),
param() {
return {
...this.search,
areaId: this.user.info?.areaId,
ids: this.ids,
}
},
},
created() {
this.dict.load('dlbResourceType').then(() => {
this.getList()
})
},
methods: {
getList() {
this.instance
.post(`/app/appdlbresource/list`, null, {
params: {
...this.page,
...this.search,
},
})
.then((res) => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
// 添加
onAdd(id) {
this.$emit('change', {
type: 'add',
params: {
id: id || '',
areaId: this.areaId,
},
})
},
// 删除
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appdlbresource/delete?id=${id}`).then((res) => {
if (res.code == 0) {
this.$message.success('删除成功!')
this.getList()
}
})
})
},
removeAll() {
var id = this.ids.join(',')
this.remove(id)
},
},
}
</script>
<style lang="scss" scoped>
.AppPetitionManage {
height: 100%;
.mar-t10 {
margin-top: 10px;
}
}
</style>