| | |
| | | var layerPageStyle={ |
| | | offsetX: 100, |
| | | offsetY:50 |
| | | } |
| | | } |
| | | |
| | | |
| | | var vMsg = new Vue({ |
| | | methods: { |
| | | success(msg) { |
| | | this.$message({ message: msg, type: 'success' }); |
| | | }, |
| | | info(msg) { |
| | | this.$message(msg); |
| | | }, |
| | | warning(msg) { |
| | | this.$message({ message: msg, type: 'warning' }); |
| | | }, |
| | | error(msg) { |
| | | this.$message.error(msg); |
| | | }, |
| | | iconSuccess(title,msg) { |
| | | this.$notify({ |
| | | title: title, |
| | | message: msg, |
| | | type: 'success' |
| | | }); |
| | | }, |
| | | iconWarning(title,msg) { |
| | | this.$notify({ |
| | | title: title, |
| | | message: msg, |
| | | type: 'warning' |
| | | }); |
| | | }, |
| | | iconWarningWithTime(title,msg,time) { |
| | | this.$notify({ |
| | | duration:time, |
| | | title: title, |
| | | message: msg, |
| | | type: 'warning' |
| | | }); |
| | | }, |
| | | }, |
| | | }); |
| | | |
| | | |
| | | function getQueryString(name) { |
| | | var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i'); |
| | | var r = decodeURI(window.location.search.substr(1)).match(reg); |
| | | if (r != null) { |
| | | return unescape(r[2]); |
| | | } |
| | | return null; |
| | | } |
| | | initToken(); |
| | | function initToken(){ |
| | | var userName = getQueryString("username"); |
| | | var JSESSIONID = getQueryString("JSESSIONID"); |
| | | window.localStorage.setItem("username", userName); |
| | | window.localStorage.setItem("JSESSIONID", JSESSIONID); |
| | | $("#username").append(userName); |
| | | |
| | | $.ajax({ |
| | | type: "post", |
| | | async: false, |
| | | url: httpConfig.webApiUrl + "landstamp/front/token?sessionId=" + JSESSIONID, |
| | | contentType: "application/json;charset=utf-8", |
| | | success: function (data) { |
| | | if(data.code==0){ |
| | | window.localStorage.setItem("token", data.token); |
| | | } |
| | | console.log(data); |
| | | }, |
| | | error: function (XMLHttpRequest, textStatus, errorThrown) { |
| | | console.log("ajax请求失败!"); |
| | | } |
| | | }); |
| | | var token = window.localStorage.getItem("token"); |
| | | $.ajax({ |
| | | type: "post", |
| | | async: false, |
| | | url: httpConfig.webApiUrl + "landstamp/front/userlogo" , |
| | | contentType: "application/json;charset=utf-8", |
| | | beforeSend:function(request){ |
| | | request.setRequestHeader("token",token); |
| | | }, |
| | | success: function (data) { |
| | | document.getElementById("userlogo").setAttribute("src", data.avatar); |
| | | }, |
| | | error: function (XMLHttpRequest, textStatus, errorThrown) { |
| | | console.log("ajax请求失败!"); |
| | | } |
| | | }); |
| | | |
| | | } |