|
@@ -4,19 +4,21 @@
|
|
|
<view class='flex userWrap justify-space-between'>
|
|
|
<view class='flex'>
|
|
|
<view style='margin-right:20rpx;'>
|
|
|
- <u--image width='60' height='60' :src="userInfo.head" shape="circle"></u--image>
|
|
|
+ <u--image width='60' height='60' :src="userInfo.head" shape="circle" @click="editHead"></u--image>
|
|
|
</view>
|
|
|
<view>
|
|
|
<view class='flex'>
|
|
|
- <view @click='login' v-if='!edit' style="font-weight: bold;font-size: 32rpx;">
|
|
|
+ <view @click='login' style="font-weight: bold;font-size: 32rpx;">
|
|
|
{{userInfo.nickname?userInfo.nickname:'请点击登录'}}
|
|
|
</view>
|
|
|
- <view v-else> <u--input placeholder="请输入内容" border="bottom" v-model='userInfo.nickname'
|
|
|
- clearable></u--input></view>
|
|
|
- <u-icon v-if='!edit&&userInfo.phone' @click='edit = true' name="edit-pen-fill"
|
|
|
+ <!-- <view v-else>
|
|
|
+ <u--input placeholder="请输入内容" border="bottom" v-model='userInfo.nickname'
|
|
|
+ clearable></u--input>
|
|
|
+ </view> -->
|
|
|
+ <!-- <u-icon v-if='!edit&&userInfo.phone' @click='edit = true' name="edit-pen-fill"
|
|
|
color="#eaad1a" size="24"></u-icon>
|
|
|
<u-icon v-if='edit&&userInfo.phone' @click='editNickName' name="checkbox-mark"
|
|
|
- color="#eaad1a" size="24"></u-icon>
|
|
|
+ color="#eaad1a" size="24"></u-icon> -->
|
|
|
</view>
|
|
|
<view>{{userInfo.phone1}}</view>
|
|
|
</view>
|
|
@@ -100,6 +102,8 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ var that;
|
|
|
+ import uploadImage from '@/components/ossutil/uploadFile.js';
|
|
|
import loginPopUp from "@/components/loginPopUp/index.vue"
|
|
|
export default {
|
|
|
components: {
|
|
@@ -116,7 +120,7 @@
|
|
|
}
|
|
|
},
|
|
|
onLoad() {
|
|
|
-
|
|
|
+ that = this
|
|
|
},
|
|
|
onShow() {
|
|
|
if (!uni.getStorageSync("userInfo").phone) {
|
|
@@ -147,9 +151,50 @@
|
|
|
if (!uni.getStorageSync("userInfo").phone) {
|
|
|
this.$refs.loginpopup.open()
|
|
|
} else {
|
|
|
-
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/my/editNickName'
|
|
|
+ })
|
|
|
}
|
|
|
- }
|
|
|
+ },
|
|
|
+ editHead() {
|
|
|
+ if (this.userInfo.phone) {
|
|
|
+ uni.chooseImage({
|
|
|
+ count: 1,
|
|
|
+ sizeType: ['original', 'compressed'],
|
|
|
+ success: function(res) {
|
|
|
+ uploadImage(res.tempFilePaths[0], 'cardImages/',
|
|
|
+ result => {
|
|
|
+ that.userInfo.head = result
|
|
|
+ that.$request.baseRequest('admin.unimall.commonUserInfo', 'update', {
|
|
|
+ commonUserInfo: JSON.stringify(that.userInfo)
|
|
|
+ }, failres => {
|
|
|
+ uni.hideLoading()
|
|
|
+ uni.showToast({
|
|
|
+ icon: "none",
|
|
|
+ title: failres.errmsg,
|
|
|
+ duration: 3000
|
|
|
+ });
|
|
|
+ }).then(res => {
|
|
|
+ uni.setStorageSync("userInfo", that.userInfo)
|
|
|
+ uni.showToast({
|
|
|
+ icon: "success",
|
|
|
+ title: '修改成功!',
|
|
|
+ duration: 2000,
|
|
|
+ complete: function() {
|
|
|
+ uni.switchTab({
|
|
|
+ url: "/pages/my/my"
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ )
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.showAuthorizePhone = true
|
|
|
+ }
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|