Browse Source

调整用户中心

master
453530270@qq.com 3 years ago
parent
commit
5b87095bf9
  1. 9
      api/user.js
  2. 158
      pages/user/index.vue
  3. 1
      store/modules/user.js

9
api/user.js

@ -5,7 +5,9 @@ const api = {
userInfo: 'user/info',
assets: 'user/assets',
bindMobile: 'user/bindMobile',
personal: 'user/personal'
personal: 'user/personal',
// 操作日志
oplogs: "slb/userself/v1/account/operation",
}
// 当前登录的用户信息
@ -32,3 +34,8 @@ export const bindMobile = (data, option) => {
export const personal = (data, option) => {
return request.post(api.personal, data, option)
}
// 操作日志
export const oplogs = (param, option) => {
return request.get(api.oplogs, param, option)
}

158
pages/user/index.vue

@ -36,6 +36,26 @@
</view>
</view>
</view>
<!-- 操作日志 -->
<view class="oplog">
<view class="log-list">
<view v-for="(item, index) in oplist" :key="index" class="log-item">
<view class="item-left flex-box">
<view class="rec-status">
<text>{{ item.operation }}</text>
</view>
<view class="rec-time">
<text>{{ item.createTime }}</text>
</view>
</view>
<view class="item-right col-green col-6">
<text>{{ 11 }}</text>
</view>
</view>
</view>
</view>
<!-- 我的钱包 -->
<view class="my-asset">
@ -48,14 +68,6 @@
<text class="oneline-hide">账户余额</text>
</view>
</view>
<view class="asset-left-item" @click="onTargetPoints">
<view class="item-value dis-flex flex-x-center">
<text>{{ isLogin ? assets.points : '--' }}</text>
</view>
<view class="item-name dis-flex flex-x-center">
<text class="oneline-hide">{{ setting[SettingKeyEnum.POINTS.value].points_name }}</text>
</view>
</view>
<view class="asset-left-item" @click="onTargetMyCoupon">
<view class="item-value dis-flex flex-x-center">
<text class="oneline-hide">{{ isLogin ? assets.coupon : '--' }}</text>
@ -183,6 +195,8 @@
assets: { balance: '--', points: '--', coupon: '--' },
//
service,
//
oplist:[],
//
orderNavbar,
//
@ -201,8 +215,6 @@
//
onRefreshPage() {
//
setCartTabBadge()
//
this.isLogin = checkLogin()
if(!this.isLogin){
@ -211,14 +223,14 @@
})
}
//
//this.getPageData()
this.getPageData()
},
//
getPageData(callback) {
const app = this
app.isLoading = true
Promise.all([app.getSetting(), app.getUserInfo(), app.getUserAssets(), app.getTodoCounts()])
Promise.all([/*app.getUserInfo(), app.getUserAssets(), */app.getOplogs()])
.then(result => {
app.isFirstload = false
//
@ -262,17 +274,6 @@
app.orderNavbar = newOrderNavbar
},
//
getSetting() {
const app = this
return new Promise((resolve, reject) => {
SettingModel.data()
.then(setting => {
app.setting = setting
resolve(setting)
}).catch(reject)
})
},
//
getUserInfo() {
@ -294,14 +295,17 @@
})
},
//
getUserAssets() {
//
getOplogs () {
const app = this
const accid = uni.getStorageSync('accountId')
return new Promise((resolve, reject) => {
!app.isLogin ? resolve(null) : UserApi.assets({}, { load: app.isFirstload })
!app.isLogin ? resolve(null) : UserApi.oplogs({'accountId': accid}, { load: app.isFirstload })
.then(result => {
app.assets = result.data.assets
resolve(app.assets)
// app.assets = result.data.assets
app.oplist = result.data
console.log("oplogs",app.oplist)
resolve(app.oplist)
})
.catch(err => {
if (err.result && err.result.status == 401) {
@ -314,8 +318,8 @@
})
},
//
getTodoCounts() {
//
getOplogsTodo() {
const app = this
return new Promise((resolve, reject) => {
!app.isLogin ? resolve(null) : OrderApi.todoCounts({}, { load: app.isFirstload })
@ -333,6 +337,7 @@
})
})
},
//
handleLogin() {
@ -404,7 +409,7 @@
//
.main-header {
background-color: #fff;
// background-image: url('/static/background/user-header.png');
background-image: url('/static/background/user-header.png');
position: relative;
width: 100%;
height: 280rpx;
@ -477,6 +482,21 @@
}
}
}
.log-list {
padding: 0 30rpx;
}
.log-item {
font-size: 28rpx;
padding: 20rpx 20rpx;
line-height: 1.8;
border-bottom: 1rpx solid rgb(238, 238, 238);
display: flex;
justify-content: center;
align-items: center;
}
//
@ -496,55 +516,6 @@
font-size: 24rpx;
}
//
.my-asset {
display: flex;
background: #fff;
padding: 40rpx 0;
.asset-right {
width: 200rpx;
border-left: 1rpx solid #eee;
}
.asset-right-item {
text-align: center;
color: #545454;
.item-icon {
font-size: 44rpx;
}
.item-name {
margin-top: 14rpx;
font-size: 28rpx;
}
}
.asset-left-item {
max-width: 183rpx;
text-align: center;
color: #666;
padding: 0 16rpx;
.item-value {
font-size: 34rpx;
color: red;
}
.item-name {
margin-top: 6rpx;
}
.item-name {
margin-top: 14rpx;
font-size: 28rpx;
}
}
}
//
.order-navbar {
display: flex;
@ -593,33 +564,6 @@
font-size: 30rpx;
}
.service-content {
margin-bottom: -20rpx;
.service-item {
position: relative;
width: 25%;
float: left;
margin-bottom: 30rpx;
.item-icon {
text-align: center;
margin: 0 auto;
padding: 14rpx 0;
color: #ff3800;
font-size: 44rpx;
}
.item-name {
font-size: 28rpx;
color: #545454;
text-align: center;
margin-right: 10rpx;
}
}
}
}
// 退

1
store/modules/user.js

@ -9,6 +9,7 @@ const loginSuccess = (commit, { token, user }) => {
// 保存tokne和userId到缓存
storage.set(ACCOUNT_ID, user.accountId, expiryTime)
storage.set(ACCESS_TOKEN, token, expiryTime)
storage.set("cuser",user)
// 记录到store全局变量
commit('SET_TOKEN', token)
commit('SET_ACCOUNT_ID', user.accountId)

Loading…
Cancel
Save