修改登录接口,修改页面
This commit is contained in:
parent
f6b9dec0f8
commit
6485e88aeb
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"pages": [
|
||||
"pages/work/work",
|
||||
"pages/loading/loading",
|
||||
"pages/work/work",
|
||||
"pages/mine/mine",
|
||||
"pages/bind/bind",
|
||||
"pages/evaluation/evaluation",
|
||||
|
|
|
@ -46,34 +46,13 @@ Page({
|
|||
wx.login({
|
||||
success: res => {
|
||||
$api.getUserInfo({
|
||||
"code": res.code
|
||||
"loginName": "erds",
|
||||
"password": "123456",
|
||||
}).then(obj => {
|
||||
if (obj.code == 200) {
|
||||
//保存openId
|
||||
wx.setStorageSync("openId", obj.data.openId);
|
||||
//判断绑定状态,跳转页面
|
||||
if (obj.data.status == "UNBIND") {
|
||||
wx.reLaunch({
|
||||
url: '/pages/bind/bind'
|
||||
})
|
||||
} else {
|
||||
wx.setStorageSync("token", obj.data.token);
|
||||
wx.setStorageSync("sourceCow", obj.data.loginUser.sourceCow);
|
||||
wx.setStorageSync("userInfo", obj.data.loginUser);
|
||||
wx.setStorageSync("sourceCow", obj.data.loginUser.sourceCow);
|
||||
wx.setStorageSync("farmName", obj.data.loginUser.name);
|
||||
let roles = obj.data.loginUser.roles;
|
||||
//拼接角色字符串
|
||||
var roleStr = "";
|
||||
roles.forEach(element => {
|
||||
roleStr += element.roleKey;
|
||||
});
|
||||
wx.setStorageSync("roleStr",roleStr);
|
||||
//保存用户信息
|
||||
wx.reLaunch({
|
||||
url: '/pages/work/work'
|
||||
});
|
||||
}
|
||||
if (obj.code === 0){
|
||||
wx.reLaunch({
|
||||
url: '/pages/evaluation/evaluation'
|
||||
});
|
||||
}
|
||||
}).catch(err => {
|
||||
Dialog.alert({
|
||||
|
|
|
@ -18,7 +18,7 @@ Page({
|
|||
{text:'党务及意识形态',value:'党务及意识形态'},
|
||||
{text:'党风廉政建设',value:'党风廉政建设'},
|
||||
{text:'日常考核指标',value:'日常考核指标'},
|
||||
{text:'年度考核指标',value:'年度考核指标'},
|
||||
{text:'季度考核指标',value:'季度考核指标'},
|
||||
],
|
||||
deptOpt:[],
|
||||
targetOpt:[],
|
||||
|
|
|
@ -6,7 +6,7 @@ Page({
|
|||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
typeOpt:['党务及意识形态','党风廉政建设','日常考核指标','年度考核指标']
|
||||
typeOpt:['党务及意识形态','党风廉政建设','日常考核指标','季度考核指标']
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
</view>
|
||||
<view class="work_item_row" data-type="3" bindtap="handleSwitch">
|
||||
<image class="item_img" src="/asset/img/index/year.png" />
|
||||
<view class="item_label">年度考核汇报</view>
|
||||
<view class="item_label">季度考核汇报</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
@ -18,7 +18,7 @@ Page({
|
|||
{text:'党务及意识形态',value:'党务及意识形态'},
|
||||
{text:'党风廉政建设',value:'党风廉政建设'},
|
||||
{text:'日常考核指标',value:'日常考核指标'},
|
||||
{text:'年度考核指标',value:'年度考核指标'},
|
||||
{text:'季度考核指标',value:'季度考核指标'},
|
||||
],
|
||||
typeShow:false,
|
||||
targetOpt:[],
|
||||
|
@ -106,6 +106,7 @@ Page({
|
|||
this.setData({
|
||||
"searchForm.target":e.detail.text,
|
||||
"searchForm.targetId":e.detail.id,
|
||||
"searchForm.shotName":e.detail.shotName,
|
||||
activeId:e.detail.id,
|
||||
targetShow:false,
|
||||
})
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<van-cell-group wx:if="{{!isRadio}}">
|
||||
<van-field
|
||||
label="指标"
|
||||
value="{{ searchForm.target }}"
|
||||
value="{{ searchForm.shotName }}"
|
||||
placeholder="请选择指标"
|
||||
border="{{ true }}"
|
||||
readonly="{{true}}"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
const http = require('./http');
|
||||
const API = {
|
||||
//获取用户信息
|
||||
getUserInfo:data => http.request("GET","/wx/health/getUserInfo",data,false),
|
||||
getUserInfo:data => http.request("GET","/wx/index/getUserInfo",data,false),
|
||||
//获取验证码
|
||||
getMsgCode:data => http.request("GET","/wx/health/sendSms",data,false),
|
||||
//绑定用户
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// const base_url = "https://breed.nxcyx.com/wx/"; //配置的域名
|
||||
const base_url = "http://192.168.0.19:8101"; //配置的域名
|
||||
const base_url = "http://192.168.0.107:8088"; //配置的域名
|
||||
// const base_url = "http://q43k76.natappfree.cc/wx/"
|
||||
|
||||
/**
|
||||
|
@ -14,10 +14,11 @@ function request(method,url,data,token){
|
|||
return new Promise(function(resolve,reject){
|
||||
let header = {
|
||||
"content-type":"application/json",
|
||||
"Authorization":""
|
||||
// "Authorization":""
|
||||
};
|
||||
if(token){
|
||||
header.Authorization = 'Bearer '+wx.getStorageSync('token');
|
||||
// header.Authorization = 'Bearer '+wx.getStorageSync('token');
|
||||
header.Cookie = wx.getStorageSync('JSessionId')
|
||||
}
|
||||
wx.request({
|
||||
url: base_url + url,
|
||||
|
@ -25,6 +26,10 @@ function request(method,url,data,token){
|
|||
data: method === "POST" ? JSON.stringify(data) : data,
|
||||
header: header,
|
||||
success(res){
|
||||
if (url.indexOf('getUserInfo')!==-1){
|
||||
let JSessionId = res.header["Set-Cookie"].toString().split(';')[0]
|
||||
wx.setStorageSync("JSessionId", JSessionId);
|
||||
}
|
||||
/**
|
||||
* 请求成功
|
||||
* 判断code是否为200
|
||||
|
|
Loading…
Reference in New Issue