960 lines
27 KiB
Vue
Executable File
960 lines
27 KiB
Vue
Executable File
<template>
|
||
<view class="container">
|
||
<view class="header">
|
||
<button class="btn-normal" open-type="chooseAvatar" @click="onClickAvatar()" @chooseavatar="onChooseAvatar">
|
||
<u-avatar :src="form.userInfo.avatar" :size="80"></u-avatar>
|
||
</button>
|
||
<text>点击修改头像</text>
|
||
</view>
|
||
<u--form :model="form" ref="uForm" :rules="rules" labelPosition="top" :labelStyle="{paddingLeft: '10rpx'}" label-width="240rpx">
|
||
<!-- 表单组件 -->
|
||
<view class="form-wrapper">
|
||
<u-cell-group :border="false">
|
||
<u-cell title="昵称" :isLink="true">
|
||
<u-input slot="value" class="nickname" v-model="form.userInfo.nickname" inputAlign="right" type="nickname" maxlength="8" placeholder="请输入昵称"
|
||
@input="onInputNickName" @blur="onInputNickName" />
|
||
</u-cell>
|
||
<u-cell title="手机号码" :value="form.userInfo.phone" ></u-cell>
|
||
</u-cell-group>
|
||
</view>
|
||
<block v-if="dict">
|
||
<u-action-sheet :show="showSex" :actions="actions" title="请选择性别" description="请选择男或女"
|
||
@close="showSex = false" @select="sexSelect">
|
||
</u-action-sheet>
|
||
<u-datetime-picker ref="datetimePicker" :show="showBirthday" v-model="birthday" mode="date" @close="closeBirthday"
|
||
@confirm="confirmBirthday" :minDate="0" :maxDate="1112102400000" @cancel="closeBirthday" :closeOnClickOverlay="true">
|
||
</u-datetime-picker>
|
||
<!-- <u-picker :show="showRegionMate" :columns="region" keyName="label" @confirm="confirmRegionMate"
|
||
@cancel="closeRegionMate"></u-picker> -->
|
||
|
||
<u-picker :show="showHeight" :columns="dict.height" @confirm="confirmHeight" @cancel="closeHeight" :closeOnClickOverlay="true" @close="closeHeight">
|
||
</u-picker>
|
||
<u-picker :show="showMonthlyPay" :columns="dict.monthlyPay" @confirm="confirmMonthlyPay"
|
||
@cancel="closeMonthlyPay" :closeOnClickOverlay="true" @close="closeMonthlyPay"></u-picker>
|
||
<u-picker :show="showYearlyPay" :columns="dict.yearlyPay" @confirm="confirmYearlyPay"
|
||
@cancel="closeYearlyPay" :closeOnClickOverlay="true" @close="closeYearlyPay"></u-picker>
|
||
<u-picker :show="showEducation" :columns="dict.education" @confirm="confirmEducation"
|
||
@cancel="closeEducation" :closeOnClickOverlay="true" @close="closeEducation"></u-picker>
|
||
<u-picker :show="showMaritalStatus" :columns="dict.maritalStatus" @confirm="confirmMaritalStatus"
|
||
@cancel="closeMaritalStatus" :closeOnClickOverlay="true" @close="closeMaritalStatus"></u-picker>
|
||
<u-picker :show="showHasChildren" :columns="dict.hasChildren" @confirm="confirmHasChildren"
|
||
@cancel="closeHasChildren" :closeOnClickOverlay="true" @close="closeHasChildren"></u-picker>
|
||
<u-picker :show="showHaveChild" :columns="dict.haveChild" @confirm="confirmHaveChild"
|
||
@cancel="closeHaveChild" :closeOnClickOverlay="true" @close="closeHaveChild"></u-picker>
|
||
<u-picker :show="showPosition" :columns="dict.vocation" @confirm="confirmPosition"
|
||
@cancel="closePosition" :closeOnClickOverlay="true" @close="closePosition"></u-picker>
|
||
<u-picker :show="showWeight" :columns="dict.weight" @confirm="confirmWeight" @cancel="closeWeight" :closeOnClickOverlay="true" @close="closeWeight">
|
||
</u-picker>
|
||
<u-picker :show="showShape" :columns="dict.shape" @confirm="confirmShape"
|
||
@cancel="closeShape" :closeOnClickOverlay="true" @close="closeShape"></u-picker>
|
||
<u-picker :show="showHasHouse" :columns="dict.hasHouse" @confirm="confirmHasHouse" @cancel="closeHasHouse" :closeOnClickOverlay="true" @close="closeHasHouse">
|
||
</u-picker>
|
||
<u-picker :show="showHasCar" :columns="dict.hasCar" @confirm="confirmHasCar" @cancel="closeHasCar" :closeOnClickOverlay="true" @close="closeHasCar">
|
||
</u-picker>
|
||
<u-picker :show="showWhenMarried" :columns="dict.whenMarried" @confirm="confirmWhenMarried"
|
||
@cancel="closeWhenMarried" :closeOnClickOverlay="true" @close="closeWhenMarried"></u-picker>
|
||
|
||
<u-picker :show="showAgeMate" :columns="dict.ageMate" @confirm="confirmAgeMate" @cancel="closeAgeMate" :closeOnClickOverlay="true" @close="closeAgeMate">
|
||
</u-picker>
|
||
<u-picker :show="showHeightMate" :columns="dict.heightMate" @confirm="confirmHeightMate"
|
||
@cancel="closeHeightMate" :closeOnClickOverlay="true" @close="closeHeightMate"></u-picker>
|
||
<u-picker :show="showMonthlyPayMate" :columns="dict.monthlyPayMate" @confirm="confirmMonthlyPayMate"
|
||
@cancel="closeMonthlyPayMate" :closeOnClickOverlay="true" @close="closeMonthlyPayMate"></u-picker>
|
||
<u-picker :show="showYearlyPayMate" :columns="dict.yearlyPayMate" @confirm="confirmYearlyPayMate"
|
||
@cancel="closeYearlyPayMate" :closeOnClickOverlay="true" @close="closeYearlyPayMate"></u-picker>
|
||
<u-picker :show="showEducationMate" :columns="dict.educationMate" @confirm="confirmEducationMate"
|
||
@cancel="closeEducationMate" :closeOnClickOverlay="true" @close="closeEducationMate"></u-picker>
|
||
<u-picker :show="showMaritalStatusMate" :columns="dict.maritalStatusMate"
|
||
@confirm="confirmMaritalStatusMate" @cancel="closeMaritalStatusMate" :closeOnClickOverlay="true" @close="closeMaritalStatusMate"></u-picker>
|
||
<u-picker :show="showHasChildrenMate" :columns="dict.hasChildrenMate" @confirm="confirmHasChildrenMate"
|
||
@cancel="closeHasChildrenMate" :closeOnClickOverlay="true" @close="closeHasChildrenMate"></u-picker>
|
||
<u-picker :show="showHaveChildMate" :columns="dict.haveChildMate" @confirm="confirmHaveChildMate"
|
||
@cancel="closeHaveChildMate" :closeOnClickOverlay="true" @close="closeHaveChildMate"></u-picker>
|
||
<u-picker :show="showPositionMate" :columns="dict.positionMate" @confirm="confirmPositionMate"
|
||
@cancel="closePositionMate" :closeOnClickOverlay="true" @close="closePositionMate"></u-picker>
|
||
<u-picker :show="showWeightMate" :columns="dict.weightMate" @confirm="confirmWeightMate"
|
||
@cancel="closeWeightMate" :closeOnClickOverlay="true" @close="closeWeightMate"></u-picker>
|
||
<u-picker :show="showShapeMate" :columns="dict.shapeMate" @confirm="confirmShapeMate"
|
||
@cancel="closeShapeMate" :closeOnClickOverlay="true" @close="closeShapeMate"></u-picker>
|
||
<u-picker :show="showIsSmokingMate" :columns="dict.isSmokingMate" @confirm="confirmIsSmokingMate"
|
||
@cancel="closeIsSmokingMate" :closeOnClickOverlay="true" @close="closeIsSmokingMate"></u-picker>
|
||
<u-picker :show="showIsDrinkMate" :columns="dict.isDrinkMate" @confirm="confirmIsDrinkMate"
|
||
@cancel="closeIsDrinkMate" :closeOnClickOverlay="true" @close="closeIsDrinkMate"></u-picker>
|
||
<u-picker :show="showHasCarMate" :columns="dict.hasCarMate" @confirm="confirmHasCarMate"
|
||
@cancel="closeHasCarMate" :closeOnClickOverlay="true" @close="closeHasCarMate"></u-picker>
|
||
<u-picker :show="showHasHouseMate" :columns="dict.hasHouseMate" @confirm="confirmHasHouseMate"
|
||
@cancel="closeHasHouseMate" :closeOnClickOverlay="true" @close="closeHasHouseMate"></u-picker>
|
||
<u-picker :show="showWhenMarriedMate" :columns="dict.whenMarriedMate" @confirm="confirmWhenMarriedMate"
|
||
@cancel="closeWhenMarriedMate" :closeOnClickOverlay="true" @close="closeWhenMarriedMate"></u-picker>
|
||
<!-- 地址选择器 -->
|
||
<liu-customize-sel ref="area" @change="chooseSuccess"></liu-customize-sel>
|
||
<!-- 地址选择器 -->
|
||
<liu-customize-sel ref="areaMate" @change="chooseSuccessMate"></liu-customize-sel>
|
||
</block>
|
||
</u--form>
|
||
<view class="" style="height: 300rpx;">
|
||
|
||
</view>
|
||
<!-- 操作按钮 -->
|
||
<view class="footer">
|
||
<view class="btn-wrapper">
|
||
<u-button text="保存" color="linear-gradient(#27b0fd, #3f72f4)" :disabled="disabled"
|
||
shape="circle" @click="handleSubmit()"></u-button>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import store from '@/store'
|
||
import {
|
||
fileUrl
|
||
} from '@/config.js'
|
||
import {
|
||
dateFormat
|
||
} from '@/utils/util.js'
|
||
import * as UserApi from '@/api/user'
|
||
import * as UserProfileApi from '@/api/love-user-profile.js'
|
||
import * as UploadApi from '@/api/upload'
|
||
import * as DictApi from '@/api/dict.js'
|
||
|
||
// tab栏数据
|
||
const tabs = [{
|
||
name: `基本信息`,
|
||
value: 10
|
||
}, {
|
||
name: `择偶条件`,
|
||
value: 20
|
||
}]
|
||
|
||
export default {
|
||
data() {
|
||
return {
|
||
tabs,
|
||
tabIndex: 10,
|
||
dict: null,
|
||
// 按钮禁用
|
||
disabled: false,
|
||
// 头像路径 (用于显示)
|
||
avatarUrl: '',
|
||
// 临时图片 (用于上传)
|
||
tempFile: null,
|
||
// 表单数据
|
||
form: {
|
||
userInfo: null
|
||
},
|
||
// 用户资料
|
||
mate: {
|
||
|
||
},
|
||
fileList1: [],
|
||
interest: [],
|
||
loading: false,
|
||
// regionsData: [
|
||
// ['广西壮族自治区','广东'],
|
||
// ['南宁市', '北海市', '贵港市']
|
||
// ],
|
||
showRegion: false,
|
||
showRegionMate: false,
|
||
showSex: false,
|
||
showBirthday: false,
|
||
showMonthlyPay: false,
|
||
showYearlyPay: false,
|
||
showEducation: false,
|
||
showMaritalStatus: false,
|
||
showHasChildren: false,
|
||
showHaveChild: false,
|
||
showPosition: false,
|
||
showHeight: false,
|
||
showWeight: false,
|
||
showShape: false,
|
||
showHasHouse: false,
|
||
showHasCar: false,
|
||
showWhenMarried: false,
|
||
|
||
showAgeMate: false,
|
||
showHeightMate: false,
|
||
showMonthlyPayMate: false,
|
||
showYearlyPayMate: false,
|
||
showEducationMate: false,
|
||
showMaritalStatusMate: false,
|
||
showHasChildrenMate: false,
|
||
showHaveChildMate: false,
|
||
showPositionMate: false,
|
||
showWeightMate: false,
|
||
showShapeMate: false,
|
||
showIsSmokingMate: false,
|
||
showIsDrinkMate: false,
|
||
showHasCarMate: false,
|
||
showHasHouseMate: false,
|
||
showWhenMarriedMate: false,
|
||
|
||
actions: [{
|
||
name: '男',
|
||
},
|
||
{
|
||
name: '女',
|
||
},
|
||
{
|
||
name: '保密',
|
||
},
|
||
],
|
||
minDate: '',
|
||
columnsHeight: [
|
||
['160cm', '170cm', '180cm']
|
||
],
|
||
birthday: Number(new Date()),
|
||
// 验证规则
|
||
rules: {
|
||
'nickname': {
|
||
type: 'string',
|
||
required: true,
|
||
message: '请填写姓名',
|
||
trigger: ['blur', 'change']
|
||
},
|
||
'sexName': {
|
||
type: 'string',
|
||
max: 2,
|
||
required: true,
|
||
message: '请选择男或女',
|
||
trigger: ['blur', 'change']
|
||
},
|
||
},
|
||
}
|
||
},
|
||
|
||
/**
|
||
* 生命周期函数--监听页面加载
|
||
*/
|
||
onLoad() {
|
||
this.getUserProfile()
|
||
this.getDict()
|
||
},
|
||
|
||
// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
|
||
onReady() {
|
||
// this.$refs.uForm.setRules(this.rules)
|
||
// 微信小程序需要用此写法
|
||
// this.$refs.datetimePicker.setFormatter(this.formatter)
|
||
},
|
||
|
||
methods: {
|
||
// 用户资料表
|
||
getUserProfile() {
|
||
const app = this
|
||
const userId = uni.getStorageSync('userId')
|
||
UserProfileApi.getUserProfile(userId).then(res => {
|
||
app.form = res.data
|
||
const userInfo = res.data.userInfo
|
||
app.form.avatar = userInfo.avatar
|
||
app.form.nickname = userInfo.nickname
|
||
app.form.comments = userInfo.comments
|
||
app.form.sexName = userInfo.sexName
|
||
app.form.birthday = userInfo.birthday
|
||
app.interest = JSON.parse(app.form.interest) || []
|
||
app.fileList1 = JSON.parse(app.form.images) || []
|
||
app.isLogin = false
|
||
}).catch(err => {
|
||
app.$success(err)
|
||
})
|
||
},
|
||
|
||
getDict() {
|
||
DictApi.listDictionary().then(res => {
|
||
this.dict = res.data;
|
||
})
|
||
},
|
||
onChangeTab(e) {
|
||
const app = this
|
||
app.tabIndex = e.value
|
||
},
|
||
sexSelect(e) {
|
||
const app = this
|
||
console.log("e.name: ", e.name);
|
||
app.form.sexName = e.name
|
||
if (e.name == '男') {
|
||
app.form.userInfo.sex = 1
|
||
}
|
||
if (e.name == '女') {
|
||
app.form.userInfo.sex = 2
|
||
}
|
||
if (e.name == '保密') {
|
||
app.form.userInfo.sex = 0
|
||
}
|
||
console.log("app.form.userInfo.sex: ", app.form.userInfo.sex);
|
||
this.$refs.uForm.validateField('sexName')
|
||
},
|
||
// 选择微信地址
|
||
// #ifdef MP-WEIXIN
|
||
chooseAddress() {
|
||
const {
|
||
form,
|
||
$refs
|
||
} = this
|
||
uni.chooseAddress({
|
||
success(res) {
|
||
const names = $refs.sRegion.getOptionItemByNames(res)
|
||
form.name = res.userName
|
||
form.phone = res.telNumber
|
||
form.detail = res.detailInfo
|
||
form.region = names.length > 0 ? names : []
|
||
}
|
||
})
|
||
},
|
||
// #endif
|
||
|
||
// 点击头像按钮事件
|
||
onClickAvatar() {
|
||
// #ifdef MP-WEIXIN
|
||
return
|
||
// #endif
|
||
this.chooseImage()
|
||
},
|
||
|
||
// 选择头像事件 - 仅限微信小程序
|
||
// #ifdef MP-WEIXIN
|
||
onChooseAvatar({
|
||
detail
|
||
}) {
|
||
const app = this
|
||
app.form.userInfo.avatar = detail.avatarUrl
|
||
app.tempFile = detail.avatarUrl
|
||
// 上传头像图片
|
||
app.uploadFile()
|
||
},
|
||
// #endif
|
||
|
||
// 选择图片
|
||
chooseImage() {
|
||
const app = this
|
||
console.log("选择图片: ");
|
||
// 选择图片
|
||
uni.chooseImage({
|
||
count: 1,
|
||
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
||
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
||
success(chooseImageRes) {
|
||
const tempFilePaths = chooseImageRes.tempFilePaths;
|
||
UploadApi.uploadFile({
|
||
filePath: tempFilePaths[0],
|
||
fileType: 'image',
|
||
name: 'file'
|
||
}).then(res => {
|
||
console.log("res: ", res);
|
||
app.form.avatar = fileUrl + res.data.path
|
||
console.log("form: ", app.form);
|
||
|
||
})
|
||
}
|
||
});
|
||
},
|
||
|
||
// 上传图片
|
||
uploadFile() {
|
||
const app = this
|
||
UploadApi.uploadFile({
|
||
filePath: app.tempFile,
|
||
fileType: 'image',
|
||
name: 'file'
|
||
}).then(res => {
|
||
app.form.userInfo.avatar = res.data.url
|
||
UserProfileApi.updateUserProfile(app.form)
|
||
})
|
||
},
|
||
|
||
// 确认修改
|
||
async handleSubmit() {
|
||
const app = this
|
||
if (app.disabled === true) return
|
||
console.log("app.tempFile: ", app.tempFile);
|
||
this.$refs.uForm.validate().then(() => {
|
||
app.form.interest = JSON.stringify(app.interest)
|
||
app.form.images = JSON.stringify(app.fileList1)
|
||
UserProfileApi.updateUserProfile(app.form).then(result => {
|
||
app.$toast(result.message)
|
||
}).catch(err => {
|
||
uni.$u.toast(err)
|
||
})
|
||
}).catch(errors => {
|
||
// uni.$u.toast('校验失败')
|
||
})
|
||
|
||
|
||
|
||
// 判断是否重复提交
|
||
// if (app.disabled === true) return
|
||
// app.$refs.uForm.validate(async valid => {
|
||
// if (valid) {
|
||
// console.log("valid: ", valid);
|
||
// // 按钮禁用
|
||
// app.disabled = true
|
||
// // 先上传头像图片
|
||
// if (app.tempFile) {
|
||
// await app.uploadFile()
|
||
// }
|
||
// // 提交保存个人信息
|
||
// UserApi.updateUser(app.form)
|
||
// .then(result => {
|
||
// app.$toast(result.message)
|
||
// setTimeout(() => {
|
||
// app.disabled = false
|
||
// uni.navigateBack()
|
||
// }, 1500)
|
||
// })
|
||
// .catch(err => app.disabled = false)
|
||
// }
|
||
// })
|
||
},
|
||
onInterest(text) {
|
||
const app = this
|
||
if (app.interest.indexOf(text) > -1) {
|
||
console.log("1: ");
|
||
app.interest.splice(app.interest.indexOf(text), 1)
|
||
} else {
|
||
console.log("2: ");
|
||
app.interest.push(text)
|
||
}
|
||
},
|
||
inArr(text) {
|
||
const {
|
||
interest
|
||
} = this
|
||
if (interest.indexOf(text) > -1) {
|
||
return false
|
||
}
|
||
return true
|
||
},
|
||
|
||
// 绑定昵称输入框 (用于微信小程序端快速填写昵称能力)
|
||
onInputNickName(val) {
|
||
console.log("val: ", val);
|
||
if (val) {
|
||
this.form.nickname = val
|
||
}
|
||
},
|
||
formatter(type, value) {
|
||
if (type === 'year') {
|
||
return `${value}年`
|
||
}
|
||
if (type === 'month') {
|
||
return `${value}月`
|
||
}
|
||
if (type === 'day') {
|
||
return `${value}日`
|
||
}
|
||
console.log("value: ", value);
|
||
return value
|
||
},
|
||
onArea() {
|
||
this.$refs.area.open()
|
||
},
|
||
//地址选择成功
|
||
chooseSuccess(e) {
|
||
const data = e.value
|
||
this.form.province = data[0].label
|
||
this.form.city = data[1].label
|
||
this.form.region = data[2].label
|
||
this.form.area = `${data[0].label} ${data[1].label} ${data[2].label}`
|
||
// 同步user表
|
||
this.form.userInfo.province = data[0].label
|
||
this.form.userInfo.city = data[1].label
|
||
this.form.userInfo.region = data[2].label
|
||
this.form.userInfo.address = `${data[0].label} ${data[1].label} ${data[2].label}`
|
||
},
|
||
onAreaMate() {
|
||
this.$refs.areaMate.open()
|
||
},
|
||
//地址选择成功
|
||
chooseSuccessMate(e) {
|
||
const data = e.value
|
||
this.form.provinceMate = data[0].label
|
||
this.form.cityMate = data[1].label
|
||
this.form.regionMate = data[2].label
|
||
this.form.areaMate = `${data[0].label} ${data[1].label} ${data[2].label}`
|
||
},
|
||
changeHandler(e) {
|
||
console.log("e: ", e);
|
||
},
|
||
confirmRegion(e) {
|
||
this.form.region = e.value[0] + ' ' + e.value[1]
|
||
this.showRegion = false
|
||
},
|
||
confirmRegionMate(e) {
|
||
this.form.regionMate = e.value[0] + ' ' + e.value[1]
|
||
this.showRegionMate = false
|
||
this.showRegion = false
|
||
},
|
||
confirmBirthday(e) {
|
||
const birthday = dateFormat('YYYY-mm-dd', new Date(e.value))
|
||
this.form.birthday = birthday
|
||
this.form.userInfo.birthday = birthday
|
||
this.showBirthday = false
|
||
// 计算年龄
|
||
const birthdayYear = dateFormat('YYYY', new Date(e.value))
|
||
const age = new Date().getFullYear() - birthdayYear
|
||
this.form.age = age
|
||
this.form.userInfo.age = age
|
||
},
|
||
confirmHeight(e) {
|
||
console.log("e: ", e);
|
||
this.form.height = e.value[0]
|
||
this.showHeight = false
|
||
},
|
||
confirmMonthlyPay(e) {
|
||
this.form.monthlyPay = e.value[0]
|
||
this.showMonthlyPay = false
|
||
},
|
||
confirmYearlyPay(e){
|
||
this.form.yearlyPay = e.value[0]
|
||
this.showYearlyPay = false
|
||
},
|
||
confirmEducation(e) {
|
||
this.form.education = e.value[0]
|
||
this.showEducation = false
|
||
},
|
||
confirmMaritalStatus(e) {
|
||
this.form.maritalStatus = e.value[0]
|
||
this.showMaritalStatus = false
|
||
},
|
||
confirmHasChildren(e) {
|
||
this.form.hasChildren = e.value[0]
|
||
this.showHasChildren = false
|
||
},
|
||
confirmHaveChild(e) {
|
||
this.form.haveChild = e.value[0]
|
||
this.showHaveChild = false
|
||
},
|
||
confirmPosition(e) {
|
||
this.form.position = e.value[0]
|
||
this.showPosition = false
|
||
},
|
||
confirmWeight(e) {
|
||
this.form.weight = e.value[0]
|
||
this.showWeight = false
|
||
},
|
||
confirmShape(e) {
|
||
this.form.shape = e.value[0]
|
||
this.showShape = false
|
||
},
|
||
confirmHasHouse(e) {
|
||
this.form.hasHouse = e.value[0]
|
||
this.showHasHouse = false
|
||
},
|
||
confirmHasCar(e) {
|
||
this.form.hasCar = e.value[0]
|
||
this.showHasCar = false
|
||
},
|
||
confirmWhenMarried(e) {
|
||
this.form.whenMarried = e.value[0]
|
||
this.showWhenMarried = false
|
||
},
|
||
confirmAgeMate(e) {
|
||
this.form.ageMate = e.value[0]
|
||
this.showAgeMate = false
|
||
},
|
||
confirmHeightMate(e) {
|
||
this.form.heightMate = e.value[0]
|
||
this.showHeightMate = false
|
||
},
|
||
confirmMonthlyPayMate(e) {
|
||
this.form.monthlyPayMate = e.value[0]
|
||
this.showMonthlyPayMate = false
|
||
},
|
||
confirmYearlyPayMate(e) {
|
||
this.form.yearlyPayMate = e.value[0]
|
||
this.showYearlyPayMate = false
|
||
},
|
||
confirmEducationMate(e) {
|
||
this.form.educationMate = e.value[0]
|
||
this.showEducationMate = false
|
||
},
|
||
confirmMaritalStatusMate(e) {
|
||
this.form.maritalStatusMate = e.value[0]
|
||
this.showMaritalStatusMate = false
|
||
},
|
||
confirmHasChildrenMate(e) {
|
||
this.form.hasChildrenMate = e.value[0]
|
||
this.showHasChildrenMate = false
|
||
},
|
||
confirmHaveChildMate(e) {
|
||
this.form.haveChildMate = e.value[0]
|
||
this.showHaveChildMate = false
|
||
},
|
||
confirmPositionMate(e) {
|
||
this.form.vocationMate = e.value[0]
|
||
this.showPositionMate = false
|
||
},
|
||
confirmWeightMate(e) {
|
||
this.form.weightMate = e.value[0]
|
||
this.showWeightMate = false
|
||
},
|
||
confirmShapeMate(e) {
|
||
this.form.shapeMate = e.value[0]
|
||
this.showShapeMate = false
|
||
},
|
||
confirmIsSmokingMate(e) {
|
||
this.form.isSmokingMate = e.value[0]
|
||
this.showIsSmokingMate = false
|
||
},
|
||
confirmIsDrinkMate(e) {
|
||
this.form.isDrinkMate = e.value[0]
|
||
this.showIsDrinkMate = false
|
||
},
|
||
confirmHasCarMate(e) {
|
||
this.form.hasCarMate = e.value[0]
|
||
this.showHasCarMate = false
|
||
},
|
||
confirmHasHouseMate(e) {
|
||
this.form.hasHouseMate = e.value[0]
|
||
this.showHasHouseMate = false
|
||
},
|
||
confirmWhenMarriedMate(e) {
|
||
this.form.whenMarriedMate = e.value[0]
|
||
this.showWhenMarriedMate = false
|
||
},
|
||
closeRegionMate() {
|
||
this.showRegionMate = false
|
||
},
|
||
closeBirthday() {
|
||
this.showBirthday = false
|
||
},
|
||
closeHeight() {
|
||
this.showHeight = false
|
||
},
|
||
closeHeight() {
|
||
this.showHeight = false
|
||
},
|
||
closeMonthlyPay() {
|
||
this.showMonthlyPay = false
|
||
},
|
||
closeEducation() {
|
||
this.showEducation = false
|
||
},
|
||
closeMaritalStatus() {
|
||
this.showMaritalStatus = false
|
||
},
|
||
closeHasChildren() {
|
||
this.showHasChildren = false
|
||
},
|
||
closeHaveChild() {
|
||
this.showHaveChild = false
|
||
},
|
||
closePosition() {
|
||
this.showPosition = false
|
||
},
|
||
closeHeight() {
|
||
this.showHeight = false
|
||
},
|
||
closeWeight() {
|
||
this.showWeight = false
|
||
},
|
||
closeHasCar() {
|
||
this.showHasCar = false
|
||
},
|
||
closeYearlyPayMate(){
|
||
this.showYearlyPayMate = false
|
||
},
|
||
closeYearlyPay(){
|
||
this.showYearlyPay = false
|
||
},
|
||
closeShape(){
|
||
this.showShape = false
|
||
},
|
||
closeHasHouse() {
|
||
this.showHasHouse = false
|
||
},
|
||
closeWhenMarried() {
|
||
this.showWhenMarried = false
|
||
},
|
||
closeAgeMate() {
|
||
this.showAgeMate = false
|
||
},
|
||
closeHeightMate() {
|
||
this.showHeightMate = false
|
||
},
|
||
closeMonthlyPayMate() {
|
||
this.showMonthlyPayMate = false
|
||
},
|
||
closeEducationMate() {
|
||
this.showEducationMate = false
|
||
},
|
||
closeMaritalStatusMate() {
|
||
this.showMaritalStatusMate = false
|
||
},
|
||
closeHasChildrenMate() {
|
||
this.showHasChildrenMate = false
|
||
},
|
||
closeHaveChildMate() {
|
||
this.showHaveChildMate = false
|
||
},
|
||
closePositionMate() {
|
||
this.showPositionMate = false
|
||
},
|
||
closeWeightMate() {
|
||
this.showWeightMate = false
|
||
},
|
||
closeShapeMate() {
|
||
this.showShapeMate = false
|
||
},
|
||
closeIsSmokingMate() {
|
||
this.showIsSmokingMate = false
|
||
},
|
||
closeIsDrinkMate() {
|
||
this.showIsDrinkMate = false
|
||
},
|
||
closeHasCarMate() {
|
||
this.showHasCarMate = false
|
||
},
|
||
closeHasHouseMate() {
|
||
this.showHasHouseMate = false
|
||
},
|
||
closeWhenMarriedMate() {
|
||
this.showWhenMarriedMate = false
|
||
},
|
||
pickerRegion(e) {
|
||
console.log("e: ", e);
|
||
},
|
||
chooseBgImage() {
|
||
const app = this;
|
||
uni.showActionSheet({
|
||
itemList: ['更换背景图'],
|
||
success() {
|
||
uni.chooseImage({
|
||
count: 1,
|
||
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
||
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
||
success(chooseImageRes) {
|
||
const tempFilePaths = chooseImageRes.tempFilePaths;
|
||
app.uploadFilePromise(tempFilePaths[0]).then(result=>{
|
||
app.form.userInfo.bgImage = result.url
|
||
console.log(app.form, result.url);
|
||
})
|
||
}
|
||
});
|
||
}
|
||
})
|
||
|
||
},
|
||
// 删除图片
|
||
deletePic(event) {
|
||
this[`fileList${event.name}`].splice(event.index, 1)
|
||
},
|
||
// 新增图片
|
||
async afterRead(event) {
|
||
console.log("event: ", event);
|
||
// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
|
||
let lists = [].concat(event.file)
|
||
let fileListLen = this[`fileList${event.name}`].length
|
||
lists.map((item) => {
|
||
this[`fileList${event.name}`].push({
|
||
...item,
|
||
status: 'uploading',
|
||
message: '上传中'
|
||
})
|
||
})
|
||
for (let i = 0; i < lists.length; i++) {
|
||
const result = await this.uploadFilePromise(lists[i].url)
|
||
let item = this[`fileList${event.name}`][fileListLen]
|
||
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
|
||
status: 'success',
|
||
message: '',
|
||
url: result.url,
|
||
thumb: result.thumbUrl
|
||
}))
|
||
fileListLen++
|
||
}
|
||
},
|
||
uploadFilePromise(url) {
|
||
return new Promise((resolve, reject) => {
|
||
UploadApi.uploadFile({
|
||
filePath: url,
|
||
fileType: 'image',
|
||
name: 'file',
|
||
header: {
|
||
Authorization: uni.getStorageSync('AccessToken')
|
||
},
|
||
}).then(result => {
|
||
setTimeout(() => {
|
||
resolve(result.data)
|
||
}, 1000)
|
||
}).catch(err => {
|
||
console.log("err: ", err);
|
||
})
|
||
// UploadApi.uploadFile()
|
||
// let a = uni.uploadFile({
|
||
// url: fileUrl + '/file/image', // 仅为示例,非真实的接口地址
|
||
// filePath: url,
|
||
// name: 'file',
|
||
// header: {
|
||
// Authorization: uni.getStorageSync('AccessToken')
|
||
// },
|
||
// formData: {
|
||
// user: 'test'
|
||
// },
|
||
// success: (res) => {
|
||
// const result = JSON.parse(res.data)
|
||
// setTimeout(() => {
|
||
// resolve(result)
|
||
// }, 1000)
|
||
// }
|
||
// });
|
||
})
|
||
},
|
||
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style>
|
||
page {
|
||
background: #f7f8fa;
|
||
}
|
||
</style>
|
||
<style lang="scss" scoped>
|
||
.container {}
|
||
.bg {
|
||
width: 750rpx;
|
||
height: 100%;
|
||
position: absolute;
|
||
top: 0;
|
||
z-index: 0;
|
||
background-color: #0d0119;
|
||
opacity: .3;
|
||
}
|
||
.page-title {
|
||
width: 94%;
|
||
margin: 0 auto;
|
||
padding-top: 40rpx;
|
||
font-size: 28rpx;
|
||
color: rgba(69, 90, 100, 0.6);
|
||
}
|
||
|
||
|
||
|
||
.header {
|
||
height: 220rpx;
|
||
padding: 40rpx 0;
|
||
display: flex;
|
||
justify-content: center;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
background: url('https://oss-aishangjia.oss-cn-shenzhen.aliyuncs.com/v2_rww72n.jpg') no-repeat;
|
||
background-size: 100%;
|
||
color: #cccccc;
|
||
font-size: 24rpx;
|
||
position: relative;
|
||
overflow: hidden;
|
||
button{
|
||
background: none;
|
||
}
|
||
|
||
text {
|
||
padding: 12rpx 0;
|
||
}
|
||
}
|
||
|
||
.form-wrapper {
|
||
margin: 20rpx auto 20rpx auto;
|
||
padding: 20rpx;
|
||
width: 680rpx;
|
||
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
|
||
border-radius: 16rpx;
|
||
background: #fff;
|
||
.nickname{
|
||
text-align: right !important;
|
||
}
|
||
.interest {
|
||
padding: 10rpx;
|
||
display: flex;
|
||
justify-content: flex-start;
|
||
flex-wrap: wrap;
|
||
|
||
.u-page__tag-item {
|
||
margin-bottom: 10rpx;
|
||
margin-right: 10rpx;
|
||
white-space: nowrap;
|
||
}
|
||
}
|
||
}
|
||
|
||
/* 底部操作栏 */
|
||
|
||
.footer {
|
||
margin-top: 50rpx;
|
||
padding-bottom: 50rpx;
|
||
position: fixed;
|
||
left: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
padding-top: 20rpx;
|
||
.btn-wrapper {
|
||
width: 360rpx;
|
||
margin: auto;
|
||
// display: flex;
|
||
// align-items: center;
|
||
padding: 0 20rpx;
|
||
}
|
||
|
||
.btn-item {
|
||
flex: 1;
|
||
font-size: 28rpx;
|
||
height: 86rpx;
|
||
color: #fff;
|
||
border-radius: 50rpx;
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
}
|
||
|
||
.btn-item-wechat {
|
||
background: #0ba90b;
|
||
margin-bottom: 26rpx;
|
||
}
|
||
|
||
.btn-item-main {
|
||
background: linear-gradient(to right, $main-bg, $main-bg2);
|
||
color: $main-text;
|
||
|
||
// 禁用按钮
|
||
&.disabled {
|
||
opacity: 0.6;
|
||
}
|
||
}
|
||
|
||
}
|
||
.tabs {
|
||
width: 700rpx;
|
||
margin: auto;
|
||
display: flex;
|
||
justify-content: center;
|
||
}
|
||
.textarea{
|
||
background-color: #f3f3f3;
|
||
}
|
||
.images{
|
||
padding: 10rpx;
|
||
}
|
||
|
||
.his-head {
|
||
display: flex;
|
||
justify-content: flex-start;
|
||
align-items: center;
|
||
font-size: 30rpx;
|
||
padding: 20rpx 0 20rpx 0;
|
||
color: #681752;
|
||
|
||
.line {
|
||
background-color: #681752;
|
||
width: 8rpx;
|
||
height: 30rpx;
|
||
margin-right: 12rpx;
|
||
}
|
||
|
||
.icon {
|
||
float: right;
|
||
}
|
||
|
||
}
|
||
|
||
</style>
|