|
@@ -3,165 +3,163 @@
|
|
|
<html>
|
|
|
|
|
|
<head>
|
|
|
- <title>景宁教育魔方</title>
|
|
|
- <!-- 这个必须引入的啊,钉钉的前端js SDK, 使用框架的请自行参照开发文档 -->
|
|
|
- <script src="https://g.alicdn.com/dingding/dingtalk-jsapi/2.7.13/dingtalk.open.js"></script>
|
|
|
- <!-- 这个jquery 想不想引入自己决定,没什么影响 -->
|
|
|
- <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
|
|
|
- <style type="text/css">
|
|
|
- .loading {
|
|
|
- position: fixed;
|
|
|
- left: 0;
|
|
|
- top: 0;
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- z-index: 100;
|
|
|
- background: url("loading.gif") center no-repeat rgba(255, 255, 255, .55);
|
|
|
- }
|
|
|
- </style>
|
|
|
+ <title>景宁教育魔方</title>
|
|
|
+ <!-- 这个必须引入的啊,钉钉的前端js SDK, 使用框架的请自行参照开发文档 -->
|
|
|
+ <script src="https://g.alicdn.com/dingding/dingtalk-jsapi/2.7.13/dingtalk.open.js"></script>
|
|
|
+ <!-- 这个jquery 想不想引入自己决定,没什么影响 -->
|
|
|
+ <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
|
|
|
+ <style type="text/css">
|
|
|
+ .loading {
|
|
|
+ position: fixed;
|
|
|
+ left: 0;
|
|
|
+ top: 0;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ z-index: 100;
|
|
|
+ background: url("loading.gif") center no-repeat rgba(255, 255, 255, .55);
|
|
|
+ }
|
|
|
+ </style>
|
|
|
</head>
|
|
|
|
|
|
<body>
|
|
|
|
|
|
- <!--TODO...替换成之前亲亲云的一个登录中转过度loading-->
|
|
|
- <div class="loading"></div>
|
|
|
- <!--<div id="user_info" style="color: #000;font-size: 15px;position: fixed;left: 0;top: 0;width: 100%;height: 100%;z-index: 150"></div>-->
|
|
|
- <!--<hr>-->
|
|
|
- <!--<h1>教育魔方-免登验证-线上环境</h1>-->
|
|
|
- <!--<p>当前页面的url:</p>-->
|
|
|
- <!--<p id="url"></p>-->
|
|
|
- <!--<br>-->
|
|
|
- <!--<p>解析url,获取的corpID:</p>-->
|
|
|
- <!--<p id="corpId"></p>-->
|
|
|
- <!--<br>-->
|
|
|
- <!--<p>SDK初始化获取的code:</p>-->
|
|
|
- <!--<p id="code"></p>-->
|
|
|
- <!--<br>-->
|
|
|
- <!--<p>请求我们服务端,登录返回的结果:</p>-->
|
|
|
- <p id="myresponse"></p>
|
|
|
-
|
|
|
- <script type="text/javascript">
|
|
|
- let login_obj = {
|
|
|
- url: '',
|
|
|
- code: '',
|
|
|
- api: ''
|
|
|
- };
|
|
|
- if (location.href.includes('.bozedu.')) {
|
|
|
- login_obj = {
|
|
|
- url: 'https://daily-cube.zjedu.com',
|
|
|
- code: 'suitemie4qeftvmhnufp1',
|
|
|
- api: 'http://jnjymf_api.bozedu.top'
|
|
|
- }
|
|
|
- } else {
|
|
|
- login_obj = {
|
|
|
- url: 'https://cube.zjedu.com',
|
|
|
- code: 'suiteecoywfohhm68lkix',
|
|
|
- api: 'http://60.188.226.44:8090'
|
|
|
- }
|
|
|
- }
|
|
|
- $(function () {
|
|
|
- var params = new Object();
|
|
|
- params = GetRequest();
|
|
|
- if (localStorage.getItem('userInfo')) {
|
|
|
- localStorage.removeItem('userInfo');
|
|
|
- }
|
|
|
- // {
|
|
|
- // var corpId = params.corpId ? params.corpId : '';
|
|
|
- // var tag = params.tag ? params.tag : '';
|
|
|
- // let follow = '';
|
|
|
- // const t = tag.split('_');
|
|
|
- // if (t.length > 1) {
|
|
|
- // tag = t.splice(0, 1)[0];
|
|
|
- // follow = t.join('/');
|
|
|
- // }
|
|
|
- // console.log(' href : ', '/app/' + tag + '/' + (follow ? ('#/' + follow) : ''))
|
|
|
- // return
|
|
|
- // }
|
|
|
- //钉钉sdk 初始化
|
|
|
- // dd.ready参数为回调函数,在环境准备就绪时触发,jsapi的调用需要保证在该回调函数触发后调用,否则无效。
|
|
|
- dd.ready(function () {
|
|
|
- var corpId = params.corpId ? params.corpId : '';
|
|
|
- var tag = params.tag ? params.tag : '';
|
|
|
- let follow = '';
|
|
|
- const t = tag.split('_');
|
|
|
- if (t.length > 1) {
|
|
|
- tag = t.splice(0, 1)[0];
|
|
|
- follow = t.join('/');
|
|
|
- }
|
|
|
- // console.log(' href : ', '/app/' + tag + '/' + (follow ? ('#/' + follow) : ''))
|
|
|
-
|
|
|
- //使用SDK 获取免登授权码
|
|
|
- dd.runtime.permission.requestAuthCode({
|
|
|
- corpId: corpId,
|
|
|
- onSuccess: function (result) {
|
|
|
- var code = result.code;
|
|
|
+ <!--TODO...替换成之前亲亲云的一个登录中转过度loading-->
|
|
|
+ <div class="loading"></div>
|
|
|
+ <!--<div id="user_info" style="color: #000;font-size: 15px;position: fixed;left: 0;top: 0;width: 100%;height: 100%;z-index: 150"></div>-->
|
|
|
+ <!--<hr>-->
|
|
|
+ <!--<h1>教育魔方-免登验证-线上环境</h1>-->
|
|
|
+ <!--<p>当前页面的url:</p>-->
|
|
|
+ <!--<p id="url"></p>-->
|
|
|
+ <!--<br>-->
|
|
|
+ <!--<p>解析url,获取的corpID:</p>-->
|
|
|
+ <!--<p id="corpId"></p>-->
|
|
|
+ <!--<br>-->
|
|
|
+ <!--<p>SDK初始化获取的code:</p>-->
|
|
|
+ <!--<p id="code"></p>-->
|
|
|
+ <!--<br>-->
|
|
|
+ <!--<p>请求我们服务端,登录返回的结果:</p>-->
|
|
|
+ <p id="myresponse"></p>
|
|
|
|
|
|
- $.ajax({
|
|
|
- type: "POST",
|
|
|
- //TODO...下面的域名要从配置文件中获取,不写死
|
|
|
- url: login_obj.url + '/user/api/v1/login/autoLogin',
|
|
|
- contentType: "application/json;charset=utf-8",
|
|
|
- data: JSON.stringify({ code: code, accessKey: login_obj.code, corpId: corpId }),
|
|
|
- dataType: "json",
|
|
|
- success: function (response) {
|
|
|
- // $('#user_info').html('22222'+ JSON.stringify(response.data));
|
|
|
- if (response.success == false) {
|
|
|
- alert(JSON.stringify(response.msg) + JSON.stringify(response.code));
|
|
|
- } else {
|
|
|
- //TODO...开始
|
|
|
- $.ajax({
|
|
|
- type: 'POST',
|
|
|
- url: login_obj.api + '/user/main/login',
|
|
|
- // contentType: "application/json;charset=utf-8",
|
|
|
- data: {
|
|
|
- cubeinfo: JSON.stringify(response.data)
|
|
|
- },
|
|
|
- dataType: "json",
|
|
|
- success: (res) => {
|
|
|
- if (res.code == 1) {
|
|
|
- localStorage.setItem('userInfo', JSON.stringify(res.data));
|
|
|
- location.href = '/app/' + tag + '/' + (follow ? ('#/' + follow) : '');
|
|
|
- // location.href = 'test.html';
|
|
|
- } else {
|
|
|
- alert(res.msg);
|
|
|
- }
|
|
|
- },
|
|
|
- error: function (re) {
|
|
|
- alert("失败" + JSON.stringify(res));
|
|
|
- }
|
|
|
- })
|
|
|
- //TODO...结束
|
|
|
- }
|
|
|
- // alert("成功" + JSON.stringify(response));
|
|
|
- //成功以后将response.data的信息提交给 本地用户获取接口(开发中),初始化登录用户信息
|
|
|
+ <script type="text/javascript">
|
|
|
+ let login_obj = {
|
|
|
+ url: '',
|
|
|
+ code: '',
|
|
|
+ api: ''
|
|
|
+ };
|
|
|
+ if (location.href.includes('.bozedu.')) {
|
|
|
+ login_obj = {
|
|
|
+ url: 'https://daily-cube.zjedu.com',
|
|
|
+ code: 'suitemie4qeftvmhnufp1',
|
|
|
+ api: 'http://jnjymf_api.bozedu.top'
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ login_obj = {
|
|
|
+ url: 'https://cube.zjedu.com',
|
|
|
+ code: 'suiteecoywfohhm68lkix',
|
|
|
+ api: 'http://60.188.226.44:8090'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $(function () {
|
|
|
+ var params = new Object();
|
|
|
+ params = GetRequest();
|
|
|
+ if (localStorage.getItem('userInfo')) {
|
|
|
+ localStorage.removeItem('userInfo');
|
|
|
+ }
|
|
|
+ // {
|
|
|
+ // var corpId = params.corpId ? params.corpId : '';
|
|
|
+ // var tag = params.tag ? params.tag : '';
|
|
|
+ // let follow = '';
|
|
|
+ // const t = tag.split('_');
|
|
|
+ // if (t.length > 1) {
|
|
|
+ // tag = t.splice(0, 1)[0];
|
|
|
+ // follow = t.join('/');
|
|
|
+ // }
|
|
|
+ // console.log(' href : ', '/app/' + tag + '/' + (follow ? ('#/' + follow) : ''))
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ //钉钉sdk 初始化
|
|
|
+ // dd.ready参数为回调函数,在环境准备就绪时触发,jsapi的调用需要保证在该回调函数触发后调用,否则无效。
|
|
|
+ dd.ready(function () {
|
|
|
+ var corpId = params.corpId ? params.corpId : '';
|
|
|
+ var tag = params.tag ? params.tag : '';
|
|
|
+ // const t = tag.split('_');
|
|
|
+ // if (t.length > 1) {
|
|
|
+ // tag = t.splice(0, 1)[0];
|
|
|
+ // follow = t.join('/');
|
|
|
+ // }
|
|
|
+ // console.log(' href : ', '/app/' + tag + '/' + (follow ? ('#/' + follow) : ''))
|
|
|
|
|
|
+ //使用SDK 获取免登授权码
|
|
|
+ dd.runtime.permission.requestAuthCode({
|
|
|
+ corpId: corpId,
|
|
|
+ onSuccess: function (result) {
|
|
|
+ var code = result.code;
|
|
|
|
|
|
- },
|
|
|
- error: function (response) {
|
|
|
- alert("失败" + JSON.stringify(response));
|
|
|
- }
|
|
|
- });
|
|
|
+ $.ajax({
|
|
|
+ type: "POST",
|
|
|
+ //TODO...下面的域名要从配置文件中获取,不写死
|
|
|
+ url: login_obj.url + '/user/api/v1/login/autoLogin',
|
|
|
+ contentType: "application/json;charset=utf-8",
|
|
|
+ data: JSON.stringify({ code: code, accessKey: login_obj.code, corpId: corpId }),
|
|
|
+ dataType: "json",
|
|
|
+ success: function (response) {
|
|
|
+ // $('#user_info').html('22222'+ JSON.stringify(response.data));
|
|
|
+ if (response.success == false) {
|
|
|
+ alert(JSON.stringify(response.msg) + JSON.stringify(response.code));
|
|
|
+ } else {
|
|
|
+ //TODO...开始
|
|
|
+ $.ajax({
|
|
|
+ type: 'POST',
|
|
|
+ url: login_obj.api + '/user/main/login',
|
|
|
+ // contentType: "application/json;charset=utf-8",
|
|
|
+ data: {
|
|
|
+ cubeinfo: JSON.stringify(response.data)
|
|
|
},
|
|
|
- onFail: function (err) {
|
|
|
- // 调用失败时回调
|
|
|
- alert("requestAuthCode失败" + JSON.stringify(err));
|
|
|
+ dataType: "json",
|
|
|
+ success: (res) => {
|
|
|
+ if (res.code == 1) {
|
|
|
+ localStorage.setItem('userInfo', JSON.stringify(res.data));
|
|
|
+ location.href = '/app/mobile/' + (tag ? ('#/?tag=' + tag) : '');
|
|
|
+ } else {
|
|
|
+ alert(res.msg);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function (re) {
|
|
|
+ alert("失败" + JSON.stringify(res));
|
|
|
}
|
|
|
- });
|
|
|
- });
|
|
|
- })
|
|
|
- function GetRequest() {
|
|
|
- var url = location.search;
|
|
|
- var theRequest = new Object();
|
|
|
- if (url.indexOf("?") != -1) {
|
|
|
- var str = url.substr(1);
|
|
|
- strs = str.split("&");
|
|
|
- for (var i = 0; i < strs.length; i++) {
|
|
|
- theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
|
|
|
+ })
|
|
|
+ //TODO...结束
|
|
|
}
|
|
|
- }
|
|
|
- return theRequest;
|
|
|
+ // alert("成功" + JSON.stringify(response));
|
|
|
+ //成功以后将response.data的信息提交给 本地用户获取接口(开发中),初始化登录用户信息
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+ error: function (response) {
|
|
|
+ alert("失败" + JSON.stringify(response));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ onFail: function (err) {
|
|
|
+ // 调用失败时回调
|
|
|
+ alert("requestAuthCode失败" + JSON.stringify(err));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ })
|
|
|
+ function GetRequest() {
|
|
|
+ var url = location.search;
|
|
|
+ var theRequest = new Object();
|
|
|
+ if (url.indexOf("?") != -1) {
|
|
|
+ var str = url.substr(1);
|
|
|
+ strs = str.split("&");
|
|
|
+ for (var i = 0; i < strs.length; i++) {
|
|
|
+ theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
|
|
|
}
|
|
|
- </script>
|
|
|
+ }
|
|
|
+ return theRequest;
|
|
|
+ }
|
|
|
+ </script>
|
|
|
</body>
|
|
|
|
|
|
</html>
|