From 91751b1b9b16c0044e16ad80c237b7275a409046 Mon Sep 17 00:00:00 2001 From: zuoxiao <470321431@qq.com> Date: 星期四, 06 三月 2025 14:47:12 +0800 Subject: [PATCH] 修改首页和登录相关 --- pages/home/home.js | 290 ++++++++++++- images/eye-close.svg | 6 images/eye-open.svg | 6 pages/rechargeCard/rechargeCard.js | 4 pages/login/login.js | 318 ++++++++++++-- images/lock.svg | 6 images/login-bg.svg | 19 project.private.config.json | 2 app.js | 9 api/config.js | 57 ++ pages/openCard/openCard.js | 2 api/request.js | 11 pages/login/login.wxss | 173 ++++++- pages/login/login.wxml | 37 + images/user.svg | 6 pages/waterIntake/waterIntake.js | 4 pages/home/home.wxml | 30 + pages/home/home.wxss | 250 +++++++++++ 18 files changed, 1,082 insertions(+), 148 deletions(-) diff --git a/api/config.js b/api/config.js index e6a3218..3757d03 100644 --- a/api/config.js +++ b/api/config.js @@ -1,17 +1,62 @@ const { ENV } = require('./env') let BASEURL +const PROJECT_URLS = { + JYG: 'https://irrigate.dayuyanjiuyuan.top/', // 鍢夊唱鍏抽」鐩� + MQ: 'https://minqin.dayuyanjiuyuan.top/' // 姘戝嫟椤圭洰 +} + +// 灏濊瘯浠庢湰鍦板瓨鍌ㄨ幏鍙栧凡閫夋嫨鐨勯」鐩� +let selectedProject = 'JYG'; // 榛樿涓哄槈宄叧椤圭洰 +try { + // 灏濊瘯浠庢湰鍦板瓨鍌ㄨ幏鍙栧凡閫夋嫨鐨勯」鐩� + if (typeof wx !== 'undefined') { + try { + const selectedProjectFromStorage = wx.getStorageSync('selectedProject'); + if (selectedProjectFromStorage) { + selectedProject = selectedProjectFromStorage; + console.log('浠庢湰鍦板瓨鍌ㄥ姞杞介」鐩缃�:', selectedProject); + } + } catch (e) { + console.error('浠庢湰鍦板瓨鍌ㄨ幏鍙栭」鐩け璐�:', e); + } + } + + // 濡傛灉鍏ㄥ眬搴旂敤宸插垵濮嬪寲锛屼篃灏濊瘯浠庡叏灞�鍙橀噺鑾峰彇 + const app = getApp(); + if (app && app.globalData && app.globalData.selectedProject) { + selectedProject = app.globalData.selectedProject; + console.log('浠庡叏灞�鍙橀噺鍔犺浇椤圭洰璁剧疆:', selectedProject); + } +} catch (e) { + console.error('鑾峰彇宸查�夋嫨椤圭洰澶辫触:', e); +} + switch (ENV) { case 'production': - BASEURL = '' - break + BASEURL = PROJECT_URLS[selectedProject] || PROJECT_URLS.JYG; + break; case 'test': - BASEURL = 'https://irrigate.dayuyanjiuyuan.top/' - break + // BASEURL 灏嗘牴鎹敤鎴烽�夋嫨鐨勯」鐩姩鎬佽缃� + BASEURL = PROJECT_URLS[selectedProject] || PROJECT_URLS.JYG; + break; default: - BASEURL = '' - break + BASEURL = PROJECT_URLS[selectedProject] || PROJECT_URLS.JYG; + break; } + +// 瀵煎嚭鍔ㄦ�佽缃� BASEURL 鐨勫嚱鏁� +function setBaseUrl(project) { + if (PROJECT_URLS[project]) { + BASEURL = PROJECT_URLS[project]; + console.log('鍔ㄦ�佽缃� BASEURL:', BASEURL); + return true; + } + return false; +} + module.exports = { BASEURL,// 椤圭洰鎺ュ彛鍦板潃锛屾敮鎸佸鍩熷悕 + PROJECT_URLS, + setBaseUrl } \ No newline at end of file diff --git a/api/request.js b/api/request.js index 0833bc0..dba9986 100644 --- a/api/request.js +++ b/api/request.js @@ -1,9 +1,7 @@ // 寮曞叆鐘舵�佺爜statusCode const statusCode = require('./statusCode') // 瀹氫箟璇锋眰璺緞, BASEURL: 鏅�氳姹侫PI; CBASEURL: 涓彴API,涓嶄娇鐢ㄤ腑鍙板彲涓嶅紩鍏BASEURL -const { - BASEURL -} = require('./config') +const config = require('./config') // 瀹氫箟榛樿鍙傛暟 const defaultOptions = { data: {}, @@ -57,7 +55,10 @@ } header.tag = app.globalData.tag; return new Promise((resolve, reject) => { - console.log("url:" + BASEURL + url); + // 鑾峰彇鏈�鏂扮殑 BASEURL + let currentBaseUrl = app.globalData.baseUrl || config.BASEURL; + + console.log("url:" + currentBaseUrl + url); if (isShowLoding) { wx.showLoading({ title: '閫氫俊涓�...', // 鍔犺浇鍔ㄧ敾鏍囬 @@ -68,7 +69,7 @@ if (url.startsWith('http')) { myUrl = url; } else { - myUrl = BASEURL + url; + myUrl = currentBaseUrl + url; } wx.request({ url: myUrl, diff --git a/app.js b/app.js index b009f3a..6633f57 100644 --- a/app.js +++ b/app.js @@ -14,11 +14,14 @@ }) }, globalData: { - sessionId:'2024052821300200006', - tag:'ym', + // sessionId:'2024052821300200006', + sessionId:'2025030416200600006', + tag:'mq', userInfo: null, userId:"", userCode:"", - token:"" + token:"", + isLoggedIn:false, + operator:"2025030416200600006" } }) diff --git a/images/eye-close.svg b/images/eye-close.svg new file mode 100644 index 0000000..0bc6729 --- /dev/null +++ b/images/eye-close.svg @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> + <path d="M3.70711,2.29289 C3.31658,1.90237 2.68342,1.90237 2.29289,2.29289 C1.90237,2.68342 1.90237,3.31658 2.29289,3.70711 L20.2929,21.7071 C20.6834,22.0976 21.3166,22.0976 21.7071,21.7071 C22.0976,21.3166 22.0976,20.6834 21.7071,20.2929 L20.3032,18.889 C21.9524,17.4299 23.1734,15.5462 23.9281,13.4668 C23.9759,13.3258 24,13.1741 24,13.0193 C24,12.8644 23.9759,12.7128 23.9281,12.5717 C21.7396,6.83 17.1937,3 12,3 C9.74324,3 7.63584,3.57668 5.76477,4.62852 L3.70711,2.29289 Z M7.97987,6.84362 C9.22051,6.29395 10.5793,6 12,6 C15.3137,6 18.3137,7.84315 19.6569,10.5 C19.2269,11.3745 18.6616,12.1658 17.9953,12.8483 L15.9906,10.8436 C15.9968,10.7292 16,10.6151 16,10.5 C16,8.567 14.433,7 12.5,7 C12.3849,7 12.2708,7.00317 12.1564,7.0094 L7.97987,6.84362 Z M12.5,14 C12.6151,14 12.7292,13.9968 12.8436,13.9906 L8.00472,9.15165 C7.33841,9.83416 6.77312,10.6255 6.34315,11.5 C7.68629,14.1569 10.6863,16 14,16 C14.3389,16 14.6731,15.9859 15.0017,15.9585 L13.0094,13.9661 C12.8444,13.9884 12.6737,14 12.5,14 Z M4.07192,12.5717 C4.02411,12.7128 4,12.8644 4,13.0193 C4,13.1741 4.02411,13.3258 4.07192,13.4668 C6.26038,19.2085 10.8063,23.0385 16,23.0385 C17.8627,23.0385 19.6159,22.6648 21.2075,21.9953 L16.9953,17.7831 C16.0194,17.9258 15.0177,18 14,18 C8.80628,18 4.26038,14.17 2.07192,8.42833 C2.02411,8.28715 2,8.13555 2,7.98074 C2,7.82593 2.02411,7.67433 2.07192,7.53315 C2.82662,5.45379 4.04758,3.57011 5.69679,2.11098 L4.07192,12.5717 Z" fill="#999999" fill-rule="nonzero"></path> + </g> +</svg> \ No newline at end of file diff --git a/images/eye-open.svg b/images/eye-open.svg new file mode 100644 index 0000000..61eefee --- /dev/null +++ b/images/eye-open.svg @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> + <path d="M12,4 C16.4183,4 20.4183,6.4183 22,10 C20.4183,13.5817 16.4183,16 12,16 C7.58172,16 3.58172,13.5817 2,10 C3.58172,6.4183 7.58172,4 12,4 Z M12,6 C8.68629,6 5.68629,7.84315 4.34315,10.5 C5.68629,13.1569 8.68629,15 12,15 C15.3137,15 18.3137,13.1569 19.6569,10.5 C18.3137,7.84315 15.3137,6 12,6 Z M12,7 C13.6569,7 15,8.34315 15,10 C15,11.6569 13.6569,13 12,13 C10.3431,13 9,11.6569 9,10 C9,8.34315 10.3431,7 12,7 Z M12,9 C11.4477,9 11,9.44772 11,10 C11,10.5523 11.4477,11 12,11 C12.5523,11 13,10.5523 13,10 C13,9.44772 12.5523,9 12,9 Z" fill="#999999" fill-rule="nonzero"></path> + </g> +</svg> \ No newline at end of file diff --git a/images/lock.svg b/images/lock.svg new file mode 100644 index 0000000..f9349b6 --- /dev/null +++ b/images/lock.svg @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> + <path d="M12,1 C15.3137,1 18,3.68629 18,7 L18,10 L19,10 C20.1046,10 21,10.8954 21,12 L21,21 C21,22.1046 20.1046,23 19,23 L5,23 C3.89543,23 3,22.1046 3,21 L3,12 C3,10.8954 3.89543,10 5,10 L6,10 L6,7 C6,3.68629 8.68629,1 12,1 Z M19,12 L5,12 L5,21 L19,21 L19,12 Z M12,15 C12.5523,15 13,15.4477 13,16 C13,16.5523 12.5523,17 12,17 C11.4477,17 11,16.5523 11,16 C11,15.4477 11.4477,15 12,15 Z M12,3 C9.79086,3 8,4.79086 8,7 L8,10 L16,10 L16,7 C16,4.79086 14.2091,3 12,3 Z" fill="#1890FF" fill-rule="nonzero"></path> + </g> +</svg> \ No newline at end of file diff --git a/images/login-bg.svg b/images/login-bg.svg new file mode 100644 index 0000000..4927451 --- /dev/null +++ b/images/login-bg.svg @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg width="200px" height="200px" viewBox="0 0 200 200" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <defs> + <linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="linearGradient-1"> + <stop stop-color="#1890FF" offset="0%"></stop> + <stop stop-color="#0050B3" offset="100%"></stop> + </linearGradient> + <circle id="path-2" cx="100" cy="100" r="100"></circle> + </defs> + <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> + <g> + <mask id="mask-3" fill="white"> + <use xlink:href="#path-2"></use> + </mask> + <use id="Circle" fill="url(#linearGradient-1)" xlink:href="#path-2"></use> + <path d="M120,80 C131.046,80 140,88.954 140,100 C140,111.046 131.046,120 120,120 C108.954,120 100,111.046 100,100 C100,88.954 108.954,80 120,80 Z M120,90 C114.477,90 110,94.477 110,100 C110,105.523 114.477,110 120,110 C125.523,110 130,105.523 130,100 C130,94.477 125.523,90 120,90 Z M120,125 C142.091,125 160,142.909 160,165 L80,165 C80,142.909 97.909,125 120,125 Z M120,135 C103.431,135 90,148.431 90,165 L150,165 C150,148.431 136.569,135 120,135 Z" fill="#FFFFFF" fill-rule="nonzero" mask="url(#mask-3)"></path> + </g> + </g> +</svg> \ No newline at end of file diff --git a/images/user.svg b/images/user.svg new file mode 100644 index 0000000..99bbad3 --- /dev/null +++ b/images/user.svg @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> + <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> + <path d="M12,2 C14.7614,2 17,4.23858 17,7 C17,9.76142 14.7614,12 12,12 C9.23858,12 7,9.76142 7,7 C7,4.23858 9.23858,2 12,2 Z M12,4 C10.3431,4 9,5.34315 9,7 C9,8.65685 10.3431,10 12,10 C13.6569,10 15,8.65685 15,7 C15,5.34315 13.6569,4 12,4 Z M12,13 C16.9706,13 21,17.0294 21,22 L3,22 C3,17.0294 7.02944,13 12,13 Z M12,15 C8.13401,15 5,18.134 5,22 L19,22 C19,18.134 15.866,15 12,15 Z" fill="#1890FF" fill-rule="nonzero"></path> + </g> +</svg> \ No newline at end of file diff --git a/pages/home/home.js b/pages/home/home.js index d0a7f0b..253cb13 100644 --- a/pages/home/home.js +++ b/pages/home/home.js @@ -4,6 +4,7 @@ get, post } = require('../../api/request.js'); +const { PROJECT_URLS } = require('../../api/config.js'); Page({ /** @@ -15,8 +16,8 @@ myItem: {}, waterIntakeName: "", image: "/images/ic_head_bg.jpg", - userPhone: "158****0723", - userName: "寮犱笁", + userPhone: "", + userName: "璇风櫥褰�", scrollViewHeight: 0, listData: [], isRefreshing: false, @@ -28,7 +29,10 @@ }, errorDialogTitle: "鍏抽榾閿欒", showForceConfirm: false, //鏄惁寮哄埗寮�闃� - lastIntakeName: "" + lastIntakeName: "", + showProjectDialog: false, + selectedProject: '', + avatarTapCount: 0 }, openValve: function (e) { @@ -75,24 +79,67 @@ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 */ onLoad(options) { - //鍒ゆ柇鏈湴鏄惁淇濆瓨sessionId - - - // 浣跨敤 wx.nextTick 绛夊緟椤甸潰娓叉煋瀹屾垚 - wx.nextTick(() => { - this.calculateScrollViewHeight(); + // 妫�鏌ユ槸鍚﹀凡閫夋嫨椤圭洰 + const { PROJECT_URLS } = require('../../api/config.js'); + + storage.getItem('selectedProject').then((project) => { + if (project) { + this.setData({ + selectedProject: project + }); + + // 纭繚鍏ㄥ眬鍙橀噺瀛樺湪 + getApp().globalData = getApp().globalData || {}; + // 璁剧疆 baseUrl + const baseUrl = PROJECT_URLS[project]; + getApp().globalData.baseUrl = baseUrl; + getApp().globalData.selectedProject = project; + + // 鏍规嵁椤圭洰璁剧疆瀵瑰簲鐨則ag + if (project === 'JYG') { + getApp().globalData.tag = 'ym'; // 鍢夊唱鍏抽」鐩搴攖ag涓簓m + } else if (project === 'MQ') { + getApp().globalData.tag = 'mq'; // 姘戝嫟椤圭洰瀵瑰簲tag涓簃q + } + + console.log('鍔犺浇宸蹭繚瀛樼殑椤圭洰:', project, '鍩熷悕:', baseUrl, 'tag:', getApp().globalData.tag); + + // 妫�鏌ョ櫥褰曠姸鎬� + if (!getApp().globalData.isLoggedIn) { + this.checkLoginStatus(); + return; // 濡傛灉鏈櫥褰曪紝绛夊緟璺宠浆鍒扮櫥褰曢〉闈� + } + } else { + // 棣栨杩涘叆锛屾樉绀洪」鐩�夋嫨寮圭獥 + this.setData({ + showProjectDialog: true + }); + return; // 绛夊緟鐢ㄦ埛閫夋嫨椤圭洰 + } + + //鍒ゆ柇鏈湴鏄惁淇濆瓨sessionId + // 浣跨敤 wx.nextTick 绛夊緟椤甸潰娓叉煋瀹屾垚 + wx.nextTick(() => { + this.calculateScrollViewHeight(); + }); + //褰撳紑闃�鎴愬姛鍚庤皟鐢ㄥ埛鏂� + console.log("onLoad锛�" + options.param); + if (options.param) { + wx.showToast({ + title: '寮�闃�鎴愬姛', + icon: 'success', + duration: 3000 + }) + this.getOpenList(); + } + this.initData(); + }).catch(err => { + console.error('Failed to get selectedProject:', err); + // 鍑洪敊鏃朵篃鏄剧ず椤圭洰閫夋嫨寮圭獥 + this.setData({ + showProjectDialog: true + }); }); - //褰撳紑闃�鎴愬姛鍚庤皟鐢ㄥ埛鏂� - console.log("onLoad锛�" + options.param); - if (options.param) { - wx.showToast({ - title: '寮�闃�鎴愬姛', - icon: 'success', - duration: 3000 - }) - this.getOpenList(); - } - this.initData(); }, /** @@ -214,7 +261,7 @@ rtuAddr: rtuAddr, vcNum: vcNum, //铏氭嫙鍗D orderNo: orderNo, - operator: app.globalData.sessionId //鎿嶄綔鍛� + operator: app.globalData.operator //鎿嶄綔鍛� }; console.log("postCloseValaue" + data); post({ @@ -254,7 +301,7 @@ const params = { url: 'wx/valve/get', data: { - operator: app.globalData.sessionId + operator: app.globalData.operator } }; get(params).then(data => { @@ -374,7 +421,7 @@ const data = { intakeName: intakeName, //鍙栨按鍙D // vcId: vcId, //铏氭嫙鍗D - operator: app.globalData.sessionId, //鎿嶄綔鍛� + operator: app.globalData.operator, //鎿嶄綔鍛� forceOpen: !!isforce // 浣跨敤閫昏緫闈炴搷浣滅 !! 鏉ョ‘淇� isForce 鏄竷灏斿�� }; post({ @@ -440,5 +487,200 @@ console.log('Failed to load parameter:false'); } - } + }, + // 澶勭悊澶村儚鐐瑰嚮 + handleAvatarTap() { + this.setData({ + avatarTapCount: this.data.avatarTapCount + 1 + }); + + if (this.data.avatarTapCount >= 5) { + this.setData({ + showProjectDialog: true, + avatarTapCount: 0 + }); + } + }, + + // 澶勭悊寮圭獥鍙鎬у彉鍖� + onVisibleChange(e) { + // 濡傛灉灏濊瘯鍏抽棴寮圭獥涓旀病鏈夐�夋嫨椤圭洰锛屽垯闃绘鍏抽棴 + if (!e.detail.visible && !this.data.selectedProject) { + return; + } + this.setData({ showProjectDialog: e.detail.visible }); + }, + + // 澶勭悊椤圭洰閫夋嫨鍙樺寲 + onProjectChange(event) { + console.log('閫夋嫨鐨勯」鐩細', event.detail.value); + this.setData({ + selectedProject: event.detail.value + }); + }, + + // 澶勭悊椤圭洰閫夋嫨纭 + handleProjectConfirm() { + if (!this.data.selectedProject) { + wx.showToast({ + title: '璇烽�夋嫨椤圭洰', + icon: 'none' + }); + return; + } + const projectName = this.data.selectedProject === 'JYG' ? '鍢夊唱鍏抽」鐩�' : '姘戝嫟椤圭洰'; + + // 淇濆瓨椤圭洰閫夋嫨鍒版湰鍦板瓨鍌� + storage.setItem('selectedProject', this.data.selectedProject).then(() => { + // 鏇存柊 BASEURL + const { PROJECT_URLS } = require('../../api/config.js'); + const baseUrl = PROJECT_URLS[this.data.selectedProject]; + + // 鐩存帴淇敼鍏ㄥ眬鍙橀噺 + getApp().globalData = getApp().globalData || {}; + getApp().globalData.baseUrl = baseUrl; + getApp().globalData.selectedProject = this.data.selectedProject; + + // 鏍规嵁椤圭洰璁剧疆瀵瑰簲鐨則ag + if (this.data.selectedProject === 'JYG') { + getApp().globalData.tag = 'ym'; // 鍢夊唱鍏抽」鐩搴攖ag涓簓m + } else if (this.data.selectedProject === 'MQ') { + getApp().globalData.tag = 'mq'; // 姘戝嫟椤圭洰瀵瑰簲tag涓簃q + } + + console.log('宸插垏鎹㈠埌椤圭洰:', projectName, '鍩熷悕:', baseUrl, 'tag:', getApp().globalData.tag); + + this.setData({ + showProjectDialog: false + }); + + wx.showToast({ + title: `宸查�夋嫨${projectName}`, + icon: 'success', + duration: 2000 + }); + + // 妫�鏌ョ櫥褰曠姸鎬� + // setTimeout(() => { + // this.checkLoginStatus(); + // }, 500); + }).catch(err => { + console.error('淇濆瓨椤圭洰閫夋嫨澶辫触锛�', err); + wx.showToast({ + title: '淇濆瓨澶辫触锛岃閲嶈瘯', + icon: 'error', + duration: 2000 + }); + }); + }, + + // 妫�鏌ョ櫥褰曠姸鎬� + checkLoginStatus() { + const app = getApp(); + + // 妫�鏌ユ槸鍚﹀凡鐧诲綍 + if (app.globalData.isLoggedIn && app.globalData.sessionId) { + // 宸茬櫥褰曪紝閲嶆柊鍔犺浇椤甸潰 + wx.reLaunch({ + url: '/pages/home/home' + }); + } else { + // 灏濊瘯浠庢湰鍦板瓨鍌ㄨ幏鍙栫敤鎴蜂俊鎭� + storage.getItem('userInfo').then(userInfoStr => { + if (userInfoStr) { + try { + const userInfo = JSON.parse(userInfoStr); + // 楠岃瘉鐢ㄦ埛淇℃伅鏄惁鏈夋晥 + if (userInfo && userInfo.sessionId) { + // 鎭㈠鐧诲綍鐘舵�� + app.globalData.sessionId = userInfo.sessionId; + app.globalData.token = userInfo.token; + app.globalData.userInfo = userInfo; + app.globalData.isLoggedIn = true; + + // 宸茬櫥褰曪紝閲嶆柊鍔犺浇椤甸潰 + wx.reLaunch({ + url: '/pages/home/home' + }); + return; + } + } catch (e) { + console.error('瑙f瀽鐢ㄦ埛淇℃伅澶辫触:', e); + } + } + + // 鏈櫥褰曪紝璺宠浆鍒扮櫥褰曢〉闈� + wx.redirectTo({ + url: `/pages/login/login?project=${this.data.selectedProject}` + }); + }).catch(err => { + console.error('鑾峰彇鐢ㄦ埛淇℃伅澶辫触:', err); + // 鏈櫥褰曪紝璺宠浆鍒扮櫥褰曢〉闈� + wx.redirectTo({ + url: `/pages/login/login?project=${this.data.selectedProject}` + }); + }); + } + }, + wxLogin(){ + if(!getApp().globalData.isLoggedIn){ + const that = this; + wx.login({ + success: function (res) { + if (res.code) { + var code = res.code; + console.log(code); + // 灏哻ode鍙戦�佸埌鏈嶅姟鍣ㄨ幏鍙杘penid + that.codeLogin(code); + } else { + console.log('鐧诲綍澶辫触锛�' + res.errMsg); + } + } + }); + } + }, + //寰俊code鐧诲綍 + codeLogin(codeData) { + wx.showLoading({ + title: '姝e湪鐧诲綍璇风◢鍊�...', // 鍔犺浇鎻愮ず鏂囧瓧 + mask: true // 鏄惁鏄剧ず閫忔槑钂欏眰锛岄槻姝㈣Е鎽哥┛閫忥紝榛樿涓� false + }); + const data = { + code: codeData, //涓存椂鐧诲綍鍑瘉 + }; + post({ + url: "wx/client/code_login", + data: data, + }).then(response => { + // 澶勭悊鎴愬姛鍝嶅簲 + console.log('璇锋眰鎴愬姛:', response); + // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢� + wx.hideLoading(); + if (response.code === "0001") { + //鍋囧涓虹┖鍒欒烦杞埌缁戝畾鐣岄潰 + if (response.content.client.clientId === "") { + wx.navigateTo({ + url: '/pages/login/login' + }) + } else { + //缂撳瓨鍦ㄦ湰鍦� + this.setData({ + isLogin: true + }) + getApp().globalData.sessionId = response.content.client.sessionId + storage.setItem("sessionId", response.content.client.sessionId) + getApp().globalData.clientId = response.content.client.clientId + storage.setItem("clientId", response.content.client.clientId) + this.initData(); + } + } else { + + } + }).catch(error => { + // 鍔犺浇瀹屾垚鍚庨殣钘忓姞杞藉姩鐢� + wx.hideLoading(); + // 澶勭悊閿欒鍝嶅簲 + console.error('璇锋眰澶辫触:', error); + }); + }, }) \ No newline at end of file diff --git a/pages/home/home.wxml b/pages/home/home.wxml index 8120e82..0984891 100644 --- a/pages/home/home.wxml +++ b/pages/home/home.wxml @@ -3,9 +3,9 @@ <view class="head-wrapper"> <view class="head-top"> - <t-avatar class="avatar-example" image="{{image}}" size="120rpx" /> + <t-avatar class="avatar-example" image="{{image}}" size="120rpx" bind:tap="handleAvatarTap" /> <view class="head-text-wrapper"> - <text>{{userName}}</text> + <text bind:tap="wxLogin">{{userName}}</text> <text class="head-bottom">{{userPhone}}</text> </view> <view class="head-button-wrapper"> @@ -75,4 +75,30 @@ <t-dialog class="error-dialog" title="{{errorDialogTitle}}" visible="{{showErrorDialog}}" content="{{errorData}}" confirm-btn="{{ confirmBtn }}" bind:confirm="closeDialog" /> <t-dialog visible="{{showForceConfirm}}" content="褰撳墠铏氭嫙鍗¤鍗犵敤锛屾槸鍚﹀己鍒跺紑闃�锛�" confirm-btn="{{ { content: '寮哄埗寮�闃�', variant: 'base', theme: 'danger' } }}" cancel-btn="鍙栨秷" bind:confirm="confirmForceDialog" bind:cancel="cancelDialog" /> + <!-- 浣跨敤寰俊鍘熺敓寮圭獥缁勪欢 --> + <view class="project-modal" wx:if="{{showProjectDialog}}"> + <view class="project-modal-mask"></view> + <view class="project-modal-content"> + <view class="project-modal-header"> + <text class="project-modal-title">璇烽�夋嫨椤圭洰</text> + </view> + <view class="project-modal-body"> + + <radio-group class="project-radio-group" bindchange="onProjectChange"> + <label class="project-radio {{selectedProject === 'JYG' ? 'project-radio-selected' : ''}}"> + <radio value="JYG" checked="{{selectedProject === 'JYG'}}" color="#1890FF" /> + <text>鍢夊唱鍏抽」鐩�</text> + </label> + <label class="project-radio {{selectedProject === 'MQ' ? 'project-radio-selected' : ''}}"> + <radio value="MQ" checked="{{selectedProject === 'MQ'}}" color="#1890FF" /> + <text>姘戝嫟椤圭洰</text> + </label> + </radio-group> + </view> + <view class="project-modal-footer"> + <button class="project-modal-btn" disabled="{{!selectedProject}}" bindtap="handleProjectConfirm">纭</button> + </view> + </view> + </view> + </view> \ No newline at end of file diff --git a/pages/home/home.wxss b/pages/home/home.wxss index 0a918b8..e653d5c 100644 --- a/pages/home/home.wxss +++ b/pages/home/home.wxss @@ -353,4 +353,252 @@ .scen-view text { font-size: 30rpx; color: #ffffff; -} \ No newline at end of file +} + +.project-select-container { + padding: 20rpx 0; +} + +.project-select-container .t-radio { + margin-bottom: 20rpx; + padding: 10rpx 0; +} + +.project-select-container .t-radio:last-child { + margin-bottom: 0; +} + +.project-select-container .t-radio__label { + font-size: 28rpx; + color: #333; +} + +.project-select-container .t-radio--checked { + background: #e6f4ff; +} + +/* 寮圭獥鎸夐挳鏍峰紡 */ +.dialog__button-group { + display: flex; + justify-content: space-between; + margin-top: 32rpx; +} + +.dialog__button-group .t-button { + flex: 1; + margin: 0 16rpx; +} + +.dialog__button-group .t-button:first-child { + margin-left: 0; +} + +.dialog__button-group .t-button:last-child { + margin-right: 0; +} + +.project-select-popup { + background-color: #fff; + border-radius: 16rpx; + width: 600rpx; +} + +.popup-title { + font-size: 32rpx; + font-weight: bold; + text-align: center; + padding: 32rpx; + border-bottom: 1px solid #f0f0f0; +} + +.popup-content { + padding: 32rpx; +} + +.radio-group { + display: flex; + flex-direction: column; + gap: 20rpx; +} + +.radio-group .t-radio { + margin-bottom: 20rpx; + padding: 20rpx; + background: #f5f5f5; + border-radius: 8rpx; +} + +.radio-group .t-radio:last-child { + margin-bottom: 0; +} + +.popup-footer { + padding: 32rpx; + border-top: 1px solid #f0f0f0; +} + +.dialog-content { + padding: 32rpx; + max-height: 60vh; +} + +.project-options { + display: flex; + flex-direction: column; + gap: 20rpx; +} + +.project-option { + display: flex; + justify-content: space-between; + align-items: center; + padding: 30rpx; + background: #f5f5f5; + border-radius: 8rpx; + font-size: 32rpx; +} + +.project-option.selected { + background: #e6f4ff; + border: 2rpx solid #1890FF; +} + +.selected-icon { + width: 40rpx; + height: 40rpx; +} + +.project-dialog-content { + padding: 20rpx; +} + +.project-item { + margin: 20rpx 0; + padding: 30rpx; + background-color: #f5f5f5; + border-radius: 8rpx; + text-align: center; + font-size: 32rpx; +} + +.project-item-selected { + background-color: #e6f4ff; + color: #1890FF; + border: 2rpx solid #1890FF; +} + +.radio-content { + padding: 30rpx 20rpx 10rpx; +} + +.radio-content .t-radio { + margin-bottom: 20rpx; + padding: 20rpx; + background-color: #f5f5f5; + border-radius: 8rpx; +} + +.radio-content .t-radio--checked { + background-color: #e6f4ff; +} + +.project-modal { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + z-index: 9999; + display: flex; + align-items: center; + justify-content: center; +} + +.project-modal-mask { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: rgba(0, 0, 0, 0.6); +} + +.project-modal-content { + position: relative; + width: 80%; + max-width: 600rpx; + background-color: #fff; + border-radius: 16rpx; + overflow: hidden; + display: flex; + flex-direction: column; +} + +.project-modal-header { + padding: 30rpx; + text-align: center; + border-bottom: 1rpx solid #f0f0f0; +} + +.project-modal-title { + font-size: 36rpx; + font-weight: bold; + color: #333; +} + +.project-modal-body { + padding: 30rpx; +} + +.project-modal-tip { + display: block; + font-size: 28rpx; + color: #999; + margin-bottom: 30rpx; + text-align: center; +} + +.project-radio-group { + display: flex; + flex-direction: column; + gap: 20rpx; +} + +.project-radio { + display: flex; + align-items: center; + padding: 20rpx; + background-color: #f5f5f5; + border-radius: 8rpx; +} + +.project-radio-selected { + background-color: #e6f4ff; + border: 2rpx solid #1890FF; +} + +.project-radio text { + margin-left: 10rpx; + font-size: 32rpx; +} + +.project-modal-footer { + padding: 30rpx; + border-top: 1rpx solid #f0f0f0; +} + +.project-modal-btn { + width: 100%; + height: 80rpx; + line-height: 80rpx; + text-align: center; + background-color: #1890FF; + color: #fff; + font-size: 32rpx; + border-radius: 8rpx; +} + +.project-modal-btn[disabled] { + background-color: #cccccc; + color: #ffffff; +} diff --git a/pages/login/login.js b/pages/login/login.js index a957679..a4dd503 100644 --- a/pages/login/login.js +++ b/pages/login/login.js @@ -1,4 +1,8 @@ const app = getApp(); +const storage = require('../../utils/storage.js'); +const { + post +} = require('../../api/request.js'); Page({ @@ -6,79 +10,217 @@ * 椤甸潰鐨勫垵濮嬫暟鎹� */ data: { - mobile: '', - code: '', - codeSent: false, - countdown: 60, + phone: '', + verificationCode: '', + codeText: '鑾峰彇楠岃瘉鐮�', + counting: false, + countDown: 60, + projectName: '鍢夊唱鍏抽」鐩�', // 榛樿椤圭洰鍚嶇О + selectedProject: 'JYG', // 榛樿椤圭洰浠g爜 + showErrorDialog: false }, - bindMobileInput: function (e) { + /** + * 缁戝畾鎵嬫満鍙疯緭鍏� + */ + bindPhoneInput: function (e) { this.setData({ - mobile: e.detail.value, + phone: e.detail.value }); }, - sendCode: function () { - if (!this.data.mobile) { + + /** + * 缁戝畾楠岃瘉鐮佽緭鍏� + */ + bindCodeInput: function (e) { + this.setData({ + verificationCode: e.detail.value + }); + }, + + /** + * 鍙戦�侀獙璇佺爜 + */ + sendVerificationCode: function () { + const { + phone, + counting + } = this.data; + + // 濡傛灉姝e湪鍊掕鏃讹紝鍒欎笉鍏佽鍐嶆鍙戦�� + if (counting) { + return; + } + + // 楠岃瘉鎵嬫満鍙锋牸寮� + if (!/^1\d{10}$/.test(phone)) { wx.showToast({ - title: '璇疯緭鍏ユ墜鏈哄彿', - icon: 'none', - duration: 2000, + title: '璇疯緭鍏ユ纭殑鎵嬫満鍙�', + icon: 'none' }); return; } - // 鍦ㄨ繖閲屽鐞嗗彂閫侀獙璇佺爜鐨勯�昏緫锛屽彲浠ヨ皟鐢ㄥ悗鍙版帴鍙e疄鐜� - // 浠ヤ笅鏄竴涓畝鍗曠殑绀轰緥锛屼粎浣滃弬鑰� - wx.showToast({ - title: '楠岃瘉鐮佸凡鍙戦��', - icon: 'success', - duration: 2000, - }); + // 寮�濮嬪�掕鏃� + this.startCountDown(); - this.setData({ - codeSent: true, - }); - - // 鍚姩鍊掕鏃� - this.startCountdown(); + // 鍙戦�侀獙璇佺爜璇锋眰 + this.postCode(); }, - //鍊掕鏃� - startCountdown: function () { - let that = this; - let timer = setInterval(function () { - let countdown = that.data.countdown - 1; - that.setData({ - countdown: countdown, - }); - if (countdown <= 0) { + /** + * 寮�濮嬪�掕鏃� + */ + startCountDown: function () { + this.setData({ + counting: true, + countDown: 60 + }); + + const timer = setInterval(() => { + if (this.data.countDown <= 1) { clearInterval(timer); - that.setData({ - codeSent: false, - countdown: 60, + this.setData({ + counting: false, + codeText: '鑾峰彇楠岃瘉鐮�' + }); + } else { + this.setData({ + countDown: this.data.countDown - 1, + codeText: `${this.data.countDown - 1}绉掑悗閲嶅彂` }); } }, 1000); + + // 淇濆瓨timer寮曠敤锛屼互渚垮湪椤甸潰鍗歌浇鏃舵竻闄� + this.countDownTimer = timer; + }, + + /** + * 鍋滄鍊掕鏃� + */ + stopCountDown: function () { + if (this.countDownTimer) { + clearInterval(this.countDownTimer); + } + this.setData({ + counting: false, + codeText: '鑾峰彇楠岃瘉鐮�' + }); }, /** * 鐧诲綍 */ - login: function (e) { - console.log("login") - let userName = "寮犱笁" - wx.navigateTo({ - url: '/pages/wxbind/wxbind' - }) + login: function () { + const { + phone, + verificationCode + } = this.data; + + // 楠岃瘉鎵嬫満鍙峰拰楠岃瘉鐮� + if (!/^1\d{10}$/.test(phone)) { + wx.showToast({ + title: '璇疯緭鍏ユ纭殑鎵嬫満鍙�', + icon: 'none' + }); + return; + } + + if (!/^\d{6}$/.test(verificationCode)) { + wx.showToast({ + title: '璇疯緭鍏�6浣嶉獙璇佺爜', + icon: 'none' + }); + return; + } + + // 鏄剧ず鍔犺浇涓� + wx.showLoading({ + title: '鐧诲綍涓�...', + mask: true + }); + this.wsLogin(); + + + // 鍙戦�佺櫥褰曡姹� + post('/api/loginByCode', { + phone: phone, + code: verificationCode, + projectCode: this.data.selectedProject + }).then(res => { + wx.hideLoading(); + + if (res.code === 0 && res.data) { + // 淇濆瓨鐢ㄦ埛淇℃伅鍜宼oken + storage.setUserInfo(res.data); + storage.setToken(res.data.token); + + // 璺宠浆鍒伴椤� + wx.switchTab({ + url: '/pages/index/index' + }); + } else { + wx.showToast({ + title: res.msg || '鐧诲綍澶辫触锛岃閲嶈瘯', + icon: 'none' + }); + } + }).catch(err => { + wx.hideLoading(); + console.error('鐧诲綍澶辫触', err); + wx.showToast({ + title: '缃戠粶寮傚父锛岃閲嶈瘯', + icon: 'none' + }); + }); }, + /** + * 璺宠浆鍒版敞鍐岄〉闈� + */ + goToRegister: function () { + wx.showToast({ + title: '娉ㄥ唽鍔熻兘鏆傛湭寮�鏀�', + icon: 'none', + duration: 2000 + }); + }, + /** + * 璺宠浆鍒板繕璁板瘑鐮侀〉闈� + */ + goToForgetPassword: function () { + wx.showToast({ + title: '鎵惧洖瀵嗙爜鍔熻兘鏆傛湭寮�鏀�', + icon: 'none', + duration: 2000 + }); + }, /** * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇 */ - onLoad(options) { - + onLoad: function (options) { + // 鑾峰彇閫夋嫨鐨勯」鐩� + if (options.project) { + this.setData({ + selectedProject: options.project, + projectName: options.project === 'JYG' ? '鍢夊唱鍏抽」鐩�' : '姘戝嫟椤圭洰' + }); + } else { + // 灏濊瘯浠庢湰鍦板瓨鍌ㄨ幏鍙栧凡閫夋嫨鐨勯」鐩� + storage.getItem('selectedProject').then(project => { + if (project) { + this.setData({ + selectedProject: project, + projectName: project === 'JYG' ? '鍢夊唱鍏抽」鐩�' : '姘戝嫟椤圭洰' + }); + } + }).catch(err => { + console.error('鑾峰彇宸查�夋嫨椤圭洰澶辫触:', err); + }); + } }, /** @@ -106,7 +248,11 @@ * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍗歌浇 */ onUnload() { - + // 娓呴櫎楠岃瘉鐮佸�掕鏃跺畾鏃跺櫒 + if (this.countDownTimer) { + clearInterval(this.countDownTimer); + this.countDownTimer = null; + } }, /** @@ -129,7 +275,83 @@ onShareAppMessage() { }, - - - + //鑾峰彇楠岃瘉鐮� + postCode: function () { + const params = { + url: 'wx/client/send_sms?phoneNumber=' + this.data.phone + }; + post(params) + .then((data) => { + wx.showToast({ + title: '楠岃瘉鐮佸凡鍙戦��', + icon: 'success', + duration: 2000, + }); + this.setData({ + codeSent: true, + }); + // 鍚姩鍊掕鏃� + this.startCountdown(); + }) + .catch((error) => { + wx.showToast({ + title: error.msg, + icon: 'none' + }); + console.error('Failed to add item:', error); + }); + }, + wsLogin() { + wx.login({ + success: res => { + if (res.code) { + console.log('鐧诲綍鎴愬姛锛岃幏鍙栧埌鐨刢ode:', res.code); + // 鍙戦�� res.code 鍒板悗鍙版湇鍔″櫒鎹㈠彇 openId, sessionKey, unionId + this.verify(res.code) + } else { + console.log('鐧诲綍澶辫触锛�' + res.errMsg); + } + } + }); + }, + //鐢ㄦ埛缁戝畾 + verify(wxCode) { + const params = { + url: 'wx/client/verify', + data: { + phoneNumber: this.data.phone, + securityCode: this.data.verificationCode, + code: wxCode + } + }; + post(params) + .then((data) => { + wx.hideLoading(); + getApp().globalData.sessionId = String(data.content.sessionId) + storage.setItem("sessionId", String(data.content.sessionId)) + getApp().globalData.clientId = String(data.content.clientId) + storage.setItem("clientId", String(data.content.clientId)) + this.bindSuccess(); + }) + .catch((error) => { + wx.hideLoading(); + wx.showToast({ + title: error.msg, + icon: 'error', + duration: 3000, + }); + console.error('Failed to add item:', error); + }); + }, + bindSuccess: function () { + if (!this.data.isButtonEnabled) return; + wx.showToast({ + title: '缁戝畾鎴愬姛', + icon: 'success' + }); + // 璺宠浆鍒� TabBar 椤甸潰 + wx.redirectTo({ + url: '/pages/home/home' // 杩欓噷濉啓浣犳兂瑕佽烦杞殑 TabBar 椤甸潰璺緞 + }); + }, }) \ No newline at end of file diff --git a/pages/login/login.wxml b/pages/login/login.wxml index 80ca67a..b45afd7 100644 --- a/pages/login/login.wxml +++ b/pages/login/login.wxml @@ -1,19 +1,32 @@ <!--pages/login/login.wxml--> <view class="login-container"> - <view> - <image src="/images/login_bg.jpeg"></image> + <view class="logo-container"> + </view> - <view class="input-wrapper"> - <input class="input" placeholder="璇疯緭鍏�11浣嶆墜鏈哄彿" maxlength="11" bindinput="bindMobileInput" /> + + <view class="form-container"> + <view class="title">鐢ㄦ埛鐧诲綍</view> + + <view class="input-wrapper"> + <view class="input-icon user-icon"></view> + <input class="input" type="number" placeholder="璇疯緭鍏ユ墜鏈哄彿" maxlength="11" bindinput="bindPhoneInput" /> + </view> + + <view class="input-wrapper"> + <view class="input-icon lock-icon"></view> + <input class="input" type="number" placeholder="璇疯緭鍏ラ獙璇佺爜" maxlength="6" bindinput="bindCodeInput" /> + <view class="code-button" bindtap="sendVerificationCode"> + <text>{{codeText}}</text> + </view> + </view> + + <view class="login-btn-container"> + <button class="login-button" bindtap="login">鐧诲綍</button> + </view> </view> - <view class="input-wrapper"> - <input class="input" type="number" placeholder="璇疯緭鍏ラ獙璇佺爜" /> - <button class="code-button" wx:if="{{!codeSent}}" bindtap="sendCode">鑾峰彇楠岃瘉鐮�</button> - <button class="code-button" wx:if="{{codeSent}}" disabled>閲嶆柊鑾峰彇({{countdown}}s)</button> + + <view class="project-info"> + <text>褰撳墠椤圭洰: {{projectName}}</text> </view> - <view> - <button class="login-button" bindtap="login">鐧诲綍</button> - </view> - </view> \ No newline at end of file diff --git a/pages/login/login.wxss b/pages/login/login.wxss index c042c05..e44353a 100644 --- a/pages/login/login.wxss +++ b/pages/login/login.wxss @@ -1,15 +1,131 @@ /* pages/login/login.wxss */ - - .login-container { display: flex; flex-direction: column; - justify-content: flex-end; - height: 80vh; + height: 100vh; width: 100%; + background-color: #f5f5f5; } +.logo-container { + display: flex; + justify-content: center; + align-items: center; + padding: 60rpx 0; +} + +.logo-circle { + width: 200rpx; + height: 200rpx; + border-radius: 50%; + background: #1890FF; + display: flex; + justify-content: center; + align-items: center; + color: white; + font-size: 80rpx; + font-weight: bold; +} + +.form-container { + background-color: #fff; + border-radius: 20rpx; + margin: 0 40rpx; + padding: 40rpx; + box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1); +} + +.title { + font-size: 40rpx; + font-weight: bold; + color: #333; + margin-bottom: 40rpx; + text-align: center; +} + +.input-wrapper { + display: flex; + align-items: center; + border-bottom: 1rpx solid #e0e0e0; + margin-bottom: 40rpx; + padding-bottom: 20rpx; +} + +.input-icon { + width: 40rpx; + height: 40rpx; + margin-right: 20rpx; + display: flex; + justify-content: center; + align-items: center; + color: #1890FF; + font-weight: bold; + font-size: 32rpx; +} + +.user-icon::before { + content: "馃懁"; +} + +.lock-icon::before { + content: "馃敀"; +} + +.eye-open-icon::before { + content: "馃憗锔�"; +} + +.eye-close-icon::before { + content: "馃憗锔忊�嶐煑笍"; +} + +.input { + flex: 1; + height: 60rpx; + font-size: 32rpx; + color: #333; +} + +.password-toggle { + padding: 10rpx; + font-size: 32rpx; +} + +.login-btn-container { + margin-top: 60rpx; +} + +.login-button { + height: 90rpx; + background-color: #1890FF; + color: #fff; + font-size: 34rpx; + border-radius: 45rpx; + display: flex; + justify-content: center; + align-items: center; +} + +.footer-links { + display: flex; + justify-content: space-between; + margin-top: 40rpx; + font-size: 28rpx; +} + +.link { + color: #1aad19; +} + +.project-info { + position: fixed; + bottom: 40rpx; + width: 100%; + text-align: center; + font-size: 28rpx; + color: #999; +} image { position: fixed; @@ -21,30 +137,6 @@ z-index: -999; } -.input { - flex: 1; - height: 30rpx; - padding: 10rpx; - border: 1px solid #ccc; - border-radius: 5px; - background-color: #fff; - font-size: 35rpx; - padding-left: 15rpx; -} - - -.input-wrapper { - - display: flex; - /* 浣跨敤 Flex 甯冨眬浣� text 鍜� input 鍦ㄥ悓涓�琛� */ - align-items: center; - justify-content: center; - margin-bottom: 40rpx; - margin-left: 40rpx; - margin-right: 40rpx; - -} - .input-label { flex: 1; /* 璁╁�煎崰鎹墿浣欑┖闂� */ @@ -52,7 +144,7 @@ width: 150rpx; margin-right: 10rpx; font-size: 31rpx; - color: #fff; + color: #333; font-weight: bold; text-align: justify; text-align-last: justify; @@ -64,18 +156,17 @@ align-items: center; } -.login-button { - margin-top: 50rpx; - margin-left: 40rpx; - margin-right: 40rpx; - height: 90rpx; - justify-content: center; /* 姘村钩灞呬腑 */ - align-items: center; /* 鍨傜洿灞呬腑 */ - display: flex; +.code-button { + width: 220rpx; + font-size: 28rpx; + color: #1890FF; + text-align: center; + padding: 10rpx 0; + border-left: 1rpx solid #e0e0e0; } -.code-button { - width: 50%; - font-size: 30rpx; - margin-left: 15rpx; +.code-button text { + display: block; + width: 100%; + height: 100%; } \ No newline at end of file diff --git a/pages/openCard/openCard.js b/pages/openCard/openCard.js index 532d7e1..9a85d8f 100644 --- a/pages/openCard/openCard.js +++ b/pages/openCard/openCard.js @@ -32,7 +32,7 @@ const data = { intakeId: this.data.intakeId, //鍙栨按鍙D vcId: vcId, //铏氭嫙鍗D - operator: app.globalData.sessionId //鎿嶄綔鍛� + operator: app.globalData.operator //鎿嶄綔鍛� }; post({ url: "8087/wx/valve/open_wx", diff --git a/pages/rechargeCard/rechargeCard.js b/pages/rechargeCard/rechargeCard.js index 56a094a..f9eef61 100644 --- a/pages/rechargeCard/rechargeCard.js +++ b/pages/rechargeCard/rechargeCard.js @@ -80,7 +80,7 @@ },//鑾峰彇铏氭嫙鍗″垪琛� getCardList(){ get({url:'https://d4x9787456.vicp.fun/sell/virtual_card/get', data: { - operator: getApp().globalData.sessionId + operator: getApp().globalData.operator }}) .then((data) => { if(data.success&&data.code==="0001"){ @@ -100,7 +100,7 @@ }, getWaterCardList(){ get({url:'https://d4x9787456.vicp.fun/sell/virtual_card/get', data: { - operator: getApp().globalData.sessionId + operator: getApp().globalData.operator }}) .then((data) => { if(data.success&&data.code==="0001"){ diff --git a/pages/waterIntake/waterIntake.js b/pages/waterIntake/waterIntake.js index de10bb5..0be2824 100644 --- a/pages/waterIntake/waterIntake.js +++ b/pages/waterIntake/waterIntake.js @@ -89,7 +89,7 @@ const data = { intakeId: intakeId, //鍙栨按鍙D // vcId: vcId, //铏氭嫙鍗D - operator: app.globalData.sessionId, //鎿嶄綔鍛� + operator: app.globalData.operator, //鎿嶄綔鍛� forceOpen: !!isforce // 浣跨敤閫昏緫闈炴搷浣滅 !! 鏉ョ‘淇� isForce 鏄竷灏斿�� }; post({ @@ -230,7 +230,7 @@ get({ url: 'wx/intake/used_intakes', data: { - operator: getApp().globalData.sessionId + operatorId: getApp().globalData.operator } }) .then((data) => { diff --git a/project.private.config.json b/project.private.config.json index 2462bad..126fb63 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -3,6 +3,6 @@ "projectname": "irrigate_user", "setting": { "compileHotReLoad": true, - "urlCheck": true + "urlCheck": false } } \ No newline at end of file -- Gitblit v1.8.0