|
@@ -3,17 +3,18 @@
|
|
|
<view style="background-color:#E75F37;height: 250rpx;">
|
|
|
<view style="padding: 33rpx;display: flex;align-items: center;">
|
|
|
<view class="">
|
|
|
- <image src="/static/images/tabBar/head.png" style="width:100rpx;height: 100rpx;" mode="scaleToFill">
|
|
|
+ <image :src="userData.avatar||avatarUrl" style="width:100rpx;height: 100rpx;border-radius: 50%;"
|
|
|
+ mode="scaleToFill" @click="showActionSheet">
|
|
|
</image>
|
|
|
</view>
|
|
|
<view style="color:#fff;margin-left: 13rpx;font-size: 30rpx;font-weight: 500;">
|
|
|
- {{name?name:''}}
|
|
|
+ {{userData.cname?userData.cname:''}}
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="card" style="height: 114rpx;">
|
|
|
<view style="display: flex;justify-content: space-around;align-items: center;height: 114rpx;">
|
|
|
-<!-- <text style="color:#818181;font-size: 24rpx;">
|
|
|
+ <!-- <text style="color:#818181;font-size: 24rpx;">
|
|
|
产生积分:
|
|
|
<text style="color:#FE8301;font-size: 26rpx;">
|
|
|
{{form.addPoints?form.addPoints:'0.00'}}
|
|
@@ -31,12 +32,12 @@
|
|
|
{{form.pointsBalance?form.pointsBalance:'0.00'}}
|
|
|
</text>
|
|
|
</text>
|
|
|
- <text style="color:#818181;font-size: 24rpx;">
|
|
|
- 现金余额:
|
|
|
- <text style="color:#FE8301;font-size: 26rpx;">
|
|
|
- {{form.recoveredBalance?form.recoveredBalance:'0.00'}}
|
|
|
- </text>
|
|
|
- </text>
|
|
|
+ <text style="color:#818181;font-size: 24rpx;">
|
|
|
+ 现金余额:
|
|
|
+ <text style="color:#FE8301;font-size: 26rpx;">
|
|
|
+ {{form.recoveredBalance?form.recoveredBalance:'0.00'}}
|
|
|
+ </text>
|
|
|
+ </text>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="card" style="margin-top: 20rpx;height: 141rpx;">
|
|
@@ -51,7 +52,7 @@
|
|
|
<view style="display: flex;flex-direction:column;align-items: center;" @click="inIntegralMall">
|
|
|
<image src="/static/images/tabBar/280-2.png" style="width:40rpx;height: 40rpx;" mode="scaleToFill">
|
|
|
</image>
|
|
|
- <view style="color: #414141;font-size: 26rpx;margin-top: 13rpx;" >积分商城
|
|
|
+ <view style="color: #414141;font-size: 26rpx;margin-top: 13rpx;">积分商城
|
|
|
<uni-icons type="right" size="13" color='#8A8A8A'></uni-icons>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -158,12 +159,15 @@
|
|
|
<script>
|
|
|
import {
|
|
|
details,
|
|
|
- corpPointsDetail
|
|
|
+ corpPointsDetail,
|
|
|
+ updateUserAvatar
|
|
|
} from '@/api/views/personalInformation/index.js'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- name: null,
|
|
|
+ avatarUrl: '/static/images/tabBar/head.png',
|
|
|
+ tempFilePaths: [],
|
|
|
+ userData: {},
|
|
|
badgeList: [],
|
|
|
form: {},
|
|
|
adminShow: false,
|
|
@@ -174,17 +178,89 @@
|
|
|
if (uni.getStorageSync('userInfo').tenant_id == '000000') {
|
|
|
this.adminShow = true
|
|
|
}
|
|
|
- details().then(res => {
|
|
|
- this.name = res.data.cname
|
|
|
- corpPointsDetail({
|
|
|
- corpId: res.data.id
|
|
|
- }).then(e => {
|
|
|
- this.form = e.data
|
|
|
- this.form.recoveredBalance = res.data.recoveredBalance
|
|
|
- })
|
|
|
- })
|
|
|
+ this.getUserData()
|
|
|
},
|
|
|
methods: {
|
|
|
+ getUserData() {
|
|
|
+ details().then(res => {
|
|
|
+ this.userData = res.data
|
|
|
+ corpPointsDetail({
|
|
|
+ corpId: res.data.id
|
|
|
+ }).then(e => {
|
|
|
+ this.form = e.data
|
|
|
+ this.form.recoveredBalance = res.data.recoveredBalance
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ showActionSheet() {
|
|
|
+ if (this.userData.checkStatus != '通过') {
|
|
|
+ uni.showToast({
|
|
|
+ title: "当前用户未授权,请联系客服",
|
|
|
+ icon: "none",
|
|
|
+ mask: true
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ uni.showActionSheet({
|
|
|
+ itemList: ['拍照', '从相册选择'],
|
|
|
+ success: (res) => {
|
|
|
+ if (res.tapIndex === 0) {
|
|
|
+ this.chooseMedia('camera')
|
|
|
+ } else {
|
|
|
+ this.chooseMedia('album')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ chooseMedia(sourceType) {
|
|
|
+ uni.chooseMedia({
|
|
|
+ count: 1,
|
|
|
+ mediaType: ['image'],
|
|
|
+ sourceType: [sourceType],
|
|
|
+ sizeType: ['original', 'compressed'],
|
|
|
+ camera: 'front',
|
|
|
+ success: (res) => {
|
|
|
+ // this.avatarUrl = res.tempFiles[0].tempFilePath
|
|
|
+ this.tempFilePaths = res.tempFiles.map(file => file.tempFilePath)
|
|
|
+ this.uploadFiles()
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ console.log(err)
|
|
|
+ },
|
|
|
+ })
|
|
|
+ },
|
|
|
+ uploadFiles() {
|
|
|
+ const uploadTasks = this.tempFilePaths.map((filePath, index) => {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ uni.uploadFile({
|
|
|
+ url: 'https://lt.echepei.com/api/blade-resource/oss/endpoint/put-file',
|
|
|
+ filePath: filePath,
|
|
|
+ name: 'file',
|
|
|
+ header: {
|
|
|
+ 'Blade-Auth': 'bearer ' + uni.getStorageSync('accessToken'),
|
|
|
+ appId: uni.getAccountInfoSync().miniProgram.appId
|
|
|
+ },
|
|
|
+ success: (uploadRes) => {
|
|
|
+ let obj = {
|
|
|
+ id: this.userData.userId,
|
|
|
+ avatar: JSON.parse(uploadRes.data).data.link
|
|
|
+ }
|
|
|
+ updateUserAvatar(obj).then(res => {
|
|
|
+ uni.showToast({
|
|
|
+ title: "上传成功",
|
|
|
+ icon: "none",
|
|
|
+ mask: true
|
|
|
+ });
|
|
|
+ this.getUserData()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ reject(err)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
getUpdate() {
|
|
|
const updateManager = uni.getUpdateManager();
|
|
|
updateManager.onCheckForUpdate(function(res) {
|
|
@@ -289,6 +365,33 @@
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
+ .action-sheet {
|
|
|
+ background: #fff;
|
|
|
+ border-radius: 24rpx 24rpx 0 0;
|
|
|
+ padding: 30rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .action-item {
|
|
|
+ padding: 28rpx 0;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ border-bottom: 1rpx solid #f5f5f5;
|
|
|
+
|
|
|
+ text {
|
|
|
+ margin-left: 20rpx;
|
|
|
+ font-size: 30rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .cancel-btn {
|
|
|
+ padding: 28rpx 0;
|
|
|
+ text-align: center;
|
|
|
+ color: #ff2442;
|
|
|
+ font-size: 30rpx;
|
|
|
+ margin-top: 20rpx;
|
|
|
+ }
|
|
|
+
|
|
|
.card {
|
|
|
position: relative;
|
|
|
margin: 0 32rpx;
|
|
@@ -325,4 +428,4 @@
|
|
|
color: #797979;
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|