Commit cfb2884e authored by 王's avatar

公众号bug

parent 4e44ee79
......@@ -54,8 +54,8 @@
<div class="menu_form_hd flex-bt">
<h4 class="global_info"> {{selectedItem && selectedItem.name}} </h4>
<div class="global_extra">
<a v-if="selectedChildIndex === -1" href="javascript:void(0);">删除菜单</a>
<a v-else href="javascript:void(0);">删除子菜单</a>
<a v-if="selectedChildIndex === -1" href="javascript:void(0);" @click="delMenu">删除菜单</a>
<a v-else href="javascript:void(0);" @click="delSubMenu">删除子菜单</a>
</div>
</div>
<div class="menu_form_bd" id="view">
......@@ -121,6 +121,7 @@
<script>
import {getPublicMenuApi, savePublicMenuApi} from "../../service/api";
import { MessageBox } from 'element-ui';
export default {
name: "index",
data(){
......@@ -184,19 +185,33 @@
getPublicMenuApi().then(res=> {
if (res.menu && res.menu.button) {
this.buttonList = res.menu.button
let selectedMenu = this.buttonList[this.selectedIndex]
let subButton = selectedMenu.sub_button
this.selectedItem = {
name: '子菜单名',
sub_button: [],
type: 'view',
url: ''
}
subButton.push(this.selectedItem)
this.selectedChildIndex = subButton.length - 1
this.buttonList[this.selectedIndex].sub_button.push(this.selectedItem)
this.selectedChildIndex = this.buttonList[this.selectedIndex].sub_button.length - 1
}
})
},
delSubMenu(){
this.$confirm('此操作将删除该子菜单?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
getPublicMenuApi().then(res => {
if (res.menu && res.menu.button) {
this.buttonList = res.menu.button
this.buttonList[this.selectedIndex].sub_button.splice(this.selectedChildIndex, 1)
this.selectedChildIndex = this.buttonList[this.selectedIndex].sub_button.length - 1
this.selectedItem = this.selectedChildIndex > -1 ? this.buttonList[this.selectedIndex][this.selectedChildIndex] : this.buttonList[this.selectedIndex]
}
});
});
},
onAddMenu(){
getPublicMenuApi().then(res=> {
if (res.menu && res.menu.button) {
......@@ -213,6 +228,26 @@
}
})
},
delMenu(){
this.$confirm('此操作将删除该菜单?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
getPublicMenuApi().then(res=> {
if (res.menu && res.menu.button) {
this.buttonList = res.menu.button
this.buttonList.splice(this.selectedIndex,1)
this.selectedItem = this.buttonList.length > 0 ? this.buttonList[0] : {
name: '菜单名',
sub_button: [],
type: 'view',
url: ''}
this.selectedChildIndex = -1
}
})
});
},
onTypeChange(val){
console.log('onTypeChange', val)
},
......@@ -228,11 +263,19 @@
buttons: JSON.stringify(buttonList)
}
savePublicMenuApi(json).then(res=>{
this.$message({
type: 'success',
message: '保存成功!'
});
this.getMenu();
if (res.errcode === 0){
this.$message({
type: 'success',
message: '保存成功!'
});
this.getMenu();
} else {
MessageBox({
title:'错误!',
message:res.errmsg,
type:'error',
})
}
})
}
......
......@@ -28,10 +28,9 @@
class="upload-demo"
ref="upload"
action="/api/public/upload/zone"
:data="uploadParam"
:show-file-list="false"
:on-success="handleUploadSuccess"
>
:http-request="uploadFile"
:show-file-list="false">
<!--:on-success="handleUploadSuccess"-->
<el-button style="order:2;" slot="trigger" size="small" type="primary">选取文件</el-button>
<!--<div slot="tip" class="el-upload__tip">大小不超过5M</div>-->
</el-upload>
......@@ -66,9 +65,9 @@
</template>
<script>
import {getMediaListApi} from "../../service/api";
import {getMediaListApi,uploadFileApi} from "../../service/api";
export default {
name: "weChatResource",
name: "resource",
data() {
return {
mediaList: [],
......@@ -119,6 +118,12 @@
if (res.code === 200) {
this.imageList = [{name:res.data.url,url:process.env.IMAGE_URL_HEAD + res.data.url}]
}
},
uploadFile(a) {
this.$store.dispatch('setProgress',{type:'new',id:a.file.uid});
uploadFileApi({file:a.file,type:'wechat'}).then(res=>{
this.imageList = [{name:res.data.url,url:process.env.IMAGE_URL_HEAD + res.data.url}]
})
}
}
}
......
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