|
一看就是童鞋级别,给你一个典型的案例代码。
login页面核心代码
- api.ajax({
- url: Login_url,
- method: 'post',
- timeout: 30,
- dataType: 'json',
- returnAll: false,
- data: {
- values: {
- ShouJi: vm.ShouJi,
- Pwd: md5(vm.Pwd),
- timestamp: vm.timestamp,
- sign: md5(vm.ShouJi+md5(vm.Pwd)+vm.timestamp)
- }
- }
- }, function (ret, err) {
- if (ret) {
- console.log(JSON.stringify(ret));
- api.toast({
- msg: ret.msg,
- duration: 2000,
- location: 'bottom'
- });
- if(ret.code == 0){
- //登录成功,保存登录会员信息
- $api.setStorage('sign',ret.sign);
- $api.setStorage('userInfo',ret.userInfo);
- api.sendEvent({
- name: 'Refresh_usercenter',//登录成功刷新会员中心页面
- });
- setTimeout(function () {
- closeme();
- },500)
- }
- } else {
- api.alert(JSON.stringify(err));
- }
- });
复制代码
|
|