|
|
@@ -1,206 +1,204 @@
|
|
|
<template>
|
|
|
- <view>
|
|
|
- <view style="background-color:#03803B;height: 250rpx;">
|
|
|
- <view style="padding: 33rpx;display: flex;align-items: center;">
|
|
|
- <view class="">
|
|
|
- <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;">
|
|
|
- {{userData.user_name?userData.user_name:''}}
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="card" style="margin-top: 20rpx;display: flex;align-items: center;">
|
|
|
- <u-cell-group :border="false">
|
|
|
- <u-cell title="个人资料" :clickable="true" @click="allClick('个人资料')">
|
|
|
- <view slot="icon">
|
|
|
- <image src="/static/images/me/100.png" style="width:26rpx;height: 27rpx;margin-right: 10rpx;"
|
|
|
- mode="scaleToFill">
|
|
|
- </image>
|
|
|
- </view>
|
|
|
- <view slot="right-icon">
|
|
|
- <uni-icons type="right" size="18" color='#CCCCCC'></uni-icons>
|
|
|
- </view>
|
|
|
- </u-cell>
|
|
|
- <u-cell title="门店信息" :clickable="true" @click="allClick('门店信息')">
|
|
|
- <view slot="icon">
|
|
|
- <image src="/static/images/me/101.png" style="width:26rpx;height: 27rpx;margin-right: 10rpx;"
|
|
|
- mode="scaleToFill">
|
|
|
- </image>
|
|
|
- </view>
|
|
|
- <view slot="right-icon">
|
|
|
- <uni-icons type="right" size="18" color='#CCCCCC'></uni-icons>
|
|
|
- </view>
|
|
|
- </u-cell>
|
|
|
- <u-cell title="设置" :clickable="true" :border="false" @click="setUp">
|
|
|
- <view slot="icon">
|
|
|
- <image src="/static/images/me/103.png" style="width:26rpx;height: 27rpx;margin-right: 10rpx;"
|
|
|
- mode="scaleToFill">
|
|
|
- </image>
|
|
|
- </view>
|
|
|
- <view slot="right-icon">
|
|
|
- <uni-icons type="right" size="18" color='#CCCCCC'></uni-icons>
|
|
|
- </view>
|
|
|
- </u-cell>
|
|
|
- </u-cell-group>
|
|
|
- </view>
|
|
|
- <!-- 提取去登录 -->
|
|
|
- <u-modal :show="adminShow" :showCancelButton="true" content='当前还未登录请先登录!!' @confirm="adminConfirm"
|
|
|
- @cancel="adminCancel"></u-modal>
|
|
|
- </view>
|
|
|
+ <view>
|
|
|
+ <view style="background-color:#03803B;height: 250rpx;">
|
|
|
+ <view style="padding: 33rpx;display: flex;align-items: center;">
|
|
|
+ <view class="">
|
|
|
+ <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;">
|
|
|
+ {{ userData.name ? userData.name : '' }}
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="card" style="margin-top: 20rpx;display: flex;align-items: center;">
|
|
|
+ <u-cell-group :border="false">
|
|
|
+ <u-cell title="个人资料" :clickable="true" @click="allClick('个人资料')">
|
|
|
+ <view slot="icon">
|
|
|
+ <image src="/static/images/me/100.png" style="width:26rpx;height: 27rpx;margin-right: 10rpx;"
|
|
|
+ mode="scaleToFill">
|
|
|
+ </image>
|
|
|
+ </view>
|
|
|
+ <view slot="right-icon">
|
|
|
+ <uni-icons type="right" size="18" color='#CCCCCC'></uni-icons>
|
|
|
+ </view>
|
|
|
+ </u-cell>
|
|
|
+ <u-cell title="门店信息" :clickable="true" @click="allClick('门店信息')">
|
|
|
+ <view slot="icon">
|
|
|
+ <image src="/static/images/me/101.png" style="width:26rpx;height: 27rpx;margin-right: 10rpx;"
|
|
|
+ mode="scaleToFill">
|
|
|
+ </image>
|
|
|
+ </view>
|
|
|
+ <view slot="right-icon">
|
|
|
+ <uni-icons type="right" size="18" color='#CCCCCC'></uni-icons>
|
|
|
+ </view>
|
|
|
+ </u-cell>
|
|
|
+ <u-cell title="设置" :clickable="true" :border="false" @click="setUp">
|
|
|
+ <view slot="icon">
|
|
|
+ <image src="/static/images/me/103.png" style="width:26rpx;height: 27rpx;margin-right: 10rpx;"
|
|
|
+ mode="scaleToFill">
|
|
|
+ </image>
|
|
|
+ </view>
|
|
|
+ <view slot="right-icon">
|
|
|
+ <uni-icons type="right" size="18" color='#CCCCCC'></uni-icons>
|
|
|
+ </view>
|
|
|
+ </u-cell>
|
|
|
+ </u-cell-group>
|
|
|
+ </view>
|
|
|
+ <!-- 提取去登录 -->
|
|
|
+ <u-modal :show="adminShow" :showCancelButton="true" content='当前还未登录请先登录!!' @confirm="adminConfirm"
|
|
|
+ @cancel="adminCancel"></u-modal>
|
|
|
+ </view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- export default {
|
|
|
- data() {
|
|
|
- return {
|
|
|
- avatarUrl: '/static/images/me/head.png',
|
|
|
- tempFilePaths: [],
|
|
|
- userData: uni.getStorageSync('userInfo'),
|
|
|
- adminShow: false,
|
|
|
- }
|
|
|
- },
|
|
|
- onShow() {
|
|
|
- },
|
|
|
- methods: {
|
|
|
- showActionSheet() {
|
|
|
- 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)
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
- })
|
|
|
- },
|
|
|
- // 确认
|
|
|
- adminConfirm() {
|
|
|
- uni.clearStorageSync();
|
|
|
- uni.redirectTo({
|
|
|
- url: '/pages/login/index'
|
|
|
- })
|
|
|
- },
|
|
|
- // 取消
|
|
|
- adminCancel() {
|
|
|
- uni.switchTab({
|
|
|
- url: '/pages/me/index'
|
|
|
- })
|
|
|
- },
|
|
|
- setUp() {
|
|
|
- this.$u.route('/pages/me/setting');
|
|
|
- },
|
|
|
- clickMeans() {
|
|
|
- uni.showToast({
|
|
|
- title: "开发中",
|
|
|
- icon: "none",
|
|
|
- });
|
|
|
- return
|
|
|
- uni.$u.route('/pages/views/personalInformation/index');
|
|
|
- },
|
|
|
- allClick(name){
|
|
|
- if(name=='门店信息'){
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/me/storeInfo'
|
|
|
- });
|
|
|
- }
|
|
|
- if(name=='个人资料'){
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/me/userInfo'
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+import {getCarUserDetail, updateCarUserDetail} from "../../api/user/index";
|
|
|
+
|
|
|
+export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ avatarUrl: '/static/images/me/head.png',
|
|
|
+ tempFilePaths: [],
|
|
|
+ userData: {},
|
|
|
+ adminShow: false,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onShow() {
|
|
|
+ this.getUserInfo()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ updateUserAvatar(avatar) {
|
|
|
+ updateCarUserDetail({avatar: avatar, id: this.userData.id}).then(res => {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: "none",
|
|
|
+ });
|
|
|
+ })
|
|
|
+ },
|
|
|
+ async getUserInfo() {
|
|
|
+ const userInfo = await getCarUserDetail()
|
|
|
+ this.userData = userInfo.data
|
|
|
+ },
|
|
|
+ showActionSheet() {
|
|
|
+ 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://b2b.gubersail.com:9000/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) => {
|
|
|
+ this.userData.avatar = JSON.parse(uploadRes.data).data.link
|
|
|
+ this.updateUserAvatar(this.userData.avatar)
|
|
|
+ },
|
|
|
+ fail: (err) => {
|
|
|
+ reject(err)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 确认
|
|
|
+ adminConfirm() {
|
|
|
+ uni.clearStorageSync();
|
|
|
+ uni.redirectTo({
|
|
|
+ url: '/pages/login/index'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 取消
|
|
|
+ adminCancel() {
|
|
|
+ uni.switchTab({
|
|
|
+ url: '/pages/me/index'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ setUp() {
|
|
|
+ this.$u.route('/pages/me/setting');
|
|
|
+ },
|
|
|
+ allClick(name) {
|
|
|
+ if (name == '门店信息') {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/me/storeInfo'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (name == '个人资料') {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/me/userInfo'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
- .action-sheet {
|
|
|
- background: #fff;
|
|
|
- border-radius: 24rpx 24rpx 0 0;
|
|
|
- padding: 30rpx;
|
|
|
- }
|
|
|
+.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;
|
|
|
|
|
|
- .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;
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
- text {
|
|
|
- margin-left: 20rpx;
|
|
|
- font-size: 30rpx;
|
|
|
- }
|
|
|
- }
|
|
|
+.cancel-btn {
|
|
|
+ padding: 28rpx 0;
|
|
|
+ text-align: center;
|
|
|
+ color: #ff2442;
|
|
|
+ font-size: 30rpx;
|
|
|
+ margin-top: 20rpx;
|
|
|
+}
|
|
|
|
|
|
- .cancel-btn {
|
|
|
- padding: 28rpx 0;
|
|
|
- text-align: center;
|
|
|
- color: #ff2442;
|
|
|
- font-size: 30rpx;
|
|
|
- margin-top: 20rpx;
|
|
|
- }
|
|
|
- .card {
|
|
|
- margin: 0 32rpx;
|
|
|
- background-color: #fff;
|
|
|
- border-radius: 14rpx;
|
|
|
+.card {
|
|
|
+ margin: 0 32rpx;
|
|
|
+ background-color: #fff;
|
|
|
+ border-radius: 14rpx;
|
|
|
|
|
|
- ::v-deep .u-cell__title-text {
|
|
|
- font-size: 24rpx;
|
|
|
- font-weight: 400;
|
|
|
- color: #797979;
|
|
|
- }
|
|
|
- }
|
|
|
-</style>
|
|
|
+ ::v-deep .u-cell__title-text {
|
|
|
+ font-size: 24rpx;
|
|
|
+ font-weight: 400;
|
|
|
+ color: #797979;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|