Commit de3d4ef4 authored by 王's avatar

优化

parent ecbafa04
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
<el-col :span="24"> <el-col :span="24">
<el-form-item prop="title" label="盒子首图"> <el-form-item prop="title" label="盒子首图">
<el-upload <el-upload
action="/api/public/upload" action="/api/public/upload/zone"
:http-request="uploadFile"
:class="{disabled:!uploadShow}" :class="{disabled:!uploadShow}"
:before-upload="beforeAvatarUpload" :before-upload="beforeAvatarUpload"
list-type="picture-card" list-type="picture-card"
...@@ -80,7 +81,7 @@ ...@@ -80,7 +81,7 @@
</template> </template>
<script> <script>
import {getSingleListApi,addBoxApi,getBoxDetailApi,editBoxApi} from "../../service/api"; import {getSingleListApi,addBoxApi,getBoxDetailApi,editBoxApi,uploadFileApi} from "../../service/api";
export default { export default {
name: "boxDialog", name: "boxDialog",
props:[ props:[
...@@ -199,6 +200,21 @@ ...@@ -199,6 +200,21 @@
handleAvatarSuccess(res) { handleAvatarSuccess(res) {
this.imageList = [{name:res.data.url,url:process.env.IMAGE_URL_HEAD + res.data.url}] this.imageList = [{name:res.data.url,url:process.env.IMAGE_URL_HEAD + res.data.url}]
}, },
uploadFile(a) {
this.loading = true;
this.$store.dispatch('setProgress',{type:'new',id:a.file.uid});
this.fileUid = a.file.uid;
uploadFileApi({file:a.file,type:'local'}).then(res=>{
this.imageList = [{name:res.url,url:process.env.IMAGE_URL_HEAD + res.url}]
this.loading = false;
this.$message({
type: 'success',
message: '上传成功!'
});
}).catch(()=>{
this.loading = false;
})
}
}, },
watch:{ watch:{
'boxDialogObj'(value){ 'boxDialogObj'(value){
......
...@@ -4,6 +4,15 @@ ...@@ -4,6 +4,15 @@
:visible.sync="dialogObj.show" :visible.sync="dialogObj.show"
> >
<el-form ref="form" :model="form" label-width="120px"> <el-form ref="form" :model="form" label-width="120px">
<el-form-item label="期数" v-if="this.dialogObj.type !==1">
<el-cascader
:options="goodsList"
:props="{value:'id',label:'name'}"
@active-item-change="handleItemChange"
@change="changePeriods"
>
</el-cascader>
</el-form-item>
<el-form-item label="老师"> <el-form-item label="老师">
<el-select v-model="form.teacher_id" placeholder="请选择"> <el-select v-model="form.teacher_id" placeholder="请选择">
<el-option <el-option
...@@ -26,7 +35,7 @@ ...@@ -26,7 +35,7 @@
</template> </template>
<script> <script>
import {getTeacherListApi,getClassDetailApi,editClassApi,addClassApi} from "../../service/api"; import {getTeacherListApi,getClassDetailApi,editClassApi,addClassApi,getPeriodsApi,getGoodsListApi} from "../../service/api";
export default { export default {
props:[ props:[
'dialogObj' 'dialogObj'
...@@ -37,7 +46,9 @@ ...@@ -37,7 +46,9 @@
teacher_id:'', teacher_id:'',
max_join_num:'' max_join_num:''
}, },
teacherList:[] teacherList:[],
goodsList: [],
periods: {}
} }
}, },
methods:{ methods:{
...@@ -47,6 +58,7 @@ ...@@ -47,6 +58,7 @@
}); });
switch (this.dialogObj.type) { switch (this.dialogObj.type) {
case 0: case 0:
this.getPeriodList();
this.form = { this.form = {
teacher_id:'', teacher_id:'',
max_join_num:'' max_join_num:''
...@@ -61,10 +73,25 @@ ...@@ -61,10 +73,25 @@
}) })
} }
}, },
getPeriodList(){
getGoodsListApi().then(res=>{
res.list.forEach(i=>{
i.children = [];
});
this.goodsList = res.list;
if(!this.periods) {
getPeriodsApi({goods_id:this.goodsList[0].id}).then(res=>{
res.list.forEach(i=>{i.name = i.title});
this.goodsList[0].children = res.list;
this.periods = res.list[0]
})
}
});
},
onSave(){ onSave(){
switch (this.dialogObj.type) { switch (this.dialogObj.type) {
case 0: case 0:
addClassApi(this.dialogObj.periodsId,this.form).then(res=>{ addClassApi(this.periods.id,this.form).then(res=>{
this.$message({ this.$message({
type: 'success', type: 'success',
message: '添加成功!' message: '添加成功!'
...@@ -83,6 +110,19 @@ ...@@ -83,6 +110,19 @@
this.dialogObj.show = false; this.dialogObj.show = false;
}) })
} }
},
handleItemChange(val){
getPeriodsApi({goods_id:val[0]}).then(res=>{
res.list.forEach(i=>{i.name = i.title});
this.goodsList.find(i=>{return i.id === val[0]}).children = res.list
})
},
changePeriods(data){
if(data.length>1){
let nowGoods = this.goodsList.find(i=>{return i.id === data[0]});
this.periods = nowGoods.children.find(i=>{return i.id === data[1]});
this.getTeacher()
}
} }
}, },
watch:{ watch:{
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<el-form-item label="课程封面"> <el-form-item label="课程封面">
<el-upload <el-upload
action="/api/public/upload" action="/api/public/upload"
:http-request="uploadFileMain"
:class="{disabled:!uploadShow}" :class="{disabled:!uploadShow}"
:before-upload="beforeAvatarUpload" :before-upload="beforeAvatarUpload"
list-type="picture-card" list-type="picture-card"
...@@ -79,7 +80,7 @@ ...@@ -79,7 +80,7 @@
</template> </template>
<script> <script>
import {getCategoryApi,getBoxTypeListApi,addLessonApi,getLessonDetailApi,editLessonApi} from "../../service/api"; import {getCategoryApi,getBoxTypeListApi,addLessonApi,getLessonDetailApi,editLessonApi,uploadFileApi} from "../../service/api";
export default { export default {
name: "dialogObj", name: "dialogObj",
props:[ props:[
...@@ -218,6 +219,7 @@ ...@@ -218,6 +219,7 @@
cover:'', cover:'',
}; };
this.imageList = [{name:res.cover,url:process.env.IMAGE_URL_HEAD + res.cover}]; this.imageList = [{name:res.cover,url:process.env.IMAGE_URL_HEAD + res.cover}];
this.uploadShow = false;
this.selectedLessonList = []; this.selectedLessonList = [];
this.selectedBoxList = []; this.selectedBoxList = [];
if(res.type === 0){ if(res.type === 0){
...@@ -263,6 +265,19 @@ ...@@ -263,6 +265,19 @@
handleAvatarSuccess(res) { handleAvatarSuccess(res) {
this.imageList = [{name:res.data.url,url:process.env.IMAGE_URL_HEAD + res.data.url}] this.imageList = [{name:res.data.url,url:process.env.IMAGE_URL_HEAD + res.data.url}]
}, },
uploadFileMain(a){
this.$store.dispatch('setProgress',{type:'new',id:a.file.uid});
this.fileUid = a.file.uid;
uploadFileApi({file:a.file,type:'local'}).then(res=>{
if(this.form.goods_desc.img){
this.form.goods_desc.img[0] = {name:res.url,url:process.env.IMAGE_URL_HEAD + res.url,title:'',lable:''}
}else{
this.form.goods_desc.img=[];
this.form.goods_desc.img[0] = {name:res.url,url:process.env.IMAGE_URL_HEAD + res.url,title:'',lable:''}
}
})
}
}, },
watch:{ watch:{
dialogObj(){ dialogObj(){
...@@ -300,3 +315,9 @@ ...@@ -300,3 +315,9 @@
text-align: left; text-align: left;
} }
</style> </style>
<style>
.disabled .el-upload--picture-card {
display: none !important;
}
</style>
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<el-form-item> <el-form-item>
<el-button @click="onChoose" type="success">选择商品</el-button> <el-button @click="onChoose" type="success">选择商品</el-button>
</el-form-item> </el-form-item>
<el-form-item style="float: right"> <el-form-item>
<el-button @click="onSearch" type="primary">查询</el-button> <el-button @click="onSearch" type="primary">查询</el-button>
</el-form-item> </el-form-item>
<el-form-item style="float: right"> <el-form-item style="float: right">
......
...@@ -6,24 +6,13 @@ ...@@ -6,24 +6,13 @@
:visible.sync="dialogObj.show" :visible.sync="dialogObj.show"
width="800px"> width="800px">
<div v-loading="loading"> <div v-loading="loading">
<el-form ref="form" :model="form" label-width="120px"> <el-form ref="form" :model="form" label-width="200px" :disabled="dialogObj.type === 2">
<el-form-item label="商品名称"> <el-form-item label="商品名称">
<el-input v-model="form.name"></el-input> <el-input v-model="form.name"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="商品描述"> <el-form-item label="商品描述">
<el-input v-model="form.goods_desc.desc"></el-input> <el-input v-model="form.goods_desc.desc"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="主图">
<el-upload
list-type="picture-card"
class="upload-demo"
action="/api/public/upload"
:http-request="uploadFileMain"
:file-list="form.goods_desc.img"
>
<i class="el-icon-plus"></i>
</el-upload>
</el-form-item>
<el-form-item label="商品类型"> <el-form-item label="商品类型">
<el-select v-model="form.goods_type" placeholder="请选择"> <el-select v-model="form.goods_type" placeholder="请选择">
<el-option <el-option
...@@ -36,6 +25,28 @@ ...@@ -36,6 +25,28 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="主图">
<el-upload
list-type="picture-card"
class="upload-demo"
action="/api/public/upload"
:http-request="uploadFileMain"
:file-list="form.goods_desc.img"
>
<i class="el-icon-plus"></i>
</el-upload>
</el-form-item>
<el-form-item label="客服">
<el-upload
list-type="picture-card"
class="upload-demo"
action="/api/public/upload"
:http-request="uploadFileMainService"
:file-list="form.desc.customer_service"
>
<i class="el-icon-plus"></i>
</el-upload>
</el-form-item>
<el-form-item label="课程类型"> <el-form-item label="课程类型">
<el-select v-model="form.course_type" placeholder="请选择" @change="changeLessonType()"> <el-select v-model="form.course_type" placeholder="请选择" @change="changeLessonType()">
<el-option <el-option
...@@ -69,21 +80,40 @@ ...@@ -69,21 +80,40 @@
v-model="form.is_real" v-model="form.is_real"
:active-value="1" :active-value="1"
:inactive-value="0"> :inactive-value="0">
</el-switch> </el-switch> <span>打开后提示用户填写具体住址</span>
</el-form-item>
<el-form-item label="是否可以分享">
<el-switch
v-model="form.is_auth_user"
:active-value="1"
:inactive-value="0">
</el-switch>
</el-form-item> </el-form-item>
<el-form-item label="原价"> <template v-if="form.goods_type === 1">
<el-form-item label="是否可以给用户分享">
<el-switch
v-model="form.is_auth_user"
:active-value="1"
:inactive-value="0">
</el-switch>
</el-form-item>
<el-form-item label="是否可以给老师分享">
<el-switch
v-model="form.is_auth_teacher"
:active-value="1"
:inactive-value="0">
</el-switch>
</el-form-item>
<el-form-item label="推荐奖金">
<el-input-number v-model="form.invite_earnings" label="推荐奖金"></el-input-number>
</el-form-item>
</template>
<el-form-item :label="form.goods_type === 1 ? '原价' : '拼团价格'">
<el-input-number v-model="form.original_price" label="原价"></el-input-number> <el-input-number v-model="form.original_price" label="原价"></el-input-number>
</el-form-item> </el-form-item>
<el-form-item label="现价"> <el-form-item :label="form.goods_type === 1 ? '现价' : '单买价格'">
<el-input-number v-model="form.current_price" label="现价"></el-input-number> <el-input-number v-model="form.current_price" label="现价"></el-input-number>
</el-form-item> </el-form-item>
<el-form-item label="成团人数" v-if="form.goods_type === 2">
<el-input-number v-model="form.desc.group_number" label="成团人数"></el-input-number>
</el-form-item>
<el-form-item label="团购失效时间" v-if="form.goods_type === 2">
<el-input-number v-model="form.desc.group_continue" label="团购失效时间"></el-input-number>小时
</el-form-item>
<el-form-item label="分享标题"> <el-form-item label="分享标题">
<el-input v-model="form.share_desc.title" style="width: 200px"></el-input> <el-input v-model="form.share_desc.title" style="width: 200px"></el-input>
</el-form-item> </el-form-item>
...@@ -107,8 +137,8 @@ ...@@ -107,8 +137,8 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer" v-if="dialogObj.type !== 2">
<el-button @click="show = false">取 消</el-button> <el-button @click="dialogObj.show = false">取 消</el-button>
<el-button type="primary" @click="sub">确 定</el-button> <el-button type="primary" @click="sub">确 定</el-button>
</span> </span>
</div> </div>
...@@ -129,7 +159,7 @@ ...@@ -129,7 +159,7 @@
loading:true, loading:true,
form:{ form:{
name:'', name:'',
goods_type:0, goods_type:1,
goods_desc:{ goods_desc:{
desc:"", desc:"",
img:[] img:[]
...@@ -149,7 +179,8 @@ ...@@ -149,7 +179,8 @@
}, },
desc:{ desc:{
detail:"", detail:"",
qa:"" qa:"",
customer_service:[]
} }
}, },
lessonList:[] lessonList:[]
...@@ -207,6 +238,18 @@ ...@@ -207,6 +238,18 @@
}) })
}, },
uploadFileMainService(a){
this.$store.dispatch('setProgress',{type:'new',id:a.file.uid});
this.fileUid = a.file.uid;
uploadFileApi({file:a.file,type:'local'}).then(res=>{
if(this.form.desc.customer_service){
this.form.desc.customer_service[0] = {name:res.url,url:process.env.IMAGE_URL_HEAD + res.url,title:'',lable:''}
}else{
this.form.desc.customer_service=[];
this.form.desc.customer_service[0] = {name:res.url,url:process.env.IMAGE_URL_HEAD + res.url,title:'',lable:''}
}
})
},
uploadFileShare(a){ uploadFileShare(a){
this.$store.dispatch('setProgress',{type:'new',id:a.file.uid}); this.$store.dispatch('setProgress',{type:'new',id:a.file.uid});
this.fileUid = a.file.uid; this.fileUid = a.file.uid;
...@@ -225,7 +268,7 @@ ...@@ -225,7 +268,7 @@
this.loading = false; this.loading = false;
this.form={ this.form={
name:'', name:'',
goods_type:0, goods_type:1,
goods_desc:{ goods_desc:{
desc:"", desc:"",
img:[] img:[]
...@@ -245,12 +288,13 @@ ...@@ -245,12 +288,13 @@
}, },
desc:{ desc:{
detail:"", detail:"",
qa:"" qa:"",
customer_service:[]
} }
}, },
this.getLessonList(); this.getLessonList();
break; break;
case 1: case 1: case 2:
getGoodsDetailApi(this.dialogObj.id).then(res=>{ getGoodsDetailApi(this.dialogObj.id).then(res=>{
this.loading = false; this.loading = false;
this.form={ this.form={
...@@ -266,12 +310,14 @@ ...@@ -266,12 +310,14 @@
is_real:res.is_real, is_real:res.is_real,
is_auth_user:res.is_auth_user, is_auth_user:res.is_auth_user,
share_desc:JSON.parse(res.share_desc), share_desc:JSON.parse(res.share_desc),
desc:JSON.parse(res.desc) desc:JSON.parse(res.desc),
invite_earnings: res.invite_earnings,
is_auth_teacher: res.is_auth_teacher
}; };
this.getLessonList() this.getLessonList()
}); });
break; break;
case 2: case 3:
this.title = '编辑'; this.title = '编辑';
this.show = this.dialogObj.show; this.show = this.dialogObj.show;
this.id = this.dialogObj.id; this.id = this.dialogObj.id;
......
...@@ -163,7 +163,8 @@ ...@@ -163,7 +163,8 @@
}, },
detail(data){ detail(data){
this.dialogObj.id = data.id; this.dialogObj.id = data.id;
this.dialogObj.type = 1; this.dialogObj.type = 2;
this.dialogObj.title = '查看商品'
this.dialogObj.show = true this.dialogObj.show = true
}, },
onDel(data){ onDel(data){
...@@ -192,8 +193,8 @@ ...@@ -192,8 +193,8 @@
type: 'success', type: 'success',
message: '操作成功!' message: '操作成功!'
}); });
this.getUser()
}); });
this.getUser()
}); });
}, },
onDown(data){ onDown(data){
...@@ -207,8 +208,8 @@ ...@@ -207,8 +208,8 @@
type: 'success', type: 'success',
message: '操作成功!' message: '操作成功!'
}); });
this.getUser()
}); });
this.getUser()
}); });
}, },
changeShow(data){ changeShow(data){
......
...@@ -23,6 +23,16 @@ ...@@ -23,6 +23,16 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row>
<el-col :span="4">
<label>分类</label>
</el-col>
<el-col :span="8">
<el-form-item>
<el-input v-model="form.category_name"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row> <el-row>
<el-col :span="4"> <el-col :span="4">
<label>封面图片</label> <label>封面图片</label>
...@@ -30,7 +40,8 @@ ...@@ -30,7 +40,8 @@
<el-col :span="20"> <el-col :span="20">
<div class="upload-block"> <div class="upload-block">
<el-upload <el-upload
action="/api/public/upload" action="/api/public/upload/zone"
:http-request="uploadFile"
:class="{disabled:!uploadShow}" :class="{disabled:!uploadShow}"
:before-upload="beforeAvatarUpload" :before-upload="beforeAvatarUpload"
list-type="picture-card" list-type="picture-card"
...@@ -52,7 +63,7 @@ ...@@ -52,7 +63,7 @@
</template> </template>
<script> <script>
import {getSingleDetailApi,addSingleApi,editSingleApi} from "../../service/api"; import {getSingleDetailApi,addSingleApi,editSingleApi,uploadFileApi} from "../../service/api";
export default { export default {
name: "dialogObj", name: "dialogObj",
props:[ props:[
...@@ -117,6 +128,21 @@ ...@@ -117,6 +128,21 @@
beforeAvatarUpload(){ beforeAvatarUpload(){
this.uploadShow = false this.uploadShow = false
}, },
uploadFile(a) {
this.loading = true;
this.$store.dispatch('setProgress',{type:'new',id:a.file.uid});
this.fileUid = a.file.uid;
uploadFileApi({file:a.file,type:'local'}).then(res=>{
this.imageList = [{name:res.url,url:process.env.IMAGE_URL_HEAD + res.url}]
this.loading = false;
this.$message({
type: 'success',
message: '上传成功!'
});
}).catch(()=>{
this.loading = false;
})
},
handleRemove(){ handleRemove(){
this.uploadShow = true this.uploadShow = true
}, },
......
...@@ -2,6 +2,12 @@ ...@@ -2,6 +2,12 @@
<div class="single"> <div class="single">
<el-form ref="searchFrom" :model="searchFrom" label-width="80px"> <el-form ref="searchFrom" :model="searchFrom" label-width="80px">
<el-row> <el-row>
<el-col :span="4">
<el-form-item label="分类名称">
<el-input v-model="searchFrom.category_name" placeholder="名称"
size="small"></el-input>
</el-form-item>
</el-col>
<el-col :span="4"> <el-col :span="4">
<el-form-item label="单品名称"> <el-form-item label="单品名称">
<el-input v-model="searchFrom.name" placeholder="名称" <el-input v-model="searchFrom.name" placeholder="名称"
...@@ -13,9 +19,13 @@ ...@@ -13,9 +19,13 @@
<el-button type="primary" plain size="small" @click="initPage"> <el-button type="primary" plain size="small" @click="initPage">
搜索 搜索
</el-button> </el-button>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item>
<el-button type="success" plain size="small" @click="onAdd"> <el-button type="success" plain size="small" @click="onAdd">
添加单品 添加单品
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
...@@ -32,6 +42,10 @@ ...@@ -32,6 +42,10 @@
prop="name" prop="name"
label="名称"> label="名称">
</el-table-column> </el-table-column>
<el-table-column
prop="category_name"
label="分类">
</el-table-column>
<el-table-column <el-table-column
prop="num" prop="num"
sortable sortable
...@@ -85,7 +99,14 @@ ...@@ -85,7 +99,14 @@
}, },
methods:{ methods:{
initPage(){ initPage(){
getSingleListApi(this.searchFrom.name).then(res=>{ let json = {}
if (this.searchFrom.name) {
json.name = this.searchFrom.name
}
if (this.searchFrom.category_name) {
json.category_name = this.searchFrom.category_name
}
getSingleListApi(json).then(res=>{
this.tableData = res.list; this.tableData = res.list;
this.total = res.total this.total = res.total
}) })
......
...@@ -238,18 +238,15 @@ ...@@ -238,18 +238,15 @@
this.loading = true; this.loading = true;
this.$store.dispatch('setProgress',{type:'new',id:a.file.uid}); this.$store.dispatch('setProgress',{type:'new',id:a.file.uid});
this.fileUid = a.file.uid; this.fileUid = a.file.uid;
this.showProgress = true;
uploadFileApi({file:a.file,type:'local'}).then(res=>{ uploadFileApi({file:a.file,type:'local'}).then(res=>{
this.imageList = [{name:res.url,url:process.env.IMAGE_URL_HEAD + res.url}] this.imageList = [{name:res.url,url:process.env.IMAGE_URL_HEAD + res.url}]
this.loading = false; this.loading = false;
this.showProgress = false;
this.$message({ this.$message({
type: 'success', type: 'success',
message: '上传成功!' message: '上传成功!'
}); });
}).catch(()=>{ }).catch(()=>{
this.loading = false; this.loading = false;
this.showProgress = false;
}) })
} }
} }
......
...@@ -54,14 +54,31 @@ ...@@ -54,14 +54,31 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row v-if="type !== 1"> <el-row>
<el-col :span="4"><label>二维码</label></el-col> <el-col :span="4"><label>二维码</label></el-col>
<el-col :span="8"> <el-col :span="8">
<span v-if="type===1">{{teacherDetail.qr}}</span> <img class="qr-img" v-if="type===1" :src="teacherDetail.qr"/>
<el-form-item v-if="type !== 1" prop="qr"> <el-form-item v-if="type !== 1">
<el-input v-model="form.qr"></el-input> <!--<el-input v-model="form.qr"></el-input>-->
<el-upload
action="/api/public/upload/zone"
:http-request="uploadFile"
: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-form-item>
</el-col> </el-col>
<template v-if="type===1">
<el-col :span="4"><label>邀请码</label></el-col>
<el-col :span="8">
<span v-if="type===1">{{teacherDetail.invite_code}}</span>
</el-col>
</template>
</el-row> </el-row>
</el-form> </el-form>
<span slot="footer" class="dialog-footer" v-if="type !== 1"> <span slot="footer" class="dialog-footer" v-if="type !== 1">
...@@ -74,7 +91,7 @@ ...@@ -74,7 +91,7 @@
</template> </template>
<script> <script>
import {getTeacherDetailApi,addTeacherApi,editTeacherApi} from "../../service/api"; import {getTeacherDetailApi,addTeacherApi,editTeacherApi,uploadFileApi} from "../../service/api";
import {TEACHERTYPE} from "../../util/wordbook"; import {TEACHERTYPE} from "../../util/wordbook";
export default { export default {
name: "dialogObj", name: "dialogObj",
...@@ -118,7 +135,7 @@ ...@@ -118,7 +135,7 @@
type:0, type:0,
qr:'', qr:'',
alias:'', alias:'',
status:0, status:0
}, },
rules:{ rules:{
name:[ name:[
...@@ -128,11 +145,16 @@ ...@@ -128,11 +145,16 @@
{ required: true, message: '请输入二维码', trigger: 'change' } { required: true, message: '请输入二维码', trigger: 'change' }
] ]
}, },
teacherDetail:{} teacherDetail:{},
imageList: [],
uploadShow: true
} }
}, },
methods:{ methods:{
sub(){ sub(){
if(this.imageList.length > 0){
this.form.qr = this.imageList[0].url;
}
switch(this.dialogObj.type){ switch(this.dialogObj.type){
case 2: case 2:
this.$refs['form'].validate((valid) => { this.$refs['form'].validate((valid) => {
...@@ -164,6 +186,31 @@ ...@@ -164,6 +186,31 @@
break break
} }
}, },
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}]
},
uploadFile(a) {
this.loading = true;
this.$store.dispatch('setProgress',{type:'new',id:a.file.uid});
this.fileUid = a.file.uid;
uploadFileApi({file:a.file,type:'local'}).then(res=>{
this.imageList = [{name:res.url,url:process.env.IMAGE_URL_HEAD + res.url}]
this.uploadShow = false;
this.loading = false;
this.$message({
type: 'success',
message: '上传成功!'
});
}).catch(()=>{
this.loading = false;
})
},
initDialog(){ initDialog(){
switch(this.dialogObj.type){ switch(this.dialogObj.type){
case 0: case 0:
...@@ -175,6 +222,7 @@ ...@@ -175,6 +222,7 @@
this.form.qr = ""; this.form.qr = "";
this.form.type = 0; this.form.type = 0;
this.form.status = 0; this.form.status = 0;
this.imageList = [];
this.loading = false; this.loading = false;
break; break;
case 1: case 1:
...@@ -198,6 +246,8 @@ ...@@ -198,6 +246,8 @@
this.form.qr = res.qr; this.form.qr = res.qr;
this.form.type = res.type; this.form.type = res.type;
this.form.status = res.status; this.form.status = res.status;
this.imageList = [{name:res.qr,url:res.qr}];
this.uploadShow = !res.qr;
this.loading = false this.loading = false
}); });
break break
...@@ -222,7 +272,7 @@ ...@@ -222,7 +272,7 @@
<style scoped lang="less"> <style scoped lang="less">
.el-col{ .el-col{
height: 50px; min-height: 50px;
text-align: center; text-align: center;
margin-bottom: 20px; margin-bottom: 20px;
line-height: 40px; line-height: 40px;
...@@ -237,8 +287,18 @@ ...@@ -237,8 +287,18 @@
color: #5982e6; color: #5982e6;
} }
} }
.qr-img {
width: 148px !important;
border: none !important;
border-radius: 0 !important;
}
.dialog-footer{ .dialog-footer{
display: block; display: block;
text-align: center; text-align: center;
} }
</style> </style>
<style>
.disabled .el-upload--picture-card {
display: none !important;
}
</style>
...@@ -36,8 +36,16 @@ ...@@ -36,8 +36,16 @@
label="微信号"> label="微信号">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="mobile" prop="invite_code"
label="邀请码">
</el-table-column>
<el-table-column
label="二维码"> label="二维码">
<template slot-scope="scope">
<a :href="scope.row.qr">
<img class="shortcut" :src="scope.row.qr"/>
</a>
</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="类别"> label="类别">
...@@ -132,8 +140,8 @@ ...@@ -132,8 +140,8 @@
type: 'success', type: 'success',
message: '删除成功!' message: '删除成功!'
}); });
this.getUser()
}); });
this.getUser()
}); });
}, },
changeShow(data){ changeShow(data){
...@@ -154,4 +162,7 @@ ...@@ -154,4 +162,7 @@
text-align: center; text-align: center;
} }
} }
.shortcut {
width: 50px;
}
</style> </style>
...@@ -187,8 +187,8 @@ export const delElementApi = function (id) { ...@@ -187,8 +187,8 @@ export const delElementApi = function (id) {
} }
// 获取单品列表 // 获取单品列表
const getSingleListUrl = `${_baseUrl}api/admin/item/stock/list`; const getSingleListUrl = `${_baseUrl}api/admin/item/stock/list`;
export const getSingleListApi = function (name) { export const getSingleListApi = function (json) {
return Vue.prototype.$fetch(`${getSingleListUrl}`,{name:name}) return Vue.prototype.$fetch(`${getSingleListUrl}`,json)
}; };
// 获取单品详情 // 获取单品详情
const getSingleDetailUrl = `${_baseUrl}api/admin/item/stock/info/`; const getSingleDetailUrl = `${_baseUrl}api/admin/item/stock/info/`;
......
...@@ -127,6 +127,11 @@ export default [ ...@@ -127,6 +127,11 @@ export default [
value:'素材管理', value:'素材管理',
routerName:'weChatResource', routerName:'weChatResource',
path:'/weChatResource' path:'/weChatResource'
},
{
value:'Banner管理',
routerName:'banner',
path:'/banner'
} }
] ]
},{ },{
...@@ -138,10 +143,6 @@ export default [ ...@@ -138,10 +143,6 @@ export default [
value:'账号管理', value:'账号管理',
routerName:'admin', routerName:'admin',
path:'/admin' path:'/admin'
},{
value:'Banner管理',
routerName:'banner',
path:'/banner'
},{ },{
value:'角色管理', value:'角色管理',
routerName:'role', routerName:'role',
......
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