Commit 9194d452 by 肖翔宇

12.5

parent c7ba5bb7
......@@ -6,3 +6,4 @@ module.exports = merge(prodEnv, {
NODE_ENV: '"development"',
BASE_API: '"http://192.168.0.13:9001/sharePiano"',
})
//http://gxgqs.com/sharePiano
......@@ -63,7 +63,7 @@ module.exports = {
* then assetsPublicPath should be set to "/bar/".
* In most cases please use '/' !!!
*/
assetsPublicPath: '/', // If you are deployed on the root path, please use '/'
assetsPublicPath: '/sharePiano/', // If you are deployed on the root path, please use '/'
/**
* Source Maps
......
......@@ -15,6 +15,10 @@ import * as sysPiano from './sys/piano'
import * as sysUserCost from './sys/userCost'
import * as sysCourse from './sys/course'
import * as sysCourseType from './sys/courseType'
import * as sysBargain from './sys/bargain'
import * as sysBargainStage from './sys/bargainStage'
import * as sysCodeForPaino from './sys/code'
import * as sysCourseDiversity from './sys/courseDiversity'
const apiObj = {
sysDict,
......@@ -23,7 +27,11 @@ const apiObj = {
sysPiano,
sysUserCost,
sysCourse,
sysCourseType
sysCourseType,
sysBargain,
sysBargainStage,
sysCodeForPaino,
sysCourseDiversity
}
const install = function(Vue) {
......
import request from '@/utils/request'
// 分页查询
export function pageList(data) {
return request({
url: '/sys/sysBargainList/pageList',
method: 'post',
data: data
})
}
// 插入
export function insert(data) {
return request({
url: '/sys/sysBargainList/insert',
method: 'post',
data: data
})
}
// 更新数据
export function update(data) {
return request({
url: '/sys/sysBargainList/update',
method: 'post',
data: data
})
}
// 查询数据
export function query(data) {
return request({
url: '/sys/sysBargainList/query',
method: 'post',
data: data
})
}
// 删除数据
export function deletes(id, ids) {
const data = {}
if (id) {
data['id'] = id
}
if (ids) {
data['ids'] = ids
}
return request({
url: '/sys/sysBargainList/delete',
method: 'post',
data: data
})
}
import request from '@/utils/request'
// 分页查询
export function pageList(data) {
return request({
url: '/sys/SysHaggleStageAllocation/pageList',
method: 'post',
data: data
})
}
// 插入
export function insert(data) {
return request({
url: '/sys/SysHaggleStageAllocation/insert',
method: 'post',
data: data
})
}
// 更新数据
export function update(data) {
return request({
url: '/sys/SysHaggleStageAllocation/update',
method: 'post',
data: data
})
}
export function findAll(data) {
return request({
url: '/sys/SysHaggleStageAllocation/findAll',
method: 'post',
data: data
})
}
// 查询数据
export function query(data) {
return request({
url: '/sys/SysHaggleStageAllocation/query',
method: 'post',
data: data
})
}
// 删除数据
export function deletes(id, ids) {
const data = {}
if (id) {
data['id'] = id
}
if (ids) {
data['ids'] = ids
}
return request({
url: '/sys/SysHaggleStageAllocation/delete',
method: 'post',
data: data
})
}
import request from '@/utils/request'
// 分页查询
export function pageList(data) {
return request({
url: '/sys/sysCodeForPiano/pageList',
method: 'post',
data: data
})
}
export function fileUpload(data) {
return request({
url: '/sys/sysCodeForPiano/fileUpload',
method: 'post',
data: data
})
}
// 插入
export function insert(data) {
return request({
url: '/sys/sysCodeForPiano/insert',
method: 'post',
data: data
})
}
// 更新数据
export function update(data) {
return request({
url: '/sys/sysCodeForPiano/update',
method: 'post',
data: data
})
}
export function findAll(data) {
return request({
url: '/sys/sysCodeForPiano/findAll',
method: 'post',
data: data
})
}
export function selectIds(data) {
return request({
url: '/sys/sysCodeForPiano/selectIds',
method: 'post',
data: data
})
}
// 查询数据
export function query(data) {
return request({
url: '/sys/sysCodeForPiano/query',
method: 'post',
data: data
})
}
// 删除数据
export function deletes(id, ids) {
const data = {}
if (id) {
data['id'] = id
}
if (ids) {
data['ids'] = ids
}
return request({
url: '/sys/sysCodeForPiano/delete',
method: 'post',
data: data
})
}
import request from '@/utils/request'
// 分页查询
export function pageList(data) {
return request({
url: '/sys/sysOnlineList/pageList',
method: 'post',
data: data
})
}
export function query(data) {
return request({
url: '/sys/sysOnlineList/query',
method: 'post',
data: data
})
}
export function findBysysOnlineCourseId(data) {
return request({
url: '/sys/sysOnlineList/findBysysOnlineCourseId',
method: 'post',
data: data
})
}
// 插入
export function insert(data) {
return request({
url: '/sys/sysOnlineList/insert',
method: 'post',
data: data
})
}
// 更新数据
export function update(data) {
return request({
url: '/sys/sysOnlineList/update',
method: 'post',
data: data
})
}
// 删除数据
export function deletes(id, ids) {
const data = {}
if (id) {
data['id'] = id
}
if (ids) {
data['ids'] = ids
}
console.log(data)
return request({
url: '/sys/sysOnlineList/delete',
method: 'post',
data: data
})
}
......@@ -17,7 +17,6 @@ export function insert(data) {
data: data
})
}
// 更新数据
export function update(data) {
return request({
......
......@@ -5,7 +5,7 @@ import 'nprogress/nprogress.css'// Progress 进度条样式
import { Message } from 'element-ui'
import { getToken } from '@/utils/auth' // 验权
const whiteList = ['/userList','/courseList','/pianoList','/courseEdit','/bannerList','/bannerEdit','/bargainList','/bargainEdit'] // 不重定向白名单
const whiteList = ['/courseList','/courseEdit','/bargainList','/bargainEdit'] // 不重定向白名单
router.beforeEach((to, from, next) => {
NProgress.start()
if (getToken()) {
......
......@@ -129,6 +129,19 @@ export const constantRouterMap = [
}
]
},
{
path: '',
component: Layout,
children: [
{
path: '/code',
component: () => import('@/views/code/index'),
name: 'code',
meta: { title: '二维码管理', noCache: false }
},
]
},
{ path: '*', redirect: '/404', hidden: true }
]
......
......@@ -33,10 +33,23 @@
v-model.trim="temp.activityPrice">
</el-input>
</el-form-item>
<el-form-item label="实际可砍价金额" prop="ActualAmountAvailable">
<el-form-item label="实际可砍价金额" prop="actualAmountAvailable">
<el-input type="text" placeholder="请输入实际可砍价金额"
v-model.trim="temp.ActualAmountAvailable">
v-model.trim="temp.actualAmountAvailable">
</el-input>
</el-form-item>
<el-form-item label="封面图" prop="picture">
<el-upload
class="avatar-uploader"
:action="uploadUrl"
list-type="picture-card"
:show-file-list="false"
:on-success="handleImgSuccess"
:on-remove="handleImgRemove"
:before-upload="beforeUpload">
<img v-if="temp.picture" :src="temp.picture" class="avatar-img">
<i v-else class='el-icon-plus avatar-uploader-icon'></i>
</el-upload>
</el-form-item>
</el-form>
......@@ -52,7 +65,7 @@ import Sticky from '@/components/Sticky' // 粘性header组件
import { upload_url } from '@/common/config'
export default {
name: 'courseEdit',
name: 'bargainEdit',
components: { Tinymce, Sticky},
props: ['currentId'],
data() {
......@@ -66,10 +79,11 @@ export default {
numberOfParticipants: undefined,
originalPrice:undefined,
activityPrice: undefined,
ActualAmountAvailable: undefined,
actualAmountAvailable: undefined,
createDate: undefined,
creteUser: undefined,
commodity_introduction: undefined
commodity_introduction: undefined,
picture: undefined
},
uploadUrl: upload_url,
// 表单验证的规则
......@@ -80,24 +94,25 @@ export default {
],
activityDay: [
{ required: true, message: '活动天数不能为空', trigger: 'blur' },
{ type: 'number', message: '只允许输入数字', trigger: 'blur' }
//{ type: 'number', message: '只允许输入数字', trigger: 'blur' }
],
numberOfParticipants: [
{ required: true, message: '参与人数不能为空', trigger: 'blur' },
{ type: 'number', message: '只允许输入数字', trigger: 'blur' }
//{ type: 'number', message: '只允许输入数字', trigger: 'blur' }
],
originalPrice: [
{ required: true, message: '原价不能为空', trigger: 'blur' },
{ type: 'number', message: '只允许输入数字', trigger: 'blur' }
//{ type: 'number', message: '只允许输入数字', trigger: 'blur' }
],
activityPrice: [
{ required: true, message: '活动价格不能为空', trigger: 'blur' },
{ type: 'number', message: '只允许输入数字', trigger: 'blur' }
//{ type: 'number', message: '只允许输入数字', trigger: 'blur' }
],
ActualAmountAvailable: [
actualAmountAvailable: [
{ required: true, message: '实际可砍价金额不能为空', trigger: 'blur' },
{ type: 'number', message: '只允许输入数字', trigger: 'blur' }
//{ type: 'number', message: '只允许输入数字', trigger: 'blur' }
],
picture: [{ required: true, message: '图片不能为空', trigger: 'blur' }],
},
videoFlag: false,
videoUploadPercent: 0,
......@@ -113,8 +128,9 @@ export default {
created() {
const params = this.$route.params
if (params && params.id) {
this.$fetch.sysCourse.query({ id: params.id }).then(({ data }) => {
this.$fetch.sysBargain.query({ id: params.id }).then(({ data }) => {
this.temp = data;
console.log(data)
})
}
},
......@@ -127,7 +143,6 @@ export default {
mounted() {
this.createTime();
this.$fetch.sysCourseType.findAll().then(({ data }) => {
console.log(data);
this.bannerTypes = data
const params = this.$route.params
if (!params || !params.id) {
......@@ -156,25 +171,44 @@ export default {
var date=new Date();
var year = date.getFullYear(); //年
var month = date.getMonth() + 1; //月
var day = date.getDate();
this.temp.createDate=year+'-'+month+'-'+day;
var day = date.getDate();
var hour = date.getHours();
var minutes = date.getMinutes();
var seconds = date.getSeconds();
this.temp.createDate=year+'-'+month+'-'+day+' '+hour+':'+minutes+':'+seconds;
},
handleImgSuccess(response, file) {
this.temp.picture = file.url;
console.log(file);
},
handleImgRemove(file) {
this.temp.picture = undefined
},
beforeUpload(file) {
const _URL = window.URL || window.webkitURL
return new Promise((resolve, reject) => {
const img = new Image()
img.src = _URL.createObjectURL(file)
img.onload = function() {
}
resolve(true)
})
},
// 返回
back() {
this.$router.push({ name: 'courseList' })
this.$router.push({ name: 'bargainList' })
},
saveData() {
if (this.videoFlag) {
this.$message.warning('请等待视频上传成功')
return
}
console.log(this.$refs['dataForm'])
this.$refs['dataForm'].validate(valid => {
if (valid) {
const tempData = Object.assign({}, this.temp)
if (!tempData.id) {
this.createTime();
this.$fetch.sysCourse.insert(tempData).then(() => {
this.$fetch.sysBargain.insert(tempData).then(() => {
this.$message({
message: '创建成功',
type: 'success'
......@@ -182,7 +216,7 @@ export default {
this.back()
})
} else {
this.$fetch.sysCourse.update(tempData).then(() => {
this.$fetch.sysBargain.update(tempData).then(() => {
this.$message({
message: '更新成功',
type: 'success'
......
......@@ -6,19 +6,46 @@
<el-button class="filter-item" style="margin-left: 10px;" v-waves type="primary" icon="el-icon-plus">添加
</el-button>
</router-link>
<el-button @click.native.prevent="openShowLog()" class="filter-item" style="margin-left: 10px;" v-waves type="primary" icon="el-icon-plus">添加类型
<modal @on-close="closeThis()":is-show='isShowLog'>
<el-table :key='tableKey' :data="bargainStage" v-loading="listLoading" :element-loading-text="elementLoadingText" border fit
highlight-current-row style="width: 100%;height:400px;overflow:scroll;">
<el-table-column align="center" :label="table.totalAmount">
<template slot-scope="scope">
<span v-for="item in bannerTypes" :key="item.key">
{{scope.row.totalAmount}}
</span>
</template>
</el-table-column>
<el-table-column align="center" :label="table.totalNumber">
<template slot-scope="scope">
<span v-for="item in bannerTypes" :key="item.key">
{{scope.row.totalNumber}}
</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="150">
<template slot-scope="scope">
<el-button @click.native.prevent="openShowBargain(scope.row)" type="primary" icon="el-icon-edit" size="mini"
round></el-button>
<el-button type="danger" icon="el-icon-delete"
@click.native.prevent="handleDeleteStage(scope.row)" size="mini" round></el-button>
</template>
</el-table-column>
</el-table>
<el-button @click.native.prevent="openShowBargain()" class="filter-item" style="margin-left: 10px;" v-waves type="primary" icon="el-icon-plus">添加类型
</el-button>
<modal @on-close="closeThis()":is-show='isShowLog'>
</modal>
<modal @on-close="closeBargain()":is-show='isShowBargain'>
<el-form :rules="rules" ref="dataForm" :model="types" label-position="left" label-width="100px"
style='width: 350px; margin-left:50px;'>
<el-form-item label="阶段人数" prop="courseName">
style='width: 350px; margin-left:50px;margin-top:50px;'>
<el-form-item label="阶段人数" prop="totalNumber">
<el-input type="text" placeholder="请输入阶段人数"
v-model.trim="types.courseName">
v-model.trim="types.totalNumber">
</el-input>
</el-form-item>
<el-form-item label="金额范围" prop="courseName">
<el-form-item label="金额范围" prop="totalAmount">
<el-input type="text" placeholder="请输入金额范围"
v-model.trim="types.courseName">
v-model.trim="types.totalAmount">
</el-input>
</el-form-item>
</el-form>
......@@ -62,7 +89,7 @@
</el-table-column>
<el-table-column align="center" :label="table.ActualAmountAvailable">
<template slot-scope="scope">
<span>{{scope.row.ActualAmountAvailable}}</span>
<span>{{scope.row.actualAmountAvailable}}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="table.createDate">
......@@ -83,6 +110,9 @@
</router-link>
<el-button type="danger" icon="el-icon-delete"
@click.native.prevent="handleDelete(scope.row)" size="mini" round></el-button>
<el-button @click.native.prevent="openShowLog(scope.row)" type="primary" icon="el-icon-plus" size="mini"
round>
</el-button>
</template>
</el-table-column>
</el-table>
......@@ -106,6 +136,7 @@
data() {
return {
isShowLog: false,
isShowBargain: false,
tableKey: 0,
// 是否加载
listLoading: true,
......@@ -130,10 +161,14 @@
ActualAmountAvailable: '实际可砍价金额',
createDate: '创建时间',
createUser: '创建人',
totalAmount: '总金额',
totalNumber: '总人数'
},
types: {
id: undefined,
courseName: undefined,
sysBargainListId: undefined,
totalAmount: undefined,
totalNumber: undefined,
},
// 临时的表单值
temp: {
......@@ -143,7 +178,7 @@
numberOfParticipants: undefined,
originalPrice:undefined,
activityPrice: undefined,
ActualAmountAvailable: undefined,
actualAmountAvailable: undefined,
createDate: undefined,
creteUser: undefined,
commodity_introduction: undefined
......@@ -155,7 +190,8 @@
{ type: 'string', max: 20, message: '课程名称不允许大于20位数', trigger: 'blur' }
]
},
bannerTypes: []
bannerTypes: [],
bargainStage: []
}
},
created() {
......@@ -185,13 +221,29 @@
closeThis(){
this.isShowLog=false;
},
openShowLog(){
openShowLog(row){
console.log(row.id)
this.$fetch.sysBargainStage.query({sysBargainListId:row.id}).then(({ data }) => {
console.log(data);
this.types.sysBargainListId=row.id
this.bargainStage = data;
const params = this.$route.params;
this.isShowLog=true;
})
},
openShowBargain(data){
if(data){
this.types=data;
}
this.isShowBargain=true;
},
closeBargain(){
this.isShowBargain=false;
},
getList() {
// 初始化数据 开始加载数据
this.listLoading = true
this.$fetch.sysCourse
this.$fetch.sysBargain
.pageList(this.listQuery)
.then(({ data, total }) => {
// 赋值数据
......@@ -256,7 +308,7 @@
type: 'warning'
})
.then(() => {
this.$fetch.sysCourse.deletes(row.id).then(() => {
this.$fetch.sysBargain.deletes(row.id).then(() => {
this.$message({
message: '删除成功',
type: 'success'
......@@ -274,6 +326,36 @@
})
})
},
// 删除
handleDeleteBargain(row) {
if (!row.id) {
this.$message('请刷新后再试')
return
}
this.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.$fetch.sysBargainStage.deletes(row.id).then(() => {
this.$message({
message: '删除成功',
type: 'success'
})
const index = this.bargainStage.indexOf(row)
this.bargainStage.splice(index, 1);
}).catch(function(reason) {
console.log( reason);
});
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
refresh() {
// 初始化查询参数
this.listQuery = {
......@@ -283,6 +365,11 @@
this.tableKey = this.tableKey + 1
this.getList()
},
refreshBargain(){
this.$fetch.sysBargainStage.findAll().then(({ data }) => {
this.bargainStage = data;
})
},
getShowType(row, dispaly = 1) {
if (row.display === dispaly) {
return {
......@@ -304,16 +391,18 @@
if (valid) {
const tempData = Object.assign({}, this.types)
if (!tempData.id) {
this.$fetch.sysCourseType.insert(tempData).then(() => {
this.$fetch.sysBargainStage.insert(tempData).then(() => {
this.$message({
message: '创建成功',
type: 'success'
})
this.types.totalAmount=undefined;
this.types.totalNumber=undefined;
this.isShowLog=false;
this.back()
})
} else {
this.$fetch.sysCourseType.update(tempData).then(() => {
this.$fetch.sysBargainStage.update(tempData).then(() => {
this.$message({
message: '更新成功',
type: 'success'
......
<template>
<div class="app-container">
<div class="filter-container">
<el-button class="filter-item" style="margin-left: 10px;" v-waves type="primary" icon="el-icon-plus" @click.native.prevent="shengcheng()">生成二维码
</el-button>
<modal @on-close="closeThis()" :is-show='isShowLog'>
<el-form :rules="rules" ref="dataForm" :model="types" label-position="left" label-width="100px"
style='width: 350px; margin-left:50px;'>
<el-form-item label="商家信息" prop="pianoBrand">
<el-input type="text" placeholder="请输入商家信息"
v-model.trim="temp.pianoBrand">
</el-input>
</el-form-item>
</el-form>
<el-button type="primary" @click="saveData">保存</el-button>
</modal>
<el-tooltip class="item" effect="dark" content="刷新" placement="top-start" :hide-after="toolTipTime">
<el-button class="filter-item" style="margin-left: 10px;" v-waves @click="refresh" type="success"
icon="el-icon-refresh" size="medium" circle></el-button>
</el-tooltip>
</div>
<el-table :key='tableKey' :data="list" v-loading="listLoading" :element-loading-text="elementLoadingText" border fit
highlight-current-row style="width: 100%">
<el-table-column align="center" :label="table.id">
<template slot-scope="scope">
<span v-for="item in bannerTypes" :key="item.key">
{{scope.row.id}}
</span>
</template>
</el-table-column>
<el-table-column align="center" :label="table.cover">
<template slot-scope="scope">
<img :src="scope.row.twoDimensionalCodeAddress" alt="" width="150" height="100">
</template>
</el-table-column>
<el-table-column align="center" :label="table.name">
<template slot-scope="scope">
<span>{{scope.row.name}}</span>
</template>
</el-table-column>
<el-table-column align="center" :label="table.pianoBrand">
<template slot-scope="scope">
<span>{{scope.row.pianoBrand}}</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="200">
<template slot-scope="scope">
<el-button type="danger" icon="el-icon-delete"
@click.native.prevent="handleDelete(scope.row)" size="mini" round></el-button>
<el-button @click.native.prevent="openShowLog(scope.row)" type="primary" icon="el-icon-edit" size="mini"
round>
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页 -->
<div class="pagination-container">
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
:current-page="listQuery.currentPage" :page-sizes="[10, 20, 30, 40,50,100]"
:page-size="listQuery.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total">
</el-pagination>
</div>
</div>
</template>
<script>
import { parseTime } from '@/utils'
import Modal from '@/components/Modal'
export default {
name: 'banner',
components: { Modal},
data() {
return {
isShowLog: false,
isShowBargain: false,
tableKey: 0,
// 是否加载
listLoading: true,
// 查询参数
listQuery: {
currentPage: 1,
pageSize: 10,
name: undefined,
code: undefined
},
// 表格的数据
list: null,
// 总数量
total: null,
// 表单显示的名称
table: {
pianoBrand: '商家信息',
name: '商家名',
id: '钢琴编号',
cover: '二维码'
},
types: {
id: undefined,
sysBargainListId: undefined,
totalAmount: undefined,
totalNumber: undefined,
},
// 临时的表单值
temp: {
pianoBrand: undefined,
name: undefined,
id: 1,
cover: undefined
},
// 表单验证的规则
rules: {
courseName: [
{ required: true, message: '课程名称不能为空', trigger: 'blur' },
{ type: 'string', max: 20, message: '课程名称不允许大于20位数', trigger: 'blur' }
]
},
bannerTypes: [],
codeList: []
}
},
created() {
// 初始化数据
this.getList()
},
mounted() {
this.$fetch.sysDict.optionsChildren('BANNER_TYPE').then(({ data }) => {
this.bannerTypes = data
})
},
computed: {
// 提示--显示的时间
toolTipTime() {
return this.$store.getters.toolTipTime
},
// 加载显示的文字
elementLoadingText() {
return this.$store.getters.elementLoadingText
},
// 加载显示的文字
displays() {
return this.$store.getters.displays
}
},
methods: {
closeThis(){
this.isShowLog=false;
},
openShowLog(row){
this.isShowLog=true;
this.temp=this.list[row.id-1]
},
shengcheng(){
this.$fetch.sysCodeForPaino.fileUpload({id:2}).then(({data}) => {
// 赋值数据
this.list = data;
console.log(this.list)
})
},
openShowBargain(data){
if(data){
this.types=data;
}
this.isShowBargain=true;
},
closeBargain(){
this.isShowBargain=false;
},
getList() {
// 初始化数据 开始加载数据
this.listLoading = true
this.$fetch.sysCodeForPaino
.pageList(this.listQuery)
.then(({ data, total }) => {
// 赋值数据
this.list = data;
console.log(this.list)
// 数据加载完成
this.listLoading = false
})
},
// 处理搜索
handleFilter() {
this.listQuery.currentPage = 1
this.getList()
},
// 处理每页条数
handleSizeChange(val) {
this.listQuery.pageSize = val
this.getList()
},
// 处理当前页面
handleCurrentChange(val) {
this.listQuery.currentPage = val
this.getList()
},
handleSuccess(response, file) {
this.temp.url = response.data
},
handleRemove(file) {
this.temp.url = undefined
},
beforeUpload(file) {
const _URL = window.URL || window.webkitURL
return new Promise((resolve, reject) => {
const img = new Image()
img.src = _URL.createObjectURL(file)
img.onload = function() {
}
resolve(true)
})
},
// 初始化temp值
resetTemp() {
this.temp = {
id: undefined,
title: undefined,
curriculumType: undefined,
pictureAddress: undefined,
videoAddress: undefined,
createDate: undefined,
cretePerson: undefined,
numberOrder: undefined
}
},
// 删除
handleDelete(row) {
if (!row.id) {
this.$message('请刷新后再试')
return
}
this.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.$fetch.sysCodeForPaino.deletes(row.id).then(() => {
this.$message({
message: '删除成功',
type: 'success'
})
const index = this.list.indexOf(row)
this.list.splice(index, 1)
}).catch(function(reason) {
console.log( reason);
});
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
// 删除
handleDeleteBargain(row) {
if (!row.id) {
this.$message('请刷新后再试')
return
}
this.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.$fetch.sysBargainStage.deletes(row.id).then(() => {
this.$message({
message: '删除成功',
type: 'success'
})
const index = this.bargainStage.indexOf(row)
this.bargainStage.splice(index, 1);
}).catch(function(reason) {
console.log( reason);
});
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
refresh() {
// 初始化查询参数
this.listQuery = {
currentPage: 1,
pageSize: 10
}
this.tableKey = this.tableKey + 1
this.getList()
},
refreshBargain(){
this.$fetch.sysBargainStage.findAll().then(({ data }) => {
this.bargainStage = data;
})
},
getShowType(row, dispaly = 1) {
if (row.display === dispaly) {
return {
type: 'info',
label: '隐藏'
}
}
return {
type: 'success',
label: '显示'
}
},
saveData() {
if (this.videoFlag) {
this.$message.warning('请等待视频上传成功')
return
}
this.$refs['dataForm'].validate(valid => {
if (valid) {
const tempData = Object.assign({}, this.temp)
if (!tempData.id) {
this.$fetch.sysCodeForPaino.update(tempData).then(() => {
this.$message({
message: '创建成功',
type: 'success'
})
this.isShowLog=false;
this.back()
})
} else {
this.$fetch.sysCodeForPaino.update(tempData).then(() => {
this.$message({
message: '更新成功',
type: 'success'
})
this.isShowLog=false;
this.back()
})
}
} else {
console.log('valid error')
}
})
}
}
}
</script>
<style scoped>
</style>
\ No newline at end of file
......@@ -49,27 +49,6 @@
<i v-else class='el-icon-plus avatar-uploader-icon'></i>
</el-upload>
</el-form-item>
<el-form-item label="视频上传" prop="videoAddress">
<!-- action必选参数, 上传的地址 -->
<el-upload class="avatar-uploader" :action="uploadUrl" :show-file-list="false"
:on-success="handleVideoSuccess" :before-upload="beforeUploadVideo"
:on-progress="uploadVideoProcess">
<video v-if="temp.videoAddress && !videoFlag" :src="temp.videoAddress" class="avatar" controls="controls">
您的浏览器不支持视频播放
</video>
<!--<i v-else-if="!videoFlag" class="el-icon-upload avatar-uploader-icon">上传视频</i>-->
<el-button v-else-if="!videoFlag" icon="el-icon-upload">上传视频</el-button>
<el-progress v-if="videoFlag" type="circle" :percentage="videoUploadPercent"
style="margin-top:30px;" color="rgba(142, 113, 199, 0.7)"></el-progress>
</el-upload>
<el-alert
show-icon
title="请保证视频格式正确,且不超过20M。视频格式如mp4、ogg、flv、avi、wmv、rmvb"
type="info"
:closable="false"
>
</el-alert>
</el-form-item>
</el-form>
<div class="editor-container">
......
......@@ -10,16 +10,92 @@
<el-button @click.native.prevent="openShowLog()" class="filter-item" style="margin-left: 10px;" v-waves type="primary" icon="el-icon-plus">添加类型
</el-button>
<modal @on-close="closeThis()":is-show='isShowLog'>
<el-table :key='tableKey' :data="courseTypes" v-loading="listLoading" :element-loading-text="elementLoadingText" border fit
highlight-current-row style="width: 100%;height:400px;overflow:scroll;">
<el-table-column align="center" :label="table.curriculumType">
<template slot-scope="scope">
<span v-for="item in bannerTypes" :key="item.key">
{{scope.row.courseName}}
</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="150">
<template slot-scope="scope">
<el-button @click.native.prevent="openShowCourse(scope.row)" type="primary" icon="el-icon-edit" size="mini"
round></el-button>
<el-button type="danger" icon="el-icon-delete"
@click.native.prevent="handleDeleteCourse(scope.row)" size="mini" round></el-button>
</template>
</el-table-column>
</el-table>
<el-button @click.native.prevent="openShowCourse()" class="filter-item" style="margin-left: 10px;" v-waves type="primary" icon="el-icon-plus">添加选集
</el-button>
</modal>
<modal @on-close="closeCourse()":is-show='isShowCourse'>
<el-form :rules="rules" ref="dataForm" :model="types" label-position="left" label-width="100px"
style='width: 350px; margin-left:50px;'>
<el-form-item label="名称" prop="courseName">
<el-input type="text" placeholder="请输入课程名称"
style='width: 350px; margin-left:50px;margin-top:40px;'>
<el-form-item label="课程类型" prop="courseName">
<el-input type="text" placeholder="请输入课程类型"
v-model.trim="types.courseName">
</el-input>
</el-form-item>
</el-form>
<el-button type="primary" @click="saveData">保存</el-button>
</modal>
<modal @on-close="closeDiversity()":is-show='isShowDiversity'>
<el-table :key='tableKey' :data="courseDiversityTypes" v-loading="listLoading" :element-loading-text="elementLoadingText" border fit
highlight-current-row style="width: 100%;height:400px;overflow:scroll;">
<el-table-column align="center" :label="table.videoName">
<template slot-scope="scope">
<span v-for="item in bannerTypes" :key="item.key">
{{scope.row.videoName}}
</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="150">
<template slot-scope="scope">
<el-button @click.native.prevent="showDiversityEdit(scope.row)" type="primary" icon="el-icon-edit" size="mini"
round></el-button>
<el-button type="danger" icon="el-icon-delete"
@click.native.prevent="handleDeleteDiversity(scope.row)" size="mini" round></el-button>
</template>
</el-table-column>
</el-table>
<el-button @click.native.prevent="showDiversityEdit()" class="filter-item" style="margin-left: 10px;" v-waves type="primary" icon="el-icon-plus">添加选集
</el-button>
</modal>
<modal @on-close="closeDiversityEdit()":is-show='isShowDiversityEdit'>
<el-form :rules="rules" ref="dataForm" :model="types" label-position="left" label-width="100px"
style='width: 350px; margin-left:50px;margin-top:40px;'>
<el-form-item label="选集序号" prop="videoName">
<el-input type="text" placeholder="请输入序号"
v-model.trim="diversityTemp.videoName">
</el-input>
</el-form-item>
<el-form-item label="视频上传" prop="videoAddress">
<!-- action必选参数, 上传的地址 -->
<el-upload class="avatar-uploader" :action="uploadUrl" :show-file-list="false"
:on-success="handleVideoSuccess" :before-upload="beforeUploadVideo"
:on-progress="uploadVideoProcess">
<video v-if="diversityTemp.videoAddress && !videoFlag" :src="diversityTemp.videoAddress" class="avatar" controls="controls">
您的浏览器不支持视频播放
</video>
<!--<i v-else-if="!videoFlag" class="el-icon-upload avatar-uploader-icon">上传视频</i>-->
<el-button v-else-if="!videoFlag" icon="el-icon-upload">上传视频</el-button>
<el-progress v-if="videoFlag" type="circle" :percentage="videoUploadPercent"
style="margin-top:30px;" color="rgba(142, 113, 199, 0.7)"></el-progress>
</el-upload>
<el-alert
show-icon
title="请保证视频格式正确,且不超过20M。视频格式如mp4、ogg、flv、avi、wmv、rmvb"
type="info"
:closable="false"
>
</el-alert>
</el-form-item>
</el-form>
<el-button type="primary" @click="saveDiversityData">保存</el-button>
</modal>
<el-tooltip class="item" effect="dark" content="刷新" placement="top-start" :hide-after="toolTipTime">
<el-button class="filter-item" style="margin-left: 10px;" v-waves @click="refresh" type="success"
icon="el-icon-refresh" size="medium" circle></el-button>
......@@ -58,12 +134,14 @@
</el-table-column>
<el-table-column align="center" label="操作" width="200">
<template slot-scope="scope">
<router-link :to="{name:'courseEdit',params:{id:scope.row.id}}">
<router-link :to="{name:'courseEdit',params:{id:scope.row}}">
<el-button type="primary" icon="el-icon-edit" size="mini"
round></el-button>
</router-link>
<el-button type="danger" icon="el-icon-delete"
@click.native.prevent="handleDelete(scope.row)" size="mini" round></el-button>
<el-button type="primary" icon="el-icon-plus"
@click.native.prevent="showDiversity(scope.row)" size="mini" round></el-button>
</template>
</el-table-column>
</el-table>
......@@ -81,12 +159,16 @@
<script>
import { parseTime } from '@/utils'
import Modal from '@/components/Modal'
import { upload_url } from '@/common/config'
export default {
name: 'banner',
components: { Modal},
data() {
return {
isShowLog: false,
isShowCourse: false,
isShowDiversity: false,
isShowDiversityEdit: false,
tableKey: 0,
// 是否加载
listLoading: true,
......@@ -109,23 +191,32 @@
videoAddress:'视频',
createDate: '创建时间',
cretePerson: '创建人',
numberOrder: '编号'
numberOrder: '编号',
videoName: '选集列表'
},
types: {
id: undefined,
courseName: undefined,
},
diversityTemp:{
id:undefined,
videoName:undefined,
videoAddress:undefined,
sysonlineCourseId:undefined
},
// 临时的表单值
temp: {
id: undefined,
title: undefined,
curriculumType: undefined,
pictureAddress: undefined,
videoAddress: undefined,
createDate: undefined,
cretePerson: undefined,
numberOrder: undefined
},
uploadUrl: upload_url,
videoFlag: false,
videoUploadPercent: 0,
// 表单验证的规则
rules: {
courseName: [
......@@ -133,7 +224,9 @@
{ type: 'string', max: 20, message: '课程名称不允许大于20位数', trigger: 'blur' }
]
},
bannerTypes: []
bannerTypes: [],
courseTypes: [],
courseDiversityTypes: [],
}
},
created() {
......@@ -144,6 +237,7 @@
this.$fetch.sysDict.optionsChildren('BANNER_TYPE').then(({ data }) => {
this.bannerTypes = data
})
},
computed: {
// 提示--显示的时间
......@@ -164,11 +258,88 @@
this.isShowLog=false;
},
openShowLog(){
this.$fetch.sysCourseType.findAll().then(({ data }) => {
console.log(data);
this.courseTypes = data;
const params = this.$route.params;
this.isShowLog=true;
})
},
closeCourse(){
this.isShowCourse=false;
},
openShowCourse(data){
if(data){
this.types=data;
}
this.isShowCourse=true;
},
showDiversity(row){
this.diversityTemp.sysonlineCourseId=row.id;
this.$fetch.sysCourseDiversity.findBysysOnlineCourseId({id:row.id}).then(({ data }) => {
console.log(data);
this.courseDiversityTypes = data;
const params = this.$route.params;
this.isShowDiversity=true;
})
},
closeDiversity(){
this.isShowDiversity=false;
},
showDiversityEdit(row){
if(row){
this.$fetch.sysCourseDiversity.query({id:row.id}).then(({ data }) => {
console.log(data);
this.diversityTemp = data;
const params = this.$route.params;
})
}else{
this.diversityTemp.id=undefined;
this.diversityTemp.videoName=undefined;
this.diversityTemp.videoAddress=undefined;
}
this.isShowDiversityEdit=true;
},
closeDiversityEdit(){
this.isShowDiversityEdit=false
},
beforeUploadVideo(file) {
const isLt10M = file.size / 1024 / 1024 < 20
if (['video/mp4', 'video/ogg', 'video/flv', 'video/avi', 'video/wmv', 'video/rmvb'].indexOf(file.type) === -1) {
this.$message.error('请上传正确的视频格式')
return false
}
if (!isLt10M) {
this.$message.error('上传视频大小不能超过20MB哦!')
return false
}
},
uploadVideoProcess(event, file, fileList) {
this.videoFlag = true
this.videoUploadPercent = Number(file.percentage.toFixed(0))
},
handleVideoSuccess(res, file) {
// 获取上传图片地址
this.videoFlag = false
this.videoUploadPercent = 0
if (res.code === 200) {
this.diversityTemp.videoAddress = res.data
console.log(res.data);
} else {
this.$message.error('视频上传失败,请重新上传!')
}
},
handleSuccess(response, file) {
this.diversityTemp.videoAddress = response.data;
console.log(1)
},
handleRemove(file) {
this.diversityTemp.videoAddress = undefined;
},
getList() {
// 初始化数据 开始加载数据
this.listLoading = true
this.listLoading = true;
console.log(this.listQuery)
this.$fetch.sysCourse
.pageList(this.listQuery)
.then(({ data, total }) => {
......@@ -193,12 +364,6 @@
this.listQuery.currentPage = val
this.getList()
},
handleSuccess(response, file) {
this.temp.url = response.data
},
handleRemove(file) {
this.temp.url = undefined
},
beforeUpload(file) {
const _URL = window.URL || window.webkitURL
return new Promise((resolve, reject) => {
......@@ -252,6 +417,66 @@
})
})
},
// 删除
handleDeleteCourse(row) {
if (!row.id) {
this.$message('请刷新后再试')
return
}
this.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.$fetch.sysCourseType.deletes(row.id).then(() => {
this.$message({
message: '删除成功',
type: 'success'
})
const index = this.courseTypes.indexOf(row)
this.courseTypes.splice(index, 1);
}).catch(function(reason) {
console.log( reason);
});
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
// 删除
handleDeleteDiversity(row) {
if (!row.id) {
this.$message('请刷新后再试')
return
}
this.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.$fetch.sysCourseDiversity.deletes(row.id).then(() => {
this.$message({
message: '删除成功',
type: 'success'
})
const index = this.courseDiversityTypes.indexOf(row)
this.courseDiversityTypes.splice(index, 1);
}).catch(function(reason) {
console.log( reason);
});
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
refresh() {
// 初始化查询参数
this.listQuery = {
......@@ -261,6 +486,18 @@
this.tableKey = this.tableKey + 1
this.getList()
},
refreshCourse(){
this.$fetch.sysCourseType.findAll().then(({ data }) => {
this.courseTypes = data;
})
},
refreshDiversity(){
this.$fetch.sysCourseDiversity.query({id:this.diversityTemp.sysonlineCourseId}).then(({ data }) => {
console.log(data);
this.diversityTemp = data;
const params = this.$route.params;
})
},
getShowType(row, dispaly = 1) {
if (row.display === dispaly) {
return {
......@@ -273,11 +510,38 @@
label: '显示'
}
},
saveDiversityData() {
this.$refs['dataForm'].validate(valid => {
if (valid) {
const tempData = Object.assign({}, this.diversityTemp)
if (!tempData.id) {
this.$fetch.sysCourseDiversity.insert(tempData).then(() => {
this.$message({
message: '创建成功',
type: 'success'
})
//this.isShowLog=false;
this.isShowDiversityEdit=false;
this.refreshCourse();
this.back()
})
} else {
this.$fetch.sysCourseDiversity.update(tempData).then(() => {
this.$message({
message: '更新成功',
type: 'success'
})
this.isShowDiversityEdit=false;
this.refreshDiversity();
this.back()
})
}
} else {
console.log('valid error')
}
})
},
saveData() {
if (this.videoFlag) {
this.$message.warning('请等待视频上传成功')
return
}
this.$refs['dataForm'].validate(valid => {
if (valid) {
const tempData = Object.assign({}, this.types)
......@@ -287,7 +551,9 @@
message: '创建成功',
type: 'success'
})
this.isShowLog=false;
//this.isShowLog=false;
this.isShowCourse=false;
this.refreshCourse();
this.back()
})
} else {
......@@ -296,7 +562,9 @@
message: '更新成功',
type: 'success'
})
this.isShowLog=false;
//this.isShowLog=false;
this.isShowCourse=false;
this.refreshCourse();
this.back()
})
}
......
......@@ -16,6 +16,20 @@
<el-radio :label="item.value" v-for="item in displays" :key="item.value">{{item.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="钢琴编号" prop="painoId">
<span v-for="items in temp.sysCodeForPianoId">
{{items}}<el-button style="padding:0px;" @click.native.prevent="deleteId(items)"><i style="color:red;" class="el-icon-close"></i></el-button>
</span>
<el-select v-model="painoId" placeholder="请选择钢琴编号" @change="saveId">
<el-option
v-for="item in bannerType"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="封面图" prop="cover">
<el-upload
class="avatar-uploader"
......@@ -84,7 +98,7 @@
data() {
return {
logo: require('../../assets/ic_gxgq_selected.png'),
bannerTypes: [],
bannerType: [1,2,3,4],
// 临时的表单值
temp: {
id: undefined,
......@@ -97,8 +111,11 @@
content: undefined,
longitude: undefined,
latitude: undefined,
status: 1
status: 1,
sysCodeForPianoId:[],
abc:[]
},
painoId:0,
banners: [],
uploadUrl: upload_url,
dialogVisible: false,
......@@ -113,9 +130,11 @@
}
},
created() {
this.getIdArr();
const params = this.$route.params
if (params && params.id) {
this.$fetch.sysPiano.query({ id: params.id }).then(({ data }) => {
console.log(1,data)
this.temp = data
if (this.temp.banners && this.temp.banners.length > 0) {
const banner = this.temp.banners.split(",")
......@@ -141,7 +160,27 @@
},
},
methods: {
getIdArr(){
this.$fetch.sysCodeForPaino
.selectIds()
.then(({ data, total }) => {
// 赋值数据
console.log(data)
for(var item in data){
this.bannerType.push(item);
}
})
},
// 返回
saveId(){
console.log(this.temp.sysCodeForPianoId)
this.temp.sysCodeForPianoId.push(this.painoId);
},
deleteId(id){
console.log(id);
var index=this.temp.sysCodeForPianoId.indexOf(id);
this.temp.sysCodeForPianoId.splice(index,1);
},
backList() {
this.$confirm('是否放弃当前编辑信息?', '提示', {
confirmButtonText: '继续编辑',
......
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 sign in to comment