Kaynağa Gözat

PCIM-web跳转过来时,对应的缓存信息的配置

raolu 6 yıl önce
ebeveyn
işleme
901ccabb7c
2 değiştirilmiş dosya ile 22 ekleme ve 12 silme
  1. 16 12
      js/api-service.js
  2. 6 0
      login.html

+ 16 - 12
js/api-service.js

@ -2,6 +2,7 @@
    var publish_version = false;
	var isInner = false; //发布线上后有内外网的配置
    var agentName = "wlyyAgentForDoc";
    var docAgentName = "docInfo";
    var server, userAgent, loginUrl, imserver, socketUrl, imgServer;
    var IMEI = localStorage.getItem('WLYY_IMEI') || uuid(16, 16)
@ -37,19 +38,22 @@
        imgServer = "http://172.19.103.54/";
    }
    userAgent = localStorage.getItem(agentName)
    var baseInfo = window.localStorage.getItem('app_storage');
    
    userAgent = window.localStorage.getItem(agentName)
    //hard code userAgent for test start
    //全科
    // userAgent = {"id":4800,"uid":"zbqD201703150222","imei":"864394010176834","token":"9b23e4ec0bcd3b9fa72a52f91544a4e9","platform":4,"hospital":"3502050100"}
    //健管
    // userAgent = {"id":4821,"uid":"zbqD201703150228","imei":"864394010176834","token":"73f5ace5c7d4cdb811f743902fd705d9","platform":4,"hospital":"3502050100"}; 
    // userAgent = JSON.stringify(userAgent);
    //hard code userAgent for test end
    if(userAgent) {
    if(baseInfo) {
        try {
            userAgent = JSON.parse(userAgent)
            baseInfo = JSON.parse(baseInfo);
            window.localStorage.setItem(docAgentName, JSON.stringify(baseInfo.api_login_doctor));
            userAgent = {
                'id': baseInfo.api_login_doctor.id,
                'uid': baseInfo.api_login_doctor.uid,
                'imei': baseInfo.IMEI,
                'token': baseInfo.api_login_doctor.token,
                'platform': '4'
            };
            localStorage.setItem('WLYY_IMEI', baseInfo.IMEI)
        } catch(e) {
            toastr && toastr.warning("登录失效,请重新登录")
            toLoginPage()
@ -75,7 +79,7 @@
                    beforeSend: function(request) {
                        var agent = userAgent || {
                            imei: localStorage.getItem('WLYY_IMEI'),
                            platform: 4
                            platform: '4'
                        }
                        request.setRequestHeader("userAgent", JSON.stringify(agent));
                    },

+ 6 - 0
login.html

@ -267,8 +267,14 @@
								imei: localStorage.getItem('WLYY_IMEI'),
								platform: 4
							}))
							localStorage.setItem("app_storage", JSON.stringify({
                                'api_login_doctor': data,
                                'IMEI': localStorage.getItem('WLYY_IMEI')
                            }))
						   if(redirect_url) {
								window.location.href = decodeURIComponent(redirect_url)
						   }else{
						       window.location.href = "index.html"
						   }
							
						} else {