修改登录接口,修改页面
This commit is contained in:
parent
6485e88aeb
commit
04a24a8a3c
|
@ -8,7 +8,8 @@ Page({
|
||||||
* 页面的初始数据
|
* 页面的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
|
username:'',
|
||||||
|
password:''
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,18 +42,35 @@ Page({
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
*/
|
*/
|
||||||
onReady() {
|
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;
|
const _this = this;
|
||||||
wx.login({
|
|
||||||
success: res => {
|
|
||||||
$api.getUserInfo({
|
$api.getUserInfo({
|
||||||
"loginName": "erds",
|
"loginName": _this.data.username,
|
||||||
"password": "123456",
|
"password": _this.data.password,
|
||||||
}).then(obj => {
|
}).then(obj => {
|
||||||
if (obj.code === 0){
|
if (obj.code === 0){
|
||||||
wx.reLaunch({
|
wx.reLaunch({
|
||||||
url: '/pages/evaluation/evaluation'
|
url: '/pages/evaluation/evaluation'
|
||||||
});
|
});
|
||||||
|
wx.setStorageSync("loginName", _this.data.username);
|
||||||
|
wx.setStorageSync("password", _this.data.password);
|
||||||
|
}else {
|
||||||
|
Dialog.alert({
|
||||||
|
message:'用户名或密码错误'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
Dialog.alert({
|
Dialog.alert({
|
||||||
|
@ -60,6 +78,40 @@ Page({
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
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,请联系管理员!'
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,5 +1,33 @@
|
||||||
<!--pages/loading/loading.wxml-->
|
<!--pages/loading/loading.wxml-->
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<van-loading type="spinner" />
|
<!-- <van-loading type="spinner" />-->
|
||||||
|
<view style="width:100%">
|
||||||
|
<van-cell-group>
|
||||||
|
<van-field
|
||||||
|
model:value="{{ username }}"
|
||||||
|
required
|
||||||
|
size="large"
|
||||||
|
clearable
|
||||||
|
label="用户名"
|
||||||
|
placeholder="请输入用户名"
|
||||||
|
input-align="right"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<van-field
|
||||||
|
model:value="{{ password }}"
|
||||||
|
type="password"
|
||||||
|
size="large"
|
||||||
|
label="密码"
|
||||||
|
clearable
|
||||||
|
placeholder="请输入密码"
|
||||||
|
input-align="right"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
</van-cell-group>
|
||||||
|
<view style="margin-top:20px;">
|
||||||
|
<van-button type="primary" block round bind:tap="login">登录</van-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
<van-dialog id="van-dialog" />
|
<van-dialog id="van-dialog" />
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<view class="list_row" data-cattleNum="{{item.name}}" wx:for="{{list}}" wx:key="id" wx:for-item="item">
|
<view class="list_row" data-cattleNum="{{item.name}}" wx:for="{{list}}" wx:key="id" wx:for-item="item">
|
||||||
<view class="list_row_right">
|
<view class="list_row_right">
|
||||||
<view>部门:{{item.deptName?item.deptName:'暂无'}}</view>
|
<view>部门:{{item.deptName?item.deptName:'暂无'}}</view>
|
||||||
<view>考核类型:{{item.type?item.type:'暂无'}}</view>
|
<view style="color:green">考核类型:{{item.type?item.type:'暂无'}}</view>
|
||||||
<view>考核指标:{{item.target?item.target:'暂无'}}</view>
|
<view>考核指标:{{item.target?item.target:'暂无'}}</view>
|
||||||
<view>指标明细:{{item.detailed?item.detailed:'暂无'}}</view>
|
<view>指标明细:{{item.detailed?item.detailed:'暂无'}}</view>
|
||||||
<view>标准分:{{item.score?item.score:'暂无'}}</view>
|
<view>标准分:{{item.score?item.score:'暂无'}}</view>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// const base_url = "https://breed.nxcyx.com/wx/"; //配置的域名
|
// 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/"
|
// const base_url = "http://q43k76.natappfree.cc/wx/"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue