From a8d750aa20de2d9b432a4268ae307928c38aff21 Mon Sep 17 00:00:00 2001 From: YWQ HK IX <568170040@qq.com> Date: Sun, 27 Nov 2022 20:38:52 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E9=A1=B5=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/settings.json | 76 ++++++++ app.js | 4 + assets/images/logo2.png | Bin 0 -> 2344 bytes ext.json | 20 +-- pages/index/index.js | 195 ++++++++++++++------- pages/index/index.ttml | 33 +++- pages/index/index.ttss | 380 +++++++++++++++++++++++++--------------- project.config.json | 58 +++--- 8 files changed, 514 insertions(+), 252 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 assets/images/logo2.png diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..0d4d636 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,76 @@ +{ + "editor.tokenColorCustomizations": { + "keywords": { + "foreground": "#FF0000", + "fontStyle": "italic bold" + }, + "variables": { + "foreground": "#ffffff", + "fontStyle": "italic bold", + }, + //字符串 + "strings": { + "foreground": "#fbff00", + "fontStyle": "italic" + }, + //函数 + "functions": "#00ffff", + //注释 + "comments": "#969696", + "types": "#00ff95" + }, + "editor.formatOnSave": true, + "editor.wordWrap": "on", + // 开启原生括号着色 + "editor.bracketPairColorization.enabled": true, + // 开启代码块边缘导轨线着色 + "editor.guides.bracketPairs": "active", + //覆盖当前所选颜色主题的颜色 + "workbench.colorCustomizations": { + //光标颜色 + "editorCursor.foreground": "#00ff00", + //编辑器背景色 + "editor.background": "#00000025", + //光标所在行边框颜色 + //光标所在行背景颜色 + "editor.lineHighlightBorder": "#ffffffa1", + "editor.lineHighlightBackground": "#ffffff1e", + //光标选中文本的背景颜色 + //光标选中文本时匹配同类型的值的背景颜色 + "editor.selectionBackground": "#ff0000c2", + "editor.selectionHighlightBackground": "#00ffff80", + //缩进参考线的颜色 + "editorIndentGuide.activeBackground": "#f92672", + //方括号出现意外的前景色 + "editorBracketHighlight.unexpectedBracket.foreground": "#ff0000", + //括号的前景色,需要启用括号对着色 + "editorBracketHighlight.foreground1": "#ffff00", + "editorBracketPairGuide.activeBackground1": "#ffff00", + "editorBracketHighlight.foreground2": "#f92672", + "editorBracketPairGuide.activeBackground2": "#f92672", + "editorBracketHighlight.foreground3": "#00ffff", + "editorBracketPairGuide.activeBackground3": "#00ffff", + "editorBracketHighlight.foreground4": "#00ff00", + "editorBracketPairGuide.activeBackground4": "#00ff00", + "workbench.colorTheme": "Sublime VSCode Theme", + "[Sublime VSCode Theme]": { + "activityBar.activeBackground": "#ffffff1e", + "activityBar.background": "#292b27", + "activityBar.foreground": "#ffffff", + "activityBar.activeBorder": "#ff0000", + "activityBar.activeFocusBorder": "#ff0000", + "breadcrumb.foreground": "#ffffff", + "breadcrumb.background": "#1a1b18", + "sideBar.background": "#1e1f1c", + "sideBarSectionHeader.background": "#343532", + "sideBarSectionHeader.foreground": "#fff", + "sideBar.border": "#777777", + "sideBar.foreground": "#fff", + "list.hoverBackground": "#8a8a8a", + "list.inactiveSelectionBackground": "#75715e", + "editor.selectionBackground": "#ff0000", + "editorGroupHeader.tabsBackground": "#141415" + }, + }, + "editor.cursorBlinking": "smooth", +} \ No newline at end of file diff --git a/app.js b/app.js index bedd248..5b2eab3 100644 --- a/app.js +++ b/app.js @@ -20,3 +20,7 @@ App({ }, statusBarHeight: 0, }) + +// 测试账号信息 +// 18872592633 +// 123456GD diff --git a/assets/images/logo2.png b/assets/images/logo2.png new file mode 100644 index 0000000000000000000000000000000000000000..553e91b679b75f6f14f5d96c997827103597316c GIT binary patch literal 2344 zcmeHJ&1(}u6yH|rcR>(D1!3G?6y49HX)?I|N@^Q$YiWaRZ=K9clC{~Lb$8mNJ*kM` zf1o1x2MC@86^mzY-uxRB!J7xcxA|DAR7Eddx-jhQo8SBT&3li1urNP6eDv&5MNx*! zbEQQ^8JJAg;X#m0f3d&8>qt1a8Y{}NlgS!T9zQv)C_|^b%8FcZuVE^DoiI`5dfN{H ztteL}+99FqT%szkdx4{Ve)&d49&^;?QP*_CB5!ze+Yw*dp0CjDby{HR#5lUr#$dqb zlAyNV3}W1N)Q(*Y`$TN0r~{Gfjyjb%L@VwBDvF4sQ9Y+oE1O4S1>MSJ%}nkxvQ4XC zn0dp>Xr_hD93CA*y+;La5v$?F($$_X_;S>Slp!{ZR;#7AGP;QBhE*tl4coA74G>zq z6-d(7f_S8Fp~Pbvd7<<~fD((ODmJ8}LZsak{4g~e#66mTFr!UE!_v(pr4EqM6c=tp z&5mLQjin~+A2kUi0HWh>;y zB9FyJMET4nggKIA6XIgTi4;*qh-Uwy7WyG08?r_hmc4+9R(x@n0xuEC9o060Ys=E? zv5Ey(X5y@Q$;@NZ>_T0^yxP{DPzz_WKR}^m7?I?UU`BCGL_UFpJ)hLM5e9V?r8MHA zXo?6NLv)$l@^Z1b5Q&=CgoAi-b{dsuiaD#0%W1Z5b;5OBTn=JM0?NxJM+I_p&tte& zr8Q<#Tgy^5rjdM>YlPTY&B_)sj8`*xMp<9KBW16}=AgM-oE)I}E-i<)eah)>ml ztv}YC0l^zd!*=s9eonD-wyU}OaF`g$HXT*)kq$c^z=Vrnl)XDU`C3s9yeOBZD(xqq z-cJoH=){h>^X9|S?L*_N{A}&%r$?)k@4uc?US-UCXHLI8ew-Y { // debugge - console.log(data,777) + console.log(data, 777) this.setData({ - logo: data.data&&data.data.mallImgUrl ? data.data.mallImgUrl : '../../assets/images/logo.png', + logo: data.data && data.data.mallImgUrl ? data.data.mallImgUrl : '../../assets/images/logo.png', }) }) }, @@ -39,34 +41,43 @@ Page({ pwd: pwd }); } + + // 进入页面后清空bUserId + HttpBasics.setBUserId(''); + tt.setStorageSync("bUserId", ''); + app.globalData.bUserId = ''; + tt.setStorage({ + key: 'bUserId', + data: '', + }) }, //显示具体的密码 - showpassword:function(){ + showpassword: function () { console.log(this.data.password); let that = this; - if (that.data.password){ + if (that.data.password) { that.setData({ password: false, - focus:true + focus: true }) - }else{ + } else { that.setData({ password: true, focus: true }) } }, - ttLogin(flag){ + ttLogin(flag) { let that = this; tt.login({ success: res => { Common.getSuperOpenId(res.code) .then(res => { console.log(res) - if (res.data&& res.data.data&&res.data.data.openId){ + if (res.data && res.data.data && res.data.data.openId) { app.globalData.superopenId = res.data.data.openId; } - if (res.data && res.data.data && res.data.data.session_key){ + if (res.data && res.data.data && res.data.data.session_key) { app.globalData.session_key = res.data.data.session_key; } if (res.data.code == 200) { @@ -75,14 +86,14 @@ Page({ ifAlBoss: true, status: "use" }) - if (flag =='fromgetPhoneNumber'){ + if (flag == 'fromgetPhoneNumber') { tt.navigateTo({ url: `/pages/datatower/datatower?superopenId=${app.globalData.superopenId}&phone=${app.globalData.phone}`, }) } - + } else { - if (flag =='fromgetPhoneNumber'){ + if (flag == 'fromgetPhoneNumber') { tt.showToast({ title: res.data.message, icon: "none", @@ -91,7 +102,7 @@ Page({ } } }).catch(error => { - console.log(error,"error"); + console.log(error, "error"); that.setData({ error: error.message }) @@ -117,48 +128,60 @@ Page({ if (pwd != '') { Common.userLogin(phone, pwd, app.globalData.latitude, app.globalData.longitude) .then(res => { - console.log(res); - if (res.code == 200) { - HttpBasics.setBUserId(res.data.bUserId); - tt.setStorageSync("phone", phone); - tt.setStorageSync("pwd", pwd); - tt.setStorageSync("bUserId", res.data.bUserId); - app.globalData.bUserId = res.data.bUserId; - tt.setStorage({ - key: 'bUserId', - data: res.data.bUserId, - }) - tt.login({ - success:function(res){ - Common.getOpenId(res.code,app.globalData.bUserId) - .then(res => { - console.log(res,888) - app.globalData.openId = res.data.data.openId; - app.globalData.token = res.data.data.token; - HttpBasics.setToken(res.data.data.token); - tt.setStorageSync("openId", res.data.data.openId); - tt.setStorageSync("session_key", res.data.data.session_key); - tt.showToast({ - image: './../../assets/images/success.png', - title: '登录成功', - }) - tt.switchTab({ - url: '/pages/main/main', - success(res) { - console.log(`${res}`); - }, - fail(err) { - console.log(err,`switchTab调用失败`); - }, + const logined = res.data.logined + const merchantList = res.data.merchantList + // 当logined为true时,正常进入商户 + if (logined) { + if (res.code == 200) { + HttpBasics.setBUserId(res.data.bUserId); + tt.setStorageSync("phone", phone); + tt.setStorageSync("pwd", pwd); + tt.setStorageSync("bUserId", res.data.bUserId); + app.globalData.bUserId = res.data.bUserId; + tt.setStorage({ + key: 'bUserId', + data: res.data.bUserId, + }) + tt.login({ + success: function (res) { + Common.getOpenId(res.code, app.globalData.bUserId) + .then(res => { + console.log(res, 888) + app.globalData.openId = res.data.data.openId; + app.globalData.token = res.data.data.token; + HttpBasics.setToken(res.data.data.token); + tt.setStorageSync("openId", res.data.data.openId); + tt.setStorageSync("session_key", res.data.data.session_key); + tt.showToast({ + image: './../../assets/images/success.png', + title: '登录成功', + }) + tt.switchTab({ + url: '/pages/main/main', + success(res) { + console.log(`${res}`); + }, + fail(err) { + console.log(err, `switchTab调用失败`); + }, + }) }) - }) - } - }) + } + }) + } else { + tt.showToast({ + image: './../../assets/images/fail.png', + title: res.message, + icon: "none" + }) + } + // 当logined为false时,选择商户 } else { - tt.showToast({ - image:'./../../assets/images/fail.png', - title: res.message, - icon: "none" + tt.setStorageSync("phone", phone); + tt.setStorageSync("pwd", pwd); + this.setData({ + ifShowShop: true, + merchantList: merchantList }) } }) @@ -169,13 +192,13 @@ Page({ icon: "none", }) } - } else if(phone=="") { + } else if (phone == "") { tt.showToast({ image: './../../assets/images/fail.png', title: '请输入手机号', icon: "none" }) - }else{ + } else { tt.showToast({ image: './../../assets/images/fail.png', title: '手机号有误', @@ -186,10 +209,16 @@ Page({ /** * 获得超级管理员手机号 */ - getPhoneNumber: function (e) { + getPhoneNumber: function (e) { this.ttLogin("fromgetPhoneNumber"); - if (app.globalData.superopenId && app.globalData.session_key){ - let { encryptedData, iv } = { encryptedData: e.detail.encryptedData, iv: e.detail.iv }; + if (app.globalData.superopenId && app.globalData.session_key) { + let { + encryptedData, + iv + } = { + encryptedData: e.detail.encryptedData, + iv: e.detail.iv + }; if (encryptedData && iv) { Common.getUserPhone(encryptedData, iv, app.globalData.superopenId, app.globalData.session_key) .then(res => { @@ -200,12 +229,48 @@ Page({ }) } }) - } } + } + }, + goShop(e) { + const id = e.currentTarget.dataset.id + HttpBasics.setBUserId(id); + tt.setStorageSync("bUserId", id); + app.globalData.bUserId = id; + tt.setStorage({ + key: 'bUserId', + data: id, + }) + tt.login({ + success: function (res) { + Common.getOpenId(res.code, app.globalData.bUserId) + .then(res => { + console.log(res, 888) + app.globalData.openId = res.data.data.openId; + app.globalData.token = res.data.data.token; + HttpBasics.setToken(res.data.data.token); + tt.setStorageSync("openId", res.data.data.openId); + tt.setStorageSync("session_key", res.data.data.session_key); + tt.showToast({ + image: './../../assets/images/success.png', + title: '登录成功', + }) + tt.switchTab({ + url: '/pages/main/main', + success(res) { + console.log(`${res}`); + }, + fail(err) { + console.log(err, `switchTab调用失败`); + }, + }) + }) + } + }) }, /** - * 用户点击右上角分享 - */ + * 用户点击右上角分享 + */ onShareAppMessage: function (res) { let _this = this; return { diff --git a/pages/index/index.ttml b/pages/index/index.ttml index 61c8b48..b9af1e8 100644 --- a/pages/index/index.ttml +++ b/pages/index/index.ttml @@ -2,14 +2,17 @@ -
+ - - + + + @@ -24,7 +27,25 @@ --> - \ No newline at end of file diff --git a/pages/index/index.ttss b/pages/index/index.ttss index edc0a23..10b5325 100644 --- a/pages/index/index.ttss +++ b/pages/index/index.ttss @@ -1,142 +1,238 @@ -.adminlogo{ - width: 100rpx; - display: block; - margin: 0 auto; - } - .logoin_wrap { - width: 100%; - display: flex; - flex-direction: column; - } - - .login { - width: 100%; - display: flex; - flex-direction: column; - position: relative; - } - .inp{ - color: #666; - } - .login view { - position: relative; - width: 88%; - display: flex; - margin: 0 auto; - height: 100rpx; - line-height: 100rpx; - border-bottom: 1rpx solid #DADADA; - } - - .line { - width: 2rpx; - height: 22rpx; - background: #d7d7d7; - position: absolute; - left: 20%; - top: 38rpx; - } - - .login view input { - font-size: 34rpx; - height: 100rpx; - line-height: 100rpx; - } - - .login view:nth-child(1) input { - /* padding-left: 60rpx; */ - font-size: 34rpx; - height: 100rpx; - line-height: 100rpx; - } - .eye{ - display: inline-block; - width: 50rpx; - margin-top:26rpx; - } - - .logo { - width: 320rpx; - margin: 100rpx auto 30rpx; - } - - .logo image { - display: block; - width: 320rpx; - } - - .button { - background: #52A0FD; - border-radius: 8rpx; - color: #fff; - margin-top: 8%; - font-size: 36rpx; - width: 90%; - } - .active{ - opacity: .4; - } - - .logoin_wrap navigator { - display: block; - width: 25%; - margin: 0 auto; - text-align: right; - margin-top: 15rpx; - } - - .logoin_wrap navigator text { - display: block; - text-align: center; - /* padding-top: 1.5%; */ - font-size: 26rpx; - height: 45rpx; - color: #404040; - letter-spacing: 0; - line-height: 45rpx; - } - .forget{ - text-align: right; - padding:0 40rpx; - color: #999; - margin-top: 20rpx; - } - .forget text{ - font-size: 26rpx; - } - .defaultLogo{ - position: absolute; - bottom: 40rpx; - left: 0; - right: 0; - margin: auto; - } - .defaultLogo text { - display: block; - text-align: center; - color: #52A0FD; - font-size: 22rpx; - } - - .defaultLogo image { - width: 200rpx; - } - .phone{ - display: block!important; - background: none!important; - color: #999!important; - font-size: 26rpx!important; - padding: 0!important; - margin-top: 40rpx!important; - } - button::after{ border: none; } - .showpassword{ - padding: 30rpx; - width: 40rpx; - position: absolute; - z-index: 100; - right: 20rpx; - top: 0; - bottom: 0; - margin: auto; - } \ No newline at end of file +.adminlogo { + width: 100rpx; + display: block; + margin: 0 auto; +} + +.logoin_wrap { + position: relative; + width: 100%; + display: flex; + flex-direction: column; +} + +.login { + width: 100%; + display: flex; + flex-direction: column; + position: relative; +} + +.inp { + color: #666; +} + +.login view { + position: relative; + width: 88%; + display: flex; + margin: 0 auto; + height: 100rpx; + line-height: 100rpx; + border-bottom: 1rpx solid #DADADA; +} + +.line { + width: 2rpx; + height: 22rpx; + background: #d7d7d7; + position: absolute; + left: 20%; + top: 38rpx; +} + +.login view input { + font-size: 34rpx; + height: 100rpx; + line-height: 100rpx; +} + +.login view:nth-child(1) input { + /* padding-left: 60rpx; */ + font-size: 34rpx; + height: 100rpx; + line-height: 100rpx; +} + +.eye { + display: inline-block; + width: 50rpx; + margin-top: 26rpx; +} + +.logo { + width: 320rpx; + margin: 100rpx auto 30rpx; +} + +.logo image { + display: block; + width: 320rpx; +} + +.button { + background: #52A0FD; + border-radius: 8rpx; + color: #fff; + margin-top: 8%; + font-size: 36rpx; + width: 90%; +} + +.active { + opacity: .4; +} + +.logoin_wrap navigator { + display: block; + width: 25%; + margin: 0 auto; + text-align: right; + margin-top: 15rpx; +} + +.logoin_wrap navigator text { + display: block; + text-align: center; + /* padding-top: 1.5%; */ + font-size: 26rpx; + height: 45rpx; + color: #404040; + letter-spacing: 0; + line-height: 45rpx; +} + +.forget { + text-align: right; + padding: 0 40rpx; + color: #999; + margin-top: 20rpx; +} + +.forget text { + font-size: 26rpx; +} + +.defaultLogo { + position: absolute; + bottom: 40rpx; + left: 0; + right: 0; + margin: auto; +} + +.defaultLogo text { + display: block; + text-align: center; + color: #52A0FD; + font-size: 22rpx; +} + +.defaultLogo image { + width: 200rpx; +} + +.defaultLogo2 { + position: fixed; + bottom: 40rpx; + left: 0; + right: 0; + margin: auto; +} + +.defaultLogo2 text { + display: block; + text-align: center; + color: #52A0FD; + font-size: 22rpx; +} + +.defaultLogo2 image { + width: 200rpx; +} + +.phone { + display: block !important; + background: none !important; + color: #999 !important; + font-size: 26rpx !important; + padding: 0 !important; + margin-top: 40rpx !important; +} + +button::after { + border: none; +} + +.showpassword { + padding: 30rpx; + width: 40rpx; + position: absolute; + z-index: 100; + right: 20rpx; + top: 0; + bottom: 0; + margin: auto; +} + +.page { + padding-left: 40rpx; + padding-right: 40rpx; + padding-bottom: 100rpx; +} + +.page .logo { + width: 320rpx; + margin: 100rpx auto 15rpx; +} + +.page .logo image { + display: block; + width: 320rpx; +} + +.page .title { + text-align: center; + font-size: 35rpx; + font-weight: 500; + margin-bottom: 40rpx; +} + +.page .shopBox { + display: flex; + padding: 20rpx; + border: 1px solid #5e5e5e; + border-radius: 15rpx; + margin-bottom: 20rpx; +} + +.page .shopBox .imgBox { + width: 230rpx; + height: 230rpx; + margin-right: 30rpx; +} + +.page .shopBox .imgBox .imgInside { + width: 100%; + height: 100%; +} + +.page .shopBox .infoBox { + padding-top: 5rpx; +} + +.page .shopBox .infoBox .shop { + font-size: 32rpx; + font-weight: 600; + margin-bottom: 70rpx; +} + +.page .shopBox .infoBox .mainShop { + font-size: 28rpx; + font-weight: 600; + margin-bottom: 32rpx; +} + +.page .shopBox .infoBox .address { + font-size: 23rpx; +} \ No newline at end of file diff --git a/project.config.json b/project.config.json index 439f027..05a112d 100644 --- a/project.config.json +++ b/project.config.json @@ -1,32 +1,32 @@ { - "setting": { - "urlCheck": true, - "es6": true, - "newFeature": false, - "postcss": false, - "autoCompile": true, - "mockUpdate": true, - "minified": false, - "autoPush": false, - "scripts": false, - "mockLogin": false - }, - "appid": "tt1f6669db8058907a01", - "projectname": "tt富茂B", - "condition": { - "miniprogram": { - "current": -1, - "list": [ - { - "id": 1637139224806, - "name": "11", - "pathName": "pages/orderUrl/orderUrl", - "query": "", - "scene": "990001", - "launchFrom": "scan", - "location": "qr_code" - } - ] + "setting": { + "urlCheck": true, + "es6": true, + "newFeature": false, + "postcss": false, + "autoCompile": true, + "mockUpdate": true, + "minified": false, + "autoPush": false, + "scripts": false, + "mockLogin": false + }, + "appid": "tt1f6669db8058907a01", + "projectname": "tt富茂B", + "condition": { + "miniprogram": { + "current": -1, + "list": [ + { + "id": 1669538124728, + "name": "登录后选择门店测试", + "pathName": "pages/chooseShop/chooseShop", + "query": "", + "scene": "990001", + "launchFrom": "scan", + "location": "qr_code" } + ] } -} \ No newline at end of file + } +}