|
|
@ -16,7 +16,12 @@ 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' |
|
|
|
import { |
|
|
|
setDefaultOrgPath, |
|
|
|
setDefaultOrgPathName, |
|
|
|
setStorage, |
|
|
|
getStorage |
|
|
|
} from './utils/auth.js' |
|
|
|
import VueAMap from 'vue-amap' |
|
|
|
|
|
|
|
Vue.use(ElementUI) |
|
|
@ -36,7 +41,9 @@ Vue.use(Print) // 注册 |
|
|
|
Vue.use(VueAMap) |
|
|
|
VueAMap.initAMapApiLoader({ |
|
|
|
key: 'ccda12d8bffc72e9f1a32c599323a876', // 此处的key,在高德开放平台申请
|
|
|
|
plugin: ['AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PlaceSearch', 'AMap.Geolocation', 'AMap.Geocoder'], // 此处的插件按需添加
|
|
|
|
plugin: ['AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PlaceSearch', 'AMap.Geolocation', |
|
|
|
'AMap.Geocoder' |
|
|
|
], // 此处的插件按需添加
|
|
|
|
v: '1.4.4', |
|
|
|
uiVersion: '1.0' |
|
|
|
}) |
|
|
@ -44,13 +51,16 @@ VueAMap.initAMapApiLoader({ |
|
|
|
Vue.config.productionTip = false |
|
|
|
|
|
|
|
// let token = null
|
|
|
|
let token = |
|
|
|
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyTm8iOiI4NWUwYWY0Yi1lMGJhLTQyM2UtOTIxMS1kYjI2MDg2NTgwM2YiLCJpc3MiOiJXQksiLCJleHAiOjE2OTkzNDQ4OTZ9.R2iCiCKfnz2b66b7uv_5CQg5URPe5AvQLlE59mITUu0' |
|
|
|
// 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)
|
|
|
|
// }
|
|
|
|
if (token) { |
|
|
|
console.log('token》》》》》',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) { |
|
|
@ -62,16 +72,73 @@ if (parseInt(one) > 18) { |
|
|
|
setDefaultOrgPathName(obj.defaultOrgPathName) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 获取登录用户信息
|
|
|
|
function getUserInfo() { |
|
|
|
console.log('2222') |
|
|
|
console.log('token' ,getStorage()) // for debug
|
|
|
|
return request({ |
|
|
|
url: '/v1/sysuser/loginDetailsNew', |
|
|
|
method: 'post', |
|
|
|
headers: { |
|
|
|
'Content-Type': 'application/json' |
|
|
|
} |
|
|
|
}).then(rep => { |
|
|
|
const data = rep.data |
|
|
|
console.log('xxxxx') |
|
|
|
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
|
|
|
|
} |
|
|
|