Commit 47253162 authored by 范雪寒's avatar 范雪寒

feat: 培生趣鼠假接口

parent f69e0260
...@@ -284,8 +284,8 @@ cc.Class({ ...@@ -284,8 +284,8 @@ cc.Class({
switch (apiName) { switch (apiName) {
case 'NS_login': case 'NS_login':
if (data.userName == 'admin' && data.password == '123456') { if (data.userName == 'admin' && data.password == '123456') {
this.showLog('成功!'); this.showLog('成功!');
callback('成功!'); callback('成功!');
} else { } else {
this.showLog('密码错误!'); this.showLog('密码错误!');
callback('密码错误!'); callback('密码错误!');
...@@ -330,13 +330,127 @@ cc.Class({ ...@@ -330,13 +330,127 @@ cc.Class({
} }
break; break;
case 'PSQS_login': case 'PSQS_login':
this.showLog(`登陆/注册: ${data.phone} ${data.code}`); this.showLog(`登录/注册: ${data.phone} ${data.code}`);
const number = Math.random();
if (number > 0.6) {
callback({
success: true,
userInfo: { // userInfo为空时弹出填写用户信息的页面
phone: 13812345678,
nickName: "小豆梓",
sex: "girl",
provice: "辽宁省",
city: "大连市",
age: '5~8岁',
grade: '一年级'
},
bookInfo: [{
name: "kind_A",
bookList: [{
id: 12334,
coverImg: "http://staging-teach.cdn.ireadabc.com/0d332cb2b167feb4204b1d77a6f02ed6.jpg",
duration: "21:33",
rate: "55%",
createDate: "2012-12-21"
}, {
id: 12231,
coverImg: "http://staging-teach.cdn.ireadabc.com/0d332cb2b167feb4204b1d77a6f02ed6.jpg",
duration: "21:33",
readTime: 2,
createDate: "2012-12-21"
}],
}, {
name: "kind_B",
bookList: [{
id: 12235,
coverImg: "http://staging-teach.cdn.ireadabc.com/0d332cb2b167feb4204b1d77a6f02ed6.jpg",
duration: "21:33",
readTime: 1,
createDate: "2012-12-21"
}],
}]
});
} else if (number > 0.3) {
callback({
success: true,
userInfo: null, // userInfo为空时弹出填写用户信息的页面
bookInfo: [{
name: "kind_A",
bookList: [{
id: 12334,
coverImg: "http://staging-teach.cdn.ireadabc.com/0d332cb2b167feb4204b1d77a6f02ed6.jpg",
duration: "21:33",
rate: "55%",
createDate: "2012-12-21"
}, {
id: 12231,
coverImg: "http://staging-teach.cdn.ireadabc.com/0d332cb2b167feb4204b1d77a6f02ed6.jpg",
duration: "21:33",
readTime: 2,
createDate: "2012-12-21"
}],
}, {
name: "kind_B",
bookList: [{
id: 12235,
coverImg: "http://staging-teach.cdn.ireadabc.com/0d332cb2b167feb4204b1d77a6f02ed6.jpg",
duration: "21:33",
readTime: 1,
createDate: "2012-12-21"
}],
}]
});
} else {
callback({ success: false, msg: '验证码错误。' });
}
break;
case 'PSQS_set_user_info':
this.showLog(`设置用户信息: ${JSON.stringify(data)}`);
if (Math.random() > 0.5) { if (Math.random() > 0.5) {
callback({ success: true }); callback({ success: true });
} else { } else {
callback({ success: false, msg: '验证码错误。' }); callback({ success: false, msg: '错误信息' });
}
break;
case 'PSQS_scan_code':
this.showLog(`扫码`);
if (Math.random() > 0.5) {
callback({
success: true,
bookInfo: [{
name: "kind_A",
bookList: [{
id: 12334,
coverImg: "http://staging-teach.cdn.ireadabc.com/0d332cb2b167feb4204b1d77a6f02ed6.jpg",
duration: "21:33",
rate: "0%",
createDate: "2012-12-21"
}],
}, {
name: "kind_B",
bookList: [],
}]
});
} else {
callback({ success: false, msg: '错误信息' });
}
break;
case 'PSQS_read_book':
this.showLog('进入课件: ' + data.bookId);
if (Math.random() > 0.5) {
callback({ success: true });
} else {
callback({ success: false, msg: '请输入正确的手机号码。' });
} }
break; break;
case 'PSQS_get_basic_info':
this.showLog('获取基本信息');
callback({
version: 'bata 0.9.7',
privacyPolicyUrl: 'http://www.baidu.com',
userAgreement: 'http://www.baidu.com',
});
break;
default: default:
this.showLog('未定义接口: ' + apiName); this.showLog('未定义接口: ' + apiName);
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment