Commit 75f91932 by caoyanzhi

init commit

parent 5ef14d31
/*
* @Descripttion: 当前组件信息
* @version: 1.0.0
* @Author: 无尘
* @Date: 2018-10-10 14:44:45
* @LastEditors: 无尘
* @LastEditTime: 2020-07-20 15:30:24
*/
// import Vue from 'vue';
import axios from 'axios';
import qs from 'qs';
import { Message } from 'element-ui';
/**
* 获取好办 企业 id
*/
// if (!!localStorage.getItem('userInfos')) {
// let haobanSign = JSON.parse(localStorage.getItem('userInfos')).enterpriseId;
// axios.defaults.headers.post['haobansign'] = haobanSign;
// axios.defaults.headers.get['haobansign'] = haobanSign;
// }
axios.defaults.timeout = 500000;
let local = window.location.origin;
/* if (local.indexOf('localhost') != -1) {
local = 'http://www.gicdev.com';
} */
let axiosPromiseArr = []; //储存cancel toke
let pending = []; //声明一个数组用于存储每个ajax请求的取消函数和ajax标识
let CancelToken = axios.CancelToken;
let removePending = ever => {
for (let p in pending) {
if (pending[p].u === ever.url + '&' + ever.method) {
//当当前请求在数组中存在时执行函数体
pending[p].f(); //执行取消操作
pending.splice(p, 1); //把这条记录从数组中移除
}
}
};
axios.interceptors.request.use(
config => {
removePending(config); //在一个ajax发送前执行一下取消操作
config.cancelToken = new CancelToken(c => {
// 这里的ajax标识我是用请求地址&请求方式拼接的字符串,当然你可以选择其他的一些方式
pending.push({
u: config.url + '&' + config.method,
f: c
});
});
// 在发送请求设置cancel token
config.cancelToken = new axios.CancelToken(cancel => {
axiosPromiseArr.push({
cancel
});
});
return config;
},
err => {
Message.error({ message: '请求超时!' });
return Promise.resolve(err);
}
);
axios.interceptors.response.use(
data => {
removePending(data.config); //在一个ajax响应后再执行一下取消操作,把已经完成的请求从pending中移除
// console.log(data);
if (data.status && data.status == 200 && data.data.errorCode != 1) {
// Message.error({message: data.data.message});
if (data.data.errorCode == 4) {
if (window.location.href.indexOf('gic-error') != -1) {
return false;
}
window.location.href = local + '/haoban-4/#/login';
}
/* if (data.data.errorCode == 3) {
Message.error({ message: data.data.message });
window.location.href = local + '/haoban-3/#/login';
} */
if (data.data.errorCode == 10 || data.data.errorCode == 7) {
window.location.href = local + '/haoban-4/#/index';
}
return data;
}
return data;
},
err => {
// console.log(err, typeof err, err.response);
if (axios.isCancel(err)) {
// console.log('请求取消');
}
if (err.response.status == 502) {
window.location.href = local + '/haoban-4/#/login';
Message.error({ message: '服务异常⊙﹏⊙∥' });
}
// Message.error({message: err.response.message});
if (err.response.status == 504 || err.response.status == 404) {
// window.location.href= local + "/haoban-3/#/login"
// Message.error({message: '服务异常⊙﹏⊙∥'});
} else if (err.response.status == 403) {
// window.location.href= local + "/haoban-3/#/login"
// Message.error({message: '权限不足,请联系管理员!'});
} else {
window.location.href = local + '/haoban-4/#/login';
Message.error({ message: '登录失效!' });
}
return Promise.resolve(err);
}
);
/*
*
* 统一 get 请求方法
* @url: 请求的 url
* @params: 请求带的参数
* @header: 带 token
*
*/
export const getRequest = (url, params) => {
params.requestProject = 'haoban-manage-web';
return axios({
method: 'get',
url: `${local}${url}`,
data: {},
params: params,
headers: {
'Content-type': 'application/x-www-form-urlencoded'
}
});
};
/**
*
* 统一 post 请求方法
* url: 请求的 url
* @params: 请求带的参数
* @header:
*
*/
export const postRequest = (url, params) => {
params.requestProject = 'haoban-manage-web';
return axios({
method: 'post',
url: `${local}${url}`,
data: qs.stringify(params),
headers: {
'Content-type': 'application/x-www-form-urlencoded'
}
});
};
export const postJsonRequest = (url, params) => {
params.requestProject = 'haoban-manage-web';
return axios({
method: 'post',
url: `${local}${url}`,
data: '{}',
params: params,
headers: { 'Content-Type': 'application/json;charset=UTF-8' }
});
};
/**
* method: 'post'
* 'Content-Type': 'application/json;charset=UTF-8'
* @data: params
* @requestProject: 'haoban-manage-web'
*
*/
export const postJson = (url, params) => {
// params.requestProject = "haoban-manage-web";
return axios({
method: 'post',
url: `${local}${url}`,
data: params,
params: { requestProject: 'haoban-manage-web' },
headers: { 'Content-Type': 'application/json;charset=UTF-8' } //multipart/form-data{"token": token}
});
};
/**
* method: 'post'
* data: params
*
*/
export const postForm = (url, params) => {
params.requestProject = 'haoban-manage-web';
return axios({
method: 'post',
url: `${local}${url}`,
data: params,
headers: {}
});
};
/**
* post excel
*/
export const postExcel = (url, params) => {
params.requestProject = 'haoban-manage-web';
return axios({
method: 'post',
url: `${local}${url}`,
data: qs.stringify(params),
responseType: 'blob',
headers: {
'content-type': 'application/x-www-form-urlencoded'
}
});
};
import getFetch from './getFetch.js';
let api = {
// 获取品牌列表
getBrandList: '/brand-list',
// 获取经营类目
getCategory: '/list-all-businesscategory',
// 编辑、新建品牌
saveBrand: '/brand-save',
// 删除品牌
delBrand: {
url: '/brand-del',
useIntercept: false
},
// 并入、批量并入
mergeBrand: {
url: '/brand-merge',
useIntercept: false
},
// 获取关联商户品牌列表
getConcatBrandList: '/brand-ref-list',
}
api = getFetch(api, '/gic-operation-web');
export default api;
import { request } from '@/utils/request.js';
export default function getFetch (api, baseUrl) {
api = api || {};
let keys = Object.keys(api);
keys.forEach(key => {
let opt = api[key];
if (typeof opt === 'string') opt = { url: opt };
opt.url = `${baseUrl}${opt.url}`;
api[key] = params => request(opt, params);
})
return api;
}
import * as api from './api';
import getFetch from './getFetch.js';
export default api;
let api = {
// 获取用户信息
getUserInfo: '/user/userinfo',
// 登出
getLoginOut: '/logout'
}
api = getFetch(api, '/gic-operation-web');
export default api;
\ No newline at end of file
<!--
* @Descripttion: 当前组件信息
* @version: 1.0.0
* @Author: 无尘
* @Date: 2018-10-10 14:44:45
* @LastEditors: 无尘
* @LastEditTime: 2020-03-11 17:33:01
-->
<template>
<div class="navwrap border-box flex flex-space-between">
<el-breadcrumb separator-class="el-icon-arrow-right">
<template v-for="(item, index) in navpath">
<template v-if="!!item.path">
<el-breadcrumb-item :key="'nav' + index" :to="{ path: item.path }" @click="changeRoute(item.path, item.relocation)">
<span class="el-breadcrumb__inner is-link" @click="changeRoute(item.path, item.relocation)">
{{ item.name }}
</span>
</el-breadcrumb-item>
</template>
<template v-else>
<el-breadcrumb-item :key="'nav' + index">{{ item.name }}</el-breadcrumb-item>
</template>
</template>
</el-breadcrumb>
<div class="my-customer-brand">
<el-tooltip class="item" effect="dark" content="不同品牌的工作台可分别进行管理。点击后切换,可以管理不同品牌下的应用" placement="top-start">
<span class="font-14 color-606266" style="cursor: pointer;padding-bottom: 2px; border-bottom: 1px dashed #2F54EB;">授权商户名称 </span>
</el-tooltip>
<el-select class="p-l-10" v-model="activeBrand" placeholder="请选择" @change="changeSelect">
<el-option v-for="item in brandListData" :key="item.enterpriseId" :label="item.enterpriseName" :value="item.enterpriseId"> </el-option>
</el-select>
</div>
</div>
</template>
<script>
import { postRequest } from '@/api/api';
import errMsg from '@/common/js/error';
export default {
name: 'navpath',
data() {
return {
projectName: 'haoban', // 当前项目名
activeBrand: '',
brandListData: []
};
},
props: {
navpath: {
type: Array,
default: function() {
return [];
}
},
slotFlag: {
type: Boolean,
default: false
},
navtip: {
type: Boolean,
default: false
},
subNavText: {
type: String,
default: ''
}
},
watch: {
brandId: function(newData, oldData) {
const that = this;
that.getBrandData();
}
},
methods: {
changeRoute(path, relocation) {
let that = this;
if (relocation) {
window.location.href = path;
} else {
that.$router.push(path);
}
},
/**
* 选择品牌
*/
changeSelect(val) {
let that = this;
let enterpriseId = '';
that.brandListData.forEach(ele => {
if (ele.enterpriseId == val) {
enterpriseId = ele.enterpriseId;
}
});
that.$emit('selectBrandId', val, enterpriseId);
},
/**
* 获取品牌
*/
getBrandData() {
const that = this;
postRequest('/haoban-manage3-web/wx-enterprise-list', {})
.then(res => {
let resData = res.data;
if (resData.errorCode == 1) {
if (!!resData.result && !!resData.result.length) {
that.brandListData = resData.result;
if (!!that.$route.query.enterpriseId) {
that.activeBrand = that.$route.query.enterpriseId;
that.$emit('selectBrandId', that.$route.query.enterpriseId);
return false;
}
that.activeBrand = that.brandListData[0].enterpriseId;
// 由于门店选择组件中没有品牌id ,只有 groupId
that.$emit('selectBrandId', that.brandListData[0].enterpriseId, that.brandListData[0].enterpriseId);
}
return;
}
errMsg.errorMsg(resData);
})
.catch(function(error) {
that.$message.error({
duration: 1000,
message: error.message
});
});
}
},
mounted() {
const that = this;
that.getBrandData();
}
};
</script>
<style type="text/less" lang="less" scoped>
.navwrap {
height: 48px;
line-height: 48px;
padding: 0 20px;
box-sizing: border-box;
.el-breadcrumb {
line-height: 48px;
}
}
.boxbttom {
border-bottom: 1px solid #e4e7ed;
}
.boxshow {
border-bottom: 1px solid #e4e7ed;
box-shadow: 5px -1px 5px #dfdfdf;
}
.navtitle {
margin: 24px 0 0 0;
font-size: 20px;
color: #303133;
font-weight: 500;
}
.navtip {
width: 100%;
height: 38px;
line-height: 38px;
font-size: 13px;
border-radius: 2px;
color: #606266;
background-color: #f4f4f5;
}
.navmTop {
margin-top: 25px;
}
.navtipcolor {
margin: 0 12px;
color: #2f54eb;
}
.el-breadcrumb__inner.is-link:hover,
.el-breadcrumb__inner a:hover {
color: #2f54eb;
}
.el-breadcrumb__item:last-child .el-breadcrumb__inner,
.el-breadcrumb__item:last-child .el-breadcrumb__inner a,
.el-breadcrumb__item:last-child .el-breadcrumb__inner a:hover,
.el-breadcrumb__item:last-child .el-breadcrumb__inner:hover {
font-weight: 700;
text-decoration: none;
cursor: pointer;
color: #303133;
}
</style>
<!--
* @Descripttion: 当前组件信息
* @version: 1.0.0
* @Author: 无尘
* @Date: 2018-10-10 14:44:45
* @LastEditors: 无尘
* @LastEditTime: 2020-03-11 17:32:16
-->
<template>
<div class="navwrap border-box">
<el-breadcrumb separator-class="el-icon-arrow-right">
<template v-for="(item, index) in navpath">
<template v-if="!!item.path">
<el-breadcrumb-item :key="'nav' + index" :to="{ path: item.path }" @click="changeRoute(item.path, item.relocation)">
<span class="el-breadcrumb__inner is-link" @click="changeRoute(item.path, item.relocation)">
{{ item.name }}
</span>
</el-breadcrumb-item>
</template>
<template v-else>
<el-breadcrumb-item :key="'nav' + index">{{ item.name }}</el-breadcrumb-item>
</template>
</template>
</el-breadcrumb>
</div>
</template>
<script>
import { postRequest } from '@/api/api';
import errMsg from '@/common/js/error';
export default {
name: 'navpath',
data() {
return {
projectName: 'member' // 当前项目名
// navpath: [
// {
// name: '首页',
// path: ''
// },
// {
// name: '会员标签',
// path: ''
// },
// ],
};
},
props: {
navpath: {
type: Array,
default: function() {
return [];
}
},
slotFlag: {
type: Boolean,
default: false
},
navtip: {
type: Boolean,
default: false
},
subNavText: {
type: String,
default: ''
}
},
methods: {
changeRoute(path, relocation) {
let that = this;
if (relocation) {
window.location.href = path;
} else {
that.$router.push(path);
}
},
// get nav path
getNavPath() {
let that = this;
let para = {
project: that.projectName,
path: that.$route.path.split('/')[1]
};
postRequest('/api-auth/get-current-memu-data', para)
.then(res => {
// console.log(res,res.data,res.data.errorCode)
var resData = res.data;
if (resData.errorCode == 0) {
if (!resData.result) {
return false;
}
that.navpath = [];
if (!!resData.result.list && !!resData.result.list.length) {
resData.result.list.forEach(function(ele, index) {
ele.name = ele.menuName;
ele.path = '';
if (index == resData.result.list.length - 1) {
ele.path = '/' + ele.menuUrl;
}
if (index > 0) {
that.navpath.push(ele);
}
});
// that.navpath = resData.result.list
}
// that.navpath[0].name = resData.result.level2.menuName;
// that.navpath[0].path = ''
// that.navpath[1].name = resData.result.level3.menuName;
// that.navpath[1].path = ''
// if (!!resData.result.level4) {
// that.navpath[2] = {
// name:'',
// path: ''
// }
// that.navpath[2].name = resData.result.level4.menuName;
// that.navpath[2].path = ''
// }
return;
}
errMsg.errorMsg(resData);
})
.catch(function(error) {
// that.toLogin()
that.$message.error({
duration: 1000,
message: error.message
});
});
}
},
/* eslint-disable */
mounted() {
// var that = this;
// that.getNavPath();
}
};
</script>
<style scoped>
.navwrap {
padding: 12px 20px;
}
.boxbttom {
border-bottom: 1px solid #e4e7ed;
}
.boxshow {
border-bottom: 1px solid #e4e7ed;
box-shadow: 5px -1px 5px #dfdfdf;
}
.navtitle {
margin: 24px 0 0 0;
font-size: 20px;
color: #303133;
font-weight: 500;
}
.navtip {
width: 100%;
height: 38px;
line-height: 38px;
font-size: 13px;
border-radius: 2px;
color: #606266;
background-color: #f4f4f5;
}
.navmTop {
margin-top: 25px;
}
.navtipcolor {
margin: 0 12px;
color: #2f54eb;
}
.el-breadcrumb__inner.is-link:hover, .el-breadcrumb__inner a:hover {
color: #2f54eb;
}
.el-breadcrumb__item:last-child .el-breadcrumb__inner,
.el-breadcrumb__item:last-child .el-breadcrumb__inner a,
.el-breadcrumb__item:last-child .el-breadcrumb__inner a:hover,
.el-breadcrumb__item:last-child .el-breadcrumb__inner:hover {
font-weight: 700;
text-decoration: none;
cursor: pointer;
color: #303133;
}
</style>
<template>
<div class="aside-menu">
<ul class="aside-menu__wrapper">
<template v-for="item in tabData">
<li
v-if="item.isShow == 1"
:class="['tab-left-list-cell p-l-14', {'active-tab': item.uri === activeTab}]"
:key="item.id"
@click="selectTab(item)"
>
<!-- <i class="my-icon" :class="['iconfont', item.icon, !!item.onlyIconActive ? 'iconActive' : '']"></i> -->
{{ item.menuName }}
<i v-if="item.nodeChildren && item.nodeChildren.length" :class="[item.collapsFlag ? 'el-icon-arrow-up' : 'el-icon-arrow-down']"></i>
</li>
<ul class="child-tab-left-list" :key="`${item.id}-sub`" v-show="item.collapsFlag">
<template v-for="childitem in item.nodeChildren">
<li
v-if="childitem.isShow == 1"
:class="['tab-left-list-cell p-l-40', {'active-tab': childitem.uri == activeTab}]"
:key="childitem.id"
@click="selectTab(childitem)"
>
{{ childitem.menuName }}
<i v-if="childitem.nodeChildren && childitem.nodeChildren.length" :class="[childitem.collapsFlag ? 'el-icon-arrow-up' : 'el-icon-arrow-down']"></i>
</li>
<ul class="third-tab-left-list" :key="`${childitem.id}-sub`" v-show="childitem.collapsFlag">
<template v-for="thirditem in childitem.nodeChildren">
<li
v-if="thirditem.isShow == 1"
:class="['tab-left-list-cell p-l-60', {'active-tab': thirditem.uri === activeTab }]"
:key="thirditem.id"
@click="selectTab(thirditem)"
>
{{ thirditem.menuName }}
</li>
</template>
</ul>
</template>
</ul>
</template>
</ul>
</div>
</template>
<script>
export default {
name: 'aside-menu',
props: {
menu: Array
},
data() {
return {
activeTab: '',
tabData: []
};
},
watch: {
'$route.path': {
immediate: true,
handler(path) {
this.activeTab = path;
}
},
menu: {
immediate: true,
handler(menu) {
let that = this;
let menuTree = menu.filter(item => item.code === 'enterprise')[0] || {};
this.tabData = setCollapsFlag(menuTree.nodeChildren || []);
function setCollapsFlag(arr) {
arr = arr.slice();
return arr.map(item => {
that.$set(item, 'collapsFlag', true)
if (item.nodeChildren && item.nodeChildren.length > 0) {
item.nodeChildren = setCollapsFlag(item.nodeChildren);
}
return item;
})
}
}
}
},
methods: {
selectTab(item) {
if (Array.isArray(item.nodeChildren) && item.nodeChildren.length > 0) {
item.collapsFlag = !item.collapsFlag;
} else {
this.$router.push({path: item.uri});
}
},
}
};
</script>
<style lang="less" scoped>
.aside-menu {
position: fixed;
top: 0;
bottom: 0;
left: 20px;
z-index: 1;
padding-top: 84px;
width: 200px;
height: 100%;
.aside-menu__wrapper {
padding: 20px 0;
width: 100%;
height: 100%;
background-color: #fff;
overflow-y: auto;
box-shadow: 3px 0 4px 0 rgba(214, 224, 240, 0.3);
}
.tab-left-list-cell {
position: relative;
margin-top: 15px;
height: 30px;
font-size: 14px;
color: #303133;
text-align: left;
line-height: 30px;
white-space: nowrap;
overflow: hidden;
cursor: pointer;
.iconActive {
color: @blue;
}
&:hover {
color: #606266;
background: rgba(24, 144, 255, 0.06);
i {
color: @blue;
}
}
&.active-tab {
color: @gray02;
background: rgba(24, 144, 255, 0.06);
&::before {
content: ' ';
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 2px;
background: @blue;
z-index: 1;
}
i {
color: @blue;
}
}
.my-icon {
font-size: 17px;
color: #000;
padding-right: 8px;
width: 25px;
display: inline-block;
box-sizing: border-box;
}
}
.child-tab-left-list {
-webkit-transition: all 0.5s ease-in-out;
-o-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;
li {
position: relative;
text-align: left;
height: 30px;
line-height: 30px;
white-space: nowrap;
overflow: hidden;
cursor: pointer;
&:hover {
background: rgba(24, 144, 255, 0.06);
i {
color: @blue;
}
}
&.active-tab {
background: rgba(24, 144, 255, 0.06);
&::before {
content: ' ';
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 2px;
background: @blue;
z-index: 1;
}
i {
color: @blue;
}
}
}
}
}
.p-l-14 {
padding-left: 14px;
}
.p-l-40 {
padding-left: 40px;
}
.p-l-60 {
padding-left: 60px;
}
</style>
<template>
<dm-layout/>
<div>
<yw-header @updateAsideMenu="updateAsideMenu"></yw-header>
<div class="main">
<aside-menu :menu="menu"></aside-menu>
<keep-alive>
<router-view v-if="$route.meta.keepAlive" :key="$route.fullPath"></router-view>
</keep-alive>
<router-view v-if="!$route.meta.keepAlive" :key="$route.fullPath"></router-view>
</div>
</div>
</template>
<script>
import YwHeader from './yw-header.vue';
import AsideMenu from './aside-menu.vue';
export default {
name: 'layout'
name: 'layout',
components: { YwHeader, AsideMenu },
data() {
return {
menu: []
}
},
methods: {
updateAsideMenu(menu) {
this.menu = menu || [];
},
}
}
</script>
<template>
<div class="header">
<a :href="`${origin}/operation-platform/#/index`" class="logo">
<img src="../images/logo.png" alt="" />
<span>好办运维平台</span>
</a>
<el-dropdown trigger="hover" placement="bottom">
<span>{{ userInfo.realName }}<i class="el-icon-arrow-down" style="margin-left: 10px"></i></span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="showUserInfo = true">账号信息</el-dropdown-item>
<el-dropdown-item @click.native="onLoginOut">退出登录</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-dialog title="账户信息" :visible.sync="showUserInfo" width="430px" append-to-body>
<el-form ref="userForm" label-width="100px">
<el-form-item label="姓名">
<el-input v-model="userInfo.realName" disabled/>
</el-form-item>
<el-form-item label="性别">
<el-radio-group v-model="userInfo.sex" disabled>
<el-radio label="1"></el-radio>
<el-radio label="0"></el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="工号">
<el-input v-model="userInfo.employeeNumber" disabled></el-input>
</el-form-item>
<el-form-item label="手机号码">
<el-input v-model="userInfo.userMobile" disabled></el-input>
</el-form-item>
<el-form-item label="职位">
<el-input v-model="userInfo.position" disabled></el-input>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script>
import { origin } from '@/config'
import fetch from '@/api';
const { getUserInfo, getLoginOut } = fetch;
export default {
name: 'ywHeader',
data() {
return {
origin,
userInfo: {},
showUserInfo: false
}
},
created() {
this.getUserInfo();
},
methods: {
// 获取用户信息
getUserInfo() {
getUserInfo().then(res => {
const result = res.result || {};
this.userInfo = Object.assign({}, result);
this.$emit('updateAsideMenu', result.menuTree || []);
})
},
// 退出登录
onLoginOut() {
this.$confirm('确认退出吗?', '提示', { type: 'warning' }).then(() => {
getLoginOut().then(res => {
this.$message.success('退出成功');
window.location.href = '/operation-platform/#/';
})
})
}
}
}
</script>
<style lang="less" scoped>
.header {
position: fixed;
top: 0;
right: 0;
left: 0;
z-index: 20;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 45px;
width: 100%;
min-width: 1400px;
height: 64px;
background: #fff;
box-shadow: 0px 3px 4px 0px rgba(214, 224, 240, 0.3);
.logo {
display: flex;
align-items: center;
cursor: pointer;
img {
margin-right: 10px;
width: 30px;
height: 30px;
}
span {
padding-top: 2px;
font-size: 16px;
color: #303133;
}
}
}
</style>
/*
* @Descripttion: 当前组件信息
* @version: 1.0.0
* @Author: 无尘
* @Date: 2020-07-17 10:38:29
* @LastEditors: 无尘
* @LastEditTime: 2020-07-17 11:07:42
*/
/* eslint-disable */
module.exports = (parantfile, file) => r => {
import('@/views/' + parantfile + '/' + file + '.vue').then(module => {
r(module);
});
};
......@@ -6,44 +6,44 @@
* @LastEditors: 无尘
* @LastEditTime: 2020-07-21 09:52:25
*/
import _import from './_import.js';
const errorPage = r => {
import('@/views/errorPage/index.vue').then(module => {
r(module);
});
};
import Layout from '@/layout/layout.vue';
export const routes = [
{
path: '/',
name: '/',
redirect: 'login'
},
{
path: '/login',
name: '登录',
component: _import('login', 'index')
},
{
path: '/index',
name: 'index',
component: _import('index', 'index')
component: Layout,
children: [
{
path: '/enterprise-list',
name: '企业管理',
component: () => import('@/views/enterprise/enterprise-list.vue')
},
{
path: '/enterprise-detail',
name: '企业详情',
component: () => import('@/views/enterprise/enterprise-detail.vue')
},
{
path: '/menu-config',
name: '菜单配置',
component: () => import('@/views/permission/menu-config.vue')
},
]
},
{
path: '/403',
name: '无权访问',
component: errorPage
component: () => import('@/views/errorPage/index.vue')
},
{
path: '/404',
name: 'error404',
component: errorPage
component: () => import('@/views/errorPage/index.vue')
},
{
path: '/500',
name: 'error500',
component: errorPage
component: () => import('@/views/errorPage/index.vue')
},
{
path: '*',
......
import axios from 'axios';
import qs from 'qs';
import { Message } from 'element-ui';
// import { getToken } from '@/'
/* eslint-disable-next-line */
// const BASEURL = process.env.NODE_ENV !== 'production' ? window.location.origin : '';
/* eslint-disable-next-line */
const isPro = process.env.NODE_ENV === 'production';
const BASEURL = isPro ? window.location.origin : 'https://four.gicdev.com';
axios.defaults.baseURL = BASEURL;
const request = (opt, params) => {
params = Object.assign({}, params);
opt = Object.assign({}, opt);
let requestConfig = {
// 请求路径
url: '',
params: '',
data: '',
// 请求type
method: 'get',
// request body 是否使用 formData格式
useFormData: false,
// response 是否使用 code === '0000' 验证
useIntercept: true,
// 设置headers, 但是好像没效果,以后再说吧
headers: {}
}
requestConfig = Object.assign(requestConfig, opt);
if (requestConfig.useFormData) params = qs.stringify(params);
switch (requestConfig.method.toLowerCase()) {
case 'get':
requestConfig.params = params;
break;
case 'post':
requestConfig.data = params;
break;
default:
requestConfig.data = params;
break;
}
return new Promise((resolve, reject) => {
axios(requestConfig).then(res => {
let resp = res.data;
if (!requestConfig.useIntercept || resp.code === '0000') {
return resolve(resp);
};
Message({
message: resp.message,
type: 'warning',
duration: 3000
});
reject(resp);
}).catch(error => {
let { response } = error;
response = response || {};
let { data, status } = response
data = data || {};
if (status === 401) {
let url = isPro ? '../operation-platform/' : 'https://four.gicdev.com/operation-platform/'
window.location.href = url;
}
Message({
message: data.message,
type: 'warning'
})
reject(error);
})
});
}
export {axios, request};
<template>
<div>企业管理详情</div>
</template>
<script>
export default {
name: 'enterprise-detail'
}
</script>
<template>
<div>企业管理列表</div>
</template>
<script>
export default {
name: 'enterprise-list'
}
</script>
<!--
* @Descripttion: 当前组件信息
* @version: 1.0.0
* @Author: 无尘
* @Date: 2020-07-16 10:44:45
* @LastEditors: 无尘
* @LastEditTime: 2020-07-17 11:21:20
-->
<template>
<div class="login-wrap">
<section>
<div class="login-body-top">
<div class="login-body-head">
<div class="login-body-head_inner border-box flex">
<img class="login-body-logo" src="../../assets/logo.png" alt="logo" />
<span class="login-body-title p-l-7">好办管理后台</span>
</div>
</div>
<div class="login-body-qrcode">
<div class="login-qrcode-inner border-box">
<div class="qrcode-title font-18 color-303133 m-b-20">企业微信扫码登录</div>
<div id="qrcode" title=""></div>
<div class="qrcode-refresh m-t-20">
<el-button class="font-12" type="text" @click="refreshCode">刷新 <span class="color-2f54eb iconfont iconshuaxin"></span></el-button>
</div>
</div>
</div>
<div class="bg-dot"></div>
<div class="bg-dot-center"></div>
</div>
<div class="login-body-bottom"></div>
</section>
<footer class="p-t-35">
<vue-gic-footer></vue-gic-footer>
</footer>
</div>
</template>
<script>
import errMsg from '@/common/js/error';
import { postRequest } from '@/api/api';
export default {
name: 'login',
data() {
return {
qrcodeNum: '', // 二维码数据
};
},
computed: {},
methods: {
/**
* 处理路由跳转
*/
toRouterView(val) {
const that = this;
// 模拟检查数据,有两个参数
that.$router.push({
path: val.path
});
},
/**
* 登录---获取二维码字符串 API
*/
getQrcode() {
const that = this;
postRequest('/haoban-manage3-web/get-login-qrcode', {})
.then(res => {
let resData = res.data;
if (resData.errorCode == 1) {
that.qrcodeNum = resData.result;
window.location.href = `${resData.result}`;
return;
}
errMsg.errorMsg(resData);
})
.catch(function(error) {
that.$message.error({
duration: 1000,
message: error.message
});
});
}
},
mounted() {
const that = this;
that.getQrcode();
// that.toLogin();
if (!!localStorage.getItem('userInfos')) {
localStorage.removeItem('userInfos');
}
},
components: {}
};
</script>
<style lang="less" scoped>
.login-wrap {
width: 100%;
min-height: 100vh;
.p-l-7 {
padding-left: 7px;
}
.login-body-top {
position: relative;
width: 100%;
height: 431px;
background-repeat: no-repeat;
background-size: cover;
background-position: center center;
background-color: #2f54eb;
.login-body-head {
width: 100%;
.login-body-head_inner {
width: 100%;
padding: 22px 0 0 24px;
img {
width: 25px;
}
.login-body-title {
font-weight: 600;
color: #fff;
font-size: 18px;
padding-top: 5px;
}
}
}
.bg-dot {
position: absolute;
left: 50%;
bottom: -93px;
margin-left: -500px;
width: 87px;
height: 142px;
background-repeat: no-repeat;
background-size: cover;
background-position: center center;
}
.bg-dot-center {
position: absolute;
left: 50%;
bottom: -233px;
margin-left: -71px;
width: 142px;
height: 87px;
background-repeat: no-repeat;
background-size: cover;
background-position: center center;
}
.login-body-qrcode {
position: absolute;
left: 50%;
bottom: -173px;
margin-left: -183px;
width: 366px;
height: 343px;
background: rgba(255, 255, 255, 1);
box-shadow: 0px 6px 8px 0px rgba(208, 213, 232, 0.27);
border-radius: 5px;
z-index: 1;
.login-qrcode-inner {
width: 100%;
padding: 40px 88px 25px 88px;
text-align: center;
#qrcode {
width: 190px;
height: 190px;
}
}
}
}
.login-body-bottom {
width: 100%;
height: 300px;
background: #fff;
}
}
</style>
<template>
<div>菜单配置</div>
</template>
<script>
export default {
name: 'menu-config'
}
</script>
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