{"action":"closed","issue":{"url":"https://api.github.com/repos/ruanyf/react-demos/issues/15","repository_url":"https://api.github.com/repos/ruanyf/react-demos","labels_url":"https://api.github.com/repos/ruanyf/react-demos/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/ruanyf/react-demos/issues/15/comments","events_url":"https://api.github.com/repos/ruanyf/react-demos/issues/15/events","html_url":"https://github.com/ruanyf/react-demos/issues/15","id":134544445,"number":15,"title":"sdsd","user":{"login":"sunshineMaria","id":9734105,"avatar_url":"https://avatars.githubusercontent.com/u/9734105?v=3","gravatar_id":"","url":"https://api.github.com/users/sunshineMaria","html_url":"https://github.com/sunshineMaria","followers_url":"https://api.github.com/users/sunshineMaria/followers","following_url":"https://api.github.com/users/sunshineMaria/following{/other_user}","gists_url":"https://api.github.com/users/sunshineMaria/gists{/gist_id}","starred_url":"https://api.github.com/users/sunshineMaria/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sunshineMaria/subscriptions","organizations_url":"https://api.github.com/users/sunshineMaria/orgs","repos_url":"https://api.github.com/users/sunshineMaria/repos","events_url":"https://api.github.com/users/sunshineMaria/events{/privacy}","received_events_url":"https://api.github.com/users/sunshineMaria/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-18T10:51:49Z","updated_at":"2016-02-18T12:19:47Z","closed_at":"2016-02-18T12:19:47Z","body":"@title: MLSPassport\r\n\r\n@name: MLSPassport\r\n\r\n@desc: MLSPassport\r\n\r\n@platform: pc\r\n\r\n@version: 0.0.1\r\n\r\n@update: \r\n\r\n@author: \r\n\r\n@bgColor: #08D6B6\r\n\r\n\r\n### 如何使用\r\n\r\nredmine参考：<http://redmine.meilishuo.com/projects/hornbill-api/wiki/Passport/>\r\n\r\n### demo\r\n<http://slab.meilishuo.net/passport/demo_lab.html>\r\n\r\n### 引入jdk\r\n```javascript\r\n\r\n<script src=\"静态路径/passport/dist/v1.min.js\"></script>\r\n```\r\n* 线上静态路径：<http://s.meilishuo.net>\r\n\r\n* lab静态环境：<http://slab.meilishuo.net>\r\n\r\n### 调用\r\n#### 登录\r\n```javascript\r\nvar login = new MLSPassport.login({\r\n    app_id:\"10001”,//必填\r\n    defaultCSS:true,//选填，默认false\r\n    ui:{},//选填，默认全显示\r\n    watch:function(res){//选填\r\n        console.log('demo login', res);\r\n    }\r\n})\r\n```\r\n#### 风控\r\n```javascript\r\nvar risk = new MLSPassport.risk({\r\n    app_id:\"10001\",//必填\r\n    defaultCSS:true,//选填，默认false\r\n    risk_type:'pic',//选填，默认pic，可选sms\r\n    outer:'#riskBox'//选填，默认#riskBox\r\n})\r\n```\r\n\r\n\r\n### 集体调用\r\n#### 建立公共passport\r\n```javascript\r\nvar passport = new MLSPassport.passport({\r\n    app_id:\"10001\",\r\n    defaultCSS:true,\r\n    \r\n    jcstatic :'xhstatic2.meilishuo.com', \r\n    //静态路径，默认：\r\n    //http环境：s.meilishuo.net，lab：slab.meilishuo.net\r\n    //https环境：account.meilishuo.com\r\n    \r\n    domain :'xhdev.meilishuo.com', \r\n    //passport接口域名，默认：\r\n    //http环境：www.meilishuo.com，lab：newlab.meilishuo.com\r\n    //https环境：account.meilishuo.com\r\n    \r\n    captcha:'captchalab.meilishuo.com', //验证码域名，默认：\r\n    //http环境：captcha.meilishuo.com\r\n    //https环境：account.meilishuo.com\r\n    \r\n    blank:'/blank.html', //跨主域名接收页面，默认：/passport/blank.html\r\n})\r\n```\r\n#### 登录:login\r\n```javascript\r\nvar login = passport.getLogin({\r\n    loginDone:function(res){},// checkLogin返回已登录成功后的回调\r\n    watch:function(res){ // 外部监听返回回调\r\n        console.log('demo login', res);\r\n    }\r\n})\r\n```\r\n\r\n#### 风控：risk，默认：图片验证码\r\n```javascript\r\nvar risk = passport.getRisk({\r\n    watch:function(res){ // 外部监听返回回调\r\n        console.log('demo risk', res);\r\n    }\r\n})\r\n```\r\n#### 风控－图片验证码：picRisk\r\n```javascript\r\nvar picrisk = passport.getPicRisk({\r\n    ruleid://规则id\r\n    watch:function(res){ // 外部监听返回回调\r\n        console.log('demo picrisk', res);\r\n    }\r\n})\r\n```\r\n#### 风控－短信验证码：smsRisk\r\n```javascript\r\nvar smsrisk = passport.getSMSRisk({\r\n    ruleid://规则id\r\n    watch:function(res){ // 外部监听返回回调\r\n        console.log('demo smsrisk', res);\r\n    }\r\n})\r\n```\r\n#### 手机发送短信：mobile\r\n```javascript\r\nvar mobile = passport.getMobile({\r\n     mobile://手机号\r\n     watch:function(res){\r\n        console.log('mobile', res);\r\n     }\r\n})\r\n```\r\n#### 风控－手机发送短信和短信验证：mobileAndSMSRisk\r\n```javascript\r\nvar mobileAndSMSRisk = passport.getMobileAndSMSRisk({\r\n     ruleid://规则id\r\n     mobile://手机号\r\n     watch:function(res){//添加公共监听\r\n        console.log('mobileAndReactiveRisk', res);\r\n     }\r\n})\r\n\r\n//添加mobile监听\r\nmobileAndSMSRisk.mobile.addWatch(function(res){\r\n    console.log('mobile',res)\r\n})\r\n\r\n//添加risk监听\r\nmobileAndSMSRisk.risk.addWatch(function(res){\r\n    console.log('risk',res)\r\n})\r\n```\r\n#### 激活－手机发送短信和短信验证：mobileAndReactive\r\nvar mobileAndReactiveRisk = passport.getMobileAndReactiveRisk({\r\n     ruleid://规则id\r\n     watch:function(res){//添加公共监听\r\n        console.log('mobileAndReactiveRisk', res);\r\n     }\r\n})\r\n\r\n//添加mobile监听\r\nmobileAndReactiveRisk.mobile.addWatch(function(res){\r\n    console.log('mobile',res)\r\n})\r\n\r\n//添加risk监听\r\nmobileAndReactiveRisk.risk.addWatch(function(res){\r\n    console.log('risk',res)\r\n})\r\n```\r\n#### 登出：logout\r\n```javascript\r\nvar logout = passport.getLougot\r\n    watch:function(res){ // 外部监听返回回调\r\n        console.log('logout', res);\r\n    }\r\n})\r\n```\r\n\r\n###参数说明\r\n```javascript\r\n{\r\n    app_id:\"10001\",//必填\r\n    \r\n    defaultCSS:true, //是否加载默认样式\r\n    \r\n    jcstatic :'xhstatic2.meilishuo.com', //静态路径，默认：s.meilishuo.net，lab：slab.meilishuo.net\r\n    domain :'xhdev.meilishuo.com', //passport接口域名，默认：www.meilishuo.com，lab：newlab.meilishuo.com\r\n    captcha:'captchalab.meilishuo.com',//验证码域名：默认：captcha.meilishuo.com，lab：captchalab.meilishuo.com\r\n    blank:'http://.../blank.html', //跨主域名接收页面，须写全url\r\n    \r\n    outer:'#loginBox'，//外容器，默认为#loginBox\r\n    \r\n    risk_sms_custom:true, //是否用户自定义手机验证动作，默认：false\r\n    \r\n    mix_validate:name,//合并表单验证，默认不填写不合并\r\n    \r\n    ui:{\r\n    //  formTitleShow:1,\r\n    //  formTitleText:'登录美丽说',\r\n    //  submitBtnText:'立即登录'\r\n    //  registerBtnShow:1,\r\n    //  registerBtnText:'注册美丽说',\r\n    //  rememberBtnShow:1,\r\n    //  rememberBtnText:'记住我',\r\n    //  findBtnShow:1,\r\n    //  findBtnText:'忘记密码？',\r\n        usernamePlaceholder:'', //用户名输入框默认文案\r\n    //  passwordPlaceholder:'', //密码输入框默认文案\r\n    //  captchaPlaceholder:'', //验证码输入框默认文案\r\n    //  usernameLabelText:'',//用户名label文案\r\n    //  passwordLabelText:'',//密码label文案\r\n    //  captchaLabelText:'',//验证码label文案\r\n    },\r\n    \r\n    watch:function(res){ // 外部监听返回回调\r\n        console.log('demo login', res);\r\n    }\r\n}\r\n```\r\n\r\n### 注意事项\r\n* passport域名：<www.meilishuo.com>\r\n* 接入域名判断：passport会自动识别域名并做相应处理，仅需在跨主域名（<www.meilizz.com>）时，配合做如下操作：\r\n例：www.meilizz.com 调用passport：\r\n在www.meilizz.com下添加opts.blank所指页面（默认为：<www.meilizz.com/passport/blank.html>）\r\n```javascript\r\n<script src=\"http://s.meilishuo.net/passport/dist/blank.min.js\"></script>\r\n<script>\r\nnew MLSPassport.bridge().send()\r\n</script>\r\n```\r\n\r\n### 说一下captcha，domain，jcstatic：\r\n1. captcha：验证码环境\r\n2. domain：哪个环境的hornbill读哪个环境的snake\r\n3. jcstatic：哪个环境的jdk css\r\n\r\n* *和后端接口有关的，只有domain和captcha\r\n* *前端调jdk，本质是拿到js并执行，默认拿线上，想拿别的环境的需要自己配置jcstatic\r\n\r\n"}}