Selaa lähdekoodia

登录页改造

dev_czc
HolyKnightIX 2 vuotta sitten
vanhempi
commit
a8d750aa20
8 muutettua tiedostoa jossa 514 lisäystä ja 252 poistoa
  1. +76
    -0
      .vscode/settings.json
  2. +4
    -0
      app.js
  3. BIN
      assets/images/logo2.png
  4. +10
    -10
      ext.json
  5. +130
    -65
      pages/index/index.js
  6. +27
    -6
      pages/index/index.ttml
  7. +238
    -142
      pages/index/index.ttss
  8. +29
    -29
      project.config.json

+ 76
- 0
.vscode/settings.json Näytä tiedosto

@@ -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",
}

+ 4
- 0
app.js Näytä tiedosto

@@ -20,3 +20,7 @@ App({
},
statusBarHeight: 0,
})

// 测试账号信息
// 18872592633
// 123456GD

BIN
assets/images/logo2.png Näytä tiedosto

Before After
Leveys: 320  |  Korkeus: 320  |  Koko: 2.3 KiB

+ 10
- 10
ext.json Näytä tiedosto

@@ -1,38 +1,38 @@
{
"ext": {
"attr": {
"configUrl": "https://b.malls.iformall.com",
"configUrl": "https://btest.malls.iformall.com",
"datatowerurl": "https://mobile.malls.iformall.com"
},
"name": "富茂券商户端模板",
"weappId": "tt7af40c49e5cd8d5001",
"name": "福喵商户端",
"weappId": "tt60d3166effed27cc01",
"appVersion": "Btest.5.1.0"
},
"debug": false,
"tabBar": {
"color": "#9F9F9F",
"selectedColor": "#52a0fd",
"backgroundColor": "#fff",
"list": [
{
"pagePath": "pages/main/main",
"text": "首页",
"iconPath": "assets/images/home-n.png",
"pagePath": "pages/main/main",
"selectedIconPath": "assets/images/home-y.png"
},
{
"pagePath": "pages/user/user",
"text": "我的",
"iconPath": "assets/images/user-n.png",
"pagePath": "pages/user/user",
"selectedIconPath": "assets/images/user-y.png"
}
]
],
"color": "#9F9F9F",
"selectedColor": "#52a0fd",
"backgroundColor": "#fff"
},
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#52A0FD"
},
"extAppid": "tt7af40c49e5cd8d5001",
"extAppid": "tt60d3166effed27cc01",
"extEnable": true,
"permission": {
"scope.userLocation": {


+ 130
- 65
pages/index/index.js Näytä tiedosto

@@ -9,18 +9,20 @@ Page({
logo: '../../assets/images/logo.png',
phone: '',
pwd: '',
status:'',
status: '',
showpass: "hidepass",
focus:false,
password: true
focus: false,
password: true,
ifShowShop: false,
merchantList: []
},
onLoad() {
Common.getMallIcon()
Common.getMallIcon()
.then(data => {
// 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 {


+ 27
- 6
pages/index/index.ttml Näytä tiedosto

@@ -2,14 +2,17 @@
<view class='logo'>
<image src='{{logo}}' mode="widthFix"></image>
</view>
<form bindsubmit='getLoginInfo'>
<form bindsubmit='getLoginInfo' tt:if="{{!ifShowShop}}">
<view class='login'>
<view>
<input type='number' name='phone' value='{{phone}}' placeholder='请输入手机号' placeholder-style='color:#BFBFBF;' maxlength='11' class='inp' />
</view>
<input type='number' name='phone' value='{{phone}}' placeholder='请输入手机号' placeholder-style='color:#BFBFBF;'
maxlength='11' class='inp' />
</view>
<view>
<input password='{{password}}' focus='{{focus}}' class='inp' placeholder='请输入密码' placeholder-style='color:#BFBFBF;' name='pwd' value='{{pwd}}' />
<image class='showpassword' bindtap='showpassword' src='../../assets/images/password.png' mode='widthFix'></image>
<input password='{{password}}' focus='{{focus}}' class='inp' placeholder='请输入密码'
placeholder-style='color:#BFBFBF;' name='pwd' value='{{pwd}}' />
<image class='showpassword' bindtap='showpassword' src='../../assets/images/password.png' mode='widthFix'>
</image>
</view>
</view>
<navigator url='../index/index' open-type='navigate' hover-class='none'>
@@ -24,7 +27,25 @@
<button class="phone" tt:if="{{ifAlBoss}}" bindtap="getPhoneNumber"><image class='adminlogo' src='../../assets/images/admin.png' mode='widthFix'></image>数据塔台</button>
</view> -->
</form>
<view class='defaultLogo'>
<view class="page" tt:if="{{ifShowShop}}">
<view class="title">请选择要管理的门店</view>
<view class="shopBox" tt:for="{{merchantList}}" tt:key="{{item.tenantId}}" bindtap="goShop"
data-id="{{item.buUserId}}">
<view class="imgBox">
<image class="imgInside" src="{{item.imgUrl}}"></image>
</view>
<view class="infoBox">
<view class="shop">{{item.merchantName}}</view>
<view class="mainShop">{{item.tenantName}}</view>
<view class="address">{{}}</view>
</view>
</view>

</view>
<view class='defaultLogo' tt:if="{{merchantList.legth>2}}">
<text>POWERED BY IFORMALL</text>
</view>
<view class='defaultLogo2' tt:else>
<text>POWERED BY IFORMALL</text>
</view>
</view>

+ 238
- 142
pages/index/index.ttss Näytä tiedosto

@@ -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;
}
.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;
}

+ 29
- 29
project.config.json Näytä tiedosto

@@ -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"
}
]
}
}
}
}

Ladataan…
Peruuta
Tallenna