You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
157 lines
5.3 KiB
157 lines
5.3 KiB
import 'babel-polyfill'
|
|
import Vue from 'vue'
|
|
import 'normalize.css/normalize.css' // A modern alternative to CSS resets
|
|
import ElementUI from 'element-ui'
|
|
import 'element-ui/lib/theme-chalk/index.css'
|
|
import '@/styles/index.scss' // global css
|
|
import App from './App'
|
|
import store from './store'
|
|
import router from './router'
|
|
|
|
import '@/icons' // 引入icon文件夹下所有的svg
|
|
// 全局自定义组件
|
|
import Pagination from '@/components/pagination/index.vue'
|
|
import tabsearch from '@/components/tab-search/index.vue'
|
|
import eimage from '@/components/E-image/index.vue'
|
|
import moment from 'moment'
|
|
import Print from '@/utils/print' // 引入附件的js文件
|
|
import request from '@/utils/request'
|
|
import {
|
|
setDefaultOrgPath,
|
|
setDefaultOrgPathName,
|
|
setStorage
|
|
} from './utils/auth.js'
|
|
|
|
Vue.use(ElementUI)
|
|
|
|
// import '@/permission' //权限控制
|
|
|
|
Vue.prototype.$userInfo = null // 用户信息
|
|
Vue.component('Pagination', Pagination)
|
|
Vue.component('tab-search', tabsearch)
|
|
Vue.component('eimage', eimage)
|
|
Vue.prototype.moment = moment
|
|
Vue.filter('dateFormat', function(dateStr, pattern = 'YYYY-MM-DD') {
|
|
return moment(dateStr).format(pattern)
|
|
})
|
|
Vue.use(Print) // 注册
|
|
|
|
import AMapLoader from '@amap/amap-jsapi-loader';
|
|
// AMapLoader.load({
|
|
// key: "0054c9409ec7a97ddfe933224b36f45c", //申请好的Web端开发者 Key,调用 load 时必填
|
|
// version: "2.0", //指定要加载的 JS API 的版本,缺省时默认为 1.4.15
|
|
// plugins: [
|
|
// 'AMap.ElasticMarker',
|
|
// 'AMap.Geolocation', //定位空间,用来获取和展示用户主机所在的经纬度位置
|
|
// ' AMap.Autocomplete ', //输入提示插件
|
|
// ' AMap.PlaceSearch ', //POI搜索插件
|
|
// ' AMap.Scale ', //右下角缩略图插件,比例尺
|
|
// ' AMap.OverView ', //地图鹰眼插件
|
|
// ' AMap.ToolBar ', //地图工具条
|
|
// ' AMap.MapType ', //类别切换空间,实现默认图层与卫星图,实施交通层之间切换的控制
|
|
// ' AMap.PolyEditor ', //编辑 折线多边形
|
|
// ' AMap.CircleEditor ',
|
|
// "AMap.Geocoder", //地图编码
|
|
// 'AMap.AMapManager',
|
|
// 'AMap.Marker'
|
|
// ], // 此处的插件按需添加
|
|
// })
|
|
// .then((AMap) => {
|
|
// const map = new AMap.Map("container");
|
|
// })
|
|
// .catch((e) => {
|
|
// console.error(e); //加载错误提示
|
|
// });
|
|
window._AMapSecurityConfig = {
|
|
securityJsCode: "e4ce71df213230e89231cc3ef9c98313",
|
|
};
|
|
Vue.config.productionTip = false
|
|
|
|
// let token = null
|
|
// token = GetQueryString('token')
|
|
// if (token) {
|
|
// setStorage(token)
|
|
// const href = window.location.href
|
|
// // href = href.split(`token=${token}`)[0]
|
|
// // window.location.href = href.slice(0, href.length - 1)
|
|
// }
|
|
|
|
var one = window.location.href.indexOf('&organizationData') + 18
|
|
if (parseInt(one) > 18) {
|
|
const data = window.location.href.substr(one) // url解码unescape()已从web中移除,尽量不使用
|
|
var data1 = decodeURIComponent(data)
|
|
if (data1 !== undefined) {
|
|
const obj = JSON.parse(data1)
|
|
setDefaultOrgPath(obj.defaultOrgPath)
|
|
setDefaultOrgPathName(obj.defaultOrgPathName)
|
|
}
|
|
}
|
|
|
|
// 获取登录用户信息
|
|
function getUserInfo() {
|
|
// return request({
|
|
// url: '/wms/apiadmin/sysuser/loginDetails',
|
|
// method: 'post',
|
|
// headers: {
|
|
// 'Content-Type': 'application/json'
|
|
// }
|
|
// }).then(rep => {
|
|
// const data = rep.data
|
|
// const user = {
|
|
// roleSid: data.roleSid,
|
|
// name: data.name,
|
|
// userName: data.userName,
|
|
// departmentName: data.departmentName, // 部门名称
|
|
// departmentSid: data.departmentSid, // 部门sid
|
|
// isAdmin: data.isAdmin,
|
|
// staffSid: data.staffSid, // 业务员sid
|
|
// userSid: data.sid,
|
|
// orgSid: data.organizationSid, // 单位sid
|
|
// Orgname: data.organizationName,
|
|
// dwjb: data.dwjb,
|
|
// orgNamePath: data.orgNamePath, // 使用组织全路径名称
|
|
// orgSidPath: data.orgSidPath // 使用组织全路径Sid
|
|
// }
|
|
// // 结果存入缓存
|
|
// window.sessionStorage.setItem('staffSid', user.staffSid)
|
|
// window.sessionStorage.setItem('userSid', user.userSid)
|
|
// window.sessionStorage.setItem('Orgname', user.Orgname)
|
|
// window.sessionStorage.setItem('orgSid', user.orgSid)
|
|
// window.sessionStorage.setItem('departmentName', user.departmentName)
|
|
// window.sessionStorage.setItem('name', user.name)
|
|
// window.sessionStorage.setItem('user', user)
|
|
// window.sessionStorage.setItem('departmentName', user.departmentName)
|
|
// window.sessionStorage.setItem('departmentSid', user.departmentSid)
|
|
// window.sessionStorage.setItem('orgNamePath', user.orgNamePath)
|
|
// window.sessionStorage.setItem('orgSidPath', user.orgSidPath)
|
|
new Vue({
|
|
el: '#app',
|
|
router,
|
|
store,
|
|
render: h => h(App)
|
|
})
|
|
// })
|
|
}
|
|
|
|
getUserInfo()
|
|
|
|
function GetQueryString(name) {
|
|
var one = window.location.href.indexOf('?token=') + 7
|
|
if (one < 7) {
|
|
return null
|
|
}
|
|
var two = window.location.href.lastIndexOf('&') // + 1
|
|
var data = window.location.href.substr(one)
|
|
if (two > one) {
|
|
data = window.location.href.slice(one, two)
|
|
console.log('token', data)
|
|
}
|
|
if (data) {
|
|
return data
|
|
}
|
|
return null
|
|
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)')
|
|
var r = window.location.search.substr(1).match(reg)
|
|
if (r != null) return unescape(r[2]);
|
|
return null
|
|
}
|
|
|