zs %!s(int64=3) %!d(string=hai) anos
pai
achega
abd46fdd41
Modificáronse 1 ficheiros con 11 adicións e 17 borrados
  1. 11 17
      pages/login/index.js

+ 11 - 17
pages/login/index.js

@@ -26,29 +26,23 @@ Page({
       wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
       return false
     } else {
-      console.log("parmas",params);
-      var phone = params.phone;
-      var password = params.password;
       wx.request({
-        url: 'http://broadcast.waityou24.cn/courtAdmin/api/user/login', //接口地址
-        dataType: 'json',
-        method: 'POST',
-        data: {
-          phone: phone,
-          password: password,
-        },
-        header: {
-          'content-type': 'application/json' // 默认值
-        },
-        success (res) {
-          console.log(res.data)
-          if (res.data.errmsg == "用户不存在") {
+        url: `${app.globalData.publicUrl}/courtAdmin/api/user/login`, //接口地址
+        method: 'post',
+        data: params,
+        success(res) {
+          if (res.data.errcode == 0) {
+            console.log('登录成功');
+            wx.navigateTo({
+              url: '/pages/home/index',//跳转地址
+            })
+          } else {
             wx.showToast({
               title: res.data.errmsg,
               icon: 'none',
               duration: 2000
             })
-          } 
+          }
         }
       })
     }