Commit cfb2884e authored by 王's avatar

公众号bug

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