From ed239da5ea73f889c4f28570962cf9a718377f99 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 26 Apr 2023 02:20:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/components/frame/sso/sso.html | 4 ++ public/components/frame/sso/sso.js | 58 ++++++++++++++++++++++++++++ public/sso.html | 26 +++++++++++++ public/test.html | 41 -------------------- public/vcCore/vcFramework.js | 1 + 5 files changed, 89 insertions(+), 41 deletions(-) create mode 100644 public/components/frame/sso/sso.html create mode 100644 public/components/frame/sso/sso.js create mode 100644 public/sso.html delete mode 100644 public/test.html diff --git a/public/components/frame/sso/sso.html b/public/components/frame/sso/sso.html new file mode 100644 index 000000000..1caadbb82 --- /dev/null +++ b/public/components/frame/sso/sso.html @@ -0,0 +1,4 @@ +
{{ssoInfo.errMsg}} + + +
\ No newline at end of file diff --git a/public/components/frame/sso/sso.js b/public/components/frame/sso/sso.js new file mode 100644 index 000000000..5614150fc --- /dev/null +++ b/public/components/frame/sso/sso.js @@ -0,0 +1,58 @@ +/** + 入驻小区 + **/ + (function(vc) { + vc.extends({ + data: { + ssoInfo: { + errMsg:'' + } + }, + _initMethod: function() { + let _hcAccessToken = vc.getParam('hcAccessToken'); + if(!_hcAccessToken){ + $that.ssoInfo.errMsg = '未包含hcAccessToken,请联系系统管理员'; + return; + } + + let _targetUrl = vc.getParam('targetUrl'); + if(!_targetUrl){ + $that.ssoInfo.errMsg = '未包含targetUrl 或者未用 targetUrl 未用encodeURIComponent 编码'; + } + $that._authLogin(_hcAccessToken,_targetUrl); + }, + _initEvent: function() { + + }, + methods: { + _authLogin:function(_hcAccessToken,_targetUrl){ + console.log(_targetUrl) + let _dataObj = { + hcAccessToken: _hcAccessToken, + } + //发送get请求 + vc.http.apiPost('/login.accessTokenLogin', + JSON.stringify(_dataObj), + { + emulateJSON: true + }, + function(json, res) { + let _data = JSON.parse(json); + if (_data.code != 0) { + $that.ssoInfo.errMsg = _data.msg; + return; + } + vc.emit('initData', 'loadCommunityInfo', { + url: decodeURIComponent(_targetUrl) + }); + //vc.jumpToPage(decodeURIComponent(_targetUrl)); + }, + function(errInfo, error) { + console.log(errInfo); + } + ); + }, + + } + }); +})(window.vc); \ No newline at end of file diff --git a/public/sso.html b/public/sso.html new file mode 100644 index 000000000..3dc4a69f4 --- /dev/null +++ b/public/sso.html @@ -0,0 +1,26 @@ + + + + + + + 获取用户权限 + + + + + + + + +
+ +
+ +
+
+ + + + + \ No newline at end of file diff --git a/public/test.html b/public/test.html deleted file mode 100644 index 58b66e1fc..000000000 --- a/public/test.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - Document - - - - - - - - - - \ No newline at end of file diff --git a/public/vcCore/vcFramework.js b/public/vcCore/vcFramework.js index 372946b6d..26e723d1c 100755 --- a/public/vcCore/vcFramework.js +++ b/public/vcCore/vcFramework.js @@ -1056,6 +1056,7 @@ } else { _api = '/callComponent/' + api; } + vcFramework.loading('open'); Vue.http.post(_api, param, options) .then(function(res) {