You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
204 lines
3.8 KiB
204 lines
3.8 KiB
<template>
|
|
<view class="bg">
|
|
|
|
<view class="user-other-info">
|
|
|
|
<view class="nickname-box">
|
|
<input v-model="inputValue" type="text" placeholder="请输入内容" />
|
|
</view>
|
|
|
|
|
|
<view class="btn-tao" @click="submit">保存</view>
|
|
</view>
|
|
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {pathToBase64} from "@/static/js/mmmm-image-tools/index.js"
|
|
export default {
|
|
data() {
|
|
return {
|
|
valueType: '',
|
|
inputValue: '',
|
|
}
|
|
},
|
|
|
|
onLoad(options) {
|
|
this.initData(options)
|
|
},
|
|
|
|
|
|
methods: {
|
|
initData (options) {
|
|
uni.setNavigationBarTitle({title: ''});
|
|
this.valueType = ''
|
|
this.inputValue = ''
|
|
if (options.valueType) {
|
|
this.valueType = options.valueType
|
|
let title = ''
|
|
switch(this.valueType){
|
|
case "nickname":
|
|
title = '姓名'
|
|
break;
|
|
case "mobile":
|
|
title = '手机号'
|
|
break;
|
|
}
|
|
uni.setNavigationBarTitle({title: title});
|
|
} else {
|
|
this.goBack()
|
|
return
|
|
}
|
|
if (options.inputValue && option.inputValue!='null' && option.inputValue!='undefined') {
|
|
this.inputValue = options.inputValue
|
|
}
|
|
},
|
|
|
|
uploadImg() {
|
|
uni.chooseImage({
|
|
success: (chooseImageRes) => {
|
|
const tempFilePaths = chooseImageRes.tempFilePaths;
|
|
|
|
// // #ifdef MP-WEIXIN
|
|
// uni.getFileSystemManager().readFile({
|
|
// filePath: tempFilePaths[0],
|
|
// encoding: 'base64',
|
|
// success: res => {
|
|
// this.Post({
|
|
// method: 'POST',
|
|
// base64: 'data:image/png;base64,' + res.data
|
|
// }, '/api/common/base64').then(res => {
|
|
// if (res.data) {
|
|
// this.Post({
|
|
// avatar: res.data
|
|
// }, '/api/user/profile').then(res => {
|
|
// uni.showModal({
|
|
// title: '提示',
|
|
// content: res.msg,
|
|
// showCancel: false,
|
|
// success: res => {
|
|
// if (res.confirm) {
|
|
// this.getList()
|
|
// }
|
|
// }
|
|
// })
|
|
// })
|
|
// }
|
|
// })
|
|
// }
|
|
// })
|
|
// // #endif
|
|
|
|
pathToBase64(tempFilePaths[0]).then(base64 => {
|
|
this.Post({
|
|
method: 'POST',
|
|
base64: base64
|
|
}, '/api/common/base64').then(res => {
|
|
if (res.data) {
|
|
this.Post({
|
|
avatar: res.data
|
|
}, '/api/user/profile').then(res => {
|
|
uni.showModal({
|
|
title: '提示',
|
|
content: res.msg,
|
|
showCancel: false,
|
|
success: res => {
|
|
if (res.confirm) {
|
|
this.getList()
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
})
|
|
})
|
|
}
|
|
});
|
|
},
|
|
|
|
|
|
|
|
submit() {
|
|
uni.$emit("updateInfo", {
|
|
msgType: 'registerInfo',
|
|
data: {
|
|
valueType: this.valueType,
|
|
inputValue: this.inputValue
|
|
}
|
|
})
|
|
this.goBack()
|
|
},
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
view {
|
|
box-sizing: content-box;
|
|
}
|
|
.bg{
|
|
min-height: 100vh;
|
|
overflow-x: hidden;
|
|
background: white;
|
|
padding-bottom: 50rpx;
|
|
}
|
|
|
|
.empty-value{
|
|
font-weight: 500;
|
|
font-size: 28rpx;
|
|
color: #999999;
|
|
}
|
|
|
|
.nickname-box {
|
|
display: flex;
|
|
align-items: center;
|
|
background: white;
|
|
margin-bottom: 100rpx;
|
|
font-size: 30rpx;
|
|
height: 70rpx;
|
|
border-bottom: 1rpx solid #D8D8D8;
|
|
span {
|
|
flex-shrink: 0;
|
|
}
|
|
input {
|
|
flex: 1;
|
|
font-size: 30rpx;
|
|
display: block;
|
|
}
|
|
}
|
|
|
|
|
|
.user-other-info {
|
|
padding: 30rpx;
|
|
}
|
|
|
|
.userinfo-item {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
font-size: 28rpx;
|
|
border-bottom: 1rpx solid #D8D8D8;
|
|
padding: 40rpx 30rpx 40rpx 0;
|
|
height: 48rpx;
|
|
color: #333;
|
|
position: relative;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.btn-tao {
|
|
width: 333rpx;
|
|
height: 80rpx;
|
|
background: #96684F;
|
|
border-radius: 40rpx;
|
|
text-align: center;
|
|
font-size: 30rpx;
|
|
line-height: 80rpx;
|
|
color: #FFFFFF;
|
|
margin: 68rpx auto 0;
|
|
}
|
|
</style>
|
|
|