个人中心修改昵称设置头像显示区块链信息健康档案完善可修改

This commit is contained in:
2022-01-25 09:37:16 +08:00
parent 33b4fb304d
commit 6135fa2fca
10 changed files with 1003 additions and 500 deletions

View File

@@ -42,13 +42,16 @@ const editHealthBefore = (id) => {
* @Date: 2022-01-12 13:49:29 * @Date: 2022-01-12 13:49:29
*/ */
const editHealth = (record_id, data) => { const editHealth = (record_id, data) => {
console.log(data,'data............')
return request({ return request({
url: `health/records/${record_id}`, url: `health/records/${record_id}`,
method: "PUT", method: "PUT",
date: data data: data
}) })
} }
export { export {
recordsHealth recordsHealth,
editHealthBefore,
editHealth
} }

View File

@@ -0,0 +1,34 @@
/**
* Web-zdx
* moduleName:修改头像和昵称
*/
import {
request
} from '../index'
// 获取用户设置中心的信息
const getUserSettingInfo = () => {
return request({
url: 'user/setting'
})
}
// 修改用户头像或昵称
const resetUserInfo = (data) => {
return request({
url: 'user/' + data.key,
method: 'PUT',
data: {
value: data.value
}
})
}
export {
getUserSettingInfo,
resetUserInfo,
}

View File

@@ -140,6 +140,15 @@
"navigationBarTextStyle": "white" "navigationBarTextStyle": "white"
} }
}, },
{
"path": "pages/setting/setting",
"name": "Setting",
"style": {
"navigationBarTitleText": "设置中心",
"navigationBarBackgroundColor": "#34CE98",
"navigationBarTextStyle": "white"
}
},
{ {
"path": "pages/store/index", "path": "pages/store/index",
"name": "Store", "name": "Store",
@@ -574,8 +583,9 @@
"path": "pages/user/files", "path": "pages/user/files",
"name": "UserFiles", "name": "UserFiles",
"style": { "style": {
"navigationBarTitleText": "健康档案", "navigationBarTitleText": "健康档案管理",
"navigationBarBackgroundColor": "#FFFFFF" "navigationBarBackgroundColor": "#34CE98",
"navigationBarTextStyle": "white"
} }
} }
], ],

View File

@@ -306,16 +306,9 @@ export default {
}, },
//年龄------------- 过滤出生年月日 //年龄------------- 过滤出生年月日
formatter(type, value) { formatter(type, value) {
if (type === 'year') { if (type === 'year') {return `${value}`;}
return `${value}`; if (type === 'month') {return `${value}`;}
} if (type === 'day') {return `${value}`;}
if (type === 'month') {
return `${value}`;
}
if (type === 'day') {
return `${value}`;
}
console.log(value);
return value; return value;
}, },
// 体重---------标尺滚动 // 体重---------标尺滚动

211
pages/setting/setting.vue Normal file
View File

@@ -0,0 +1,211 @@
<template>
<view class="setting">
<!-- 更多管理 -->
<view class="list">
<view class="list-item" @click="updImgs">
<view class="list-item-left">
<span>修改头像</span>
</view>
<view class="avatar" >
<image :src="avatar.showPath || require('@/static/user/cover.png')" mode="aspectFill" />
<u-icon name="arrow-right" color="#999" size="20"></u-icon>
</view>
</view>
<view class="list-item">
<view class="list-item-left">
<span>修改昵称</span>
</view>
<view class="input">
<input type="text" :value="nickname" @blur='blur' placeholder="请输入用户的昵称" maxlength="12" />
<u-icon name="arrow-right" color="#999" size="20"></u-icon>
</view>
</view>
</view>
<u-toast ref="uToast" />
</view>
</template>
<script>
import {
getUserSettingInfo,
resetUserInfo
} from '@/apis/interfaces/setting.js'
import {
uploads
} from '@/apis/interfaces/uploading'
export default {
data() {
return {
canLogin: true,
nickname: '',
avatar: {
path: '',
showPath: ''
},
is_bind: true
}
},
onShow() {
this.getUserInfo()
},
onPullDownRefresh() {
this.getUserInfo()
},
methods: {
// 获取当前用户得基本信息
getUserInfo() {
getUserSettingInfo().then(res => {
this.avatar.showPath = res.avatar
this.nickname = res.nickname
this.is_bind = res.is_bind
uni.stopPullDownRefresh()
}).catch(err => {
this.$refs.uToast.show({
title: err.message,
type: 'primary',
duration: 3000
})
})
},
// 上传头像
updImgs(type) {
uni.chooseImage({
crop: {
width: 80,
height: 80
},
success: res => {
let path = res.tempFiles.map((val, index) => {
return {
name: 'uploads' + index,
uri: val.path
}
})
uploads(path).then(pathRes => {
this.avatar.path = pathRes.path[0]
this.avatar.showPath = pathRes.url[0]
this.resetUserInfo('avatar',pathRes.url[0])
}).catch(err => {
uni.showToast({
title: err.message,
icon: 'none'
})
})
}
})
},
// 修改姓名
blur(e){
let value = e.detail.value
if(value !== this.nickname){
this.resetUserInfo('nickname',value)
}
},
// 修改头像或昵称
resetUserInfo(key, value) {
let data ={
key:key,
value:value
}
resetUserInfo(data).then(res=>{
uni.showToast({
title: res,
icon: 'none'
})
this.getUserInfo()
}).catch(err => {
uni.showToast({
title: err.message,
icon: 'none'
})
})
}
}
}
</script>
<style lang="scss" scoped>
page {
background-color: #F8F8F8;
}
.setting {
position: relative;
background-color: #fff;
// 更多管理
.list {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: flex-start;
box-sizing: border-box;
position: relative;
top: -10rpx;
border-radius: 20rpx;
margin: 0 $margin;
padding: 30rpx 0;
width: calc(100% - 80rpx);
.list-item {
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 40rpx 0;
border-bottom: solid 1rpx #f9f9f9;
box-sizing: border-box;
font-size: $title-size;
.avatar {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
image {
width: 100rpx;
height: 100rpx;
border-radius: 50%;
margin-right: 20rpx;
}
}
.input {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
text-align: right;
flex: 1;
input {
padding-right: $padding - 10;
width: 100%;
}
}
.list-item-left {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
image {
width: 40rpx;
}
span {
margin-left: 20rpx;
}
}
}
}
}
</style>

View File

@@ -1,70 +1,282 @@
<template> <template>
<view class="content"> <view class="content">
<view class="files"> <!-- 性别start -->
<view class="name"> <view class="files" @click="sexShow = true">
性别 <view class="name">性别</view>
</view> <view class="text">
<view class="text"> <u-icon
{{ recordsData.sex == 1 ? '男' : '女' }} class="target-icon"
</view> :label="recordsData.sex == 1 ? '男士' : '女士'"
</view> name="arrow-right"
<view class="files"> color="#999"
<view class="name"> size="14"
年龄 labelSize="14"
</view> labelColor="#666"
<view class="text"> labelPos="left"
{{ recordsData.age }} space="10"
</view> />
</view> </view>
<view class="files"> </view>
<view class="name"> <u-action-sheet
身高 :actions="sexList"
</view> title="你的性别是?"
<view class="text"> :show="sexShow"
{{ recordsData.height }}cm cancelText="暂不修改"
</view> @select=" e => { (this.recordsData.sex = e.id), (this.sexShow = false); } "
</view> @close="sexShow = false"
<view class="files"> />
<view class="name"> <!-- 性别 end -->
体重
</view> <!-- 生日 start -->
<view class="text"> <view class="files" @click="birthdayShow = true">
{{ recordsData.weight }}kg <view class="name">生日</view>
</view> <view class="text">
</view> <u-icon class="target-icon" :label="showBirthday" name="arrow-right" color="#999" size="14" labelSize="14" labelColor="#666" labelPos="left" space="10" />
</view> </view>
</view>
<u-datetime-picker
confirmColor="#34ce98"
v-model="recordsData.birthday"
mode="date"
:show="birthdayShow"
:formatter="formatter"
:minDate="-302688000"
:maxDate="maxDate"
@confirm=" e => { this.recordsData.birthday = e.value, this.birthdayShow = false } "
@cancel=" () => { this.birthdayShow = false; } "
/>
<!-- 生日 end -->
<!-- 身高 start-->
<view class="files" @click="heightShow = true">
<view class="name">身高</view>
<view class="text">
<u-icon class="target-icon" :label="recordsData.height + ` CM`" name="arrow-right" color="#999" size="14" labelSize="14" labelColor="#666" labelPos="left" space="10" />
</view>
</view>
<u-popup :show="heightShow" @close="() => { heightShow = false }">
<view class="v-scale">
<view class="title"> 你的身高为?</view>
<view class="total"> {{recordsData.height}} CM </view>
<vue-scale :min="10" :max="100" :int="false" :single="10" :h="80" :styles="styles" @scroll="scrollAll('height',$event)" :scrollLeft="Number(recordsData.height)" />
</view>
</u-popup>
<!-- 身高 end -->
<!-- 最新体重 start -->
<view class="files bt30" @click="weightShow = true">
<view class="name">最新体重</view>
<view class="text">
<u-icon class="target-icon" :label="recordsData.weight + ` KG`" name="arrow-right" color="#999" size="14" labelSize="14" labelColor="#666" labelPos="left" space="10" />
</view>
</view>
<u-popup :show="weightShow" @close="() => { weightShow = false }">
<view class="v-scale">
<view class="title"> 你的当前体重为?</view>
<view class="total"> {{recordsData.weight}} KG </view>
<vue-scale :min="10" :max="100" :int="false" :single="10" :h="80" :styles="styles" @scroll="scrollAll('weight',$event)" :scrollLeft="Number(recordsData.weight)" />
</view>
</u-popup>
<!-- 生日 end -->
<!-- 目标 start -->
<view class="files" @click="targetShow = true">
<view class="name">目标</view>
<view class="text">
<u-icon class="target-icon" :label="targetList[selectedTargetIndex].name" name="arrow-right" color="#999" size="14" labelSize="14" labelColor="#666" labelPos="left" space="10" />
</view>
</view>
<u-action-sheet
:actions="targetList"
title="你的目标是?"
:show="targetShow"
cancelText="暂不修改"
@select=" e => { (this.selectedTargetIndex = this.targetList.findIndex(item => e.id === item.id)), (this.targetShow = false); } "
@close="targetShow = false"
/>
<!-- 目标 end -->
<!-- 目标体重 start-->
<view class="files" @click="targetWeightShow = true">
<view class="name">目标体重</view>
<view class="text"><u-icon class="target-icon" :label="recordsData.goal_weight + ` KG`" name="arrow-right" color="#999" size="14" labelSize="14" labelColor="#666" labelPos="left" space="10" /></view>
</view>
<u-popup :show="targetWeightShow" @close="() => { targetWeightShow = false }">
<view class="v-scale">
<view class="title"> 你的目标体重为?</view>
<view class="total"> {{recordsData.goal_weight}} KG </view>
<vue-scale :min="10" :max="100" :int="false" :single="10" :h="80" :styles="styles" @scroll="scrollAll('goalweight',$event)" :scrollLeft="Number(recordsData.goal_weight)" />
</view>
</u-popup>
<!-- 目标体重 end -->
<!-- 运动量 start -->
<view class="files" @click="exerciseShow = true">
<view class="name">运动量</view>
<view class="text">
<u-icon class="target-icon" :label="exerciseList[selectExerciseIndex].name" name="arrow-right" color="#999" size="14" labelSize="14" labelColor="#666" labelPos="left" space="10" />
</view>
</view>
<u-action-sheet
:actions="exerciseList"
title="你的运动量是?"
:show="exerciseShow"
cancelText="暂不修改"
@select=" e => { (this.selectExerciseIndex = this.exerciseList.findIndex(item => e.id === item.id)), (this.exerciseShow = false); } "
@close="exerciseShow = false"
/>
<!-- 运动量 end -->
<view class="sureBtn" @click="sureBtn"> 确认修改 </view>
<view class="des">修改资料后可更新并查看最新方案预算热量可能会发生变化</view>
</view>
</template> </template>
<script> <script>
import { records } from '@/apis/interfaces/user' import { editHealthBefore,editHealth } from '@/apis/interfaces/essentialInfo.js';
export default { import moment from 'moment';
data() { import vueScale from '@/components/vueScale'; // 体重标尺
return { export default {
recordsData: '' components:{
}; vueScale
}, },
mounted() { data() {
records().then(res => { return {
this.recordsData = res recordsData: {},
}) birthdayShow: false, // 出生日期展示
} maxDate: new Date().getTime(),
}; sexShow: false, // 性别弹窗是否显示
sexList: [{name: '男士',id: 1},{name: '女士',id: 2}],
targetShow: false, // 目标弹窗是否显示
targetList: [{name: '减脂',id: 1},{name: '保持体重',id: 2},{name: '增肌',id: 3}],
selectedTargetIndex: 0,// 默认选择了那个target
exerciseShow:false,// 运动量弹窗是否显示
exerciseList:[{name:'久坐不动',id:1},{name:'少量运动',id:2},{name:'中等运动量',id:3},{name:'超强度运动',id:4}],
selectExerciseIndex:0,//默认选择运动量是久坐不懂得
heightShow:false,
weightShow:false,
targetWeightShow:false,
styles: {
line: '#dbdbdb',
bginner: '#fbfbfb',
bgoutside: '#ffffff',
font: '#404040',
fontColor: '#404040',
fontSize: 16
},
};
},
computed: {
showBirthday() {
return moment(this.recordsData.birthday).format('YYYY年MM月DD日');
}
},
onShow() {
let id = this.$Route.query.id;
editHealthBefore(id)
.then(res => {
this.recordsData = res;
this.recordsData.birthday = moment(res.birthday).format('YYYY-MM-DD');
this.selectExerciseIndex = this.exerciseList.findIndex(item => item.id === res.exercise)
})
.catch(err => {
conso.log(err);
});
},
methods: {
// 身高 体重 目标体重 滚动
scrollAll(type,value) {
if(type === 'height'){
return this.recordsData.height = value;
}
if(type === 'weight'){
return this.recordsData.weight = value;
}
if(type === 'goalweight'){
return this.recordsData.goal_weight = value;
}
},
// 年龄 - 过滤 - 自定义 - 出生年月日
formatter(type, value) {
if (type === 'year') {return `${value}`;}
if (type === 'month') {return `${value}`;}
if (type === 'day') {return `${value}`;}
return value;
},
// 提交按钮
sureBtn(){
let params = {
record_id:this.recordsData.record_id,
birthday:moment(this.recordsData.birthday).format('YYYY-MM-DD'),
sex:this.recordsData.sex,
height:this.recordsData.height,
weight:this.recordsData.weight,
exercise:this.exerciseList[this.selectExerciseIndex].id,
goal_weight:this.recordsData.goal_weight,
days:1
}
editHealth(params.record_id,params).then(res=>{
this.$Router.back()
}).catch(err=>{
this.$Router.back()
})
}
}
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.files { .content {
display: flex; padding: $padding;
padding: $padding; }
box-sizing: border-box; .files {
border-bottom: $border-color 2rpx solid; display: flex;
&:last-child { padding: $padding + 10 $padding - 20;
border: none; box-sizing: border-box;
} border-bottom: #f9f9f9 2rpx solid;
.name { font-size: $title-size;
flex: 1; &:last-child {
} border: none;
.text { }
color: $text-gray; .name {
} flex: 1;
} }
.text {
color: $text-gray;
}
}
.v-scale{
padding: $padding * 2 0;
font-size: $title-size;
.title{
text-align: center;
font-size: $title-size + 10;
margin-bottom: $margin;
}
.total{
font-size: $title-size;
color: $main-color;
text-align: center;
}
}
.des {
color: $text-gray-m;
font-size: $title-size-m - 4;
margin-top: $margin * 2;
text-align: center;
}
.sureBtn{
background-color: $main-color;
color: #fff;
font-size: $title-size;
text-align: center;
padding: $padding;
border-radius: $radius;
margin-top: $margin * 2;
}
.bt30 {
border-bottom: #f9f9f9 20rpx solid;
}
</style> </style>

View File

@@ -1,432 +1,472 @@
<template> <template>
<view class="content"> <view class="content">
<!-- 用户信息 --> <!-- 用户信息 -->
<view class="info-box"> <view class="info-box">
<image src="@/static/user/user_back.png" mode="aspectFill"></image> <image src="@/static/user/user_back.png" mode="aspectFill" />
<view class="user-flex"> <view class="user-flex">
<image class="cover" :src="userInfo.avatar || require('@/static/user/cover.png')" mode="aspectFill"></image> <image class="cover" @click="$Router.push({ name: 'Setting' })" :src="userInfo.avatar || require('@/static/user/cover.png')" mode="aspectFill" />
<view class="user-content"> <view class="user-content">
<block v-if="$store.state.token != ''"> <block v-if="$store.state.token != ''">
<view class="name">{{userInfo.nickname}}</view> <view class="name">{{ userInfo.nickname }}</view>
<view class="tabs" v-if="userInfo.identity.length != 0"> <view class="tabs" v-if="userInfo.identity.length !== 0">
<view class="tabs-item"><image src="@/static/user/icon_07.png"></image>会员</view> <view class="tabs-item">
</view> <image src="@/static/user/icon_07.png" />
</block> VIP会员
<block v-else> </view>
<view class="name" @click="isLogin()">未登录</view> </view>
</block> <view class="tabs" v-else>
</view> <view class="tabs-item">
</view> <image src="@/static/user/icon_07.png" />
</view> 普通用户
<!-- 会员卡 --> </view>
<view class="vip-card"> </view>
<view class="title"> <view class="chainAddress" v-if="userInfo.chain_address">
<image src="@/static/user/icon_06.png" mode="widthFix"></image> <u-icon labelPos="left" @click="copy(userInfo.chain_address)" labelSize="14" labelColor="#fff" :label="userInfo.chain_address.substr(0, 20)+'...'" space="10" :name="require('@/static/imgs/copy.png')" size="16" />
ZH会员 </view>
</view> </block>
<view class="subtitle"> <block v-else><view class="name" @click="isLogin()">未登录</view></block>
<u-notice-bar </view>
:text="cardText" </view>
icon="" </view>
bgColor=""
duration="3000"
color="#fcc692" <!-- 会员卡 -->
direction="column" <view class="vip-card">
></u-notice-bar> <view class="title">
</view> <image src="@/static/user/icon_06.png" mode="widthFix" />
<view class="btn" @click="openVip" v-if="userInfo.identity.length === 0">开通</view> ZH会员
</view> </view>
<!-- 健康数据 --> <view class="subtitle"><u-notice-bar :text="cardText" icon="" bgColor="" duration="3000" color="#fcc692" direction="column"></u-notice-bar></view>
<view class="health-flex" v-if="userInfo.has_record"> <view class="btn" @click="openVip" v-if="userInfo.identity.length === 0">开通</view>
<view class="health-flex-item"> </view>
<view class="title">
体脂率 <!-- 健康数据 -->
<image class="icon" src="@/static/user/icon_04.png" mode="widthFix"></image> <view class="health-flex" v-if="userInfo.has_record">
</view> <view class="health-flex-item">
<view class="num"> <view class="title">
{{userInfo.record.fat.fat}}<text>%</text> 体脂率
</view> <image class="icon" src="@/static/user/icon_04.png" mode="widthFix" />
<view class="hith">{{userInfo.record.fat.text}}</view> </view>
</view> <view class="num">
<view class="health-flex-item"> {{ userInfo.record.fat.fat }}
<view class="title"> <text>%</text>
体重 </view>
<image class="icon" src="@/static/user/icon_05.png" mode="widthFix"></image> <view class="hith">{{ userInfo.record.fat.text }}</view>
</view> </view>
<view class="num"> <view class="health-flex-item">
{{userInfo.record.weight.weight}}<text>KG</text> <view class="title">
</view> 体重
<view class="hith">{{userInfo.record.weight.text}}</view> <image class="icon" src="@/static/user/icon_05.png" mode="widthFix" />
</view> </view>
</view> <view class="num">
<!-- 订单 --> {{ userInfo.record.weight.weight }}
<view class="order-box"> <text>KG</text>
<view class="order-box-item" @click="onBtn('Order', {index: 0})"> </view>
<image class="icon" src="@/static/user/order_icon_00.png" mode="widthFix"></image> <view class="hith">{{ userInfo.record.weight.text }}</view>
<view class="title">全部订单</view> </view>
</view> </view>
<view class="order-box-item" @click="onBtn('Order', {index: 1})"> <!-- 订单 -->
<image class="icon" src="@/static/user/order_icon_01.png" mode="widthFix"></image> <view class="order-box">
<view class="title">待付款</view> <view class="order-box-item" @click="onBtn('Order', { index: 0 })">
</view> <image class="icon" src="@/static/user/order_icon_00.png" mode="widthFix" />
<view class="order-box-item" @click="onBtn('Order', {index: 2})"> <view class="title">全部订单</view>
<image class="icon" src="@/static/user/order_icon_02.png" mode="widthFix"></image> </view>
<view class="title">待发货</view> <view class="order-box-item" @click="onBtn('Order', { index: 1 })">
</view> <image class="icon" src="@/static/user/order_icon_01.png" mode="widthFix" />
<view class="order-box-item" @click="onBtn('Order', {index: 3})"> <view class="title">待付款</view>
<image class="icon" src="@/static/user/order_icon_03.png" mode="widthFix"></image> </view>
<view class="title">待收货</view> <view class="order-box-item" @click="onBtn('Order', { index: 2 })">
</view> <image class="icon" src="@/static/user/order_icon_02.png" mode="widthFix" />
<view class="order-box-item" @click="onBtn('Order', {index: 4})"> <view class="title">待发货</view>
<image class="icon" src="@/static/user/order_icon_04.png" mode="widthFix"></image> </view>
<view class="title">已完成</view> <view class="order-box-item" @click="onBtn('Order', { index: 3 })">
</view> <image class="icon" src="@/static/user/order_icon_03.png" mode="widthFix" />
</view> <view class="title">待收货</view>
<!-- 功能块 --> </view>
<view class="btns-box"> <view class="order-box-item" @click="onBtn('Order', { index: 4 })">
<view class="btns-box-item" @click="onWallet"> <image class="icon" src="@/static/user/order_icon_04.png" mode="widthFix" />
<image class="icon" src="@/static/user/userIcon_00.png" mode="widthFix"></image> <view class="title">已完成</view>
ZH钱包 </view>
<uni-icons class="forward" type="forward" color="#999"></uni-icons> </view>
</view> <!-- 功能块 -->
<view class="btns-box-item" @click="onFiles"> <view class="btns-box">
<image class="icon" src="@/static/user/userIcon_02.png" mode="widthFix"></image> <view class="btns-box-item" @click="onWallet">
健康档案 <image class="icon" src="@/static/user/userIcon_00.png" mode="widthFix" />
<uni-icons class="forward" type="forward" color="#999"></uni-icons> ZH钱包
</view> <uni-icons class="forward" type="forward" color="#999" />
<view class="btns-box-item" @click="onBtn('Address', {type: 'edit'})"> </view>
<image class="icon" src="@/static/user/userIcon_03.png" mode="widthFix"></image> <view class="btns-box-item" @click="onFiles">
地址管理 <image class="icon" src="@/static/user/userIcon_02.png" mode="widthFix" />
<uni-icons class="forward" type="forward" color="#999"></uni-icons> 健康档案
</view> <uni-icons class="forward" type="forward" color="#999" />
</view> </view>
<view class="btns-box" v-if="$store.state.token != ''"> <view class="btns-box-item" @click="onBtn('Address', { type: 'edit' })">
<view class="btns-box-item" @click="logOut"> <image class="icon" src="@/static/user/userIcon_03.png" mode="widthFix" />
<image class="icon" src="@/static/user/userIcon_05.png" mode="widthFix"></image> 地址管理
退出登录 <uni-icons class="forward" type="forward" color="#999" />
<uni-icons class="forward" type="forward" color="#999"></uni-icons> </view>
</view> </view>
</view> <view class="btns-box" v-if="$store.state.token != ''">
<view class="footer-text"> <view class="btns-box-item" @click="logOut">
<view>ZH生态俱乐部</view> <image class="icon" src="@/static/user/userIcon_05.png" mode="widthFix" />
<view>All Rights Reserved. ZH Eco Club</view> 退出登录
</view> <uni-icons class="forward" type="forward" color="#999" />
</view> </view>
</view>
<view class="footer-text">
<view>ZH生态俱乐部</view>
<view>All Rights Reserved. ZH Eco Club</view>
</view>
</view>
</template> </template>
<script> <script>
import { info } from '@/apis/interfaces/user' import { info } from '@/apis/interfaces/user';
import userAuth from '@/public/userAuth' import userAuth from '@/public/userAuth';
export default { export default {
data() { data() {
return { return {
cardText: ['新用户首单即赠会员', '老用户专属验证开通会员'], cardText: ['新用户首单即赠会员', '老用户专属验证开通会员'],
userInfo: { userInfo: {
nickname: "", nickname: '',
avatar : "", avatar: '',
identity: [] identity: []
} }
}; };
}, },
onShow() { onShow() {
this.getInfo() this.getInfo();
}, },
methods:{ methods: {
// 用户信息 // 用户信息
getInfo(){ getInfo() {
if(this.$store.state.token === '') return if (this.$store.state.token === '') return;
info().then(res => { info()
uni.setNavigationBarTitle({ .then(res => {
title: res.nickname console.log(res);
}) uni.setNavigationBarTitle({
this.userInfo = res title: res.nickname
}).catch(err => { });
uni.showToast({ this.userInfo = res;
title: err.message, console.log(res);
icon : 'none' })
}) .catch(err => {
}) uni.showToast({
}, title: err.message,
// 开通会员 icon: 'none'
openVip(){ });
if(this.isLogin()){ });
uni.showActionSheet({ },
itemList: ["我是新用户", "我是老用户"], // 开通会员
success: res=> { openVip() {
switch (res.tapIndex){ if (this.isLogin()) {
case 0: uni.showActionSheet({
uni.showModal({ itemList: ['我是新用户', '我是老用户'],
title: '开通提示', success: res => {
content: '平台新用户完成首笔订单即可获赠ZH健康会员', switch (res.tapIndex) {
showCancel:false, case 0:
cancelText: '去完成', uni.showModal({
success: res => { title: '开通提示',
console.log(res) content: '平台新用户完成首笔订单即可获赠ZH健康会员',
this.$Router.pushTab({name: 'Store'}) showCancel: false,
} cancelText: '去完成',
}) success: res => {
break; console.log(res);
case 1: this.$Router.pushTab({ name: 'Store' });
uni.showToast({ }
title: '老用户渠道暂未开放', });
icon : 'none' break;
}) case 1:
break; uni.showToast({
} title: '老用户渠道暂未开放',
} icon: 'none'
}) });
} break;
}, }
// 开通钱包 }
onWallet(){ });
if(this.isLogin()){ }
if(this.userInfo.is_wallet) this.$Router.push({name: 'WalletProperty'}) },
else this.$Router.push({name: 'WalletAdd'}) // 开通钱包
} onWallet() {
}, if (this.isLogin()) {
// 个人档案 if (this.userInfo.is_wallet) this.$Router.push({ name: 'WalletProperty' });
onFiles(){ else this.$Router.push({ name: 'WalletAdd' });
if(this.isLogin()){ }
if(!this.userInfo.has_record){ },
this.$Router.push({name: 'EssentialInfo'}) // 个人档案
return onFiles() {
} if (this.isLogin()) {
this.$Router.push({name: 'UserFiles'}) if (!this.userInfo.has_record) {
} this.$Router.push({ name: 'EssentialInfo' });
}, return;
// 按钮导航 }
onBtn(name, params){ // this.$Router.push({ name: 'UserFiles',params:{id:this.userInfo.record_id} });
if(this.isLogin()){ uni.navigateTo({
this.$Router.push({name, params}) url: `/pages/user/files?id=${this.userInfo.record.record_id}`
} });
}, }
// 检查登录 },
isLogin(){ // 按钮导航
if(this.$store.state.token === ''){ onBtn(name, params) {
const Auth = new userAuth() if (this.isLogin()) {
Auth.Login() this.$Router.push({ name, params });
return false }
} },
return true // 检查登录
}, isLogin() {
// 退出登录 if (this.$store.state.token === '') {
logOut(){ const Auth = new userAuth();
this.userInfo = { Auth.Login();
nickname: "", return false;
avatar : "", }
identity: [] return true;
} },
this.$store.commit('setToken', '') // 退出登录
} logOut() {
} this.userInfo = {
} nickname: '',
avatar: '',
identity: []
};
this.$store.commit('setToken', '');
},
copy(data){
uni.setClipboardData({
data: data,
success: function () {
uni.showToast({
title:'复制成功',
icon:'none'
})
}
});
}
}
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.content{ .content {
background: $window-color; background: $window-color;
min-height: 100vh; min-height: 100vh;
} }
// 版权信息 // 版权信息
.footer-text{ .footer-text {
text-align: center; text-align: center;
font-size: $title-size-sm; font-size: $title-size-sm;
padding: $padding $padding $padding*2; padding: $padding $padding $padding * 2;
color: $text-gray-m; color: $text-gray-m;
} }
// 用户信息 // 用户信息
.info-box{ .info-box {
position: relative; position: relative;
background: linear-gradient(to right, #34ce98, #22aa98); background: linear-gradient(to right, #34ce98, #22aa98);
color: white; color: white;
@extend .ios-top; @extend .ios-top;
&>image{ & > image {
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
} // z-index: 100;
.user-flex{ }
position: relative; .user-flex {
padding: $padding*2 $padding ($padding*2 + 60); position: relative;
height: 128rpx; padding: $padding * 2 $padding ($padding * 2 + 60);
.cover{ height: 128rpx;
position: absolute; .cover {
width: 128rpx; position: absolute;
height: 128rpx; width: 128rpx;
border-radius: 50%; height: 128rpx;
border:solid 6rpx white; border-radius: 50%;
box-sizing: border-box; border: solid 6rpx white;
} box-sizing: border-box;
.user-content{ z-index: 100;
padding-left: 158rpx; }
height: 128rpx; .user-content {
display: flex; padding-left: 158rpx;
flex-direction: column; height: 128rpx;
justify-content: center; display: flex;
.name{ flex-direction: column;
line-height: 40rpx; justify-content: center;
font-weight: bold; position: relative;
font-size: $title-size + 8; .chainAddress {
@extend .nowrap; overflow: hidden;
} white-space: nowrap;
.tabs{ text-overflow: ellipsis;
padding-top: 10rpx; font-size: $title-size-m;
&-item{ padding-top: 10rpx;
background: rgba($color: #000000, $alpha: .3); display: flex;
font-size: $title-size-sm - 4; flex-direction: row;
display: inline-block; align-items: center;
line-height: 36rpx; justify-content: flex-start;
padding: 0 20rpx; position: relative;
border-radius: 20rpx; z-index: 200;
image{ }
width: 26rpx; .name {
height: 26rpx; line-height: 40rpx;
vertical-align: middle; font-weight: bold;
margin-bottom: 2rpx; font-size: $title-size + 8;
margin-right: 8rpx; @extend .nowrap;
} }
} .tabs {
} padding-top: 10rpx;
} &-item {
} background: rgba($color: #000000, $alpha: 0.3);
} font-size: $title-size-sm - 4;
// 会员卡 display: inline-block;
.vip-card{ line-height: 36rpx;
position: relative; padding: 0 20rpx;
margin: -60rpx $margin $margin; border-radius: 20rpx;
background: linear-gradient(to right bottom, #3e5364, #31364a); image {
border-radius: $radius; width: 26rpx;
box-sizing: border-box; height: 26rpx;
color: #fcc692; vertical-align: middle;
padding: $padding ($padding + 170) $padding $padding; margin-bottom: 2rpx;
.title{ margin-right: 8rpx;
font-weight: bold; }
font-size: $title-size-lg; }
line-height: 40rpx; }
image{ }
width: 32rpx; }
height: 32rpx; }
margin-right: 10rpx; // 会员卡
vertical-align: middle; .vip-card {
margin-bottom: 4rpx; position: relative;
} margin: -60rpx $margin $margin;
} background: linear-gradient(to right bottom, #3e5364, #31364a);
.subtitle{ border-radius: $radius;
font-size: $title-size-sm; box-sizing: border-box;
margin-top: 10rpx; color: #fcc692;
.u-notice-bar{ padding: $padding ($padding + 170) $padding $padding;
padding: 0; .title {
} font-weight: bold;
} font-size: $title-size-lg;
.btn{ line-height: 40rpx;
position: absolute; image {
right: $margin; width: 32rpx;
margin-top: -30rpx; height: 32rpx;
top: 50%; margin-right: 10rpx;
height: 60rpx; vertical-align: middle;
line-height: 60rpx; margin-bottom: 4rpx;
background: linear-gradient(to right, #fce3c5, #fcc590); }
color: #31364a; }
font-weight: bold; .subtitle {
width: 150rpx; font-size: $title-size-sm;
text-align: center; margin-top: 10rpx;
font-size: $title-size-m; .u-notice-bar {
border-radius: 30rpx; padding: 0;
} }
} }
// 订单信息 .btn {
.order-box{ position: absolute;
margin: $margin; right: $margin;
background: white; margin-top: -30rpx;
border-radius: $radius; top: 50%;
display: flex; height: 60rpx;
justify-content: space-between; line-height: 60rpx;
&-item{ background: linear-gradient(to right, #fce3c5, #fcc590);
width: 25%; color: #31364a;
padding: $padding $padding/2; font-weight: bold;
text-align: center; width: 150rpx;
.icon{ text-align: center;
width: 48rpx; font-size: $title-size-m;
height: 48rpx; border-radius: 30rpx;
vertical-align: top; }
} }
.title{ // 订单信息
font-size: $title-size-sm; .order-box {
margin-top: $margin/3; margin: $margin;
} background: white;
} border-radius: $radius;
} display: flex;
// 健康数据 justify-content: space-between;
.health-flex{ &-item {
display: flex; width: 25%;
margin: $margin ($margin - 10); padding: $padding $padding/2;
&-item{ text-align: center;
margin: 0 10rpx; .icon {
background: white; width: 48rpx;
width: calc(50% - 20rpx); height: 48rpx;
border-radius: $radius; vertical-align: top;
padding: $padding; }
box-sizing: border-box; .title {
.title{ font-size: $title-size-sm;
font-size: $title-size-lg; margin-top: $margin/3;
.icon{ }
width: 32rpx; }
height: 32rpx; }
vertical-align: middle; // 健康数据
margin-left: 10rpx; .health-flex {
margin-bottom: 2rpx; display: flex;
} margin: $margin ($margin - 10);
} &-item {
.num{ margin: 0 10rpx;
font-weight: bold; background: white;
font-size: $title-size + 10; width: calc(50% - 20rpx);
padding: $padding/3 0; border-radius: $radius;
text{ padding: $padding;
font-size: 70%; box-sizing: border-box;
padding-left: 10rpx; .title {
} font-size: $title-size-lg;
} .icon {
.hith{ width: 32rpx;
font-size: $title-size-sm; height: 32rpx;
color: $text-gray; vertical-align: middle;
} margin-left: 10rpx;
} margin-bottom: 2rpx;
} }
// 模块 }
.btns-box{ .num {
background: white; font-weight: bold;
margin: $margin; font-size: $title-size + 10;
border-radius: $radius; padding: $padding/3 0;
&-item{ text {
position: relative; font-size: 70%;
line-height: 90rpx; padding-left: 10rpx;
padding: 0 $padding; }
font-size: $title-size-lg; }
&::after{ .hith {
position: absolute; font-size: $title-size-sm;
height: 1rpx; color: $text-gray;
content: " "; }
left: $margin; }
right: $margin; }
bottom: 0; // 模块
background-color: $border-color; .btns-box {
} background: white;
&:last-child::after{ margin: $margin;
display: none; border-radius: $radius;
} &-item {
.forward{ position: relative;
position: absolute; line-height: 90rpx;
right: $margin; padding: $padding * 0.6 $padding;
} font-size: $title-size-lg;
.icon{ &::after {
width: 44rpx; position: absolute;
height: 44rpx; height: 1rpx;
vertical-align: middle; content: ' ';
margin-right: $margin/2; left: $margin;
margin-bottom: 8rpx; right: $margin;
} bottom: 0;
} background-color: #f9f9f9;
} }
&:last-child::after {
display: none;
}
.forward {
position: absolute;
right: $margin;
}
.icon {
width: 44rpx;
height: 44rpx;
vertical-align: middle;
margin-right: $margin/2;
margin-bottom: 8rpx;
}
}
}
</style> </style>

BIN
static/imgs/copy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
static/user/user-avatar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 930 B