Showing
10 changed files
with
94 additions
and
45 deletions
1 | import minaEnv from "../utils/minaEnv"; | 1 | import minaEnv from "../utils/minaEnv"; |
2 | + | ||
2 | export const API_CONST = { | 3 | export const API_CONST = { |
3 | login: { | 4 | login: { |
4 | wxLogin: { | 5 | wxLogin: { |
5 | - url: `/qx-api/qx-apaas-auth/server/auth/login`, | 6 | + url: `/power/user/userLogin`, |
6 | method: "POST" | 7 | method: "POST" |
7 | }, | 8 | }, |
8 | loginSecurity: { | 9 | loginSecurity: { |
@@ -15,7 +16,7 @@ export const API_CONST = { | @@ -15,7 +16,7 @@ export const API_CONST = { | ||
15 | }, | 16 | }, |
16 | 17 | ||
17 | logout: { | 18 | logout: { |
18 | - url: `/qx-api/qx-apaas-auth/server/auth/mobile/logout`, | 19 | + url: `/power/user/userLogout`, |
19 | method: "POST" | 20 | method: "POST" |
20 | } | 21 | } |
21 | 22 | ||
@@ -24,11 +25,11 @@ export const API_CONST = { | @@ -24,11 +25,11 @@ export const API_CONST = { | ||
24 | 25 | ||
25 | home: { | 26 | home: { |
26 | miniData: { | 27 | miniData: { |
27 | - url: `/open/qx-apaas-custom/hczd/index`, | 28 | + url: `/power/hczd/index`, |
28 | method: "POST"//参数:{"corpCode": "default"} | 29 | method: "POST"//参数:{"corpCode": "default"} |
29 | }, | 30 | }, |
30 | getDate: { | 31 | getDate: { |
31 | - url: `/open/qx-apaas-custom/hczd/getDate`, | 32 | + url: `/power/hczd/getDate`, |
32 | method: "POST"//参数 | 33 | method: "POST"//参数 |
33 | }, | 34 | }, |
34 | userInfoDetail: { | 35 | userInfoDetail: { |
@@ -76,8 +76,9 @@ Page({ | @@ -76,8 +76,9 @@ Page({ | ||
76 | }, | 76 | }, |
77 | 77 | ||
78 | __mobilelogoutEvent() { | 78 | __mobilelogoutEvent() { |
79 | + const cookieVal: any = wx.getStorageSync("power_session_id") | ||
79 | HTTP.POST({ | 80 | HTTP.POST({ |
80 | - ...API_CONST.login.logout, | 81 | + ...{ url: `${API_CONST.login.logout.url}?power_session_id=${cookieVal}`, method: "POST" }, |
81 | payload: { | 82 | payload: { |
82 | cookieFlag: true | 83 | cookieFlag: true |
83 | } | 84 | } |
@@ -96,7 +97,8 @@ Page({ | @@ -96,7 +97,8 @@ Page({ | ||
96 | .then(() => { | 97 | .then(() => { |
97 | // on confirm | 98 | // on confirm |
98 | this.__mobilelogoutEvent() | 99 | this.__mobilelogoutEvent() |
99 | - | 100 | + // wx.clearStorageSync() |
101 | + // wx.reLaunch({ url: "/pages/login/login" }) | ||
100 | }) | 102 | }) |
101 | .catch(() => { | 103 | .catch(() => { |
102 | // on cancel | 104 | // on cancel |
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | </view> | 5 | </view> |
6 | <view class="acount_info"> | 6 | <view class="acount_info"> |
7 | <van-cell-group> | 7 | <van-cell-group> |
8 | - <van-cell title="姓名" value="{{optionsObj.name || '未设置'}}" /> | 8 | + <van-cell title="姓名" value="{{optionsObj.userName || '未设置'}}" /> |
9 | <van-cell title="手机号" value="{{optionsObj.mobile || '未设置'}}" /> | 9 | <van-cell title="手机号" value="{{optionsObj.mobile || '未设置'}}" /> |
10 | <van-cell title="邮箱" value="{{optionsObj.email || '未设置'}}" /> | 10 | <van-cell title="邮箱" value="{{optionsObj.email || '未设置'}}" /> |
11 | </van-cell-group> | 11 | </van-cell-group> |
@@ -11,7 +11,19 @@ Page({ | @@ -11,7 +11,19 @@ Page({ | ||
11 | userInfoObj: {} | 11 | userInfoObj: {} |
12 | }, | 12 | }, |
13 | onLoad() { | 13 | onLoad() { |
14 | - this.__getUserInfoDetail() | 14 | + // this.__getUserInfoDetail() |
15 | + const power_user_info: any = wx.getStorageSync("power_user_info") | ||
16 | + console.log(power_user_info,'power_user_info') | ||
17 | + | ||
18 | + if(Object.entries(power_user_info).length>0&&power_user_info){ | ||
19 | + const arr = power_user_info.userName.split("") | ||
20 | + const lastName = arr[arr.length-1] | ||
21 | + const dataTitle = "徽辰智电" | ||
22 | + console.log(arr,'pppppparrr') | ||
23 | + this.setData({ | ||
24 | + userInfoObj: {...power_user_info,lastName,dataTitle} | ||
25 | + }) | ||
26 | + } | ||
15 | }, | 27 | }, |
16 | handleGetMessage(e: any) { | 28 | handleGetMessage(e: any) { |
17 | console.log(e, 'handleGetMessagehandleGetMessage') | 29 | console.log(e, 'handleGetMessagehandleGetMessage') |
@@ -5,11 +5,11 @@ | @@ -5,11 +5,11 @@ | ||
5 | </view> | 5 | </view> |
6 | <view class="mine-info"> | 6 | <view class="mine-info"> |
7 | <view class="mine-info-basic"> | 7 | <view class="mine-info-basic"> |
8 | - {{userInfoObj.dataTitle}} | 8 | + {{userInfoObj.userName}} |
9 | </view> | 9 | </view> |
10 | <view class="mine-company"> | 10 | <view class="mine-company"> |
11 | <!-- <image src="" class="image_view" mode=""/> --> | 11 | <!-- <image src="" class="image_view" mode=""/> --> |
12 | - <view class="mine-company-info">{{userInfoObj.corpName}}</view> | 12 | + <view class="mine-company-info">{{userInfoObj.dataTitle}}</view> |
13 | </view> | 13 | </view> |
14 | </view> | 14 | </view> |
15 | </view> | 15 | </view> |
@@ -22,7 +22,7 @@ Page({ | @@ -22,7 +22,7 @@ Page({ | ||
22 | * 生命周期函数--监听页面加载 | 22 | * 生命周期函数--监听页面加载 |
23 | */ | 23 | */ |
24 | onLoad() { | 24 | onLoad() { |
25 | - this.__getLoginSecurityImg() | 25 | + // this.__getLoginSecurityImg() |
26 | }, | 26 | }, |
27 | 27 | ||
28 | /** | 28 | /** |
@@ -93,16 +93,17 @@ Page({ | @@ -93,16 +93,17 @@ Page({ | ||
93 | ...API_CONST.login.wxLogin, | 93 | ...API_CONST.login.wxLogin, |
94 | payload: this.getLoginParams() | 94 | payload: this.getLoginParams() |
95 | }).then((data: any) => { | 95 | }).then((data: any) => { |
96 | - console.log(data, '登录参数') | ||
97 | if (data.success) { | 96 | if (data.success) { |
98 | //登录请求回来之后,读取res的header的cookie | 97 | //登录请求回来之后,读取res的header的cookie |
99 | //cookie是个唯一标识 | 98 | //cookie是个唯一标识 |
100 | - wx.setStorageSync("cookie", data.data) | 99 | + console.log(data.data.power_session_id, '登录参数') |
100 | + wx.setStorageSync("power_user_info", data.data.user) | ||
101 | + wx.setStorageSync("power_session_id", data.data.power_session_id) | ||
101 | wx.switchTab({ | 102 | wx.switchTab({ |
102 | url: "/pages/monitor/monitor" | 103 | url: "/pages/monitor/monitor" |
103 | }) | 104 | }) |
104 | } else { | 105 | } else { |
105 | - this.__getUserSecurityImg() | 106 | + // this.__getUserSecurityImg() |
106 | wx.showToast({ | 107 | wx.showToast({ |
107 | title: data.msg || '请求失败', | 108 | title: data.msg || '请求失败', |
108 | icon: 'error', | 109 | icon: 'error', |
@@ -125,14 +126,8 @@ Page({ | @@ -125,14 +126,8 @@ Page({ | ||
125 | getLoginParams() { | 126 | getLoginParams() { |
126 | // 组织ID登录 | 127 | // 组织ID登录 |
127 | return { | 128 | return { |
128 | - LOGIN_TYPE: 'CORP', | ||
129 | - code: this.data.codeKey.replace(/(^\s*)|(\s*$)/g, ''), // 图片验证码 | ||
130 | - corpCode: "hczd", | ||
131 | - username: this.data.username, | 129 | + loginName: this.data.username, |
132 | password: this.data.password, | 130 | password: this.data.password, |
133 | - key: this.data.keyStr, | ||
134 | - autoLogin: false, | ||
135 | - | ||
136 | } | 131 | } |
137 | }, | 132 | }, |
138 | imgKeyEvent(e: any) { | 133 | imgKeyEvent(e: any) { |
@@ -9,8 +9,8 @@ | @@ -9,8 +9,8 @@ | ||
9 | <van-field label="用户名" title-width="50" value="{{ username }}" bind:change="userEvent" required clearable placeholder="请输入手机号" bind:click-icon="onClickIcon" /> | 9 | <van-field label="用户名" title-width="50" value="{{ username }}" bind:change="userEvent" required clearable placeholder="请输入手机号" bind:click-icon="onClickIcon" /> |
10 | <van-field label="密码" title-width="50" value="{{ password }}" bind:change="passEvent" type="{{checkFlag?'password':''}}" bind:click-icon="changeIconEvent" icon="{{!checkFlag?'eye-o':'closed-eye'}}" placeholder="请输入密码" required /> | 10 | <van-field label="密码" title-width="50" value="{{ password }}" bind:change="passEvent" type="{{checkFlag?'password':''}}" bind:click-icon="changeIconEvent" icon="{{!checkFlag?'eye-o':'closed-eye'}}" placeholder="请输入密码" required /> |
11 | 11 | ||
12 | - <van-field wx:if="{{!hideFlag&& imgUrl}}" title-width="50" label="验证码" value="{{ codeKey }}" bind:change="imgKeyEvent" placeholder="请输入验证码" required /> | ||
13 | - <image src="{{imgUrl}}" wx:if="{{ imgUrl}}" class="code-img" /> | 12 | + <!-- <van-field wx:if="{{!hideFlag&& imgUrl}}" title-width="50" label="验证码" value="{{ codeKey }}" bind:change="imgKeyEvent" placeholder="请输入验证码" required /> |
13 | + <image src="{{imgUrl}}" wx:if="{{ imgUrl}}" class="code-img" /> --> | ||
14 | </van-cell-group> | 14 | </van-cell-group> |
15 | <view class="login_btn" bind:tap="loginEvent"> | 15 | <view class="login_btn" bind:tap="loginEvent"> |
16 | 登录 | 16 | 登录 |
@@ -293,6 +293,8 @@ Page({ | @@ -293,6 +293,8 @@ Page({ | ||
293 | 293 | ||
294 | }, | 294 | }, |
295 | __getOpenQxCustomHczdInde() {//接口请求 | 295 | __getOpenQxCustomHczdInde() {//接口请求 |
296 | + const cookieVal: any = wx.getStorageSync("power_session_id") | ||
297 | + console.log(cookieVal, 'cookieValcookieVal') | ||
296 | Toast.loading({ | 298 | Toast.loading({ |
297 | message: '加载中...', | 299 | message: '加载中...', |
298 | forbidClick: true, | 300 | forbidClick: true, |
@@ -300,7 +302,7 @@ Page({ | @@ -300,7 +302,7 @@ Page({ | ||
300 | duration: 0, // 持续展示 toast | 302 | duration: 0, // 持续展示 toast |
301 | }); | 303 | }); |
302 | HTTP.POST({ | 304 | HTTP.POST({ |
303 | - ...API_CONST.home.miniData, | 305 | + ...{ url: `${API_CONST.home.miniData.url}?power_session_id=${cookieVal}&type=mobile`, method: "POST" }, |
304 | payload: { | 306 | payload: { |
305 | corpCode: "hczd" | 307 | corpCode: "hczd" |
306 | } | 308 | } |
@@ -586,20 +588,35 @@ Page({ | @@ -586,20 +588,35 @@ Page({ | ||
586 | deviceDataList: deviceDataListNew, | 588 | deviceDataList: deviceDataListNew, |
587 | overallDataList: overallDataListNew | 589 | overallDataList: overallDataListNew |
588 | }) | 590 | }) |
589 | - wx.showToast({ | ||
590 | - title: '请求失败', | ||
591 | - icon: 'error', | ||
592 | - duration: 2000 | ||
593 | - }); | 591 | + console.log(data.errCode === 'loginOut', 'data======', data) |
592 | + if (data.data === 'loginOut') { | ||
593 | + wx.showToast({ | ||
594 | + title: data.msg, | ||
595 | + icon: 'error', | ||
596 | + duration: 2000 | ||
597 | + }); | ||
598 | + wx.clearStorageSync() | ||
599 | + wx.reLaunch({ url: "/pages/login/login" }) | ||
600 | + } else { | ||
601 | + console.log('=============进来了吗') | ||
602 | + wx.showToast({ | ||
603 | + title: '请求失败', | ||
604 | + icon: 'error', | ||
605 | + duration: 2000 | ||
606 | + }); | ||
607 | + } | ||
608 | + | ||
594 | 609 | ||
595 | } | 610 | } |
596 | 611 | ||
597 | }) | 612 | }) |
598 | }, | 613 | }, |
599 | 614 | ||
600 | - __getOpenQxCustomHczdGetDate(type: String) {//列表滚动数据 | 615 | + __getOpenQxCustomHczdGetDate(type: String) {//列表滚动数据 |
616 | + const cookieVal: any = wx.getStorageSync("power_session_id") | ||
617 | + console.log(cookieVal, 'cookieValcookieVal') | ||
601 | HTTP.POST({ | 618 | HTTP.POST({ |
602 | - ...API_CONST.home.getDate, | 619 | + ...{ url: `${API_CONST.home.getDate.url}?power_session_id=${cookieVal}&type=mobile`, method: "POST" }, |
603 | payload: { | 620 | payload: { |
604 | corpCode: "hczd", | 621 | corpCode: "hczd", |
605 | type: type | 622 | type: type |
@@ -614,11 +631,21 @@ Page({ | @@ -614,11 +631,21 @@ Page({ | ||
614 | this.setData({ | 631 | this.setData({ |
615 | tableList: [] | 632 | tableList: [] |
616 | }) | 633 | }) |
617 | - wx.showToast({ | ||
618 | - title: '请求失败', | ||
619 | - icon: 'error', | ||
620 | - duration: 2000 | ||
621 | - }); | 634 | + if (res.errCode === 'loginOut') { |
635 | + wx.showToast({ | ||
636 | + title: res.msg, | ||
637 | + icon: 'error', | ||
638 | + duration: 2000 | ||
639 | + }); | ||
640 | + wx.clearStorageSync() | ||
641 | + wx.reLaunch({ url: "/pages/login/login" }) | ||
642 | + } else { | ||
643 | + wx.showToast({ | ||
644 | + title: '请求失败', | ||
645 | + icon: 'error', | ||
646 | + duration: 2000 | ||
647 | + }); | ||
648 | + } | ||
622 | } | 649 | } |
623 | 650 | ||
624 | }) | 651 | }) |
@@ -626,8 +653,10 @@ Page({ | @@ -626,8 +653,10 @@ Page({ | ||
626 | 653 | ||
627 | 654 | ||
628 | __getOpenQxCustomHczdGetDateEchartLine(type: String) {//曲线图 | 655 | __getOpenQxCustomHczdGetDateEchartLine(type: String) {//曲线图 |
656 | + const cookieVal: any = wx.getStorageSync("power_session_id") | ||
657 | + console.log(cookieVal, 'cookieValcookieVal') | ||
629 | HTTP.POST({ | 658 | HTTP.POST({ |
630 | - ...API_CONST.home.getDate, | 659 | + ...{ url: `${API_CONST.home.getDate.url}?power_session_id=${cookieVal}&type=mobile`, method: "POST" }, |
631 | payload: { | 660 | payload: { |
632 | corpCode: "hczd", | 661 | corpCode: "hczd", |
633 | type: type | 662 | type: type |
@@ -655,11 +684,21 @@ Page({ | @@ -655,11 +684,21 @@ Page({ | ||
655 | myLineObj: {}, | 684 | myLineObj: {}, |
656 | homeLineObj: {} | 685 | homeLineObj: {} |
657 | }) | 686 | }) |
658 | - wx.showToast({ | ||
659 | - title: '请求失败', | ||
660 | - icon: 'error', | ||
661 | - duration: 2000 | ||
662 | - }); | 687 | + if (res.errCode === 'loginOut') { |
688 | + wx.showToast({ | ||
689 | + title: res.msg, | ||
690 | + icon: 'error', | ||
691 | + duration: 2000 | ||
692 | + }); | ||
693 | + wx.clearStorageSync() | ||
694 | + wx.reLaunch({ url: "/pages/login/login" }) | ||
695 | + } else { | ||
696 | + wx.showToast({ | ||
697 | + title: '请求失败', | ||
698 | + icon: 'error', | ||
699 | + duration: 2000 | ||
700 | + }); | ||
701 | + } | ||
663 | } | 702 | } |
664 | 703 | ||
665 | }) | 704 | }) |
@@ -99,7 +99,7 @@ class HTTPService { | @@ -99,7 +99,7 @@ class HTTPService { | ||
99 | payload = { | 99 | payload = { |
100 | ...payload | 100 | ...payload |
101 | } | 101 | } |
102 | - const cookieVal:any = wx.getStorageSync("cookie") | 102 | + const cookieVal:any = wx.getStorageSync("power_session_id") |
103 | return new Promise((resolve, reject) => { | 103 | return new Promise((resolve, reject) => { |
104 | wx.request({ | 104 | wx.request({ |
105 | url: rootUrlProduce + url, | 105 | url: rootUrlProduce + url, |
@@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
6 | * 3: 现代物流uat环境 | 6 | * 3: 现代物流uat环境 |
7 | * 4: 现代物流正式环境 | 7 | * 4: 现代物流正式环境 |
8 | */ | 8 | */ |
9 | -const envLevel = 1; | 9 | +const envLevel = 2; |
10 | 10 | ||
11 | /** | 11 | /** |
12 | * 后台接口 | 12 | * 后台接口 |
@@ -14,7 +14,7 @@ const envLevel = 1; | @@ -14,7 +14,7 @@ const envLevel = 1; | ||
14 | const serverUrlProduce = [ | 14 | const serverUrlProduce = [ |
15 | "http://10.9.1.180", // http://10.9.1.180/open/qx-apaas-custom/hczd/index | 15 | "http://10.9.1.180", // http://10.9.1.180/open/qx-apaas-custom/hczd/index |
16 | "https://test.qgutech.com", | 16 | "https://test.qgutech.com", |
17 | - "https://test.xdwl.qgutech.com", | 17 | + "http://10.9.4.3:8031", |
18 | "https://wanyouuat.m56.com.cn:4443", | 18 | "https://wanyouuat.m56.com.cn:4443", |
19 | "https://wanyou.m56.com.cn", | 19 | "https://wanyou.m56.com.cn", |
20 | ][envLevel]; | 20 | ][envLevel]; |