Commit 15dfa51a by 赵雅纹

Merge branch 'feature-zyw' into 'dev'

小程序个人中心

See merge request !1
parents 3735afaa bf8578f6
......@@ -41,6 +41,7 @@ App({
userNo: null,
storeId: '',
storeName: '',
loginFirst: false
loginFirst: false,
imageUrl:"" //图片地址
}
})
{
"pages": [
"pages/welcome/welcome",
"pages/userCenter/userCenter",
"pages/welcome/welcome",
"pages/mySpend/mySpend",
"pages/memberRules/memberRules",
"pages/memberOfOwn/memberOfOwn",
......
......@@ -7,7 +7,7 @@
>
<block wx:for="{{imgUrls}}" wx:key="{{item}}">
<swiper-item>
<image src="{{item}}" bindtap='preview' class="slide-image" width="355" height="150" />
<image src="{{item}}" bindtap='preview' class="slide-image" />
</swiper-item>
</block>
</swiper>
/* component/imageSwiper/imageSwiper.wxss */
swiper image{
width: 100%
width: 100%;
border-radius:14rpx;
}
\ No newline at end of file
......@@ -4,8 +4,8 @@ const needMock = '' //
// appid_dev wxc3b64b09b1d3dfc2
// appid_prod
const devCtx = 'https://srtest.ihotwind.cn/wxMiniProgram/'
const prodCtx = 'https://wxapp.ihotwind.cn/wxMiniProgram/' // 发生产时解开此注释
const devCtx = 'http://111.231.86.64/member'
const prodCtx = '' // 发生产时解开此注释
const config = {
dev: devCtx,
......
<!--pages/userCenter.wxml-->
<view class='user-center'>
<image-swiper />
<view class="activation-content {{true ? 'user-content' : ''}}">
<image class='activation-bg' src='/assets/imgs/user-bg.png'></image>
<button type="primary" plain='false' wx:if='{{false}}'>激活立享会员特权</button>
<view class='user-info' wx:if='{{true}}'>
<view class="user-avatar">
<open-data type="userAvatarUrl"></open-data>
</view>
<view class='user-name-content'>
<view class='user-name'>
<open-data type="userNickName" class="userinfo-nickname" lang="zh_CN"></open-data>
<image class='icon-edit' src='/assets/imgs/icon-edit.png'></image>
</view>
<view class='user-id'>34765736454</view>
</view>
<view class='qr-code pr'>
<image src='/assets/imgs/qr-code.png'></image>
</view>
</view>
</view>
<view class='df tc'>
<view class='df-1 point'>
<view class='point-number'>100</view>
<view class='point-desc'>积分</view>
</view>
<view class='df-1 point'>
<view class='point-number'>2</view>
<view class='point-desc'>优惠券</view>
</view>
</view>
<view class='main-content'>
<view class='top-content'>
<view class='top-left-img'>
<image src='/assets/imgs/user-bg.png'></image>
</view>
<view class='top-right-img'>
<view>
<image src='/assets/imgs/user-bg.png'></image>
</view>
<view>
<image src='/assets/imgs/user-bg.png'></image>
</view>
</view>
</view>
<view class='bottom-content'>
<image src='/assets/imgs/user-bg.png'></image>
<image src='/assets/imgs/user-bg.png'></image>
</view>
</view>
</view>
<view class='footer-content'>
<image class='arrow-left' src='/assets/imgs/arrow-left.png'></image>
<text class='footer-text'>往左滑更有料</text>
</view>
\ No newline at end of file
/* pages/userCenter.wxss */
@import './../../base/base.wxss'
@import './../../base/base.wxss';
.user-center{
padding: 15rpx
padding: 15rpx 30rpx;
}
.activation-content{
position: relative;
width: 690rpx;
height: 166rpx;
margin-top: 18rpx;
border-radius: 7rpx;
}
.activation-bg{
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
border-radius: 7rpx;
z-index: -1;
}
.main-content{
margin-top: 18rpx;
}
.activation-content button{
width: 400rpx;
height: 68rpx;
border-radius: 68rpx;
line-height: 68rpx;
font-size: 30rpx;
position: absolute;
top: 49rpx;
left: 144rpx;
}
.top-content,.bottom-content{
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: space-between;
}
.top-content image{
width: 337rpx;
}
.top-left-img image{
height: 337rpx;
}
.top-right-img image{
height: 160rpx;
}
.bottom-content image{
width: 337rpx;
height: 160rpx;
}
.footer-content{
width: 100%;
height: 100rpx;
background-color: rgb(5, 195, 90);
position: fixed;
bottom: 0;
line-height: 100rpx;
padding: 0 54rpx;
}
.arrow-left {
width: 32rpx;
height: 32rpx;
vertical-align: middle;
}
.footer-text{
color: #ffffff;
font-size: 32rpx;
margin-left: 208rpx;
}
/* 会员信息 */
.user-content{
height: 92rpx;
width: 598rpx;
padding: 37rpx 46rpx;
}
.user-avatar{
width: 100rpx;
height: 100rpx;
overflow:hidden;
border-radius: 50%;
display: inline-block;
margin-right: 46rpx;
}
.user-name-content{
display: inline-block;
}
.user-name{
margin-bottom: 25rpx;
}
.icon-edit{
width: 28rpx;
height: 28rpx;
vertical-align: middle;
margin-left: 8rpx;
}
.user-id{
color: #666666;
font-size: 24rpx;
}
.qr-code image{
width: 100rpx;
height: 100rpx;
}
.point{
padding:36rpx 0 25rpx 0;
}
.point-number{
font-size: 30rpx;
font-weight: bold;
color: #333333;
margin-bottom: 15rpx;
}
\ No newline at end of file
.point-desc{
font-size: 20rpx;
color: #666666;
}
\ No newline at end of file
......@@ -7,7 +7,7 @@ const envInfo = require('../../config/index').envInfo
wxService.page({
data: {
motto: 'Hello World',
motto: '开启广东7-Eleven会员专区',
userInfo: {},
hasUserInfo: false,
env: envInfo.env
......@@ -18,6 +18,8 @@ wxService.page({
url: '../logs/logs'
})
},
onShow(){
},
onLoad: function () {
if (app.globalData.userInfo) {
this.setData({
......@@ -46,33 +48,41 @@ wxService.page({
})
}
},
_getUserInfo(ev = {}) {
const userInfo = ev.detail || {}
utils.getUserInfoByBtn(userInfo).then(({ token = '', data = {} }) => {
wx.setStorageSync('_accreditUserInfo', userInfo)
wx.hideNavigationBarLoading()
if (token) {
app.globalData.userNo = token.split('###')[0]
wx.setStorageSync('token', token)
} else {
wx.setStorageSync('token', '')
}
if (data && data.isMember === '1') {
app.globalData.openCard = true
app.globalData.userInfo = wx.getStorageSync('_userInfo')
cEvent.notify('openCardSuccess', data)
}
wx.setStorageSync('_baseUserInfo', data)
this.setUserInfo()
}).catch(err => {
if (err && err.rspCode === -1) {
wx.showToast({
title: `会员系统异常请稍后重试!`,
icon: 'none'
})
}
})
_getUserInfo(res = {}) {
console.log('-------',res)
const userInfo = res.detail || {}
if (res.detail.userInfo){
console.log('点击了同意')
utils.getUserInfoByBtn(userInfo).then(({ token = '', data = {} }) => {
wx.setStorageSync('_accreditUserInfo', userInfo)
wx.hideNavigationBarLoading()
if (token) {
app.globalData.userNo = token.split('###')[0]
wx.setStorageSync('token', token)
} else {
wx.setStorageSync('token', '')
}
if (data && data.isMember === '1') {
app.globalData.openCard = true
app.globalData.userInfo = wx.getStorageSync('_userInfo')
cEvent.notify('openCardSuccess', data)
}
wx.setStorageSync('_baseUserInfo', data)
this.setUserInfo()
}).catch(err => {
if (err && err.rspCode === -1) {
wx.showToast({
title: `会员系统异常请稍后重试!`,
icon: 'none'
})
}
})
}else{
console.log('点击了取消')
wxService.router(`/pages/userCenter/userCenter`)
}
},
setUserInfo: function (e) {
console.log('开卡')
......
<!--index.wxml-->
<!--index.wxml-->
<view class="container">
<view class="userinfo">
<view class="userinfo-avatar">
......@@ -10,4 +8,4 @@
<view class="usermotto">
<button bindgetuserinfo="_getUserInfo" open-type='getUserInfo' class="user-motto">{{motto}}</button>
</view>
</view>
</view>
\ No newline at end of file
......@@ -158,10 +158,10 @@ function getUserInfoByBtn(userInfo) {
icon: 'none',
mask: true
})
return wxService.get(`memberCard/getCrmUserInfo`, {
code: res[1].code,
wechatInfo: JSON.stringify(res[0])
})
// return wxService.post(`/minaLogin`, {
// code: res[1].code,
// wechatInfo: res[0]
// })
}, (err) => {
return Promise.reject(err)
}).then(response => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment