@@ -2,9 +2,9 @@ | |||||
"pages": [ | "pages": [ | ||||
"pages/index/index", | "pages/index/index", | ||||
"pages/users/users", | "pages/users/users", | ||||
"pages/location/location", | "pages/location/location", | ||||
"pages/getuserinfo/index" | |||||
"pages/getuserinfo/index", | |||||
"pages/getphoneInfo/getphoneInfo" | |||||
], | ], | ||||
"tabBar": { | "tabBar": { | ||||
"list": [ | "list": [ | ||||
@@ -17,7 +17,7 @@ | |||||
{ | { | ||||
"pagePath": "pages/users/users", | "pagePath": "pages/users/users", | ||||
"text": "我的", | "text": "我的", | ||||
"iconPath": "assets/images/park.png", | |||||
"iconPath": "assets/images/user.png", | |||||
"selectedIconPath": "assets/images/user-a.png" | "selectedIconPath": "assets/images/user-a.png" | ||||
} | } | ||||
], | ], | ||||
@@ -29,6 +29,18 @@ var config = { | |||||
* 授权后获取用户的昵称,unionId等信息 | * 授权后获取用户的昵称,unionId等信息 | ||||
*/ | */ | ||||
getUserInfo: "/user/getUserInfo", | getUserInfo: "/user/getUserInfo", | ||||
/** | |||||
* 获得成长值 | |||||
*/ | |||||
getScore: '/user/userinfo', | |||||
/** | |||||
* 接口用途:授权后获取用户的手机号 | |||||
*/ | |||||
getUserPhone: "/user/getUserPhone", | |||||
/** | |||||
* 检查用户手机授权状态 | |||||
*/ | |||||
checkPhoneStatus: "/user/checkPhoneStatus", | |||||
}, | }, | ||||
}; | }; | ||||
@@ -0,0 +1,71 @@ | |||||
const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px' | |||||
var config = require("../../config/config.js"); | |||||
const Http = require("../../utils/HttpBasics"); | |||||
var app = getApp(); | |||||
Page({ | |||||
data: { | |||||
navigationBarHeight, | |||||
canIUse: wx.canIUse("button.open-type.getPhoneNumber"), | |||||
}, | |||||
onLoad: function (options) { | |||||
var that = this; | |||||
Http.get({ | |||||
url: config.api.marketicon, | |||||
data: { | |||||
appId: config.weapp.AppId | |||||
} | |||||
}).then(res => { | |||||
that.setData({ | |||||
mallImgUrl: res.data.mallImgUrl | |||||
}); | |||||
wx.setNavigationBarTitle({ | |||||
title: res.data.mallName | |||||
}) | |||||
}) | |||||
.catch(err => { | |||||
wx.showToast({ | |||||
title: err.errMsg, | |||||
icon: 'none', | |||||
duration: 2000, | |||||
mask: false | |||||
}); | |||||
}) | |||||
}, | |||||
backHome: function () { | |||||
wx.switchTab({ | |||||
url: '/pages/index/index', | |||||
}) | |||||
}, | |||||
getPhoneNumber: function (e) { | |||||
var that = this; | |||||
var iv = e.detail.iv; | |||||
var encryptedData = e.detail.encryptedData; | |||||
Http.post({ | |||||
url: config.api.getUserPhone, | |||||
data: { | |||||
encryptedData: encryptedData, | |||||
iv: iv | |||||
} | |||||
}).then(res=>{ | |||||
console.log("成功授权手机号") | |||||
wx.setStorageSync("phone", res.data.phone) | |||||
wx.switchTab({ | |||||
url: '/pages/users/users', | |||||
}) | |||||
}) | |||||
.catch(err => { | |||||
wx.showToast({ | |||||
title: "请授权手机号", | |||||
icon: 'none', | |||||
duration: 2000, | |||||
mask: false | |||||
}); | |||||
}) | |||||
} | |||||
}); |
@@ -0,0 +1,5 @@ | |||||
{ | |||||
"usingComponents": { | |||||
"navbar": "../../components/navbar/navbar" | |||||
} | |||||
} |
@@ -0,0 +1,15 @@ | |||||
<navbar home text="微信授权手机号" style="padding-top:200rpx;"></navbar> | |||||
<view class="login-body"> | |||||
<view class="login-logo"> | |||||
<image src="{{mallImgUrl}}" mode="widthFix"></image> | |||||
</view> | |||||
<view class="title"> | |||||
<text>Hi , 请登录~</text> | |||||
<text>授权后,可以更好的体验我们哦~</text> | |||||
</view> | |||||
<view class="login-btn"> | |||||
<button open-type="getPhoneNumber" hover-class='active' wx:if="{{canIUse}}" class="login-btn-login" bindgetphonenumber="getPhoneNumber">授权手机号</button> | |||||
<view wx:else>请升级微信版本</view> | |||||
<button hover-class='active' class="login-btn-login backHome" bindtap="backHome">取消</button> | |||||
</view> | |||||
</view> |
@@ -0,0 +1,60 @@ | |||||
page{ | |||||
background: #fbfbfb; | |||||
} | |||||
.login-body { | |||||
padding-top: 200rpx; | |||||
display: flex; | |||||
flex-direction: column; | |||||
align-items: center; | |||||
justify-content: center; | |||||
} | |||||
.backHome{ | |||||
margin-top: 20rpx!important; | |||||
} | |||||
.login-logo { | |||||
width: 320rpx; | |||||
/* height: 320rpx; */ | |||||
padding-top: 70rpx; | |||||
} | |||||
.login-logo>image { | |||||
width: 100%; | |||||
height: 100%; | |||||
border-radius: 16rpx; | |||||
} | |||||
.login-btn { | |||||
padding-top: 120rpx; | |||||
width: 600rpx; | |||||
} | |||||
.active{ | |||||
opacity: .6; | |||||
} | |||||
.login-btn .login-btn-login { | |||||
background: #1faf0c; | |||||
border-radius: 15rpx !important; | |||||
height: 94rpx !important; | |||||
line-height: 94rpx; | |||||
padding: 0 !important; | |||||
font-family: PingFangSC-Semibold !important; | |||||
font-size: 36rpx !important; | |||||
color: #FFFFFF !important; | |||||
letter-spacing: 0.75rpx !important; | |||||
text-align: center; | |||||
} | |||||
.title{ | |||||
margin-top: 30rpx; | |||||
} | |||||
.title text{ | |||||
display: block; | |||||
text-align: center; | |||||
} | |||||
.title text:nth-of-type(1){ | |||||
font-size: 38rpx; | |||||
font-weight: bold; | |||||
} | |||||
.title text:nth-of-type(2){ | |||||
font-size: 30rpx; | |||||
margin-top: 25rpx; | |||||
} |
@@ -6,7 +6,7 @@ Page({ | |||||
data: { | data: { | ||||
navigationBarHeight, | navigationBarHeight, | ||||
canIUse: wx.canIUse("button.open-type.getUserInfo"), | canIUse: wx.canIUse("button.open-type.getUserInfo"), | ||||
curPhone:'', | |||||
}, | }, | ||||
onLoad: function(options) { | onLoad: function(options) { | ||||
var that = this; | var that = this; | ||||
@@ -57,6 +57,7 @@ Page({ | |||||
* 生命周期函数--监听页面加载 | * 生命周期函数--监听页面加载 | ||||
*/ | */ | ||||
onLoad: function (options) { | onLoad: function (options) { | ||||
if (app.globalData.token) { | if (app.globalData.token) { | ||||
this.getBannerlist() | this.getBannerlist() | ||||
this.gitSquareLis() | this.gitSquareLis() | ||||
@@ -74,7 +75,6 @@ Page({ | |||||
获取集团下面的广场 | 获取集团下面的广场 | ||||
*/ | */ | ||||
gitSquareLis(){ | gitSquareLis(){ | ||||
const tempData = wx.getStorageSync("subMalls"); | const tempData = wx.getStorageSync("subMalls"); | ||||
console.log(wx.getStorageSync("subMalls")) | console.log(wx.getStorageSync("subMalls")) | ||||
this.setData({ | this.setData({ | ||||
@@ -2,6 +2,7 @@ | |||||
const imgurl = require("../../utils/imgurl"); | const imgurl = require("../../utils/imgurl"); | ||||
const Http = require("../../utils/HttpBasics"); | const Http = require("../../utils/HttpBasics"); | ||||
var config = require("../../config/config.js"); | var config = require("../../config/config.js"); | ||||
const bgColor = require("../../utils/bgColor.js") | |||||
let app = getApp(); | let app = getApp(); | ||||
Page({ | Page({ | ||||
@@ -11,28 +12,66 @@ Page({ | |||||
data: { | data: { | ||||
aboutUs: imgurl.aboutUs.url, | aboutUs: imgurl.aboutUs.url, | ||||
banneColor: "linear-gradient(180deg,rgba(253,131,45,1) 0%,rgba(254,74,22,1) 100%)", | banneColor: "linear-gradient(180deg,rgba(253,131,45,1) 0%,rgba(254,74,22,1) 100%)", | ||||
// levelName: | |||||
levelName: "", | |||||
levelBg: bgColor.colorFirst.user.levelBg, | |||||
score: '0', | |||||
curPhone: '', | |||||
}, | |||||
//授权手机号 | |||||
gotoPhoneInfo() { | |||||
// let that = this; | |||||
// Http.get({ | |||||
// url: config.api.checkPhoneStatus, | |||||
// data: {} | |||||
// }).then(res => { | |||||
// return | |||||
// }).catch(err => { | |||||
// wx.redirectTo({ | |||||
// url: `/pages/getphoneInfo/getphoneInfo` | |||||
// }); | |||||
// }) | |||||
wx.redirectTo({ | |||||
url: `/pages/getphoneInfo/getphoneInfo` | |||||
}); | |||||
}, | }, | ||||
/* 判断是否授权*/ | /* 判断是否授权*/ | ||||
checkUserStatus() { | checkUserStatus() { | ||||
Http.get({ | Http.get({ | ||||
url: config.api.checkUserStatus, | url: config.api.checkUserStatus, | ||||
data: { | data: { | ||||
token: app.globalData.token | token: app.globalData.token | ||||
} | } | ||||
}).then(res => { | }).then(res => { | ||||
// wx.navigateTo({ | |||||
// url: '/pages/edit/edit', | |||||
// }) | |||||
console.log("111") | |||||
this.getUserInfo() | |||||
}).catch(err => { | }).catch(err => { | ||||
wx.navigateTo({ | wx.navigateTo({ | ||||
url: `/pages/getuserinfo/index`, | url: `/pages/getuserinfo/index`, | ||||
}) | }) | ||||
}) | }) | ||||
// wx.navigateTo({ | |||||
// url: '/pages/getuserinfo/index', | |||||
// }) | |||||
}, | |||||
//获取当前登录用户信息 | |||||
getUserInfo: function () { | |||||
let that = this; | |||||
// 获取用户信息 | |||||
Http.get({ | |||||
url: config.api.getScore, | |||||
}) | |||||
.then(res => { | |||||
const { code, data } = res | |||||
if (code == 200) { | |||||
that.setData({ | |||||
levelName: data.levelName, | |||||
getScore: data.getScore, | |||||
}) | |||||
} | |||||
}) | |||||
}, | }, | ||||
@@ -40,7 +79,7 @@ Page({ | |||||
* 生命周期函数--监听页面加载 | * 生命周期函数--监听页面加载 | ||||
*/ | */ | ||||
onLoad: function (options) { | onLoad: function (options) { | ||||
this.checkUserStatus() | |||||
}, | }, | ||||
@@ -56,7 +95,10 @@ Page({ | |||||
* 生命周期函数--监听页面显示 | * 生命周期函数--监听页面显示 | ||||
*/ | */ | ||||
onShow: function () { | onShow: function () { | ||||
this.checkUserStatus() | |||||
this.setData({ | |||||
curPhone: wx.getStorageSync('phone') | |||||
}) | |||||
}, | }, | ||||
/** | /** | ||||
@@ -5,27 +5,27 @@ | |||||
<view wx:if="{{flag=='hidden'}}"></view> | <view wx:if="{{flag=='hidden'}}"></view> | ||||
</view> | </view> | ||||
<view class="top" style='background:{{banneColor}}'> | <view class="top" style='background:{{banneColor}}'> | ||||
<view class='aboutUs' bindtap='gomallInfo' > | |||||
<view class='aboutUs' bindtap='gomallInfo'> | |||||
<image class='aboutIcons' src="{{aboutUs}}" mode='widthFix'></image> | <image class='aboutIcons' src="{{aboutUs}}" mode='widthFix'></image> | ||||
<text>关于我们</text> | <text>关于我们</text> | ||||
</view> | </view> | ||||
</view> | </view> | ||||
<view class="top-content" wx:if="{{ifStoreApp!=1}}"> | <view class="top-content" wx:if="{{ifStoreApp!=1}}"> | ||||
<view class='user_title'> | <view class='user_title'> | ||||
<view class="user-avatar" > | |||||
<view class="user-avatar"> | |||||
<open-data class="open" type="userAvatarUrl"></open-data> | <open-data class="open" type="userAvatarUrl"></open-data> | ||||
</view> | </view> | ||||
<view class="user-name" > | |||||
<open-data class="name" type="userNickName" ></open-data> | |||||
<view class=' usre_level'style='background:{{levelBg}}'> | |||||
<view class="user-name"> | |||||
<open-data class="name" type="userNickName"></open-data> | |||||
<view class=' usre_level' style='background:{{levelBg}}'> | |||||
<text class='chengzhang '>{{levelName}}</text> | <text class='chengzhang '>{{levelName}}</text> | ||||
</view> | </view> | ||||
</view> | </view> | ||||
<!-- --> | <!-- --> | ||||
<view class="user-name" wx:if="{{curPhone}}" style="margin-top:20rpx;" bindtap='gotoPhoneInfo'> | <view class="user-name" wx:if="{{curPhone}}" style="margin-top:20rpx;" bindtap='gotoPhoneInfo'> | ||||
<text class="my">我的手机号:</text> | <text class="my">我的手机号:</text> | ||||
<text class="chengzhang_h" >{{curPhone}}</text> | |||||
<text class="view" style='color:#F64A16'>[微信授权手机号]</text> | |||||
<text class="chengzhang_h">{{curPhone}}</text> | |||||
<!-- <text class="view" style='color:#F64A16'>[微信授权手机号]</text> --> | |||||
</view> | </view> | ||||
<view class="user-name" wx:if="{{!curPhone}}" style="margin-top:20rpx;" bindtap='gotoPhoneInfo'> | <view class="user-name" wx:if="{{!curPhone}}" style="margin-top:20rpx;" bindtap='gotoPhoneInfo'> | ||||
<text class="view" style='color:#F64A16'>获取微信授权手机号</text> | <text class="view" style='color:#F64A16'>获取微信授权手机号</text> | ||||
@@ -33,12 +33,12 @@ | |||||
<!-- --> | <!-- --> | ||||
<view class="user-phone" bindtap='gotograde'> | <view class="user-phone" bindtap='gotograde'> | ||||
<text class="my">我的</text> | <text class="my">我的</text> | ||||
<text class="chengzhang_h" >成长值{{score}}</text> | |||||
<text class="chengzhang_h">成长值{{score}}</text> | |||||
<text class="my my_line">|</text> | <text class="my my_line">|</text> | ||||
<!-- <text class="my">更多成长值</text> --> | <!-- <text class="my">更多成长值</text> --> | ||||
<text class="view" style='color:{{view}}'>更多成长值</text> | <text class="view" style='color:{{view}}'>更多成长值</text> | ||||
</view> | |||||
</view> | |||||
</view> | </view> | ||||
</view> | </view> | ||||
@@ -0,0 +1,37 @@ | |||||
module.exports = { | |||||
colorFirst:{ | |||||
// 我的 | |||||
"user": { | |||||
"banneColor": "linear-gradient(180deg,rgba(253,131,45,1) 0%,rgba(254,74,22,1) 100%)", | |||||
"levelBg":"linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%)", | |||||
"view":"#FD832D" | |||||
}, | |||||
//首页 | |||||
"main": { | |||||
"chengzhangBox":"linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%)", | |||||
"activeColor":"#FC8B37", | |||||
"qg":"#FD782D", | |||||
"sql":"linear-gradient(127deg,rgba(252,177,74,1) 0%,rgba(254,70,20,1) 100%)", | |||||
"txt": "#2C8DFF", | |||||
}, | |||||
}, | |||||
colorSecond:{ | |||||
// 我的 | |||||
"user": { | |||||
"banneColor": "linear-gradient(180deg,rgba(50,177,252,1) 0%,rgba(47,108,255,1) 100%)", | |||||
"levelBg": "linear-gradient(180deg,rgba(50,177,252,1) 0%,rgba(47,108,255,1) 100%)", | |||||
"view": "#FF1D30" | |||||
}, | |||||
//首页 | |||||
"main": { | |||||
"chengzhangBox": "linear-gradient(130deg,rgba(50,177,252,1) 0%,rgba(47,108,255,1) 100%)", | |||||
"activeColor": "#2C8DFF", | |||||
"qg": "#31A5FC", | |||||
"sql": "linear-gradient(127deg,rgba(119,192,254,1) 0%,rgba(48,120,255,1) 100%)", | |||||
"txt":"#FF1D30", | |||||
}, | |||||
} | |||||
} |