头像
This commit is contained in:
parent
f946789c8e
commit
46a5948463
@ -3,10 +3,19 @@ import request from '@/utils/request'
|
||||
|
||||
//------------------博主、通告主-----------------------
|
||||
//查询博主详情
|
||||
export function bloggerDetail(userId) {
|
||||
export function queryDetail(params) {
|
||||
return request({
|
||||
url: '/member/member/bloggerDetail/' + userId,
|
||||
method: 'get'
|
||||
url: '/member/member/queryDetail',
|
||||
method: 'get',
|
||||
params:params
|
||||
})
|
||||
}
|
||||
//保存博主
|
||||
export function uniSaveMember(data) {
|
||||
return request({
|
||||
url: '/member/member/uniSaveMember',
|
||||
method: 'post',
|
||||
data:data
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@
|
||||
getStrData
|
||||
} from '@/utils/auth.js'
|
||||
import {
|
||||
bloggerDetail
|
||||
queryDetail
|
||||
} from '@/api/business/member.js'
|
||||
export default {
|
||||
props: {
|
||||
@ -215,7 +215,6 @@
|
||||
popupImgUrl: "",
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
onShow() {
|
||||
|
||||
},
|
||||
@ -225,7 +224,7 @@
|
||||
mounted() {
|
||||
if (null != getJSONData(constant.userInfo)) {
|
||||
this.userInfo = getJSONData(constant.userInfo)
|
||||
this.getBloggerDetail()
|
||||
this.getDetail()
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -240,11 +239,12 @@
|
||||
// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
|
||||
this.$refs.popup.open(type)
|
||||
},
|
||||
getBloggerDetail() {
|
||||
bloggerDetail(this.userInfo.userId).then(res => {
|
||||
getDetail() {
|
||||
queryDetail({userId:this.userInfo.userId,userType:this.localUserType}).then(res => {
|
||||
this.userInfo.tfansNum = res.data.tfansNum.toString()
|
||||
this.userInfo.pointsBalance = res.data.pointsBalance.toString()
|
||||
this.userInfo.report = res.data.report.toString()
|
||||
this.userInfo.avatar = this.imageUrl+res.data.avatar
|
||||
})
|
||||
},
|
||||
/**
|
||||
@ -254,6 +254,7 @@
|
||||
changeUserType(type)
|
||||
this.localUserType = type
|
||||
this.$emit('update:nowUserType', this.localUserType)
|
||||
this.getDetail()
|
||||
this.$forceUpdate()
|
||||
},
|
||||
handleToInfo() {
|
||||
@ -284,7 +285,7 @@
|
||||
* 跳转编辑页
|
||||
*/
|
||||
goEdit() {
|
||||
this.$tab.navigateTo('/pages/mine/set/my-info')
|
||||
this.$tab.navigateTo('/pages/mine/set/my-info?userType='+this.localUserType+'&userId='+this.userInfo.userId)
|
||||
},
|
||||
viewNewPeople() {
|
||||
this.$tab.navigateTo(
|
||||
|
@ -5,7 +5,7 @@
|
||||
<view class="form-data-box">
|
||||
<!-- 基础表单校验 -->
|
||||
<uni-forms ref="valiForm" :rules="rules" :modelValue="valiFormData">
|
||||
<uni-forms-item labelWidth="280rpx" label="头像" required name="avatar">
|
||||
<uni-forms-item labelWidth="280rpx" label="头像" name="avatar">
|
||||
<uni-file-picker small="true" :value="fileList" :sizeType="sizeType" @select="afterRead"
|
||||
@delete="deleteFile" limit="1"></uni-file-picker>
|
||||
</uni-forms-item>
|
||||
@ -18,15 +18,15 @@
|
||||
<uni-forms-item labelWidth="280rpx" label="绑定手机号" required name="userName">
|
||||
<uni-easyinput disabled v-model="valiFormData.userName" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item labelWidth="280rpx" label="收款码" required name="tRecipientImage">
|
||||
<uni-forms-item labelWidth="280rpx" label="收款码" name="trecipientImage">
|
||||
<uni-file-picker small="true" :value="recipientImageList" :sizeType="sizeType"
|
||||
@select="afterReadRecipient" @delete="deleteFileRecipient" limit="1"></uni-file-picker>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item labelWidth="280rpx" label="收款码真实姓名" required name="tRecipientName">
|
||||
<uni-easyinput v-model="valiFormData.tRecipientName" placeholder="请输入" />
|
||||
<uni-forms-item labelWidth="280rpx" label="收款码真实姓名" name="trecipientName">
|
||||
<uni-easyinput v-model="valiFormData.trecipientName" placeholder="请输入" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item labelWidth="280rpx" label="通告报名免打扰" required name="tOpenDisturb">
|
||||
<uni-data-checkbox v-model="valiFormData.tOpenDisturb" :localdata="ranges" />
|
||||
<uni-forms-item labelWidth="280rpx" label="通告报名免打扰" name="topenDisturb">
|
||||
<uni-data-checkbox v-model="valiFormData.topenDisturb" :localdata="ranges" />
|
||||
</uni-forms-item>
|
||||
</uni-forms>
|
||||
<button type="primary" style="background-color: #FC2B49;" @click="submit('valiForm')">提交</button>
|
||||
@ -38,17 +38,25 @@
|
||||
|
||||
<script>
|
||||
import navigationBarVue from '@/components/navigation/navigationBar.vue';
|
||||
import config from '@/config'
|
||||
import {
|
||||
queryDetail,uniSaveMember
|
||||
} from '@/api/business/member.js'
|
||||
import upload from '@/utils/upload'
|
||||
export default {
|
||||
components: {
|
||||
navigationBarVue
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
userType:'',
|
||||
sizeType: ['compressed'],
|
||||
//头像数组
|
||||
fileList: [],
|
||||
fileImageUrl:[],
|
||||
//收款码数组
|
||||
recipientImageList: [],
|
||||
recipientImageUrl: [],
|
||||
ranges: [{
|
||||
text: '开启',
|
||||
value: "1"
|
||||
@ -62,18 +70,18 @@
|
||||
nickName: "",
|
||||
phonenumber: "",
|
||||
userName: "",
|
||||
tRecipientImage: "",
|
||||
tRecipientName: "",
|
||||
tOpenDisturb: "0"
|
||||
trecipientImage: "",
|
||||
trecipientName: "",
|
||||
topenDisturb: "0"
|
||||
},
|
||||
// 校验规则
|
||||
rules: {
|
||||
avatar: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '头像不能为空'
|
||||
}]
|
||||
},
|
||||
// avatar: {
|
||||
// rules: [{
|
||||
// required: true,
|
||||
// errorMessage: '头像不能为空'
|
||||
// }]
|
||||
// },
|
||||
nickName: {
|
||||
rules: [{
|
||||
required: true,
|
||||
@ -86,35 +94,76 @@
|
||||
errorMessage: '联系方式不能为空'
|
||||
}]
|
||||
},
|
||||
tRecipientImage: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '收款码不能为空'
|
||||
}]
|
||||
},
|
||||
tRecipientName: {
|
||||
rules: [{
|
||||
required: true,
|
||||
errorMessage: '收款码真实姓名不能为空'
|
||||
}]
|
||||
},
|
||||
// trecipientImage: {
|
||||
// rules: [{
|
||||
// required: true,
|
||||
// errorMessage: '收款码不能为空'
|
||||
// }]
|
||||
// },
|
||||
// trecipientName: {
|
||||
// rules: [{
|
||||
// required: true,
|
||||
// errorMessage: '收款码真实姓名不能为空'
|
||||
// }]
|
||||
// },
|
||||
},
|
||||
}
|
||||
},
|
||||
onLoad(options){
|
||||
this.userType = options.userType
|
||||
this.userId = options.userId
|
||||
this.initData(options.userType,options.userId)
|
||||
},
|
||||
methods: {
|
||||
goMyBlackList() {
|
||||
this.$tab.navigateTo('/pages/mine/set/black-list')
|
||||
},
|
||||
submit(ref) {
|
||||
this.valiFormData.avatar = this.fileImageUrl.join(',');
|
||||
this.valiFormData.trecipientImage = this.recipientImageUrl.join(',');
|
||||
let that = this
|
||||
this.$refs[ref].validate().then(res => {
|
||||
console.log('success', res);
|
||||
uniSaveMember(that.valiFormData).then(res => {
|
||||
uni.showToast({
|
||||
title: `校验通过`
|
||||
icon: 'success',
|
||||
duration: 2000,
|
||||
title: '保存成功'
|
||||
});
|
||||
uni.navigateBack()
|
||||
})
|
||||
}).catch(err => {
|
||||
console.log('err', err);
|
||||
})
|
||||
},
|
||||
|
||||
/**初始化数据*/
|
||||
initData(userType,userId){
|
||||
this.fileList = []
|
||||
this.fileImageUrl = []
|
||||
this.recipientImageList = []
|
||||
this.recipientImageUrl = []
|
||||
queryDetail({userType:userType,userId:userId}).then(res=>{
|
||||
console.log(res,131)
|
||||
this.valiFormData = res.data
|
||||
if (this.valiFormData.avatar != null && this.valiFormData.avatar != ''){
|
||||
this.fileImageUrl = this.valiFormData.avatar.split(',')
|
||||
this.fileImageUrl.map((item)=>{
|
||||
this.fileList.push({
|
||||
url:config.baseUrl + item
|
||||
})
|
||||
})
|
||||
}
|
||||
if (this.valiFormData.trecipientImage != null && this.valiFormData.trecipientImage != ''){
|
||||
this.recipientImageUrl = this.valiFormData.trecipientImage.split(',')
|
||||
this.recipientImageUrl.map((item)=>{
|
||||
this.recipientImageList.push({
|
||||
url:config.baseUrl + item
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
afterRead(file) {
|
||||
for (let i = 0; i < file.tempFilePaths.length; i++) {
|
||||
upload({
|
||||
@ -123,8 +172,9 @@
|
||||
}).then((res) => {
|
||||
console.log(res, '215')
|
||||
this.fileList.push({
|
||||
url: config.baseUrl + res.data
|
||||
url: res.url
|
||||
})
|
||||
this.fileImageUrl.push(res.fileName)
|
||||
console.log(this.fileList, 'fileList')
|
||||
})
|
||||
}
|
||||
@ -132,6 +182,7 @@
|
||||
deleteFile(file, index) {
|
||||
console.log('删除文件');
|
||||
this.fileList.splice(index, 1);
|
||||
this.fileImageUrl.splice(index, 1);
|
||||
},
|
||||
afterReadRecipient(file) {
|
||||
for (let i = 0; i < file.tempFilePaths.length; i++) {
|
||||
@ -141,14 +192,16 @@
|
||||
}).then((res) => {
|
||||
console.log(res, '215')
|
||||
this.recipientImageList.push({
|
||||
url: config.baseUrl + res.data
|
||||
url: res.url
|
||||
})
|
||||
this.recipientImageUrl.push(res.fileName)
|
||||
})
|
||||
}
|
||||
},
|
||||
deleteFileRecipient(file, index) {
|
||||
console.log('删除文件');
|
||||
this.recipientImageList.splice(index, 1);
|
||||
this.recipientImageUrl.splice(index, 1);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user