Commit 7c9d0b53 by 无尘

add: 增加好办后台公共 header 插件

parent 1575ecec
{
"presets": [
["env", { "modules": false }],
"stage-3"
]
}
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
.DS_Store
node_modules/
npm-debug.log
yarn-error.log
package-lock.json
# Editor directories and files
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
# 好办 office header
\ No newline at end of file
# 好办公共 header 插进
>>>HEAD
> A Vue.js vue-office-header Plugin
## Install
- 记得需要切换 公司源
- 换源: npm config set registry http://www.gicdev.com:7001/ 或者使用 nrm 切换
```shell
npm install @gic-test/vue-office-header -S
```
## how to use
```
// main.js
import vueOfficeHeader from '@gic-test/vue-office-header'
Vue.use(vueOfficeHeader)
// 使用页面
<vue-office-header :projectName="projectName" :collapseFlag="collapseFlag" @collapseTag="collapseTag" @toRouterView="toRouterView"></vue-office-header>
data() {
return {
// 可传参数
projectName: '', // 当前项目名
collapseFlag: false, // 折叠参数
// 路由菜单
// 修改由插件请求
}
}
methods: {
// 处理路由跳转
toRouterView(val) {
var that = this;
// 模拟检查数据
console.log(val);
//有两个参数
//{
// name:,
// path:
//}
that.$router.push({
path: val.path
})
},
// 折叠事件
collapseTag(val){
var that = this;
console.log(val);
}
},
```
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("vue-office-header",[],t):"object"==typeof exports?exports["vue-office-header"]=t():e["vue-office-header"]=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="./",t(t.s=3)}([function(e,t,r){"use strict";var n=r(13),o=r.n(n);t.a={name:"vue-office-header",props:["menuRouter","collapseFlag","projectName"],data:function(){return{repProjectName:"gic-web",pathName:"",isCollapse:!1,menuHead:[{menuCode:null,menuName:"首页",menuUrl:"/index",parentCode:null,project:"office"},{menuCode:null,menuName:"通讯录",menuUrl:"/administrativeFrame",parentCode:null,project:"office"},{menuCode:null,menuName:"企业应用",menuUrl:"/enterpriseApp",parentCode:null,project:"office"},{menuCode:null,menuName:"审核中心",menuUrl:"/unreview",parentCode:null,project:"office"},{menuCode:null,menuName:"我的企业",menuUrl:"/unreview",parentCode:null,project:"office"},{menuCode:null,menuName:"设置",menuUrl:"/companyAddress",parentCode:null,project:"office"}],baseUrl:"",routePathName:""}},beforeMount:function(){var e=this,t=window.location.origin;console.log("当前host:",t),"-1"!=t.indexOf("localhost")?e.baseUrl="http://gicdev.demogic.com":e.baseUrl=t},methods:{handleCollapse:function(){var e=this;e.isCollapse=1!=e.isCollapse,e.$emit("collapseTag",e.isCollapse)},toGicLogin:function(){window.location.href=window.location.origin+"/gic-web/#/"},toLoginOut:function(){var e=this;e.$confirm("确认退出吗?","提示",{type:"warning"}).then(function(){e.axios.post(e.baseUrl+"/api-auth/do-logout",{}).then(function(t){var r=t.data;if(0==r.errorCode)return e.$message({message:"退出成功",type:"success"}),void(window.location.href=window.location.origin+"/gic-web/#/");e.$message.error({duration:1e3,message:r.message})}).catch(function(t){console.log(t),e.$message.error({duration:1e3,message:t.message})})}).catch(function(){console.log(error),e.$message.error({duration:1e3,message:error.message})})},toRouter:function(e,t,r){var n=this,o={path:"/"+e,name:t};n.$emit("toRouterView",o)},getHeaderMenu:function(){var e=this,t={project:e.repProjectName,requestProject:e.repProjectName};e.axios.post(e.baseUrl+"/api-auth/login-clerk-menu",o.a.stringify(t)).then(function(t){var r=t.data;if(0==r.errorCode)return e.menuHeadRouter=r.result,console.log(e.menuHeadRouter),void e.getLeftMenu();e.$message.error({duration:1e3,message:r.message})}).catch(function(t){console.log(t),e.$message.error({duration:1e3,message:t.message})})}},watch:{$route:{handler:function(e,t){console.log("获取当前路由:",e)},deep:!0},collapseFlag:function(e,t){this.isCollapse=e},projectName:function(e,t){this.repProjectName=e||"gic-web"}},mounted:function(){console.log("传递的参数对象:",this.collapseFlag);var e=this;e.pathName=e.$route.path,e.routePathName=window.location.hash.split("/")[1],-1!=e.routePathName.indexOf("?")&&(e.routePathName=e.routePathName.split("?")[0]),-1!=e.routePathName.indexOf("/")&&(e.routePathName=e.routePathName.split("/")[0]),console.log("routePathname:",e.routePathName),e.repProjectName=e.projectName||"gic-web",e.isCollapse=e.collapseFlag,e.getHeaderMenu()}}},function(e,t,r){"use strict";var n=Object.prototype.hasOwnProperty,o=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}();t.arrayToObject=function(e,t){for(var r=t&&t.plainObjects?Object.create(null):{},n=0;n<e.length;++n)void 0!==e[n]&&(r[n]=e[n]);return r},t.merge=function(e,r,o){if(!r)return e;if("object"!=typeof r){if(Array.isArray(e))e.push(r);else{if("object"!=typeof e)return[e,r];(o.plainObjects||o.allowPrototypes||!n.call(Object.prototype,r))&&(e[r]=!0)}return e}if("object"!=typeof e)return[e].concat(r);var a=e;return Array.isArray(e)&&!Array.isArray(r)&&(a=t.arrayToObject(e,o)),Array.isArray(e)&&Array.isArray(r)?(r.forEach(function(r,a){n.call(e,a)?e[a]&&"object"==typeof e[a]?e[a]=t.merge(e[a],r,o):e.push(r):e[a]=r}),e):Object.keys(r).reduce(function(e,n){var a=r[n];return Object.prototype.hasOwnProperty.call(e,n)?e[n]=t.merge(e[n],a,o):e[n]=a,e},a)},t.decode=function(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return e}},t.encode=function(e){if(0===e.length)return e;for(var t="string"==typeof e?e:String(e),r="",n=0;n<t.length;++n){var a=t.charCodeAt(n);45===a||46===a||95===a||126===a||a>=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122?r+=t.charAt(n):a<128?r+=o[a]:a<2048?r+=o[192|a>>6]+o[128|63&a]:a<55296||a>=57344?r+=o[224|a>>12]+o[128|a>>6&63]+o[128|63&a]:(n+=1,a=65536+((1023&a)<<10|1023&t.charCodeAt(n)),r+=o[240|a>>18]+o[128|a>>12&63]+o[128|a>>6&63]+o[128|63&a])}return r},t.compact=function(e,r){if("object"!=typeof e||null===e)return e;var n=r||[],o=n.indexOf(e);if(-1!==o)return n[o];if(n.push(e),Array.isArray(e)){for(var a=[],i=0;i<e.length;++i)e[i]&&"object"==typeof e[i]?a.push(t.compact(e[i],n)):void 0!==e[i]&&a.push(e[i]);return a}return Object.keys(e).forEach(function(r){e[r]=t.compact(e[r],n)}),e},t.isRegExp=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},t.isBuffer=function(e){return null!==e&&void 0!==e&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}},function(e,t,r){"use strict";var n=String.prototype.replace,o=/%20/g;e.exports={default:"RFC3986",formatters:{RFC1738:function(e){return n.call(e,o,"+")},RFC3986:function(e){return e}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(4),o={install:function(e,t){e.component(n.a.name,n.a)}};"undefined"!=typeof window&&window.Vue&&window.Vue.use(o),t.default=o},function(e,t,r){"use strict";function n(e){r(5)}var o=r(0),a=r(16),i=r(12),s=n,l=i(o.a,a.a,!1,s,"data-v-35ac6463",null);t.a=l.exports},function(e,t,r){var n=r(6);"string"==typeof n&&(n=[[e.i,n,""]]),n.locals&&(e.exports=n.locals);r(10)("08c845be",n,!0,{})},function(e,t,r){var n=r(7);t=e.exports=r(8)(!1),t.push([e.i,".navheader[data-v-35ac6463]{position:fixed;display:flex;top:0;left:0;width:100%;height:64px;line-height:64px;font-size:14px;background-color:#fff;padding:0;z-index:99;color:#fff}.navheader .fl[data-v-35ac6463]{float:left}.navheader .fr[data-v-35ac6463]{float:right}.navheader-logo[data-v-35ac6463]{flex:0 0 200px;width:200px;height:64px;float:left;padding-left:28px;font-size:20px;color:#1f2f3d;text-align:center;background:url("+n(r(9))+") no-repeat 20px}.navheader-pic[data-v-35ac6463]{vertical-align:middle}.navheader-item[data-v-35ac6463]{flex:1;box-shadow:5px -1px 10px #ddd}.navheader .itemlink[data-v-35ac6463]{float:left;padding:0 20px;display:inline-block;height:62px;cursor:pointer;color:#606266}.navheader .itemlink[data-v-35ac6463]:hover{color:#1890ff}.navheader .bottom[data-v-35ac6463]:hover{border-bottom:2px solid #1890ff}.navheader .current-module.bottom[data-v-35ac6463]{color:#1890ff;border-bottom:2px solid #1890ff;font-weight:500}.navheader .moveleft[data-v-35ac6463]{margin-left:-136px;transition:all .3s ease;background-position:151px 10px;color:transparent}.navheader .moveright[data-v-35ac6463]{margin-left:0;transition:all .2s ease}li[data-v-35ac6463]{list-style:none}.navuserinfo[data-v-35ac6463]{text-align:center}.navuserinfo .el-button--text[data-v-35ac6463]{padding-right:24px;font-size:14px;color:#606266;margin-left:30px}@media screen and (max-width:1280px){.navheader[data-v-35ac6463]{min-width:1280px}}@media screen and (min-width:1280px) and (max-width:1366px){.navheader[data-v-35ac6463]{min-width:1280px}}@media screen and (min-width:1366px) and (max-width:1440px){.navheader[data-v-35ac6463]{min-width:1366px}}@media screen and (min-width:1440px) and (max-width:1920px){.navheader[data-v-35ac6463]{min-width:1440px}}",""])},function(e,t){e.exports=function(e){return"string"!=typeof e?e:(/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),/["'() \t\n]/.test(e)?'"'+e.replace(/"/g,'\\"').replace(/\n/g,"\\n")+'"':e)}},function(e,t){function r(e,t){var r=e[1]||"",o=e[3];if(!o)return r;if(t&&"function"==typeof btoa){var a=n(o);return[r].concat(o.sources.map(function(e){return"/*# sourceURL="+o.sourceRoot+e+" */"})).concat([a]).join("\n")}return[r].join("\n")}function n(e){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e))))+" */"}e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n=r(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n}).join("")},t.i=function(e,r){"string"==typeof e&&(e=[[null,e,""]]);for(var n={},o=0;o<this.length;o++){var a=this[o][0];"number"==typeof a&&(n[a]=!0)}for(o=0;o<e.length;o++){var i=e[o];"number"==typeof i[0]&&n[i[0]]||(r&&!i[2]?i[2]=r:r&&(i[2]="("+i[2]+") and ("+r+")"),t.push(i))}},t}},function(e,t,r){e.exports=r.p+"static/img/logo.png?861ef5c7fa1fa5d519456913f682d46e"},function(e,t,r){function n(e){for(var t=0;t<e.length;t++){var r=e[t],n=u[r.id];if(n){n.refs++;for(var o=0;o<n.parts.length;o++)n.parts[o](r.parts[o]);for(;o<r.parts.length;o++)n.parts.push(a(r.parts[o]));n.parts.length>r.parts.length&&(n.parts.length=r.parts.length)}else{for(var i=[],o=0;o<r.parts.length;o++)i.push(a(r.parts[o]));u[r.id]={id:r.id,refs:1,parts:i}}}}function o(){var e=document.createElement("style");return e.type="text/css",f.appendChild(e),e}function a(e){var t,r,n=document.querySelector("style["+g+'~="'+e.id+'"]');if(n){if(m)return h;n.parentNode.removeChild(n)}if(y){var a=p++;n=d||(d=o()),t=i.bind(null,n,a,!1),r=i.bind(null,n,a,!0)}else n=o(),t=s.bind(null,n),r=function(){n.parentNode.removeChild(n)};return t(e),function(n){if(n){if(n.css===e.css&&n.media===e.media&&n.sourceMap===e.sourceMap)return;t(e=n)}else r()}}function i(e,t,r,n){var o=r?"":n.css;if(e.styleSheet)e.styleSheet.cssText=b(t,o);else{var a=document.createTextNode(o),i=e.childNodes;i[t]&&e.removeChild(i[t]),i.length?e.insertBefore(a,i[t]):e.appendChild(a)}}function s(e,t){var r=t.css,n=t.media,o=t.sourceMap;if(n&&e.setAttribute("media",n),v.ssrId&&e.setAttribute(g,t.id),o&&(r+="\n/*# sourceURL="+o.sources[0]+" */",r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */"),e.styleSheet)e.styleSheet.cssText=r;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(r))}}var l="undefined"!=typeof document;if("undefined"!=typeof DEBUG&&DEBUG&&!l)throw new Error("vue-style-loader cannot be used in a non-browser environment. Use { target: 'node' } in your Webpack config to indicate a server-rendering environment.");var c=r(11),u={},f=l&&(document.head||document.getElementsByTagName("head")[0]),d=null,p=0,m=!1,h=function(){},v=null,g="data-vue-ssr-id",y="undefined"!=typeof navigator&&/msie [6-9]\b/.test(navigator.userAgent.toLowerCase());e.exports=function(e,t,r,o){m=r,v=o||{};var a=c(e,t);return n(a),function(t){for(var r=[],o=0;o<a.length;o++){var i=a[o],s=u[i.id];s.refs--,r.push(s)}t?(a=c(e,t),n(a)):a=[];for(var o=0;o<r.length;o++){var s=r[o];if(0===s.refs){for(var l=0;l<s.parts.length;l++)s.parts[l]();delete u[s.id]}}}};var b=function(){var e=[];return function(t,r){return e[t]=r,e.filter(Boolean).join("\n")}}()},function(e,t){e.exports=function(e,t){for(var r=[],n={},o=0;o<t.length;o++){var a=t[o],i=a[0],s=a[1],l=a[2],c=a[3],u={id:e+":"+o,css:s,media:l,sourceMap:c};n[i]?n[i].parts.push(u):r.push(n[i]={id:i,parts:[u]})}return r}},function(e,t){e.exports=function(e,t,r,n,o,a){var i,s=e=e||{},l=typeof e.default;"object"!==l&&"function"!==l||(i=e,s=e.default);var c="function"==typeof s?s.options:s;t&&(c.render=t.render,c.staticRenderFns=t.staticRenderFns,c._compiled=!0),r&&(c.functional=!0),o&&(c._scopeId=o);var u;if(a?(u=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),n&&n.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},c._ssrRegister=u):n&&(u=n),u){var f=c.functional,d=f?c.render:c.beforeCreate;f?(c._injectStyles=u,c.render=function(e,t){return u.call(t),d(e,t)}):c.beforeCreate=d?[].concat(d,u):[u]}return{esModule:i,exports:s,options:c}}},function(e,t,r){"use strict";var n=r(14),o=r(15),a=r(2);e.exports={formats:a,parse:o,stringify:n}},function(e,t,r){"use strict";var n=r(1),o=r(2),a={brackets:function(e){return e+"[]"},indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},i=Date.prototype.toISOString,s={delimiter:"&",encode:!0,encoder:n.encode,serializeDate:function(e){return i.call(e)},skipNulls:!1,strictNullHandling:!1},l=function e(t,r,o,a,i,s,l,c,u,f,d){var p=t;if("function"==typeof l)p=l(r,p);else if(p instanceof Date)p=f(p);else if(null===p){if(a)return s?s(r):r;p=""}if("string"==typeof p||"number"==typeof p||"boolean"==typeof p||n.isBuffer(p))return s?[d(s(r))+"="+d(s(p))]:[d(r)+"="+d(String(p))];var m=[];if(void 0===p)return m;var h;if(Array.isArray(l))h=l;else{var v=Object.keys(p);h=c?v.sort(c):v}for(var g=0;g<h.length;++g){var y=h[g];i&&null===p[y]||(m=Array.isArray(p)?m.concat(e(p[y],o(r,y),o,a,i,s,l,c,u,f,d)):m.concat(e(p[y],r+(u?"."+y:"["+y+"]"),o,a,i,s,l,c,u,f,d)))}return m};e.exports=function(e,t){var r=e,n=t||{};if(null!==n.encoder&&void 0!==n.encoder&&"function"!=typeof n.encoder)throw new TypeError("Encoder has to be a function.");var i=void 0===n.delimiter?s.delimiter:n.delimiter,c="boolean"==typeof n.strictNullHandling?n.strictNullHandling:s.strictNullHandling,u="boolean"==typeof n.skipNulls?n.skipNulls:s.skipNulls,f="boolean"==typeof n.encode?n.encode:s.encode,d=f?"function"==typeof n.encoder?n.encoder:s.encoder:null,p="function"==typeof n.sort?n.sort:null,m=void 0!==n.allowDots&&n.allowDots,h="function"==typeof n.serializeDate?n.serializeDate:s.serializeDate;if(void 0===n.format)n.format=o.default;else if(!Object.prototype.hasOwnProperty.call(o.formatters,n.format))throw new TypeError("Unknown format option provided.");var v,g,y=o.formatters[n.format];"function"==typeof n.filter?(g=n.filter,r=g("",r)):Array.isArray(n.filter)&&(g=n.filter,v=g);var b=[];if("object"!=typeof r||null===r)return"";var x;x=n.arrayFormat in a?n.arrayFormat:"indices"in n?n.indices?"indices":"repeat":"indices";var w=a[x];v||(v=Object.keys(r)),p&&v.sort(p);for(var j=0;j<v.length;++j){var C=v[j];u&&null===r[C]||(b=b.concat(l(r[C],C,w,c,u,d,g,p,m,h,y)))}return b.join(i)}},function(e,t,r){"use strict";var n=r(1),o=Object.prototype.hasOwnProperty,a={allowDots:!1,allowPrototypes:!1,arrayLimit:20,decoder:n.decode,delimiter:"&",depth:5,parameterLimit:1e3,plainObjects:!1,strictNullHandling:!1},i=function(e,t){for(var r={},n=e.split(t.delimiter,t.parameterLimit===1/0?void 0:t.parameterLimit),a=0;a<n.length;++a){var i,s,l=n[a],c=-1===l.indexOf("]=")?l.indexOf("="):l.indexOf("]=")+1;-1===c?(i=t.decoder(l),s=t.strictNullHandling?null:""):(i=t.decoder(l.slice(0,c)),s=t.decoder(l.slice(c+1))),o.call(r,i)?r[i]=[].concat(r[i]).concat(s):r[i]=s}return r},s=function(e,t,r){if(!e.length)return t;var n,o=e.shift();if("[]"===o)n=[],n=n.concat(s(e,t,r));else{n=r.plainObjects?Object.create(null):{};var a="["===o.charAt(0)&&"]"===o.charAt(o.length-1)?o.slice(1,-1):o,i=parseInt(a,10);!isNaN(i)&&o!==a&&String(i)===a&&i>=0&&r.parseArrays&&i<=r.arrayLimit?(n=[],n[i]=s(e,t,r)):n[a]=s(e,t,r)}return n},l=function(e,t,r){if(e){var n=r.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,a=/(\[[^[\]]*])/,i=/(\[[^[\]]*])/g,l=a.exec(n),c=l?n.slice(0,l.index):n,u=[];if(c){if(!r.plainObjects&&o.call(Object.prototype,c)&&!r.allowPrototypes)return;u.push(c)}for(var f=0;null!==(l=i.exec(n))&&f<r.depth;){if(f+=1,!r.plainObjects&&o.call(Object.prototype,l[1].slice(1,-1))&&!r.allowPrototypes)return;u.push(l[1])}return l&&u.push("["+n.slice(l.index)+"]"),s(u,t,r)}};e.exports=function(e,t){var r=t||{};if(null!==r.decoder&&void 0!==r.decoder&&"function"!=typeof r.decoder)throw new TypeError("Decoder has to be a function.");if(r.delimiter="string"==typeof r.delimiter||n.isRegExp(r.delimiter)?r.delimiter:a.delimiter,r.depth="number"==typeof r.depth?r.depth:a.depth,r.arrayLimit="number"==typeof r.arrayLimit?r.arrayLimit:a.arrayLimit,r.parseArrays=!1!==r.parseArrays,r.decoder="function"==typeof r.decoder?r.decoder:a.decoder,r.allowDots="boolean"==typeof r.allowDots?r.allowDots:a.allowDots,r.plainObjects="boolean"==typeof r.plainObjects?r.plainObjects:a.plainObjects,r.allowPrototypes="boolean"==typeof r.allowPrototypes?r.allowPrototypes:a.allowPrototypes,r.parameterLimit="number"==typeof r.parameterLimit?r.parameterLimit:a.parameterLimit,r.strictNullHandling="boolean"==typeof r.strictNullHandling?r.strictNullHandling:a.strictNullHandling,""===e||null===e||void 0===e)return r.plainObjects?Object.create(null):{};for(var o="string"==typeof e?i(e,r):e,s=r.plainObjects?Object.create(null):{},c=Object.keys(o),u=0;u<c.length;++u){var f=c[u],d=l(f,o[f],r);s=n.merge(s,d,r)}return n.compact(s)}},function(e,t,r){"use strict";var n=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"navheader"},[r("div",{staticClass:"navheader-logo fl",class:{moveleft:e.isCollapse,moveright:!e.isCollapse}},[e._v("好办管理平台")]),e._v(" "),r("div",{staticClass:"navheader-item fl"},[r("a",{staticClass:"itemlink",on:{click:e.handleCollapse}},[r("i",{staticClass:"iconfont",class:{"icon-shouqi":e.isCollapse,"icon-zhankai":!e.isCollapse}})]),e._v(" "),e._l(e.menuHead,function(t){return[r("a",{class:["itemlink","bottom","menu-mall",e.pathName==t.menuUrl?"current-module":""],attrs:{href:"#"+t.menuUrl,target:1==t.target?"_blank":""}},[e._v(e._s(t.menuName))])]}),e._v(" "),r("div",{staticClass:"navuserinfo fr"},[r("el-button",{on:{click:e.toGicLogin}},[e._v("GIC管理平台")]),e._v(" "),r("el-button",{attrs:{type:"text"},on:{click:e.toLoginOut}},[e._v("退出")])],1)],2)])},o=[],a={render:n,staticRenderFns:o};t.a=a}])});
//# sourceMappingURL=vue-office-header.js.map
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>vue-office-header</title>
</head>
<body>
<div id="app"></div>
<!-- <script src="/dist/build.js"></script> -->
<script src="/dist/vue-office-header.js"></script>
</body>
</html>
{
"name": "@gic-test/vue-office-header",
"description": "vue-office-header Plugin",
"author": "fairyly <498745097@qq.com>",
"version": "1.0.2",
"license": "MIT",
"private": false,
"main": "dist/vue-office-header.js",
"scripts": {
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
},
"dependencies": {
"axios": "^0.18.0",
"vue": "^2.5.11"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
],
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-env": "^1.6.0",
"babel-preset-stage-3": "^6.24.1",
"cross-env": "^5.0.5",
"css-loader": "^0.28.7",
"file-loader": "^1.1.4",
"less": "^3.0.4",
"less-loader": "^4.1.0",
"node-sass": "^4.5.3",
"sass-loader": "^6.0.6",
"vue-loader": "^13.0.5",
"vue-template-compiler": "^2.4.4",
"webpack": "^3.6.0",
"webpack-dev-server": "^2.9.1"
}
}
<template>
<div id="app">
<vue-gic-header :projectName="projectName" :collapseFlag="collapseFlag" @collapseTag="collapseTag" @toRouterView="toRouterView"></vue-gic-header>
</div>
</template>
<script>
import vueGicHeader from './lib/vue-gic-header'
export default {
name: 'app',
data () {
return {
projectName: '', // 当前项目名
// headerRouterOptions: {
collapseFlag: false, // 折叠参数
// 路由菜单
// 修改由插件请求
// },
}
},
components: {
vueGicHeader
},
methods: {
// 处理路由跳转
toRouterView(val) {
var that = this;
// 模拟检查数据
// //有两个参数
//{
// name:,
// path:
//}
console.log(val);
that.$router.push({
path: val.path
})
},
// 折叠事件
collapseTag(val){
var that = this;
console.log(val);
}
}
}
</script>
<style lang="scss">
* {
margin: 0;
padding: 0;
}
</style>
import axios from 'axios';
import qs from 'qs';
axios.defaults.timeout = 10000;
let base = "http://192.168.1.164:8282/gic/";
const timeout = 10000;
let token = ''//sessionStorage.getItem('user');
/*
*
* 统一 get 请求方法
* @url: 请求的 url
* @params: 请求带的参数
* @header: 带 token
*
*/
export const getRequest = (url, params) => {
return axios({
method: 'get',
url: `${base}${url}`,
data: {},
params: params,
headers: {'content-type': 'application/x-www-form-urlencoded'},// "token": token
});
}
import vueOfficeHeader from './vue-office-header.vue' // 导入组件
const vueOffice = {
install(Vue, options) {
Vue.component(vueOfficeHeader.name, vueOfficeHeader) // vueGicHeader.name 组件的name属性
// 类似通过 this.$xxx 方式调用插件的 其实只是挂载到原型上而已
// Vue.prototype.$xxx // 最终可以在任何地方通过 this.$xxx 调用
// 虽然没有明确规定用$开头 但是大家都默认遵守这个规定
}
}
if (typeof window !== 'undefined' && window.Vue) {
window.Vue.use(vueOffice);
}
export default vueOffice
// export {
// vueOfficeHeader
// }
<template>
<div class="navheader">
<!-- logo -->
<div class="navheader-logo fl" :class="{moveleft: isCollapse ,moveright: !isCollapse}">好办管理平台</div>
<div class="navheader-item fl">
<a class="itemlink" @click="handleCollapse">
<i class="iconfont" :class="{'icon-shouqi': isCollapse,'icon-zhankai': !isCollapse}"></i>
</a>
<!-- <a :class="['itemlink', 'bottom','menu-all',summaryName=='/index'? 'current-module':'']" :href="origin+'/report/#/memberSummary'">首页</a>
<div :class="['itemlink-gic', 'bottom', pathName=='gic-web'? 'current-module':'']">GIC商户后台</div> -->
<!-- menu -->
<template v-for="menuitem in menuHead">
<a :class="['itemlink', 'bottom','menu-mall',pathName==menuitem.menuUrl? 'current-module':'']" :href="'#'+menuitem.menuUrl" :target="menuitem.target == 1?'_blank':''">{{menuitem.menuName}}</a>
</template>
<!-- 最右侧用户信息 -->
<div class="navuserinfo fr">
<el-button @click="toGicLogin">GIC管理平台</el-button>
<el-button type="text" @click="toLoginOut">退出</el-button>
</div>
</div>
</div>
</template>
<script>
// import { getRequest } from './api';
import qs from 'qs';
export default {
name: 'vue-office-header',
props: ['menuRouter','collapseFlag','projectName'],
data () {
return {
repProjectName: 'gic-web', // 项目名
// 当前路由
pathName: '',
isCollapse: false,// 是否收起左侧
// 菜单数据
menuHead: [
{
menuCode: null,
menuName: "首页",
menuUrl: "/index",
parentCode: null,
project: "office"
},
{
menuCode: null,
menuName: "通讯录",
menuUrl: "/administrativeFrame",
parentCode: null,
project: "office"
},
{
menuCode: null,
menuName: "企业应用",
menuUrl: "/enterpriseApp",
parentCode: null,
project: "office"
},
{
menuCode: null,
menuName: "审核中心",
menuUrl: "/unreview",
parentCode: null,
project: "office"
},
{
menuCode: null,
menuName: "我的企业",
menuUrl: "/unreview",
parentCode: null,
project: "office"
},
{
menuCode: null,
menuName: "设置",
menuUrl: "/companyAddress",
parentCode: null,
project: "office"
},
],
// 获取 location origin
baseUrl: '',
routePathName: '', // 当前路由值
}
},
beforeMount() {
var that = this
var host = window.location.origin;
console.log("当前host:",host)
if (host.indexOf('localhost') != '-1') {
that.baseUrl = 'http://gicdev.demogic.com';
}else {
that.baseUrl = host
}
},
methods: {
// 处理折叠
handleCollapse() {
var that = this;
that.isCollapse = (that.isCollapse==true? false: true);
that.$emit('collapseTag', that.isCollapse)
},
// 跳转 gic 管理后台
toGicLogin() {
window.location.href = window.location.origin + '/gic-web/#/';
},
//退出登录
toLoginOut() {
var that = this;
// var para = {
// requestProject: that.repProjectName
// }
that.$confirm('确认退出吗?', '提示', {
type: 'warning'
}).then(() => {
that.axios.post(that.baseUrl+'/api-auth/do-logout',{})
.then((res) => {
// console.log(res,res.data,res.data.errorCode)
var resData = res.data
if (resData.errorCode == 0) {
that.$message({
message: '退出成功',
type: 'success'
});
// 跳转登录页
window.location.href = window.location.origin + '/gic-web/#/';
return;
}
that.$message.error({
duration: 1000,
message: resData.message
})
})
.catch(function (error) {
console.log(error);
that.$message.error({
duration: 1000,
message: error.message
})
});
}).catch(() => {
console.log(error);
that.$message.error({
duration: 1000,
message: error.message
})
});
},
// 触发父组件路由
toRouter(path,name,code) {
var that = this;
var obj ={
path: '/'+ path,
name: name
}
that.$emit('toRouterView', obj)
},
// 获取菜单
getHeaderMenu() {
var that = this
var para = {
project: that.repProjectName,
requestProject: that.repProjectName
}
that.axios.post(that.baseUrl + '/api-auth/login-clerk-menu',qs.stringify(para))
.then((res) => {
// console.log(res,res.data,res.data.errorCode)
var resData = res.data
if (resData.errorCode == 0) {
that.menuHeadRouter = resData.result;
console.log(that.menuHeadRouter)
// that.setNewData(resData.result)
// 获取左侧菜单
that.getLeftMenu()
return;
}
that.$message.error({
duration: 1000,
message: resData.message
})
})
.catch(function (error) {
console.log(error);
// that.toLogin()
that.$message.error({
duration: 1000,
message: error.message
})
});
},
},
watch: {
$route: {
handler: function(val, oldVal){
console.log("获取当前路由:",val);
var that = this
},
// 深度观察监听
deep: true
},
collapseFlag: function(newData,oldData){
var that = this;
that.isCollapse = newData
},
projectName: function(newData,oldData){
var that = this;
that.repProjectName = newData || 'gic-web';
},
},
/* 接收数据 */
mounted(){
console.log("传递的参数对象:",this.collapseFlag)
var that = this;
that.pathName = that.$route.path
//获取项目名 pathname (路由的hash)
that.routePathName = window.location.hash.split('/')[1];
if (that.routePathName.indexOf('?')!= -1) {
that.routePathName = that.routePathName.split('?')[0]
}
if (that.routePathName.indexOf('/')!= -1) {
that.routePathName = that.routePathName.split('/')[0]
}
console.log("routePathname:",that.routePathName)
// 项目名
that.repProjectName = that.projectName || 'gic-web';
that.isCollapse = that.collapseFlag
// 获取菜单
that.getHeaderMenu();
},
}
</script>
<style lang="less" scoped>
@base-color: #353944;
@hover-color: #3c92eb;
@hoverbg-color: #20242d;
@main-color: #1890ff;
@navbgcolor: #04143a;
@sidebgcolor: #020b21;
@userinfobgcolor: #ecf5ff;
@contentbgcolor: #f5f7fa;
@bordercolor: #dcdfe6;
@customnavcolor: #04143a;
@btnbgcolor: #f5f7fa;
@iconbgcolor: #e6e9f2;
@elmenuisactive: #1890ff;
.flex1(@width,@height) {
flex: 0 0 @width;
width: @width;
height: @height;
}
.navheader /deep/ {
position: fixed;
display: flex;
top: 0;
left: 0;
width: 100%;
/*min-width: 1400px;*/
height: 64px;
line-height: 64px;
font-size: 14px;
background-color: #fff;
padding: 0;
z-index: 99;
color: #fff;
.fl {
float: left;
}
.fr {
float: right;
}
&-logo {
flex: 0 0 200px;
width: 200px;
height: 64px;
float: left;
padding-left: 28px;
font-size: 20px;
color: #1F2F3D;
text-align: center;
background: url("./logo.png") no-repeat 20px center;
}
&-pic {
vertical-align: middle;
}
&-item {
flex: 1;
box-shadow: 5px -1px 10px #ddd;
}
.itemlink {
float: left;
padding: 0 20px;
display: inline-block;
height: 62px;
cursor: pointer;
color: #606266;
&:hover {
color: @main-color;
}
}
.bottom:hover {
border-bottom: 2px solid @main-color;
}
/* 选中 */
.current-module.bottom {
color: @main-color;
border-bottom: 2px solid @main-color;
font-weight: 500;
}
/* logo */
.moveleft {
margin-left: -136px;
transition: all .3s ease;
background-position: 151px 10px;
color: transparent;
}
.moveright {
margin-left: 0px;
transition: all .2s ease;
}
}
li {
list-style: none;
}
/*用户信息*/
.navuserinfo {
/*width: 140px;*/
/*font-size: 0;*/
text-align: center;
.el-button--text {
padding-right: 24px;
font-size: 14px;
color: #606266;
margin-left: 30px;
}
}
/* 当浏览器的可视区域小于1280px */
@media screen and ( max-width: 1280px ) {
.navheader {
min-width: 1280px
}
}
@media screen and (min-width: 1280px) and ( max-width: 1366px ) {
.navheader {
min-width: 1280px
}
}
@media screen and (min-width: 1366px) and ( max-width: 1440px ) {
.navheader {
min-width: 1366px
}
}
@media screen and (min-width: 1440px) and ( max-width: 1920px ) {
.navheader {
min-width: 1440px
}
}
</style>
import Vue from 'vue'
import App from './App.vue'
new Vue({
el: '#app',
render: h => h(App)
})
var path = require('path')
var webpack = require('webpack')
module.exports = {
// entry: './src/main.js',
entry: './src/lib/index.js',
output: {
path: path.resolve(__dirname, './dist'),
publicPath: './',
// filename: 'build.js',
filename: 'vue-office-header.js',
library: 'vue-office-header',
libraryTarget: 'umd',
umdNamedDefine: true
},
module: {
rules: [
{
test: /\.css$/,
use: [
'vue-style-loader',
'css-loader'
],
},
{
test: /\.scss$/,
use: [
'vue-style-loader',
'css-loader',
'sass-loader'
],
},
{
test: /\.sass$/,
use: [
'vue-style-loader',
'css-loader',
'sass-loader?indentedSyntax'
],
},
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
// Since sass-loader (weirdly) has SCSS as its default parse mode, we map
// the "scss" and "sass" values for the lang attribute to the right configs here.
// other preprocessors should work out of the box, no loader config like this necessary.
'scss': [
'vue-style-loader',
'css-loader',
'sass-loader'
],
'sass': [
'vue-style-loader',
'css-loader',
'sass-loader?indentedSyntax'
]
}
// other vue-loader options go here
}
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
// options: {
// name: '[name].[ext]?[hash]'
// },
query : {
name : 'static/img/[name].[ext]?[hash]'
}
}
]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js'
},
extensions: ['*', '.js', '.vue', '.json']
},
devServer: {
historyApiFallback: true,
noInfo: true,
overlay: true
},
performance: {
hints: false
},
devtool: '#eval-source-map'
}
if (process.env.NODE_ENV === 'production') {
module.exports.devtool = '#source-map'
// http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: false
}
}),
new webpack.LoaderOptionsPlugin({
minimize: true
})
])
}
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