Browse Source

我的页面样式调整等

work_tab_bar
李素 1 year ago
parent
commit
ec899fc1b0
  1. 59
      pages/login/login.js
  2. 2
      pages/login/login.wxml
  3. 14
      pages/mine/mine.js
  4. 9
      pages/mine/mine.wxml
  5. 12
      pages/mine/mine.wxss

59
pages/login/login.js

@ -96,8 +96,6 @@ Page({
}) })
return return
} }
//var和const的区别,一个可变,一个不可变,
// const 声明一个不可变的对象parm,并创建了对象
const parm = { const parm = {
// wxCode对象的初始化 // wxCode对象的初始化
wxCode :'', wxCode :'',
@ -108,36 +106,53 @@ Page({
wx.showLoading({ wx.showLoading({
title: '登录中', title: '登录中',
}) })
//微信的api,获取登录凭证 //微信的api,获取登录凭证,用户获取凭证
// 在这一步骤中,用户获取凭证 wx.getUserProfile({
desc: '用于获取用户个人信息',
success: function (res) {
var userInfo = res.userInfo;
var avatarUrl = userInfo.avatarUrl;
wx.setStorageSync('avatarUrl', avatarUrl)
console.log("User's Avatar URL:", avatarUrl);
wx.login({ wx.login({
success: (res) => { success: (res) => {
parm.wxCode = res.code parm.wxCode = res.code
console.log(parm.wxCode); console.log(parm.wxCode);
// 调用登录的接口 // 调用登录的接口
userLoginlog(parm).then((res)=>{ userLoginlog(parm).then((res)=>{
console.log(res); console.log(res);
// 不明白这里判断的是什么 // 判断登录是否成功
if(res.code == 0){ if(res.code == 0){
// 用于跳转的api,跳转到某某某 // 用于跳转的api,跳转到某某某
wx.switchTab({ wx.switchTab({
url: '/pages/index/index', url: '/pages/index/index',
}) })
//加入本地内存的api //加入本地内存的api
wx.setStorageSync('token', res.data.token) wx.setStorageSync('token', res.data.token)
}
}).catch(err=>{ }
wx.showToast({ }).catch(err=>{
title: res.msg, wx.showToast({
icon:'none', title: res.msg,
duration:3000 icon:'none',
}) duration:3000
console.log(err); })
}) console.log(err);
wx.hideLoading() })
wx.hideLoading()
}, },
}) })
}
})
}, },
/** /**
* 用户点击右上角分享 * 用户点击右上角分享

2
pages/login/login.wxml

@ -21,3 +21,5 @@
<!-- tap事件绑定到handelClickSubmit。tab事件,当触摸屏时 --> <!-- tap事件绑定到handelClickSubmit。tab事件,当触摸屏时 -->
<button bind:tap="handelClickSubmit" style="font-weight: 600;">登录</button> <button bind:tap="handelClickSubmit" style="font-weight: 600;">登录</button>
</view> </view>

14
pages/mine/mine.js

@ -10,19 +10,21 @@ Page({
statusHeight:'', statusHeight:'',
navigationHeight:'', navigationHeight:'',
agencyName:'', agencyName:'',
userName:'' userName:'',
avatar:''
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {
// 获取存储在本地缓存中的用户信息
const avatarU = wx.getStorageSync('avatarUrl');
// 输出用户信息
console.log('12312',avatarU);
this.setData({ this.setData({
statusHeight: app.globalData.deviceInfo.statusHeight, 'avatar': avatarU
navigationHeight: app.globalData.deviceInfo.navigationHeight,
share:app.globalData.share,
agencyName:app.globalData.user.agencyName,
userName:app.globalData.user.realName
}) })
}, },
toChangePassword(){ toChangePassword(){

9
pages/mine/mine.wxml

@ -1,15 +1,13 @@
<!--pages/mine/mine.wxml--> <!--pages/mine/mine.wxml-->
<view class="header"> <view class="header">
<view class="navigation" style="height: {{navigationHeight}}px; top: {{statusHeight}}px;"> <view class="navigation" style="height: {{navigationHeight}}px; top: {{statusHeight}}px;">
我的 <view style="margin-top: 60rpx;">我的</view>
</view> </view>
<view class="content"> <view class="content">
<view class="left"><image src="../../images/mine/lz.png" mode=""/></view> <view class="left"><image wx:if="{{avatar}}" src="{{avatar}}" mode="aspectFill"/></view>
<view class="right"> <view class="right">
<view class="top"> <b>{{userName}}</b> <text>{{agencyName}}</text></view> <view class="top"> <b>{{userName}}</b> <text>{{agencyName}}</text></view>
<view class="bto"> <view class="bto">
<!-- <view> <image src="../../images/mine/wgz.png" mode=""/> 网格长 </view> -->
<!-- <view> <image src="../../images/mine/lz.png" mode=""/> 楼长 </view> -->
<view class="text-wrapper_24"> <view class="text-wrapper_24">
<text class="text_63">网格长</text> <text class="text_63">网格长</text>
</view> </view>
@ -20,7 +18,9 @@
</view> </view>
</view> </view>
</view> </view>
<view class="nase">
<view class="body"> <view class="body">
<view class="card"> <view class="card">
<!-- <view class="item" bind:tap="handelInformation"> <!-- <view class="item" bind:tap="handelInformation">
<view class="left"> <view class="left">
@ -73,5 +73,6 @@
<view class="right"> <image src="../../images/right.png" mode=""/></view> <view class="right"> <image src="../../images/right.png" mode=""/></view>
</view> </view>
</view> </view>
</view>
</view> </view>
<custom-tab-bar></custom-tab-bar> <custom-tab-bar></custom-tab-bar>

12
pages/mine/mine.wxss

@ -3,8 +3,17 @@ page{
height: 100vh; height: 100vh;
width: 100%; width: 100%;
background-color: #f7f7f7; background-color: #f7f7f7;
}
.nase{
height: 100%;
border: 3rpx solid #F7F7F7;
border-radius: 30rpx;
position: relative;
top: -20rpx;
background: #F7F7F7;
} }
.header { .header {
width: 100%; width: 100%;
@ -33,7 +42,7 @@ page{
margin-right: 17rpx; margin-right: 17rpx;
} }
.header .content{ .header .content{
margin:80rpx 0 0; margin:60rpx 0 0;
height: 130rpx; height: 130rpx;
width: 100%; width: 100%;
padding: 0 30rpx; padding: 0 30rpx;
@ -95,6 +104,7 @@ page{
margin-top: 30rpx; margin-top: 30rpx;
} }
.body .card { .body .card {
background-color: #ffffff; background-color: #ffffff;
border-radius: 20rpx; border-radius: 20rpx;

Loading…
Cancel
Save