mirror of
https://gitee.com/java110/MicroCommunityWeb.git
synced 2026-06-12 10:00:56 +08:00
优化代码
This commit is contained in:
parent
781e2e12a0
commit
ed239da5ea
4
public/components/frame/sso/sso.html
Normal file
4
public/components/frame/sso/sso.html
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<div><span>{{ssoInfo.errMsg}}</span>
|
||||||
|
|
||||||
|
<vc:create path="frame/initData"></vc:create>
|
||||||
|
</div>
|
||||||
58
public/components/frame/sso/sso.js
Normal file
58
public/components/frame/sso/sso.js
Normal file
@ -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);
|
||||||
26
public/sso.html
Normal file
26
public/sso.html
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
|
<title>获取用户权限</title>
|
||||||
|
|
||||||
|
<vc:create path="frame/commonTop" location="head"></vc:create>
|
||||||
|
<link rel="stylesheet" href="/css/vc-ui.css?time=1" />
|
||||||
|
<script src="/js/vue/vue.min.js"></script>
|
||||||
|
<script src="/js/vue/vue-resource.min.js"></script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
<vc:create path="frame/bodyTop"></vc:create>
|
||||||
|
<div id="component">
|
||||||
|
<vc:create path="frame/sso"></vc:create>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script src="/js/bootstrap/jquery-3.3.1.min.js"></script>
|
||||||
|
<script src="/vcCore/vcFramework.js"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@ -1,41 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Document</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<button onclick="a.b().d()">点我</button>
|
|
||||||
<script type="text/javascript">
|
|
||||||
a = {
|
|
||||||
b: function() {
|
|
||||||
|
|
||||||
return {
|
|
||||||
data: {
|
|
||||||
|
|
||||||
},
|
|
||||||
c: function() {
|
|
||||||
console.log('123123');
|
|
||||||
},
|
|
||||||
d: function() {
|
|
||||||
this.c();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
console.log(a)
|
|
||||||
|
|
||||||
a.b().d();
|
|
||||||
|
|
||||||
console.log(a)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
@ -1056,6 +1056,7 @@
|
|||||||
} else {
|
} else {
|
||||||
_api = '/callComponent/' + api;
|
_api = '/callComponent/' + api;
|
||||||
}
|
}
|
||||||
|
|
||||||
vcFramework.loading('open');
|
vcFramework.loading('open');
|
||||||
Vue.http.post(_api, param, options)
|
Vue.http.post(_api, param, options)
|
||||||
.then(function(res) {
|
.then(function(res) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user