890 行
47 KiB
HTML
可执行文件
890 行
47 KiB
HTML
可执行文件
<!DOCTYPE html>
|
||
<html>
|
||
<!--[1.8.74]-->
|
||
<head>
|
||
<meta charset="utf-8"/>
|
||
<link rel="stylesheet" type="text/css" href="/Public/css/menu.css?v=1.0.5"/>
|
||
<link rel="stylesheet" type="text/css" href="/Public/Retail/css/myscroll.css?v=1.0.2"/>
|
||
<link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.css">
|
||
<link rel="stylesheet" type="text/css" href="/Public/layui-v2.4.3/layui/css/layui.css"/>
|
||
<link rel="stylesheet" type="text/css" href="/Public/Retail/css/home.css"/>
|
||
<link rel="stylesheet" type="text/css" href="/Public/Retail/css/goodsList.css?v=1.0.2"/>
|
||
<link rel="stylesheet" type="text/css" href="/Public/vue/element-ui.css?v=2.13.2">
|
||
<link rel="stylesheet" type="text/css" href="/Public/css/common-upload.css">
|
||
<link rel="stylesheet" type="text/css" href="/Public/css/system-gallery.css?v=1.0.6">
|
||
<link rel="stylesheet" type="text/css" href="/Public/css/page-common.css?v=1.0.2"/>
|
||
<script type="text/javascript" charset="utf-8" src="/Public/vue/js/vue2.5.16.js"></script>
|
||
<script type="text/javascript" charset="utf-8" src="/Public/vue/element-ui.js?v=2.13.2"></script>
|
||
<script type="text/javascript" charset="utf-8" src="/Public/js/common.js?v=1.0.2"></script>
|
||
<script type="text/javascript" charset="utf-8" src="/Public/js/drawer.js"></script>
|
||
<script type="text/javascript" charset="utf-8" src="/Public/js/system-gallery.js?v=1.0.6"></script>
|
||
<script type="text/javascript" charset="utf-8" src="/Public/jquery/js/jquery-3.2.1.min.js"></script>
|
||
<script type="text/javascript" charset="utf-8" src="/Public/layui-v2.4.3/layui/layui.js"></script>
|
||
<script type="text/javascript" charset="utf-8" src="/Public/receipt/Qrcode.js"></script>
|
||
<script type="text/javascript" charset="utf-8" src="/Public/UEditor/ueditor.config.js?v=1.0.1"></script>
|
||
<script type="text/javascript" charset="utf-8" src="/Public/UEditor/ueditor.all.js"></script>
|
||
<script type="text/javascript" charset="utf-8" src="/Public/js/select-pro-and-city.js"></script>
|
||
<script type="text/javascript" charset="utf-8" src="/Public/Retail/common/js/select-goods-category.js"></script>
|
||
<script type="text/javascript"
|
||
src="https://api.map.baidu.com/api?v=3.0&ak=ObMZWhkHzzF0zbnNgF72Bcws8GHqnya7"></script>
|
||
<script>
|
||
var MenuApp;
|
||
</script>
|
||
</head>
|
||
<body>
|
||
<div id="MenuIndex" v-cloak ref="MenuIndexContainer">
|
||
<div class="menu-index-box">
|
||
<el-scrollbar class="myInclude-content"
|
||
v-loading="menuLoading"
|
||
element-loading-text="加载中"
|
||
element-loading-spinner="el-icon-loading"
|
||
element-loading-background="rgba(0, 0, 0, 0.1)">
|
||
<div class="menu-index-left">
|
||
<div class="menu-index-left-logo">
|
||
<img v-if="web_stage_url" :src="web_stage_url"
|
||
onerror="this.onerror=null,this.src='/Public/Retail/images/zhihuilogo4.png'"/>
|
||
</div>
|
||
<el-menu :default-active="String(actMenuIndex)"
|
||
@select="selectMenu"
|
||
background-color="#232b42"
|
||
text-color="#fff"
|
||
unique-opened
|
||
ref="menu"
|
||
active-text-color="#409EFF">
|
||
<template v-for="(item,index) in menuList">
|
||
<el-submenu :ref="'item'" v-if="item.list" :index="''+index+''">
|
||
<template slot="title">
|
||
<div>
|
||
<i :class="item.icon"></i>
|
||
<span>{{item.name}}</span>
|
||
</div>
|
||
</template>
|
||
<template v-for="(list,i) in item.list">
|
||
<el-menu-item-group v-if="list.path">
|
||
<el-menu-item :index="index+'-'+i">
|
||
<template slot="title">
|
||
<span style="display: block;width: 100%;height: 100%">{{list.name}}</span>
|
||
</template>
|
||
</el-menu-item>
|
||
</el-menu-item-group>
|
||
<el-submenu v-else :index="index+'-'+i">
|
||
<template slot="title">{{list.name}}</template>
|
||
<el-menu-item v-for="(li,j) in list.list" :key="j" :index="index+'-'+i+'-'+j">
|
||
{{li.name}}
|
||
</el-menu-item>
|
||
</el-submenu>
|
||
</template>
|
||
</el-submenu>
|
||
<el-menu-item :class="actMenuIndex==index?'menu-index-active':''" :ref="'item'" v-else
|
||
:index="''+index+''">
|
||
<template slot="title">
|
||
<div class="menu-index-list-con">
|
||
<i :class="item.icon"
|
||
:style="actMenuIndex==index?'color:#409EFF!important':''"></i>
|
||
<span>{{item.name}}</span>
|
||
</div>
|
||
</template>
|
||
</el-menu-item>
|
||
</template>
|
||
</el-menu>
|
||
</div>
|
||
</el-scrollbar>
|
||
|
||
<div ref="titleRight" class="menu-index-right">
|
||
<div class="menu-index-right-title">
|
||
<div>
|
||
<div class="menu-index-user-name">
|
||
<span>{{manageName}}管理后台</span>
|
||
</div>
|
||
<div v-if="notice" class="menu-index-notice" @click="noticeDetail">
|
||
<div class="menu-index-notice-left">
|
||
<span>公告:</span>
|
||
<img src="/Public/notice/notices.png">
|
||
</div>
|
||
<div class="menu-index-notice-right">
|
||
<marquee style="cursor: pointer;font-size: 12px;" height="65"><span
|
||
style="color: #fff;">{{notice}}</span>
|
||
</marquee>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div>
|
||
<div class="menu-index-right-list-box"
|
||
:class="rightMenuRow?'menu-index-right-list-row':'menu-index-right-list-column'">
|
||
<div class="menu-index-right-list" @click="swapUrl('{:U('Super/App/index')}',1,'软件下载')">
|
||
<img :style="rightMenuRow?'':'display:none'" src="/Public/user/images/p1.png"
|
||
width="16px">
|
||
<span>软件下载</span>
|
||
</div>
|
||
<div class="menu-index-right-list" @click="swapUrl('{:U('Super/Helps/MetInfo')}?types=1',2)">
|
||
<i class="fa fa-question-circle"></i>
|
||
<span>帮助中心</span>
|
||
</div>
|
||
<div class="menu-index-right-list">
|
||
<i class="fa fa-thermometer-full"></i>
|
||
<span @click="showResetPassword=true">修改密码</span>
|
||
</div>
|
||
<template v-if="openScan==1">
|
||
<div class="menu-index-right-list" v-if="isBinding">
|
||
<i class="fa fa-comments"></i>
|
||
<span @click="relieveWx">解绑微信</span>
|
||
</div>
|
||
<div class="menu-index-right-list" v-else>
|
||
<i class="fa fa-comments"></i>
|
||
<span @click="getTokenUrl">绑定微信</span>
|
||
</div>
|
||
</template>
|
||
</div>
|
||
|
||
<div class="menu-index-right-title-nickname" @click="showSetUserAvatar=true">
|
||
<el-avatar :size="40" :src="user_avatar"></el-avatar>
|
||
<div class="menu-index-right-title-nickname-detail">
|
||
<span v-text="username"></span>
|
||
<span style="font-size: 12px" v-if="other_name" v-text="other_name"></span>
|
||
</div>
|
||
</div>
|
||
<div class="menu-index-right-title-quit" @click="loginOutBefore">
|
||
<img src="/Public/Retail/images/quit.png"/>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!--右侧导航栏-->
|
||
<div class="menu-index-right-header">
|
||
<template>
|
||
<el-breadcrumb separator-class="el-icon-arrow-right">
|
||
<template v-for="(item,index) in pathData">
|
||
<el-breadcrumb-item>
|
||
<span @click="breadcrumbClick(index)"
|
||
:class="item.path&&index<pathData.length-1?'separator-act':'separator-normal'">{{item.name}}</span>
|
||
<i v-if="loading&&index==pathData.length-1" class="el-icon-loading"></i>
|
||
</el-breadcrumb-item>
|
||
</template>
|
||
</el-breadcrumb>
|
||
</template>
|
||
<el-tooltip class="item" effect="dark" content="点击刷新当前页面" placement="bottom-end">
|
||
<div class="menu-index-refresh-child-window" @click="refreshWindow(true)">
|
||
<i class="el-icon-refresh"></i>
|
||
<span>刷新</span>
|
||
</div>
|
||
</el-tooltip>
|
||
</div>
|
||
<div class="menu-index-right-content">
|
||
<!--右侧内容区-->
|
||
<div v-if="iframeSrc!=''" class="secondIframe-box">
|
||
<iframe :src="iframeSrc" frameborder="0" class="secondIframe" id="secondIframe"></iframe>
|
||
</div>
|
||
<template v-else>
|
||
<div id="myInclude">
|
||
<!--页面-->
|
||
<div class="include-page"></div>
|
||
</div>
|
||
<div class="menu-index-right-content-loading" v-if="loading" v-loading="true"></div>
|
||
</template>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<el-dialog title="修改密码" :visible.sync="showResetPassword" :width="'400px'" :close-on-click-modal="false">
|
||
<div style="padding: 0 20px">
|
||
<el-form :model="passwordForm" :rules="rules" ref="passwordForm" label-width="68px">
|
||
<el-form-item label="旧密码" prop="oldPass">
|
||
<el-input type="password" v-model="passwordForm.oldPass" auto-complete="off"
|
||
placeholder="请输入旧密码"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="新密码" prop="newPass">
|
||
<el-input type="password" v-model="passwordForm.newPass" auto-complete="off"
|
||
placeholder="请输入新密码"></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="新密码" prop="newRePass">
|
||
<el-input type="password" v-model="passwordForm.newRePass" auto-complete="off"
|
||
placeholder="再次输入新密码"></el-input>
|
||
</el-form-item>
|
||
</el-form>
|
||
</div>
|
||
<div slot="footer" class="dialog-footer">
|
||
<el-button @click="showResetPassword = false">取 消</el-button>
|
||
<el-button type="primary" @click="sureResetPassword('passwordForm')">确 定</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
<el-dialog title="设置头像"
|
||
:visible.sync="showSetUserAvatar"
|
||
:width="'400px'"
|
||
:close-on-click-modal="false">
|
||
<div class="menu-index-list">
|
||
<el-form>
|
||
<el-form-item label="头像图片" label-width="80px">
|
||
<choose-one-file :file-url.sync="avatar"
|
||
:file-id.sync="avatar_id"></choose-one-file>
|
||
<p class="menu-index-tips">建议大小100*100</p>
|
||
</el-form-item>
|
||
</el-form>
|
||
</div>
|
||
|
||
<div class="menu-index-center">
|
||
<el-button type="primary" size="medium" @click="setUserAvatar">保存</el-button>
|
||
</div>
|
||
</el-dialog>
|
||
<el-dialog title="绑定微信" :visible.sync="showUserAuthCode" :width="'400px'" :close-on-click-modal="false"
|
||
:before-close="closeCode">
|
||
<div class="menu-index-code-big-box">
|
||
<div class="menu-index-code-title">
|
||
<span>{{scan_title}}<el-tooltip class="item" effect="dark" content="请在扫码之前关注该公众号"
|
||
placement="top-start">
|
||
<i class="el-icon-question"></i>
|
||
</el-tooltip></span>
|
||
</div>
|
||
<div class="menu-index-code-box-con">
|
||
<div class="menu-index-code-box" v-qrcode="{'value':code}"></div>
|
||
<div class="menu-index-code-timeout" v-if="isTimeOut">
|
||
<span>二维码过期</span>
|
||
<div class="menu-index-refresh" @click="getTokenUrl">点击刷新</div>
|
||
</div>
|
||
<div class="menu-index-code-timeout" v-if="isScanCode">
|
||
<div class="menu-index-item-suc-one-1">
|
||
<img src="/Public/login/images/success.png" class="menu-index-item-suc-done-img">
|
||
<span>成功扫码,等待确认</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</el-dialog>
|
||
|
||
<template v-if="showLoginOut">
|
||
<div role="dialog" aria-modal="true" aria-label="温馨提示" class="el-message-box__wrapper"
|
||
style="z-index: 10000000000;">
|
||
<div class="el-message-box login-out">
|
||
<div class="el-message-box__header">
|
||
<div class="el-message-box__title">
|
||
<span>温馨提示</span>
|
||
</div>
|
||
<button type="button" @click="showLoginOut=false"
|
||
aria-label="Close"
|
||
class="el-message-box__headerbtn">
|
||
<i class="el-message-box__close el-icon-close"></i>
|
||
</button>
|
||
</div>
|
||
<div class="el-message-box__content">
|
||
<div class="el-message-box__container">
|
||
<div class="el-message-box__status el-icon-warning"></div>
|
||
<div class="el-message-box__message">
|
||
<p>确定退出登录?</p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="el-message-box__btns">
|
||
<button type="button" @click="showLoginOut=false"
|
||
class="el-button el-button--default el-button--small">
|
||
<span>取消</span>
|
||
</button>
|
||
<button type="button" @click="sureLoginOut"
|
||
class="el-button el-button--default el-button--small el-button--primary ">
|
||
<span>退出</span>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="v-modal" tabindex="0" style="z-index: 999999999;"></div>
|
||
</template>
|
||
</div>
|
||
</body>
|
||
<script type="text/javascript">
|
||
//注册组件
|
||
Vue.directive('qrcode', function (el, binding) {
|
||
el.innerHTML = "";
|
||
var text = binding.value.value;
|
||
if (text) {
|
||
new QRCode(el, {
|
||
text: text,
|
||
width: 200,
|
||
height: 200,
|
||
colorDark: "#000000",
|
||
colorLight: "#ffffff",
|
||
correctLevel: QRCode.CorrectLevel.H
|
||
});
|
||
}
|
||
});
|
||
layui.use('layer', function () {
|
||
MenuApp = new Vue({
|
||
el: "#MenuIndex",
|
||
data() {
|
||
return {
|
||
web_stage_url: '',
|
||
notice: '',
|
||
openScan: 0,//是否开启扫码绑定微信
|
||
rightMenuRow: false,//是否横向展示顶部菜单导航
|
||
manageName: '',//角色名称
|
||
username: '',//用户名称
|
||
other_name: '',//其他名称
|
||
menuList: [],//用户权限菜单列表
|
||
actMenuIndex: -1,//当前点击的菜单下标
|
||
menuLoading: true,//菜单加载状态
|
||
user_avatar: '',//右上角显示的用户头像
|
||
avatar: '',//修改时显示的用户头像
|
||
avatar_id: '',//修改时显示的用户头像ID
|
||
showUserAuthCode: false,//是否显示绑定微信弹框
|
||
code: '',//二维码内容
|
||
isTimeOut: false,//二维码是否过期
|
||
isScanCode: false,//是否扫码成功
|
||
scan_title: false,//公众号名称
|
||
showSetUserAvatar: false,//是否显示修改用户头像
|
||
isBinding: false,//是否已经绑定微信
|
||
check_scan: null,//微信扫码时间计时器
|
||
check_auth: null,//微信确认绑定时间计时器
|
||
showResetPassword: false,//是否显示修改密码弹框
|
||
showLoginOut: false,//是否显示退出登录
|
||
passwordForm: {
|
||
oldPass: '',
|
||
newPass: '',
|
||
newRePass: '',
|
||
},//修改密码表单信息
|
||
rules: {
|
||
oldPass: [{message: '请输入原密码', required: true, trigger: 'blur'}, {
|
||
validator: function (rule, value, callback) {
|
||
var reg = /^[a-zA-Z0-9.+*-/<>?!@#$%^&*():''"";]{1,}$/;
|
||
if (!value) {
|
||
callback(new Error('请输入原密码'));
|
||
} else if (reg.test(value) == false) {
|
||
callback(new Error('只支持数字字母及字符.+*-/<>?!@#$%^&*():\'\'"";'));
|
||
} else {
|
||
callback();
|
||
}
|
||
}, trigger: 'blur'
|
||
}],
|
||
newPass: [{message: '请输入新密码', required: true, trigger: 'blur'}, {
|
||
validator: function (rule, value, callback) {
|
||
var reg = /^[a-zA-Z0-9.+*-/<>?!@#$%^&*():''"";]{1,}$/;
|
||
if (!value) {
|
||
callback(new Error('请输入新密码'));
|
||
} else if (reg.test(value) == false) {
|
||
callback(new Error('只支持数字字母及字符.+*-/<>?!@#$%^&*():\'\'"";'));
|
||
} else if (MenuApp.passwordForm.newRePass && MenuApp.passwordForm.newRePass != value) {
|
||
callback(new Error('新旧密码不一致'));
|
||
} else {
|
||
callback();
|
||
}
|
||
}, trigger: 'blur'
|
||
}],
|
||
newRePass: [{message: '请再次输入新密码', required: true, trigger: 'blur'}, {
|
||
validator: function (rule, value, callback) {
|
||
var reg = /^[a-zA-Z0-9.+*-/<>?!@#$%^&*():''"";]{1,}$/;
|
||
if (!value) {
|
||
callback(new Error('请再次输入新密码'));
|
||
} else if (reg.test(value) == false) {
|
||
callback(new Error('只支持数字字母及字符.+*-/<>?!@#$%^&*():\'\'"";'));
|
||
} else if (MenuApp.passwordForm.newPass && MenuApp.passwordForm.newPass != value) {
|
||
callback(new Error('新旧密码不一致'));
|
||
} else {
|
||
callback();
|
||
}
|
||
}, trigger: 'blur'
|
||
}],
|
||
},//修改密码规则
|
||
pathData: [],//页面路由数组
|
||
loading: false,//页面是否正在加载中
|
||
iframeSrc: '',
|
||
iframeUrlList: [
|
||
'/index.php/Retail/Diy/index',
|
||
'/index.php/Retail/Diy/mer_index',
|
||
],
|
||
pathList: [],//实际含有路径的列表
|
||
pagePathList: [],//在实际含有路径的列表中并且已经渲染路径的页面
|
||
is_back_preview: false,//是否是返回之前的页面
|
||
pageEndCallback: null,//页面结束的回调函数
|
||
}
|
||
},
|
||
methods: {
|
||
//选择菜单
|
||
selectMenu(val) {
|
||
if (this.loading) {
|
||
//如果上一次点击的菜单没有渲染完成直接return
|
||
return;
|
||
}
|
||
this.actMenuIndex = val;
|
||
var arr = val.split('-');
|
||
var index = parseInt(arr[0]);
|
||
var item = this.menuList[index];
|
||
let pathData;
|
||
if (item.type) {
|
||
if (item.reBack) {
|
||
this.sendRequest('Retail/Menu/reBack', {
|
||
success: () => {
|
||
location.href = item.path;
|
||
}
|
||
})
|
||
} else {
|
||
location.href = item.path;
|
||
}
|
||
return;
|
||
} else if (item.path) {
|
||
pathData = [item];
|
||
} else if (arr.length == 2) {
|
||
pathData = [{name: item.name}, item.list[parseInt(arr[1])]];
|
||
} else if (arr.length == 3) {
|
||
let _i = parseInt(arr[1]);
|
||
let __i = parseInt(arr[2]);
|
||
pathData = [{name: item.name}, {name: item.list[_i].name}, item.list[_i].list[__i]];
|
||
} else {
|
||
|
||
}
|
||
this.pathData = JSON.parse(JSON.stringify(pathData));
|
||
},
|
||
//直接替换菜单
|
||
swapUrl(url, type, _name = '') {
|
||
if (type == 1) {
|
||
this.pathData = [{name: _name, path: url}];
|
||
} else {
|
||
window.open(url);
|
||
}
|
||
},
|
||
//确认修改密码
|
||
sureResetPassword(formName) {
|
||
this.$refs[formName].validate((valid) => {
|
||
if (valid) {
|
||
this.sendRequest('Retail/Menu/resetPassword', {
|
||
data: {
|
||
oldPass: this.passwordForm.oldPass,
|
||
newPass: this.passwordForm.newPass,
|
||
newRePass: this.passwordForm.newRePass
|
||
},
|
||
success: (res) => {
|
||
if (res.status == 1) {
|
||
this.$message.success(res.message);
|
||
this.showResetPassword = false;
|
||
this.passwordForm = {
|
||
oldPass: '',
|
||
newPass: '',
|
||
newRePass: '',
|
||
};
|
||
} else {
|
||
this.$message.error(res.message);
|
||
}
|
||
}
|
||
})
|
||
}
|
||
});
|
||
},
|
||
//保存头像设置
|
||
setUserAvatar() {
|
||
if (!this.avatar_id || !this.avatar) {
|
||
return this.$message.warning('您未修改头像');
|
||
}
|
||
this.sendRequest('Retail/Menu/setUserImage', {
|
||
data: {
|
||
avatar: this.avatar,
|
||
avatar_id: this.avatar_id,
|
||
},
|
||
success: (res) => {
|
||
if (res.status == 1) {
|
||
this.user_avatar = this.avatar;
|
||
this.$message.success(res.message);
|
||
this.showSetUserAvatar = false;
|
||
} else {
|
||
this.$message.error(res.message);
|
||
}
|
||
}
|
||
})
|
||
},
|
||
//解绑微信
|
||
relieveWx() {
|
||
this.$confirm('您确认解绑微信吗?', '温馨提示', {
|
||
confirmButtonText: '解绑',
|
||
cancelButtonText: '取消'
|
||
}).then(() => {
|
||
this.sendRequest('Retail/Menu/relieveWx', {
|
||
data: {},
|
||
success: (res) => {
|
||
if (res.status == 1) {
|
||
this.isBinding = false;
|
||
this.$message.success(res.message);
|
||
} else {
|
||
this.$message.error(res.message);
|
||
}
|
||
}
|
||
})
|
||
}).catch(() => {
|
||
});
|
||
},
|
||
//微信扫码绑定---关闭授权
|
||
closeCode() {
|
||
clearTimeout(this.check_scan);
|
||
clearTimeout(this.check_auth);
|
||
this.showUserAuthCode = false;
|
||
},
|
||
//微信扫码绑定---刷新token
|
||
getTokenUrl() {
|
||
this.sendRequest('Retail/Menu/random', {
|
||
data: {},
|
||
success: (res) => {
|
||
if (res.status == 1) {
|
||
this.code = res.data.url;
|
||
this.scan_title = res.data.title;
|
||
this.check(res.data.token, 0);
|
||
this.showUserAuthCode = true;
|
||
this.isTimeOut = false;
|
||
this.isScanCode = false;
|
||
} else {
|
||
this.$message.error(rea.message);
|
||
}
|
||
}
|
||
})
|
||
},
|
||
/* 判断二维码过期时间 */
|
||
check(token, time) {
|
||
if (time >= 30) {
|
||
//显示刷新按钮
|
||
this.isTimeOut = true;
|
||
clearTimeout(this.check_scan);
|
||
return false;
|
||
} else {
|
||
this.check_scan = setTimeout(() => {
|
||
this.sendRequest('Retail/Menu/check', {
|
||
data: {
|
||
token: token,
|
||
},
|
||
success: (res) => {
|
||
if (res.status == 1) {
|
||
//显示扫面成功
|
||
clearTimeout(this.check_scan);
|
||
this.isScanCode = true;
|
||
this.auth(token, 0); // 调起授权计时器
|
||
} else if (res.status == 2) {
|
||
clearTimeout(this.check_scan);
|
||
this.showUserAuthCode = false;
|
||
this.isBinding = true;
|
||
this.$message.success(res.message);
|
||
} else if (res.status == 3) {
|
||
clearTimeout(this.check_scan);
|
||
this.$message.error(res.message);
|
||
} else if (res.status == 4) {
|
||
this.isTimeOut = true;
|
||
clearTimeout(this.check_scan);
|
||
this.$message.error(res.message);
|
||
} else {
|
||
time++;
|
||
this.check(token, time);
|
||
}
|
||
}
|
||
})
|
||
}, 1000)
|
||
}
|
||
},
|
||
/* 判断授权过期时间 */
|
||
auth(token, time) {
|
||
if (time >= 30) {
|
||
//显示刷新二维码按钮
|
||
clearTimeout(this.check_auth);
|
||
this.isTimeOut = true;
|
||
this.isScanCode = false;
|
||
return false;
|
||
} else {
|
||
this.check_auth = setTimeout(() => {
|
||
this.sendRequest('Retail/Menu/auth', {
|
||
data: {token: token},
|
||
success: (res) => {
|
||
if (res.status == 1) { // 授权
|
||
//用户授权成功
|
||
clearTimeout(this.check_scan);
|
||
this.showUserAuthCode = false;
|
||
this.isBinding = true;
|
||
this.$message.success(res.message);
|
||
} else if (res.status == 2) { // 取消授权
|
||
clearTimeout(this.check_scan);
|
||
this.showUserAuthCode = false;
|
||
this.$message.error(res.message);
|
||
} else if (res.status == 3) {
|
||
this.isTimeOut = true;
|
||
clearTimeout(this.check_scan);
|
||
this.$message.error(res.message);
|
||
} else {
|
||
time++;
|
||
this.auth(token, time);
|
||
}
|
||
}
|
||
})
|
||
}, 1000)
|
||
}
|
||
},
|
||
//退出登录
|
||
loginOutBefore() {
|
||
this.showLoginOut = true;
|
||
},
|
||
//确认退出登录
|
||
sureLoginOut() {
|
||
localStorage.removeItem('thisPath');
|
||
window.location.href = "{:U('loginOut')}";
|
||
},
|
||
//点击导航栏路由
|
||
breadcrumbClick(index) {
|
||
if (index < this.pathData.length - 1 && this.pathData[index].path) {
|
||
if (typeof this.pathData[index + 1].onClose == "function") {
|
||
this.pathData[index + 1].onClose();
|
||
}
|
||
this.pathData = this.pathData.slice(0, index + 1);
|
||
this.is_back_preview = true;
|
||
}
|
||
},
|
||
//返回上一页,仅针对子菜单返回上一级菜单
|
||
backPreview() {
|
||
try {
|
||
if (this.pathData[this.pathData.length - 2] && this.pathData[this.pathData.length - 2].path) {
|
||
this.breadcrumbClick(MenuApp.pathData.length - 2);
|
||
}
|
||
} catch (e) {
|
||
console.error('The page is already a level one page, and cannot be returned to the previous level');
|
||
}
|
||
},
|
||
//载入页面、刷新页面
|
||
refreshWindow(pathData = null) {
|
||
this.loading = true;
|
||
if (pathData && typeof pathData == "object") {
|
||
//重新设置路由
|
||
this.pathData = pathData;
|
||
return;
|
||
} else if (typeof pathData == "string") {
|
||
//直接替换为固定地址
|
||
this.pathData[this.pathData.length - 1].path = pathData;
|
||
return;
|
||
}
|
||
top.layer.closeAll();
|
||
|
||
let index = this.pathData.length - 1;
|
||
let path = this.pathData[index].path;
|
||
if (this.iframeUrlList.indexOf(path) >= 0) {
|
||
this.iframeSrc = path;
|
||
let _iframe = document.getElementById('secondIframe');
|
||
if (_iframe) {
|
||
_iframe.contentWindow.location.reload(true);
|
||
}
|
||
this.loading = false;
|
||
} else {
|
||
let _i = this.pagePathList.indexOf(path);
|
||
if (_i == -1 || typeof pathData == "boolean" && pathData && !this.is_back_preview) {
|
||
$.get(path, (data) => {
|
||
let f = document.getElementById('myInclude');
|
||
if (_i >= 0) {
|
||
f.removeChild(f.childNodes[_i]);
|
||
}
|
||
let _page = document.createElement('div');
|
||
_page.className = 'include-page';
|
||
_page.setAttribute('data-i', index);
|
||
_page.setAttribute('data-p', path);
|
||
_page.style.zIndex = this.pagePathList.length + 1;
|
||
f.appendChild(_page);
|
||
this.pagePathList.push(path);
|
||
$(".include-page[data-i='" + index + "']").html(data);
|
||
this.loading = false;
|
||
});
|
||
} else {
|
||
this.is_back_preview = false;
|
||
this.loading = false;
|
||
}
|
||
}
|
||
localStorage.thisPath = JSON.stringify(this.pathData);
|
||
},
|
||
//获取可用区域宽高
|
||
getWindowsClient() {
|
||
let client = $(this.$refs.MenuIndexContainer)[0].getBoundingClientRect();
|
||
return {
|
||
width: client.width - 200,
|
||
height: client.height - 145,
|
||
}
|
||
},
|
||
getContainerClientHeight() {
|
||
return this.getWindowsClient().height;
|
||
},
|
||
getContainerClientWidth() {
|
||
return this.getWindowsClient().width;
|
||
},
|
||
//根据路径获取页面导航
|
||
getActMenuIndex(path, menuList) {
|
||
if (this.actMenuIndex != -1 && this.actMenuIndex) {
|
||
let arr = this.actMenuIndex.split('-')
|
||
let menu = [...this.menuList];
|
||
let _path = '';
|
||
for (let k in arr) {
|
||
if (menu[arr[k]]) {
|
||
if (menu[arr[k]].path) {
|
||
_path = menu[arr[k]].path;
|
||
break;
|
||
}
|
||
menu = menu[arr[k]].list
|
||
} else {
|
||
break
|
||
}
|
||
}
|
||
if (_path == path) {
|
||
return this.actMenuIndex;
|
||
}
|
||
} else {
|
||
for (let i = 0; i < menuList.length; i++) {
|
||
if (menuList[i]['list']) {
|
||
let list_i = this.getActMenuIndex(path, menuList[i]['list']);
|
||
if (list_i === false) {
|
||
continue;
|
||
} else {
|
||
return i + '-' + list_i;
|
||
}
|
||
} else if (menuList[i]['path'] == path) {
|
||
return i + '';
|
||
}
|
||
}
|
||
}
|
||
return false;
|
||
},
|
||
//获取当前页面url携带的某个参数
|
||
getQueryVariable(name) {
|
||
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(MenuApp.pathData[MenuApp.pathData.length - 1].path) || [, ""])[1].replace(/\+/g, '%20')) || null
|
||
},
|
||
//公告详情
|
||
noticeDetail() {
|
||
this.swapUrl('/index.php/Retail/StoreNotice/index', 1, '门店公告');
|
||
},
|
||
//初始化菜单栏
|
||
unitMenu() {
|
||
let thisPath = localStorage.thisPath;
|
||
try {
|
||
thisPath = JSON.parse(thisPath);
|
||
} catch (e) {
|
||
|
||
}
|
||
if (thisPath && typeof thisPath == "object") {
|
||
let actMenuIndex = '';
|
||
for (let i = 0; i < thisPath.length; i++) {
|
||
let index = this.getActMenuIndex(thisPath[i].path, this.menuList);
|
||
if (index) {
|
||
actMenuIndex = index;
|
||
}
|
||
}
|
||
if (actMenuIndex) {
|
||
this.actMenuIndex = actMenuIndex;
|
||
this.selectMenu(actMenuIndex);
|
||
return;
|
||
}
|
||
}
|
||
let pathData;
|
||
if (!this.menuList[0].path && !this.menuList[0].type) {
|
||
this.actMenuIndex = '0';
|
||
if (!this.menuList[0].list[0].path) {
|
||
//三级菜单
|
||
pathData = [this.menuList[0], [this.menuList[0].list[0]], this.menuList[0].list[0].list[0]]
|
||
} else {
|
||
//二级菜单
|
||
pathData = [this.menuList[0], this.menuList[0].list[0]];
|
||
}
|
||
} else if (this.menuList[0].type) {
|
||
if (this.menuList[1].path) {
|
||
this.actMenuIndex = '1';
|
||
pathData = [this.menuList[1]];
|
||
} else {
|
||
this.actMenuIndex = '1';
|
||
pathData = [this.menuList[1], this.menuList[1].list[0]];
|
||
}
|
||
|
||
} else {
|
||
this.actMenuIndex = '0';
|
||
pathData = [this.menuList[0]];
|
||
}
|
||
this.pathData = JSON.parse(JSON.stringify(pathData));
|
||
},
|
||
},
|
||
mounted() {
|
||
|
||
},
|
||
created() {
|
||
let web_ico_url = localStorage.getItem('web_ico_url');
|
||
let web_system_name = localStorage.getItem('web_system_name');
|
||
web_ico_url && $('head').append(`<link rel='icon' type="image/x-icon" href='${web_ico_url}'>`);
|
||
web_system_name && $('head').append(`<title>${web_system_name}后台管理系统</title>`);
|
||
window.onload = window.onresize = () => {
|
||
let width = this.$refs.titleRight.offsetWidth;
|
||
if (width < 1020) {
|
||
this.rightMenuRow = false;
|
||
} else {
|
||
this.rightMenuRow = true;
|
||
}
|
||
};
|
||
this.sendRequest('Retail/Menu/getMenuData', {
|
||
success: (res) => {
|
||
if (res.status == 1) {
|
||
this.menuLoading = false;
|
||
this.menuList = res.data.menu;
|
||
this.$nextTick(() => {
|
||
if (this.menuList.length) {
|
||
$('head').append(`<link rel='icon' type="image/x-icon" href='${res.data.logo.icourl}'>`);
|
||
$('head').append(`<title>${res.data.logo.name ? res.data.logo.name : ''}后台管理系统</title>`);
|
||
localStorage.setItem('web_ico_url', res.data.logo.icourl ? res.data.logo.icourl : '');
|
||
localStorage.setItem('web_system_name', res.data.logo.name ? res.data.logo.name : '');
|
||
this.unitMenu();
|
||
this.avatar = res.data.user.avatar;
|
||
this.user_avatar = res.data.user.avatar;
|
||
this.isBinding = res.data.user.isBinding;
|
||
this.web_stage_url = res.data.logo.stageurl ? res.data.logo.stageurl : '/Public/Retail/images/zhihuilogo4.png';
|
||
this.username = res.data.user.name;
|
||
this.other_name = res.data.user.other_name;
|
||
this.manageName = res.data.manageName;
|
||
this.notice = res.data.notice;
|
||
this.openScan = res.data.openScan;
|
||
//门店权限
|
||
Vue.prototype.storeAuth = res.data.store_id ? res.data.store_auth : {};
|
||
localStorage.store_auth = JSON.stringify(Vue.prototype.storeAuth);
|
||
//商户、门店信息
|
||
localStorage.merchant_id = res.data.merchant_id ? res.data.merchant_id : '';
|
||
localStorage.store_id = res.data.store_id ? res.data.store_id : '';
|
||
localStorage.industry_id = res.data.industry_id ? res.data.industry_id : '';
|
||
localStorage.store_name = res.data.store_name ? res.data.store_name : '';
|
||
} else {
|
||
this.$alert('当前用户暂无后台的操作权限', '提示', {
|
||
confirmButtonText: '退出登录',
|
||
showClose: false,
|
||
callback: action => {
|
||
this.sureLoginOut();
|
||
}
|
||
});
|
||
}
|
||
})
|
||
} else {
|
||
this.$message.error(res.message);
|
||
}
|
||
}
|
||
});
|
||
},
|
||
watch: {
|
||
//监听菜单栏变化
|
||
pathData: {
|
||
deep: true, //深度监听设置为 true
|
||
handler(n, o) {
|
||
// console.log('menu发生变化:当前页面:' + n[n.length - 1].path);
|
||
if (this.iframeUrlList.indexOf(n[n.length - 1].path) >= 0) {
|
||
this.refreshWindow(true);
|
||
} else {
|
||
this.pathList = [];
|
||
this.pagePathList = [];
|
||
n.forEach((item) => {
|
||
if (item.path) this.pathList.push(item.path);
|
||
});
|
||
let f = document.getElementById('myInclude');
|
||
if (f && f.childNodes) {
|
||
for (let i = f.childNodes.length - 1; i >= 0; i--) {
|
||
let path = f.childNodes[i].getAttribute('data-p');
|
||
if (!path || this.pathList.indexOf(path) == -1) {
|
||
f.removeChild(f.childNodes[i]);
|
||
} else if (path) {
|
||
this.pagePathList.push(path);
|
||
}
|
||
}
|
||
}
|
||
|
||
this.iframeSrc = '';
|
||
this.refreshWindow(true);
|
||
let index = this.getActMenuIndex(n[n.length - 1].path, this.menuList);
|
||
if (index !== false) {
|
||
this.actMenuIndex = index;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
});
|
||
})
|
||
</script>
|
||
</html>
|