h5-cli
Version:
hello
112 lines (105 loc) • 5.58 kB
JavaScript
"use strict";
//\u4ee5\u4e0bjs\u6709\u4e24\u4e2a\u57df\u540d\u8bbf\u95ee
//http://s.yuantutech.com/tms/h5/oauth-login.php
//http://guahao.jkqd.gov.cn/oauth-login.php
define(function (require, exports, module) {
var md5 = require("libs/md5");
var VModule = require("component/VModule");
var registerToken = require("mods/register-token/index");
/**
\u9875\u9762\u6b63\u5728\u5b8c\u5584\uff0c\u4f60\u4f20\u5165\u4e86\u4ee5\u4e0b\u53c2\u6570
<pre>
<?php
print_r($_GET);
?>
</pre>
\u9875\u9762\u9700\u6c42\u53c2\u6570\u8bf4\u660e\uff1a\uff08\u8bf7\u6ce8\u610f\u53c2\u6570\u9700\u8fdb\u8fc7url\u7f16\u7801\uff09
<pre>
// //daily.yuantutech.com/tms/h5/oauth-login.php?appid=1 \u6d4b\u8bd5\u73af\u5883
appid:test //\u8fdc\u56fe\u7ed9\u7b2c\u4e09\u65b9\u7684id,
sign:"FGHJKRYUIGHJK345678" //\u52a0\u5bc6\u5b57\u7b26\u4e32
phone:"136...." //\u7528\u6237\u624b\u673a
idNo:"511321....x" //\u7528\u6237\u8eab\u4efd\u8bc1\u53f7\u7801
cardType:"4"//\u5361\u7c7b\u578b 1:\u9752\u5c9b\u533a\u57df\u8bca\u7597\u5361 2:\u9752\u5c9b\u533b\u4fdd\u5361 3:\u5e7f\u5dde\u533b\u4fdd\u5361 4:\u5e7f\u5dde\u756a\u79ba\u6c11\u751f\u5361
name:"" //\u7528\u6237\u771f\u5b9e\u59d3\u540d
cardNo:""// \u5361\u9762\u53f7
custId:"" // \u5ba2\u6237id
redirectCorpId:"123", //\u91cd\u5b9a\u5411\u5230\u67d0\u533b\u9662\u9996\u9875 \u533b\u9662id \u4f18\u5148\u7ea71
redirectUnionId:"60", //\u91cd\u5b9a\u5411\u5230 \u533a\u57df\u533b\u9662\u9996\u9875 \u533a\u57dfid \u4f18\u5148\u7ea72
redirectUrl: "//www.baidu.com" // \u767b\u5f55\u5b8c\u6210\u8df3\u8f6c\u5730\u5740 \u4f18\u5148\u7ea73
redirectUrlKey:1 //\u6570\u5b57\uff0c\u6570\u5b57\u5b9a\u4e49\u5728 http://daily.yuantutech.com/tms/h5/huiyi.php \u5e9f\u5f03 redirectUrl
</pre>
*/
//\u5f53\u524d\u9875\u9762\u53ea\u80fd\u8fd0\u884c\u5728tms\u7684\u7684\u57df\u540d\u4e0b
var page = VModule.render({
init: function init() {
this.state = {
loading: true
};
/**
appId \u533b\u8054\u4f53Id \u6570\u5b57 \u533b\u8054\u4f53Id
phone \u7535\u8bdd\u53f7\u7801 \u6570\u5b57
idNo \u8eab\u4efd\u8bc1\u53f7\u7801 \u6570\u5b57
name \u59d3\u540d \u5b57\u7b26\u4e32
guader_id \u76d1\u62a4\u4eba\u8eab\u4efd\u8bc1 \u6570\u5b57
guader_name \u76d1\u62a4\u4eba\u59d3\u540d \u5b57\u7b26\u4e32
cardNo \u5361\u53f7 \u6570\u5b57
cardType \u5361\u7c7b\u578b \u6570\u5b57
custId \u5ba2\u6237\u53f7 \u6570\u5b57
sign \u7b7e\u540d \u5b57\u7b26\u4e32
redirectCorpId:"123", //\u91cd\u5b9a\u5411\u5230\u67d0\u533b\u9662\u9996\u9875 \u533b\u9662id \u4f18\u5148\u7ea71
redirectUnionId:"60", //\u91cd\u5b9a\u5411\u5230 \u533a\u57df\u533b\u9662\u9996\u9875 \u533a\u57dfid \u4f18\u5148\u7ea72
redirectUrl: "//www.baidu.com" // \u767b\u5f55\u5b8c\u6210\u8df3\u8f6c\u5730\u5740 \u4f18\u5148\u7ea73
*/
////gitlab.yuantutech.com/yuantu/usercenter/wikis/vaccine_schedule
this.redirectCorpId = this.query.redirectCorpId;
this.redirectUnionId = this.query.redirectUnionId;
this.redirectUrl = this.query.redirectUrl;
this.redirectUrlKey = this.query.redirectUrlKey;
// console.log( this.query )
this.module = this.initModule(this.state, '#J_Page');
this.get("/user-web/restapi/common/ytUsers/loginOauth", this.query);
},
onSuccess: function onSuccess(result) {
// $('#')
result.loading = false;
if (result.success) {
//\u9752\u5c9bPC\u662fguahao.gov\u7684\u57df\u540d \u8fd9\u91cc\u76f4\u63a5\u8df3\u8f6c\u5230\u7ebf\u4e0a
if (location.href.indexOf(".yuantutech.com") == -1) {
location.replace("https://s.yuantutech.com/tms/h5/huiyi.php?" + this.util.flat({
redirectCorpId: this.redirectCorpId,
redirectUnionId: this.redirectUnionId,
redirectUrl: this.redirectUrl,
redirectUrlKey: this.redirectUrlKey
}));
} else {
location.replace("/tms/h5/huiyi.php?" + this.util.flat({
redirectCorpId: this.redirectCorpId,
redirectUnionId: this.redirectUnionId,
redirectUrl: this.redirectUrl,
redirectUrlKey: this.redirectUrlKey
}));
}
}
this.setState(result);
},
onError: function onError(result) {
result.loading = false;
this.setState(result);
},
render: function render(state) {
return '';
},
renderError: function renderError(state) {
return "\n <div class=\"ui-tips center\" style=\"margin-top:50px;\">\u6388\u6743\u767B\u5F55\u5931\u8D25<br/>" + (state.msg || "") + " , code:" + (state.resultCode || "") + "</div>\n <div style=\"margin:30px 20px;\">\n <a class=\"ui-btn-lg ui-btn-primary\" href=\"/tms/h5/huiyi.php?" + this.util.flat({
redirectCorpId: this.redirectCorpId,
redirectUnionId: this.redirectUnionId,
redirectUrl: this.redirectUrl,
redirectUrlKey: this.redirectUrlKey
}) + "\">\u7EE7\u7EED\u6D4F\u89C8\u9875\u9762</a>\n </div>\n <div style=\"position:absolute;bottom:20px;width:100%;text-align:center;font-size:12px;\"><a href=\"//s.yuantutech.com/tms/fb/join-h5.html\" target=\"_blank\">\u67E5\u770B\u63A5\u5165\u6587\u6863</a></div>\n ";
}
});
//\u9875\u9762
page.init();
module.exports = page;
});