Commit c46ce7a7 authored by wangwei's avatar wangwei

页面编写

parent 99025ad6
...@@ -13,8 +13,8 @@ module.exports = { ...@@ -13,8 +13,8 @@ module.exports = {
//本地代理设置 //本地代理设置
proxyTable: { proxyTable: {
'/api': { '/api': {
target: 'http://wechat.test.singsingenglish.com', // 接口的域名 target: 'http://local.base-api.sing.com', // 接口的域名
// target: 'wechat.test.singsingenglish.com http://local.base-api.sing.com', // target: 'wechat.test.singsingenglish.com',
changeOrigin: true, // 如果接口跨域,需要进行这个参数配置 changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
} }
}, },
......
<template> <template>
<el-dialog
:title="boxDialogObj.title"
:visible.sync="boxDialogObj.show"
width="950px">
<div v-loading="loading">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="24">
<el-form-item prop="title" label="盒子名称">
<el-input v-model="form.title"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item prop="title" label="盒子首图">
<el-upload
action="/api/public/upload"
:class="{disabled:!uploadShow}"
:before-upload="beforeAvatarUpload"
list-type="picture-card"
:file-list="imageList"
:on-success="handleAvatarSuccess"
:on-remove="handleRemove">
<i class="el-icon-plus"></i>
</el-upload>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item prop="title" label="最小年龄">
<el-input-number v-model="form.min_age"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="title" label="最大年龄">
<el-input-number v-model="form.max_age"></el-input-number>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item prop="title" label="最小等级">
<el-input-number v-model="form.min_level"></el-input-number>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="title" label="最大等级">
<el-input-number v-model="form.max_level"></el-input-number>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-transfer
:titles="['单品列表', '盒子内容']"
v-model="singleList"
:props="{
key: 'id',
label: 'name'
}"
@change="changeTrans"
:data="data2">
<span slot-scope="{ option }" style="display: block">
{{ option.name }}
<el-input-number style="float: right" size="mini" v-model="option.checkNum"></el-input-number>
</span>
</el-transfer>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="boxDialogObj.show = false">取 消</el-button>
<el-button type="primary" @click="sub">确 定</el-button>
</span>
</div>
</el-dialog>
</template> </template>
<script> <script>
export default { import {getSingleListApi,addBoxApi,getBoxDetailApi} from "../../service/api";
name: "boxDialog" export default {
name: "boxDialog",
props:[
"boxDialogObj"
],
data(){
return {
loading:false,
rules:{},
data2:[],
singleList:[],
uploadShow: true,
imageList: [],
form:{
title:"",
item_stock_arr:[],
cover:'',
min_age:0,
max_age:0,
min_level:0,
max_level:0
}
}
},
mounted(){
},
methods:{
initPage(){
getSingleListApi().then(res=>{
res.list.forEach(i=>{
i.checkNum = 1;
});
this.data2 = res.list
});
switch (this.boxDialogObj.type) {
case 0:
this.form = {
title:"",
item_stock_arr:[],
cover:'',
min_age:0,
max_age:0,
min_level:0,
max_level:0
};
this.imageList = [];
this.singleList = [];
break;
case 1:
getBoxDetailApi(this.boxDialogObj.id).then(res=>{
})
}
},
sub(){
this.singleList.forEach(i=>{
let x = this.data2.find(a=>{
return a.id === i
});
this.form.item_stock_arr.push({stock_id:x.id,num:x.checkNum})
});
this.form.item_stock_arr = JSON.stringify(this.form.item_stock_arr)
if(this.imageList.length>0){
this.form.cover = this.imageList[0].name;
}
switch (this.boxDialogObj.type) {
case 0:
addBoxApi(this.boxDialogObj.category_id,this.form).then(res=>{
this.$message({
type: 'success',
message: '添加成功!'
});
this.boxDialogObj.show = false;
this.$emit("reflash",this.boxDialogObj.category_id);
})
}
},
changeTrans(a,b,c){
console.log(c)
},
beforeAvatarUpload(){
this.uploadShow = false
},
handleRemove(){
this.uploadShow = true
},
handleAvatarSuccess(res) {
this.imageList = [{name:res.data.url,url:process.env.IMAGE_URL_HEAD + res.data.url}]
},
},
watch:{
'boxDialogObj'(value){
this.initPage()
}
} }
</script>
<style scoped> }
</script>
<style scoped lang="less">
</style> </style>
<style>
.el-transfer-panel{
width: 400px;
}
</style>
...@@ -34,17 +34,22 @@ ...@@ -34,17 +34,22 @@
close:false close:false
} }
}, },
components:{
},
mounted(){ mounted(){
this.getBoxTypeList() this.getBoxTypeList()
}, },
methods: { methods: {
getBoxTypeList(){ getBoxTypeList(){
getBoxTypeListApi().then(res=>{ getBoxTypeListApi().then(res=>{
this.list = res this.list = res;
if(this.nowId === '') {
this.changeCateGory(res[0].id)
}
}) })
}, },
changeCateGory(id){ changeCateGory(id){
this.nowId = id this.nowId = id;
this.$emit('changeCategoryId',id) this.$emit('changeCategoryId',id)
} }
} }
...@@ -62,6 +67,7 @@ ...@@ -62,6 +67,7 @@
padding: 0; padding: 0;
margin: 0; margin: 0;
transition: all .3s; transition: all .3s;
z-index: 10;
&:hover{ &:hover{
right: 0; right: 0;
} }
......
...@@ -2,46 +2,56 @@ ...@@ -2,46 +2,56 @@
<div class="box-index"> <div class="box-index">
<box-type-list @changeCategoryId="changeCategoryId"/> <box-type-list @changeCategoryId="changeCategoryId"/>
<div class="add-block"> <div class="add-block">
<el-button class="add-btn" type="success">+新增盒子</el-button> <el-button class="add-btn" type="success" @click="onAdd()">+新增盒子</el-button>
</div> </div>
<el-row> <el-row>
<el-col :span="4" v-for="(data, index) in list" :key="o"> <el-col :span="5" v-for="(data, index) in list" :key="index" class="card-col">
<el-card :body-style="{ padding: '0px' }" shadow="hover"> <el-card :body-style="{ padding: '0px' }" shadow="hover" class="card">
<img v-if="data.cover !== ''" :src="defaultImgPath + data.cover" class="image"> <img v-if="data.cover !== ''" :src="defaultImgPath + data.cover" class="image">
<img v-if="data.cover === ''" :src="defaultImgPath + data.cover" class="image">
<div style="padding: 14px;"> <div style="padding: 14px;">
<span> <span>
{{data.title}} {{data.title}}
</span> </span>
<div class="bottom clearfix"> <div class="bottom clearfix">
<el-tag size="mini">level{{data.min_level}}-level{{data.max_level}}</el-tag> <el-tag size="mini">level{{data.min_level}}-level{{data.max_level}}</el-tag>
<el-tag type="success" size="mini">{{data.min_age}}-{{data.max_age}}</el-tag> <el-tag type="success" size="mini">{{data.min_age}}-{{data.max_age}}</el-tag>
<div class="btn-block"> <div class="btn-block">
<el-button type="primary" icon="el-icon-search" circle plain size="mini"></el-button> <el-button type="primary" icon="el-icon-search" circle plain size="mini"></el-button>
<el-button type="warning" icon="el-icon-edit" circle plain size="mini"></el-button> <el-button type="warning" icon="el-icon-edit" circle plain size="mini" @click="onEdit(data.id)"></el-button>
<el-button type="danger" icon="el-icon-delete" circle plain size="mini"></el-button> <el-button type="danger" icon="el-icon-delete" circle plain size="mini" @click="delBox(data.id)"></el-button>
</div> </div>
</div> </div>
</div> </div>
</el-card> </el-card>
</el-col> </el-col>
</el-row> </el-row>
<box-dialog :boxDialogObj="boxDialogObj" @reflash="initPage"/>
</div> </div>
</template> </template>
<script> <script>
import { getBoxListApi } from "../../service/api"; import { getBoxListApi,delBoxApi} from "../../service/api";
import BoxTypeList from './boxTypeList' import BoxTypeList from './boxTypeList'
import boxDialog from './boxDialog';
export default { export default {
name: "index", name: "index",
components:{ components:{
BoxTypeList BoxTypeList,
boxDialog
}, },
data(){ data(){
return { return {
category_id:'', category_id:'',
defaultImgPath:process.env.IMAGE_URL_HEAD , defaultImgPath:process.env.IMAGE_URL_HEAD ,
list:[] list:[],
boxDialogObj:{
show:false,
id:'',
category_id:'',
title:'',
type:0
},
} }
}, },
mounted(){ mounted(){
...@@ -53,8 +63,40 @@ ...@@ -53,8 +63,40 @@
this.list = res.list this.list = res.list
}) })
}, },
onEdit(id){
this.boxDialogObj = {
show:true,
type:1,
title:'修改盒子',
id:id,
category_id:this.category_id
}
},
onAdd(){
this.boxDialogObj = {
show:true,
type:0,
title:'添加盒子',
category_id:this.category_id
}
},
changeCategoryId(data){ changeCategoryId(data){
this.category_id = data this.category_id = data
},
delBox(id){
this.$confirm('此操作将删除该盒子?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delBoxApi(id).then(res=>{
this.$message({
type: 'success',
message: '删除成功!'
});
});
this.initPage(this.category_id)
});
} }
}, },
watch:{ watch:{
...@@ -74,7 +116,28 @@ ...@@ -74,7 +116,28 @@
display: block; display: block;
text-align: right; text-align: right;
margin: 10px 0; margin: 10px 0;
}
.card-col{
padding: 15px;
}
.card{
cursor: pointer;
.image{
width: 100%;
height: 300px;
background: #f0f0f0;
display: inline-block;
}
.bottom {
height: 30px;
line-height: 30px;
.btn-block {
float: right;
.el-button {
margin: 0;
}
}
}
} }
} }
......
This diff is collapsed.
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
label="实体包数量"> label="实体包数量">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="250"
label="操作"> label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" plain type="primary" @click="detail(scope.row)"> <el-button size="mini" plain type="primary" @click="detail(scope.row)">
...@@ -126,8 +127,12 @@ ...@@ -126,8 +127,12 @@
this.dialogObj.show = true this.dialogObj.show = true
}, },
add(){ add(){
this.dialogObj.type = 0; this.dialogObj = {
this.dialogObj.show = true type:0,
show:true,
id:'',
title:'新增课程'
}
}, },
detail(data){ detail(data){
this.dialogObj.id = data.id; this.dialogObj.id = data.id;
...@@ -135,7 +140,7 @@ ...@@ -135,7 +140,7 @@
this.dialogObj.show = true this.dialogObj.show = true
}, },
delTeacher(data){ delTeacher(data){
this.$confirm('此操作将删除该账号?', '提示', { this.$confirm('此操作将删除该课程?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
......
...@@ -8,6 +8,6 @@ ...@@ -8,6 +8,6 @@
} }
</script> </script>
<style scoped> <style scoped lang="less">
</style> </style>
<template>
</template>
<script>
export default {
name: "sysConfig"
}
</script>
<style scoped>
</style>
<template>
</template>
<script>
export default {
name: "autoReply"
}
</script>
<style scoped>
</style>
...@@ -22,6 +22,9 @@ import consignment from '@/components/consignment' ...@@ -22,6 +22,9 @@ import consignment from '@/components/consignment'
import notice from '@/components/notice' import notice from '@/components/notice'
import weChat from '@/components/weChat' import weChat from '@/components/weChat'
import help from '@/components/help' import help from '@/components/help'
import sysConfig from '@/components/system/sysConfig'
import autoReply from '@/components/weChat/autoReply'
Vue.use(Router); Vue.use(Router);
const router =new Router({ const router =new Router({
...@@ -56,6 +59,10 @@ const router =new Router({ ...@@ -56,6 +59,10 @@ const router =new Router({
path: '/weChat', path: '/weChat',
name:'weChat', name:'weChat',
component: weChat component: weChat
},{
path: '/autoReply',
name:'autoReply',
component: autoReply
},{ },{
path: '/resources', path: '/resources',
name:'resources', name:'resources',
...@@ -109,6 +116,10 @@ const router =new Router({ ...@@ -109,6 +116,10 @@ const router =new Router({
path: '/order', path: '/order',
name:'order', name:'order',
component: order component: order
},{
path: '/sysConfig',
name:'sysConfig',
component: sysConfig
}, },
] ]
} }
......
...@@ -183,6 +183,22 @@ const getBoxListUrl = `${_baseUrl}api/admin/item/box/list/`; ...@@ -183,6 +183,22 @@ const getBoxListUrl = `${_baseUrl}api/admin/item/box/list/`;
export const getBoxListApi = function (id) { export const getBoxListApi = function (id) {
return Vue.prototype.$fetch(`${getBoxListUrl}${id}`) return Vue.prototype.$fetch(`${getBoxListUrl}${id}`)
}; };
// 添加盒子
const addBoxUrl = `${_baseUrl}api/admin/item/box/add/`;
export const addBoxApi = function (id, json) {
return Vue.prototype.$post(`${addBoxUrl}${id}`,json)
};
// 删除盒子
const delBoxUrl = `${_baseUrl}api/admin/item/box/`;
export const delBoxApi = function (id) {
return Vue.prototype.$del(`${delBoxUrl}${id}`)
};
// 获取盒子详情
const getBoxDetailUrl = `${_baseUrl}api/admin/item/box/info/`;
export const getBoxDetailApi = function (id) {
return Vue.prototype.$fetch(`${getBoxDetailUrl}${id}`)
};
// 获取公众号菜单 // 获取公众号菜单
const getPublicMenuUrl = `${_baseUrl}api/admin/open/menu`; const getPublicMenuUrl = `${_baseUrl}api/admin/open/menu`;
export const getPublicMenuApi = function (id) { export const getPublicMenuApi = function (id) {
......
...@@ -35,7 +35,11 @@ export default [ ...@@ -35,7 +35,11 @@ export default [
value:'期数列表', value:'期数列表',
routerName:'periods', routerName:'periods',
path:'/periods' path:'/periods'
} },{
value:'不上课日期',
routerName:'noLesson',
path:'/noLesson'
},
] ]
},{ },{
name: '', name: '',
...@@ -106,6 +110,11 @@ export default [ ...@@ -106,6 +110,11 @@ export default [
routerName:'notice', routerName:'notice',
path:'/notice' path:'/notice'
}, },
{
value:'回复设置',
routerName:'autoReply',
path:'/autoReply'
},
{ {
value:'公众号', value:'公众号',
routerName:'weChat', routerName:'weChat',
...@@ -129,6 +138,10 @@ export default [ ...@@ -129,6 +138,10 @@ export default [
value:'权限管理', value:'权限管理',
routerName:'permission', routerName:'permission',
path:'/permission' path:'/permission'
},{
value:'系统配置',
routerName:'sysConfig',
path:'/sysConfig'
} }
] ]
},{ },{
......
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