Browse Source

增加登陆页面

shibei
luyan 1 year ago
parent
commit
c0a00a4933
  1. 14
      miniprogram/.gitignore
  2. 4
      miniprogram/app.json
  3. 1
      miniprogram/pages/formid/formid.js
  4. 75
      miniprogram/pages/login/login.js
  5. 4
      miniprogram/pages/login/login.json
  6. 28
      miniprogram/pages/login/login.wxml
  7. 165
      miniprogram/pages/login/login.wxss
  8. 50
      miniprogram/pages/my/my.js
  9. 2
      miniprogram/project.config.json
  10. 7
      miniprogram/project.private.config.json
  11. 92
      miniprogram/utils/index.js
  12. 3
      package-lock.json

14
miniprogram/.gitignore

@ -0,0 +1,14 @@
# Windows
[Dd]esktop.ini
Thumbs.db
$RECYCLE.BIN/
# macOS
.DS_Store
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
# Node.js
node_modules/

4
miniprogram/app.json

@ -1,5 +1,6 @@
{
"pages": [
"pages/login/login",
"pages/home/home",
"pages/message/message",
"pages/my/my",
@ -20,7 +21,8 @@
"pages/gridLeaderRegister/gridLeaderRegister",
"pages/navigatetoApp/navigatetoApp"
],
"subPackages": [{
"subPackages": [
{
"root": "subpages/redSail",
"name": "redSail",
"pages": [

1
miniprogram/pages/formid/formid.js

@ -1,6 +1,5 @@
var api = require('../../utils/api.js')
var global = require('../../utils/config.js')
const app = getApp()
Page({
data: {
gridId: '',

75
miniprogram/pages/login/login.js

File diff suppressed because one or more lines are too long

4
miniprogram/pages/login/login.json

@ -0,0 +1,4 @@
{
"navigationStyle": "custom",
"navigationBarTitleText": "登录"
}

28
miniprogram/pages/login/login.wxml

@ -0,0 +1,28 @@
<view class="header">
<image class="header-bg" src="../../images/main/home_top.png" mode="widthFix" />
<view class="login-top"></view>
<view class="login-bottom">
<view class="info">
<view class="info-bg">
<view class="name">
<view class="name-pw-bg">
<image src="../../../../../../assets/images/name.png"></image>
</view>
<view class="info-input">
<input bindinput="getUserName" placeholder="请输入用户名"></input>
</view>
</view>
<view class="password">
<view class="name-pw-bg">
<image src="../../../../../../assets/images/password.png"></image>
</view>
<view class="info-input">
<input bindinput="getPassword" password placeholder="请输入密码"></input>
</view>
</view>
<view class="login" bindtap="handleLogin">登 录</view>
</view>
</view>
</view>
</view>

165
miniprogram/pages/login/login.wxss

@ -0,0 +1,165 @@
page {
width: 100%;
height: 100vh;
}
.main-bg {
width: 100%;
height: 100%;
background:#fff;
position: relative;
}
.header .header-bg {
width: 100%;
height: 100%;
/* position: absolute;
z-index: 10;
left: 0;
top: 0; */
position: absolute;
height: 100%;
z-index: -999;
}
.main-bg image{
width: 100%;
height: 100%;
object-fit: cover;
position: absolute;
left: 0;
top: 0;
}
.login-top{
width: 100%;
height: 310rpx;
z-index: 100;
position: relative;
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
}
.login-top .picture{
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-end;
height: 100%;
}
.login-top .picture .picture-bg{
width: 160rpx;
height: 160rpx;
position: relative;
display: flex;
align-items: center;
justify-content: center;
}
.data-name{
width: 96rpx;
height: 36rpx;
text-align: center;
position: relative;
left: 85rpx;
top: -22rpx;
}
.data-name image{
width: 100%;
height: 100%;
object-fit: cover;
position: absolute;
left: 0;
top: 0;
}
.data-name .name{
font-size:24rpx;
font-family:PingFang SC;
font-weight:500;
position: relative;
color:rgba(255,255,255,1);
}
.login-bottom{
width: 100%;
height: 570rpx;
z-index: 100;
position: relative;
box-sizing: border-box;
display: flex;
justify-content: center;
align-items: center;
top: 127rpx;
}
.login-bottom .info{
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-end;
}
.login-bottom .info .info-bg{
width: 640rpx;
height: 500rpx;
position: relative;
background:rgba(255,255,255,1);
box-shadow:0px 8px 10px 0px rgba(33,155,138,0.22);
border-radius: 24rpx;
}
.login-bottom .info .info-bg .name{
width:560rpx;
height:88rpx;
background:rgba(248,248,248,1);
border-radius:44rpx;
position: relative;
margin-top: 97rpx;
left: 39rpx;
}
.name-pw-bg{
width: 34rpx;
height: 34rpx;
float: left;
position: absolute;
left: 41rpx;
margin-top: 27rpx;
}
.info-input{
float: left;
width: 395rpx;
height: 100%;
position: absolute;
margin-left: 107rpx;
}
.info-input input{
margin-top: 15rpx;
font-size:30rpx;
}
.login-bottom .info .info-bg .password{
width:560rpx;
height:88rpx;
background:rgba(248,248,248,1);
border-radius:44rpx;
position: relative;
margin-top: 29rpx;
left: 39rpx;
}
.login-bottom .info .info-bg .login{
width:560rpx;
height:88rpx;
background:#f5071ad6;
border-radius:44rpx;
position: relative;
margin-top: 82rpx;
left: 39rpx;
text-align: center;
line-height: 88rpx;
font-size:36rpx;
font-family:PingFang SC;
font-weight:500;
color:rgba(255,255,255,1);
}

50
miniprogram/pages/my/my.js

@ -12,8 +12,8 @@ Page({
navigationHeight: app.globalData.deviceInfo.navigationHeight,
userName: {},
faceImg: '',
pass:0,
userId:'',
pass: 0,
userId: '',
userInfo: {},
},
/**
@ -40,8 +40,8 @@ Page({
// });
let obj = JSON.parse(wx.getStorageSync('userInfo'))
this.setData({
userId:obj.id,
faceImg:obj.faceImg
userId: obj.id,
faceImg: obj.faceImg
})
this.getCentralhousehold();
},
@ -111,30 +111,28 @@ Page({
delta: 1
})
},
logoout(){
logoout() {
wx.showModal({
title: '提示',
content: '确定退出登录',
success (res) {
success(res) {
if (res.confirm) {
// wx.setStorageSync("token", res.data.token)
wx.showLoading({
title: "退出中,请稍后...",
mask: true,
success(){
setTimeout(()=>{
wx.removeStorage({key: 'token',})
wx.switchTab({
url: '/pages/home/home',
success() {
setTimeout(() => {
wx.removeStorage({
key: 'token',
})
},1000)
wx.reLaunch({
url: '/pages/login/login'
})
}, 1000)
}
})
} else if (res.cancel) {
}
}
})
},
@ -153,11 +151,11 @@ Page({
name: 'file',
url: config.BASEURL() + 'commonsUtils/upload',
formData: {},
success:function(res) {
success: function (res) {
let imgUrl = JSON.parse(res.data).data.url;
if(imgUrl){
if (imgUrl) {
_this.setData({
faceImg:imgUrl
faceImg: imgUrl
})
wx.login({
success: (res) => {
@ -181,7 +179,7 @@ Page({
if (res.code) {
api.userInfoUpdate(para).then(res => {
if (res.code == 0) {
wx.setStorageSync(para,'userInfo')
wx.setStorageSync(para, 'userInfo')
_this.getUserInfo()
}
}).catch(err => {
@ -206,16 +204,16 @@ Page({
console.log(err)
})
},
getCentralhousehold(){
getCentralhousehold() {
let para = this.data.userId
partyApi.getCentralhousehold(para).then(res =>{
if(res.data.pass === 1){
partyApi.getCentralhousehold(para).then(res => {
if (res.data.pass === 1) {
this.setData({
pass:res.data.pass // 审核状态
pass: res.data.pass // 审核状态
})
}else {
} else {
this.setData({
pass:res.data.pass // 审核状态
pass: res.data.pass // 审核状态
})
}
})

2
miniprogram/project.config.json

@ -43,7 +43,7 @@
"condition": false
},
"compileType": "miniprogram",
"libVersion": "2.10.4",
"libVersion": "2.32.2",
"appid": "wxfa4afaa2b5f9c876",
"projectname": "%E5%85%9A%E7%BE%A4e%E5%AE%B6-%E7%BA%BF%E4%B8%8A%E7%89%88",
"simulatorType": "wechat",

7
miniprogram/project.private.config.json

@ -168,6 +168,13 @@
"query": "",
"launchMode": "default",
"scene": null
},
{
"name": "登陆",
"pathName": "pages/login/login",
"query": "",
"launchMode": "default",
"scene": 1017
}
]
}

92
miniprogram/utils/index.js

File diff suppressed because one or more lines are too long

3
package-lock.json

@ -0,0 +1,3 @@
{
"lockfileVersion": 1
}
Loading…
Cancel
Save