Commit 22923a51 authored by FE-安焕焕's avatar FE-安焕焕 👣

修改菜单跳转。上传文件显示问题

parent c9de8cc3
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
<Col span="3" class="aside" style="width:17%;height:100%"> <Col span="3" class="aside" style="width:17%;height:100%">
<img src="https://o7oe0d6qz.qnssl.com/image/homelogo.png" alt="" style="height:60px"> <img src="https://o7oe0d6qz.qnssl.com/image/homelogo.png" alt="" style="height:60px">
<Menu style="width: 100%;" ref='subMenu' :active-name="vSubName" :open-names="vName" @on-select="go"> <Menu style="width: 100%;" ref='subMenu' :active-name="vSubName" :open-names="vName" @on-select="go">
<template v-for="menu in childMenu" > <template v-for="(menu, index) in childMenu" >
<Submenu :name="menu.name" :key="menu.name" v-show='!(isadmin==false&&menu.item=="账户管理")'> <Submenu :name="menu.name" :key="menu.name" v-show='!(isAdmin==false&&menu.item=="账户管理")'>
<template slot="title"> <template slot="title">
<Icon type="ios-paper"/> <Icon :type="menu.icon"/>
{{menu.item}} {{menu.item}}
</template> </template>
<MenuItem v-for="child in menu.child" :key="child.name" :name="child.name" @click="go">{{child.item}}</MenuItem> <MenuItem v-for="child in menu.child" :key="child.name" :name="child.name" @click="go" :active-name="vSubName">{{child.item}}</MenuItem>
</Submenu> </Submenu>
</template> </template>
</Menu> </Menu>
...@@ -43,6 +43,7 @@ import localstorage from '../service/localstorage.service.js' ...@@ -43,6 +43,7 @@ import localstorage from '../service/localstorage.service.js'
data() { data() {
return { return {
massage:'', massage:'',
isAdmin: false,
arr:[], arr:[],
biaoshi:'', biaoshi:'',
channelARR:[], channelARR:[],
...@@ -53,45 +54,131 @@ import localstorage from '../service/localstorage.service.js' ...@@ -53,45 +54,131 @@ import localstorage from '../service/localstorage.service.js'
xiabiao:'', xiabiao:'',
itemSelect:'', itemSelect:'',
type:'', type:'',
name: '1', hName: '',
hName: '1', vName: ['1-1', '2-1', '3-1', '4-1'],
vName: ['1'], vSubName: '1-1-1',
vSubName: '1-1',
typearr:['"ios-apps-outline"','"ios-list"','"ios-paper-outline"','"ios-cloud-upload-outline"','"ios-contact-outline"','"ios-mail-outline"','"ios-qr-scanner"'],
menuList: [ menuList: [
{ name: '1', item: '简历管理', child: [{ name: '1', item: '全部管理', child: [{ name: '1-1', item:'全部简历', route: '/allResume' }] }, { name: '1',
{ name: '2', item: '渠道简历', child: [] }]}, item: '简历管理',
{ name: '2', item: '面试管理', child: [{ name: '1', item: '面试管理', child: [{ name: '1-1', item:'全部简历', route: '/interview' }] }] }, child: [
{ name: '3', item: '上传简历', child: [{ name: '1', item: '上传简历', child: [{ name: '1-1', item:'上传简历', route: '/upload' }] }] }, {
{ name: '4', item: '系统管理', child: [{ name: '1', item: '账户管理', child: [{ name: '1-1', item:'账户管理', route: '/account' }] }, name: '1-1',
{ name: '2', item: '邮箱管理', child: [{ name: '2-1', item:'邮箱管理', route: '/emailMange' }] }, item: '全部管理',
{ name: '3', item: '二维码管理', child: [{ name: '3-1', item:'二维码管理', route: '/QRcode' }] } icon: 'ios-apps-outline',
child: [
{
name: '1-1-1',
item:'全部简历',
route: '/allResume'
}
]
},
{ name: '1-2',
item: '渠道简历',
icon: 'ios-list',
child: []
}]
},
{ name: '2',
item: '面试管理',
child: [
{ name: '2-1',
item: '面试管理',
icon: 'ios-paper-outline',
child: [
{ name: '2-1-1',
item:'全部简历',
route: '/interview'
}]
}]
},
{ name: '3',
item: '上传简历',
child: [{
name: '3-1',
item: '上传简历',
icon: 'ios-cloud-upload-outline',
child: [
{ name: '3-1-1',
item:'上传简历',
route: '/upload'
}]
}]
},
{ name: '4',
item: '系统管理',
child: [{
name: '4-1',
item: '账户管理',
icon: 'ios-contact-outline',
child: [{
name: '4-1-1',
item:'账户管理',
route: '/account'
}]
},
{ name: '4-2',
item: '邮箱管理',
icon:'ios-mail-outline',
child: [{
name: '4-2-1',
item:'邮箱管理',
route: '/emailMange'
}]},
{ name: '4-3',
item: '二维码管理',
icon: 'ios-qr-scanner',
child: [
{ name: '4-3-1',
item:'二维码管理',
route: '/QRcode'
}]}
] }, ] },
], ],
childMenu: [{ name: '1', item: '全部简历', child: [{ name: '1-1', item:'全部简历', route: '' }] }, childMenu: [{ name: '1-1', item: '全部管理', child: [{ name: '1-1-1', item:'全部简历', route: '/allResume' }] },
{ name: '2', item: '渠道简历', child: [{ name: 'name', item:'item', route: 'router' }] }] { name: '1-2', item: '渠道简历', child: [] }]
}
},
watch:{
$route(to,from){
if (to.params.fromInterview){
this.getActiveName()
}
} }
}, },
methods: { methods: {
go(name) { go(name) {
let vName = name.split('-')[0] this.vSubName = name
const menu = this.childMenu.filter(v => vName === v.name) this.childMenu.map(par => {
const route = menu.length === 1 ? menu[0].child.filter(v => name === v.name)[0].route :'' par.child.map(child => {
this.$router.push(route) if (child.name == name) {
this.$router.push(child.route)
}
})
})
}, },
selectMenu(name) { selectMenu(name, type) {
// type是否为刷新页面
this.hName = name
const menus = this.menuList.filter(v => name === v.name) const menus = this.menuList.filter(v => name === v.name)
this.childMenu = menus.length > 0 ? menus[0].child : [{ name: '1', item: '全部简历', child: [{ name: '1-1', item:'全部简历', route: '/user/login' }] }] this.childMenu = menus.length > 0 ? menus[0].child : [{ name: '1-1', item: '全部管理', child: [{ name: '1-1-1', item:'全部简历', route: '/allResume' }] },{ name: '1-2', item: '渠道简历', child: [] }]
if(name=='4' &&this.isadmin==false){ if (!type) { // 点击菜单默认展示第一个菜单
this.vSubName='2-1' this.vName = []
}else{ this.vName[0] = ((name == '4') && this.isAdmin && this.childMenu[0].name) || ((name == '4') && !this.isAdmin && this.childMenu[1].name) || this.childMenu[0].name
this.vSubName='1-1' this.vSubName = ((name == '4') && this.isAdmin && this.childMenu[0].child[0].name) || ((name == '4') && !this.isAdmin && this.childMenu[1].child[0].name) || this.childMenu[0].child[0].name
}
if (name == '1') { // 简历管理模块需要加载渠道简历
this.getChannelMenu()
} }
if(name=='1'){ if (type&&this.$route.path.indexOf('channel') > -1) {
this.menuList[0].child[1].child=[] this.vSubName = this.$route.path.split('/')[2]
this.a() }
} this.$nextTick(() => {
this.$refs.subMenu.updateOpened();
this.$refs.subMenu.updateActiveName();
})
this.go(this.vSubName) this.go(this.vSubName)
}, },
// 获取个人信息 // 获取个人信息
...@@ -110,12 +197,13 @@ import localstorage from '../service/localstorage.service.js' ...@@ -110,12 +197,13 @@ import localstorage from '../service/localstorage.service.js'
} }
}) })
}, },
a(){ getChannelMenu(){
this.menuList[0].child[1].child = []
getChannelMassage().then(res=>{ getChannelMassage().then(res=>{
this.channelARR=res.data.body this.channelARR=res.data.body
this.channelARR.map((item,index) => { this.channelARR.map((item,index) => {
var obj = { var obj = {
name: `2-${index+1}`, name: `${item.sourceName}`,
item: item.sourceName, item: item.sourceName,
route: `/channel/${item.sourceCode}` route: `/channel/${item.sourceCode}`
} }
...@@ -123,39 +211,42 @@ import localstorage from '../service/localstorage.service.js' ...@@ -123,39 +211,42 @@ import localstorage from '../service/localstorage.service.js'
}) })
}) })
}, },
c(){ getActiveName (change) {
this.typearr.map((item,index)=>{ let pathName = this.$route.path
this.type=item if (pathName.indexOf('channel') > -1) {
console.log(item) this.hName = '1'
}) this.vSubName = pathName.split('/')[2]
}, this.vName = []
getActiveName () { this.vName.push('1-2')
this.selectMenu(this.hName, 'refresh')
return
}
this.menuList.map(parent => { this.menuList.map(parent => {
parent.child.map(child => { parent.child.map(child => {
child.child.map(grandson => { child.child.map(grandson => {
if (grandson.route == this.$route.path) { if (grandson.route == pathName) {
this.vSubName = grandson.name this.vSubName = grandson.name
this.hName = parent.name this.hName = parent.name
this.vName = []
this.vName.push(child.name)
} }
}) })
}) })
}) })
this.selectMenu(this.hName) this.selectMenu(this.hName, 'refresh')
}, },
// 判断是否为超级管理员 // 判断是否为超级管理员
judgeadmin(){ judgeadmin(){
judeAdmin().then(res=>{ judeAdmin().then(res=>{
this.isadmin=res.data.body this.isAdmin=res.data.body
}) })
} }
}, },
mounted() { mounted() {
this.getmassage() this.getmassage()
// this.getMenu()
this.getActiveName() this.getActiveName()
this.judgeadmin() this.judgeadmin()
this.c()
} }
} }
</script> </script>
......
...@@ -1035,7 +1035,7 @@ import Router from 'vue-router'; ...@@ -1035,7 +1035,7 @@ import Router from 'vue-router';
}, },
// 跳转到面试管理 // 跳转到面试管理
tointerview(){ tointerview(){
this.$router.push('/interview') this.$router.push({name:'interview',params:{fromInterview:true}})
}, },
// 刷新列表 // 刷新列表
pushlist(){ pushlist(){
......
...@@ -179,7 +179,7 @@ import {getuploadNumber,uploadfile,serchList,serchRESUMEdetail,deleteREsumeUPLOa ...@@ -179,7 +179,7 @@ import {getuploadNumber,uploadfile,serchList,serchRESUMEdetail,deleteREsumeUPLOa
import { import {
sapi sapi
} from '../../config/env.config' } from '../../config/env.config'
import ajax from '../../service/ajax' import {uploadFile} from '../../service/ajax'
export default { export default {
data () { data () {
return { return {
...@@ -289,7 +289,7 @@ import ajax from '../../service/ajax' ...@@ -289,7 +289,7 @@ import ajax from '../../service/ajax'
return return
} }
this.uploadModal = true this.uploadModal = true
ajax({ uploadFile({
headers: this.headers, headers: this.headers,
data: this.dataList, data: this.dataList,
batchNum: this.batchNum, batchNum: this.batchNum,
...@@ -298,7 +298,9 @@ import ajax from '../../service/ajax' ...@@ -298,7 +298,9 @@ import ajax from '../../service/ajax'
appendName: 'batchNum', appendName: 'batchNum',
appendFile: 'recFile', appendFile: 'recFile',
onProgress: e => { onProgress: e => {
this.handleProgress(e); setTimeout(() => {
this.handleProgress(e);
}, 200)
}, },
onSuccess: res => { onSuccess: res => {
this.handleSuccess(res, this.files); this.handleSuccess(res, this.files);
...@@ -320,18 +322,18 @@ import ajax from '../../service/ajax' ...@@ -320,18 +322,18 @@ import ajax from '../../service/ajax'
let data = res.body let data = res.body
for(let key in data){ for(let key in data){
let code = data[key].code let code = data[key].code
if (code == '900') { // if (code == '900') {
this.$Notice.error({render:(h) => {return h('div', {style: { // this.$Notice.error({render:(h) => {return h('div', {style: {
paddingRight: '10px', // paddingRight: '10px',
fontSize: '14px', // fontSize: '14px',
color: '#17233d' // color: '#17233d'
}}, '您的账号已在其他地方登录,如不是您个人操作,请及时修改密码')}}) // }}, '您的账号已在其他地方登录,如不是您个人操作,请及时修改密码')}})
this.$router.replace({name: 'login'}) // this.$router.replace({name: 'login'})
} // }
if (code == '902') { // if (code == '902') {
Notice.error({title:'cookie已失效,请重新登录'}) // Notice.error({title:'cookie已失效,请重新登录'})
this.$router.replace({name: 'login'}) // this.$router.replace({name: 'login'})
} // }
this.Code=data[key].code this.Code=data[key].code
this.Massage=data[key].message this.Massage=data[key].message
this.dataList.map(item => { this.dataList.map(item => {
......
// https://github.com/ElemeFE/element/blob/dev/packages/upload/src/ajax.js // https://github.com/ElemeFE/element/blob/dev/packages/upload/src/ajax.js
import axios from './http.service.js'
function getError(action, option, xhr) { function getError(action, option, xhr) {
const msg = `fail to post ${action} ${xhr.status}'`; const msg = `fail to post ${action} ${xhr.status}'`;
const err = new Error(msg); const err = new Error(msg);
...@@ -21,7 +21,29 @@ function getBody(xhr) { ...@@ -21,7 +21,29 @@ function getBody(xhr) {
return text; return text;
} }
} }
export function uploadFile (option) {
const action = option.action;
const formData = new FormData();
if (option.data) {
option.data.map(item => {
formData.append(option.appendFile, item.data)
})
}
formData.append(option.appendName, option.batchNum);
axios.post(action, formData, {
onUploadProgress: function(progressEvent){
if (progressEvent.total > 0) {
progressEvent.percent = (progressEvent.loaded / progressEvent.total * 100);
}
option.onProgress(progressEvent);
}
}).then((res) => {
option.onSuccess(res.data)
}).catch((error) => {
option.onError(error)
})
}
export default function upload(option) { export default function upload(option) {
if (typeof XMLHttpRequest === 'undefined') { if (typeof XMLHttpRequest === 'undefined') {
return; return;
...@@ -33,7 +55,7 @@ export default function upload(option) { ...@@ -33,7 +55,7 @@ export default function upload(option) {
if (xhr.upload) { if (xhr.upload) {
xhr.upload.onprogress = function progress(e) { xhr.upload.onprogress = function progress(e) {
if (e.total > 0) { if (e.total > 0) {
e.percent = e.loaded / e.total * 100; e.percent = (e.loaded / e.total * 100 -10 );
} }
option.onProgress(e); option.onProgress(e);
}; };
......
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