Showing
10 changed files
with
94 additions
and
45 deletions
| 1 | 1 | import minaEnv from "../utils/minaEnv"; |
| 2 | + | |
| 2 | 3 | export const API_CONST = { |
| 3 | 4 | login: { |
| 4 | 5 | wxLogin: { |
| 5 | - url: `/qx-api/qx-apaas-auth/server/auth/login`, | |
| 6 | + url: `/power/user/userLogin`, | |
| 6 | 7 | method: "POST" |
| 7 | 8 | }, |
| 8 | 9 | loginSecurity: { |
| ... | ... | @@ -15,7 +16,7 @@ export const API_CONST = { |
| 15 | 16 | }, |
| 16 | 17 | |
| 17 | 18 | logout: { |
| 18 | - url: `/qx-api/qx-apaas-auth/server/auth/mobile/logout`, | |
| 19 | + url: `/power/user/userLogout`, | |
| 19 | 20 | method: "POST" |
| 20 | 21 | } |
| 21 | 22 | |
| ... | ... | @@ -24,11 +25,11 @@ export const API_CONST = { |
| 24 | 25 | |
| 25 | 26 | home: { |
| 26 | 27 | miniData: { |
| 27 | - url: `/open/qx-apaas-custom/hczd/index`, | |
| 28 | + url: `/power/hczd/index`, | |
| 28 | 29 | method: "POST"//参数:{"corpCode": "default"} |
| 29 | 30 | }, |
| 30 | 31 | getDate: { |
| 31 | - url: `/open/qx-apaas-custom/hczd/getDate`, | |
| 32 | + url: `/power/hczd/getDate`, | |
| 32 | 33 | method: "POST"//参数 |
| 33 | 34 | }, |
| 34 | 35 | userInfoDetail: { | ... | ... |
| ... | ... | @@ -76,8 +76,9 @@ Page({ |
| 76 | 76 | }, |
| 77 | 77 | |
| 78 | 78 | __mobilelogoutEvent() { |
| 79 | + const cookieVal: any = wx.getStorageSync("power_session_id") | |
| 79 | 80 | HTTP.POST({ |
| 80 | - ...API_CONST.login.logout, | |
| 81 | + ...{ url: `${API_CONST.login.logout.url}?power_session_id=${cookieVal}`, method: "POST" }, | |
| 81 | 82 | payload: { |
| 82 | 83 | cookieFlag: true |
| 83 | 84 | } |
| ... | ... | @@ -96,7 +97,8 @@ Page({ |
| 96 | 97 | .then(() => { |
| 97 | 98 | // on confirm |
| 98 | 99 | this.__mobilelogoutEvent() |
| 99 | - | |
| 100 | + // wx.clearStorageSync() | |
| 101 | + // wx.reLaunch({ url: "/pages/login/login" }) | |
| 100 | 102 | }) |
| 101 | 103 | .catch(() => { |
| 102 | 104 | // on cancel | ... | ... |
| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | </view> |
| 6 | 6 | <view class="acount_info"> |
| 7 | 7 | <van-cell-group> |
| 8 | - <van-cell title="姓名" value="{{optionsObj.name || '未设置'}}" /> | |
| 8 | + <van-cell title="姓名" value="{{optionsObj.userName || '未设置'}}" /> | |
| 9 | 9 | <van-cell title="手机号" value="{{optionsObj.mobile || '未设置'}}" /> |
| 10 | 10 | <van-cell title="邮箱" value="{{optionsObj.email || '未设置'}}" /> |
| 11 | 11 | </van-cell-group> | ... | ... |
| ... | ... | @@ -11,7 +11,19 @@ Page({ |
| 11 | 11 | userInfoObj: {} |
| 12 | 12 | }, |
| 13 | 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 | 28 | handleGetMessage(e: any) { |
| 17 | 29 | console.log(e, 'handleGetMessagehandleGetMessage') | ... | ... |
| ... | ... | @@ -5,11 +5,11 @@ |
| 5 | 5 | </view> |
| 6 | 6 | <view class="mine-info"> |
| 7 | 7 | <view class="mine-info-basic"> |
| 8 | - {{userInfoObj.dataTitle}} | |
| 8 | + {{userInfoObj.userName}} | |
| 9 | 9 | </view> |
| 10 | 10 | <view class="mine-company"> |
| 11 | 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 | 13 | </view> |
| 14 | 14 | </view> |
| 15 | 15 | </view> | ... | ... |
| ... | ... | @@ -22,7 +22,7 @@ Page({ |
| 22 | 22 | * 生命周期函数--监听页面加载 |
| 23 | 23 | */ |
| 24 | 24 | onLoad() { |
| 25 | - this.__getLoginSecurityImg() | |
| 25 | + // this.__getLoginSecurityImg() | |
| 26 | 26 | }, |
| 27 | 27 | |
| 28 | 28 | /** |
| ... | ... | @@ -93,16 +93,17 @@ Page({ |
| 93 | 93 | ...API_CONST.login.wxLogin, |
| 94 | 94 | payload: this.getLoginParams() |
| 95 | 95 | }).then((data: any) => { |
| 96 | - console.log(data, '登录参数') | |
| 97 | 96 | if (data.success) { |
| 98 | 97 | //登录请求回来之后,读取res的header的cookie |
| 99 | 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 | 102 | wx.switchTab({ |
| 102 | 103 | url: "/pages/monitor/monitor" |
| 103 | 104 | }) |
| 104 | 105 | } else { |
| 105 | - this.__getUserSecurityImg() | |
| 106 | + // this.__getUserSecurityImg() | |
| 106 | 107 | wx.showToast({ |
| 107 | 108 | title: data.msg || '请求失败', |
| 108 | 109 | icon: 'error', |
| ... | ... | @@ -125,14 +126,8 @@ Page({ |
| 125 | 126 | getLoginParams() { |
| 126 | 127 | // 组织ID登录 |
| 127 | 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 | 130 | password: this.data.password, |
| 133 | - key: this.data.keyStr, | |
| 134 | - autoLogin: false, | |
| 135 | - | |
| 136 | 131 | } |
| 137 | 132 | }, |
| 138 | 133 | imgKeyEvent(e: any) { | ... | ... |
| ... | ... | @@ -9,8 +9,8 @@ |
| 9 | 9 | <van-field label="用户名" title-width="50" value="{{ username }}" bind:change="userEvent" required clearable placeholder="请输入手机号" bind:click-icon="onClickIcon" /> |
| 10 | 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 | 14 | </van-cell-group> |
| 15 | 15 | <view class="login_btn" bind:tap="loginEvent"> |
| 16 | 16 | 登录 | ... | ... |
| ... | ... | @@ -293,6 +293,8 @@ Page({ |
| 293 | 293 | |
| 294 | 294 | }, |
| 295 | 295 | __getOpenQxCustomHczdInde() {//接口请求 |
| 296 | + const cookieVal: any = wx.getStorageSync("power_session_id") | |
| 297 | + console.log(cookieVal, 'cookieValcookieVal') | |
| 296 | 298 | Toast.loading({ |
| 297 | 299 | message: '加载中...', |
| 298 | 300 | forbidClick: true, |
| ... | ... | @@ -300,7 +302,7 @@ Page({ |
| 300 | 302 | duration: 0, // 持续展示 toast |
| 301 | 303 | }); |
| 302 | 304 | HTTP.POST({ |
| 303 | - ...API_CONST.home.miniData, | |
| 305 | + ...{ url: `${API_CONST.home.miniData.url}?power_session_id=${cookieVal}&type=mobile`, method: "POST" }, | |
| 304 | 306 | payload: { |
| 305 | 307 | corpCode: "hczd" |
| 306 | 308 | } |
| ... | ... | @@ -586,20 +588,35 @@ Page({ |
| 586 | 588 | deviceDataList: deviceDataListNew, |
| 587 | 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 | 618 | HTTP.POST({ |
| 602 | - ...API_CONST.home.getDate, | |
| 619 | + ...{ url: `${API_CONST.home.getDate.url}?power_session_id=${cookieVal}&type=mobile`, method: "POST" }, | |
| 603 | 620 | payload: { |
| 604 | 621 | corpCode: "hczd", |
| 605 | 622 | type: type |
| ... | ... | @@ -614,11 +631,21 @@ Page({ |
| 614 | 631 | this.setData({ |
| 615 | 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 | 653 | |
| 627 | 654 | |
| 628 | 655 | __getOpenQxCustomHczdGetDateEchartLine(type: String) {//曲线图 |
| 656 | + const cookieVal: any = wx.getStorageSync("power_session_id") | |
| 657 | + console.log(cookieVal, 'cookieValcookieVal') | |
| 629 | 658 | HTTP.POST({ |
| 630 | - ...API_CONST.home.getDate, | |
| 659 | + ...{ url: `${API_CONST.home.getDate.url}?power_session_id=${cookieVal}&type=mobile`, method: "POST" }, | |
| 631 | 660 | payload: { |
| 632 | 661 | corpCode: "hczd", |
| 633 | 662 | type: type |
| ... | ... | @@ -655,11 +684,21 @@ Page({ |
| 655 | 684 | myLineObj: {}, |
| 656 | 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 | 99 | payload = { |
| 100 | 100 | ...payload |
| 101 | 101 | } |
| 102 | - const cookieVal:any = wx.getStorageSync("cookie") | |
| 102 | + const cookieVal:any = wx.getStorageSync("power_session_id") | |
| 103 | 103 | return new Promise((resolve, reject) => { |
| 104 | 104 | wx.request({ |
| 105 | 105 | url: rootUrlProduce + url, | ... | ... |
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | * 3: 现代物流uat环境 |
| 7 | 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 | 14 | const serverUrlProduce = [ |
| 15 | 15 | "http://10.9.1.180", // http://10.9.1.180/open/qx-apaas-custom/hczd/index |
| 16 | 16 | "https://test.qgutech.com", |
| 17 | - "https://test.xdwl.qgutech.com", | |
| 17 | + "http://10.9.4.3:8031", | |
| 18 | 18 | "https://wanyouuat.m56.com.cn:4443", |
| 19 | 19 | "https://wanyou.m56.com.cn", |
| 20 | 20 | ][envLevel]; | ... | ... |