diff --git a/miniprogram/pages/loading/loading.js b/miniprogram/pages/loading/loading.js index ea8530f..104d316 100644 --- a/miniprogram/pages/loading/loading.js +++ b/miniprogram/pages/loading/loading.js @@ -8,7 +8,8 @@ Page({ * 页面的初始数据 */ data: { - + username:'', + password:'' }, /** @@ -41,25 +42,76 @@ Page({ * 生命周期函数--监听页面初次渲染完成 */ onReady() { - //登录 + var username = wx.getStorageSync('loginName') + var password = wx.getStorageSync('password') + console.log(username) + console.log(password) + if (username && password){ + this.autoLogin(username,password) + } + }, + + autoLogin(username,password){ + this.setData({ + username:username, + password:password + }) const _this = this; - wx.login({ - success: res => { - $api.getUserInfo({ - "loginName": "erds", - "password": "123456", - }).then(obj => { - if (obj.code === 0){ - wx.reLaunch({ - url: '/pages/evaluation/evaluation' - }); - } - }).catch(err => { - Dialog.alert({ - message:'服务器错误:404,请联系管理员!' - }) + $api.getUserInfo({ + "loginName": _this.data.username, + "password": _this.data.password, + }).then(obj => { + if (obj.code === 0){ + wx.reLaunch({ + url: '/pages/evaluation/evaluation' + }); + wx.setStorageSync("loginName", _this.data.username); + wx.setStorageSync("password", _this.data.password); + }else { + Dialog.alert({ + message:'用户名或密码错误' }) - }, + } + }).catch(err => { + Dialog.alert({ + message:'服务器错误:404,请联系管理员!' + }) + }) + }, + + login(){ + const _this = this; + if (!_this.data.username){ + Dialog.alert({ + message:'请输入用户名' + }) + return false + } + if (!_this.data.password){ + Dialog.alert({ + message:'请输入密码' + }) + return false + } + $api.getUserInfo({ + "loginName": _this.data.username, + "password": _this.data.password, + }).then(obj => { + if (obj.code === 0){ + wx.reLaunch({ + url: '/pages/evaluation/evaluation' + }); + wx.setStorageSync("loginName", _this.data.username); + wx.setStorageSync("password", _this.data.password); + }else { + Dialog.alert({ + message:'用户名或密码错误' + }) + } + }).catch(err => { + Dialog.alert({ + message:'服务器错误:404,请联系管理员!' + }) }) }, /** diff --git a/miniprogram/pages/loading/loading.wxml b/miniprogram/pages/loading/loading.wxml index 1130f0a..14e5aae 100644 --- a/miniprogram/pages/loading/loading.wxml +++ b/miniprogram/pages/loading/loading.wxml @@ -1,5 +1,33 @@ - + + + + + + + + + 登录 + + + diff --git a/miniprogram/pages/queryList/queryList.wxml b/miniprogram/pages/queryList/queryList.wxml index 0edf501..e5ca62f 100644 --- a/miniprogram/pages/queryList/queryList.wxml +++ b/miniprogram/pages/queryList/queryList.wxml @@ -27,7 +27,7 @@ 部门:{{item.deptName?item.deptName:'暂无'}} - 考核类型:{{item.type?item.type:'暂无'}} + 考核类型:{{item.type?item.type:'暂无'}} 考核指标:{{item.target?item.target:'暂无'}} 指标明细:{{item.detailed?item.detailed:'暂无'}} 标准分:{{item.score?item.score:'暂无'}} diff --git a/miniprogram/utils/http.js b/miniprogram/utils/http.js index da15fc1..f854e9f 100644 --- a/miniprogram/utils/http.js +++ b/miniprogram/utils/http.js @@ -1,5 +1,6 @@ // const base_url = "https://breed.nxcyx.com/wx/"; //配置的域名 -const base_url = "http://192.168.0.107:8088"; //配置的域名 +// const base_url = "http://192.168.0.107:8088"; //配置的域名 +const base_url = "http://39.106.198.243:8088"; //配置的域名 // const base_url = "http://q43k76.natappfree.cc/wx/" /**