From ca51b8836f1578f81012cbe7ff63bf6061229823 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 29 七月 2020 20:46:23 +0800 Subject: [PATCH] 2020-07-29 --- src/store/service.js | 65 +++++++++++++++++++++++++++++++- 1 files changed, 63 insertions(+), 2 deletions(-) diff --git a/src/store/service.js b/src/store/service.js index 5617a6e..d138270 100644 --- a/src/store/service.js +++ b/src/store/service.js @@ -1,6 +1,9 @@ import axios from 'axios' +import md5 from 'md5' -axios.defaults.baseURL = '/webapi/dostar' +import Utils from '@/utils' + +// axios.defaults.baseURL = '/webapi/dostar' axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8' axios.defaults.crossDomain = true axios.defaults.withCredentials = true @@ -9,7 +12,7 @@ // 鍦ㄥ彂閫佽姹備箣鍓嶅仛浜涗粈涔� config.data = config.data || {} config.method = 'post' - config.data.userid = '' + config.data.userid = config.data.userid || '' config.data = JSON.stringify(config.data) return config }, (error) => { @@ -43,6 +46,7 @@ } else { return new Promise(resolve => { axios({ + url: '/webapi/dostar', data: { func: DBS } @@ -54,6 +58,61 @@ }) }) } + } + + /** + * @description 娓稿鐧诲綍 + */ + loginSSO () { + let param = { + func: 's_visitor_login', + timestamp: Utils.getCurrentTime(), + SessionUid: localStorage.getItem('SessionUid'), + TypeCharOne: 'pc' + } + + param.LText = md5(window.btoa(localStorage.getItem('SessionUid') + param.timestamp)) + param.secretkey = md5(param.LText + 'mingke' + param.timestamp) + param.appkey = window.GLOB.appkey + param.rduri = window.GLOB.rduri.replace('webapi/dostars', 'webapi/dologon') + + return axios({ + url: '/webapi/dostar', + data: param + }) + } + + /** + * @description 杞帴璋冪敤sso绯荤粺鐨刣ostars + * @param {String} param 璇锋眰鍙傛暟 + */ + setSSORequest (param) { + param.appkey = window.GLOB.appkey + param.rduri = window.GLOB.rduri + + param.userid = sessionStorage.getItem('UserID') || '' + param.SessionUid = localStorage.getItem('SessionUid') || '' + param.LoginUID = sessionStorage.getItem('LoginUID') || '' + + param.nonc = Utils.getuuid() + + let keys = Object.keys(param).sort() + let values = '' + keys.forEach(key => { + if (key === 'rduri' || key === 't') return + if (typeof(param[key]) === 'object') { + values += key + JSON.stringify(param[key]) + } else { + values += key + param[key] + } + }) + param.sign = md5(values) + param.t = new Date().getTime() + + return axios({ + url: '/webapi/dostar', + data: param + }) } /** @@ -69,6 +128,7 @@ } else { return new Promise(resolve => { axios({ + url: '/webapi/dostar', data: param }).then(res => { if (res.status) { @@ -86,6 +146,7 @@ */ setSubmit (param) { return axios({ + url: '/webapi/dostar', data: param }) } -- Gitblit v1.8.0