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. 118
      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": [
"pages/login/login",
"pages/home/home", "pages/home/home",
"pages/message/message", "pages/message/message",
"pages/my/my", "pages/my/my",
@ -20,7 +21,8 @@
"pages/gridLeaderRegister/gridLeaderRegister", "pages/gridLeaderRegister/gridLeaderRegister",
"pages/navigatetoApp/navigatetoApp" "pages/navigatetoApp/navigatetoApp"
], ],
"subPackages": [{ "subPackages": [
{
"root": "subpages/redSail", "root": "subpages/redSail",
"name": "redSail", "name": "redSail",
"pages": [ "pages": [

1
miniprogram/pages/formid/formid.js

@ -1,6 +1,5 @@
var api = require('../../utils/api.js') var api = require('../../utils/api.js')
var global = require('../../utils/config.js') var global = require('../../utils/config.js')
const app = getApp()
Page({ Page({
data: { data: {
gridId: '', 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);
}

118
miniprogram/pages/my/my.js

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

2
miniprogram/project.config.json

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

7
miniprogram/project.private.config.json

@ -168,6 +168,13 @@
"query": "", "query": "",
"launchMode": "default", "launchMode": "default",
"scene": null "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