From 20f5203f80444254892012e87e1672f2bc6001db Mon Sep 17 00:00:00 2001
From: ansel0926 <ansel0926@gmail.com>
Date: 星期二, 17 五月 2022 13:59:58 +0800
Subject: [PATCH] Merge branch 'master' of ssh://117.78.1.188:29418/DDE-WEB

---
 assets/js/config.js |   53 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 52 insertions(+), 1 deletions(-)

diff --git a/assets/js/config.js b/assets/js/config.js
index 349be59..23934b5 100644
--- a/assets/js/config.js
+++ b/assets/js/config.js
@@ -50,4 +50,55 @@
             });
         },
     },
-});
\ No newline at end of file
+});
+
+
+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璇锋眰澶辫触锛�");
+        }
+    });
+
+}

--
Gitblit v1.9.1