|
@@ -5,7 +5,8 @@
|
|
<view class="value icon">
|
|
<view class="value icon">
|
|
<view class="title">头像</view>
|
|
<view class="title">头像</view>
|
|
<view class="label">
|
|
<view class="label">
|
|
- <image class="image" mode="aspectFill" :src="form.icon||config.logoUrl" @tap="Preview"></image>
|
|
|
|
|
|
+ <image name="icon" class="image" mode="aspectFill" :src="form.icon||config.logoUrl"
|
|
|
|
+ @tap="Preview"></image>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="remark">
|
|
<view class="remark">
|
|
@@ -14,19 +15,19 @@
|
|
<view class="value other">
|
|
<view class="value other">
|
|
<view class="title">姓名</view>
|
|
<view class="title">姓名</view>
|
|
<view class="label">
|
|
<view class="label">
|
|
- <input class="input" :value="form.name" placeholder="点击登录" />
|
|
|
|
|
|
+ <input name="name" class="input" :value="form.name" placeholder="请输入真实姓名" />
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="value other margin">
|
|
<view class="value other margin">
|
|
<view class="title">昵称</view>
|
|
<view class="title">昵称</view>
|
|
<view class="label">
|
|
<view class="label">
|
|
- <input class="input" :value="form.nickname" placeholder="请输入昵称" />
|
|
|
|
|
|
+ <input name="nickname" class="input" :value="form.nickname" placeholder="请输入昵称" />
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="value other">
|
|
<view class="value other">
|
|
<view class="title">性别</view>
|
|
<view class="title">性别</view>
|
|
<view class="label">
|
|
<view class="label">
|
|
- <picker @change="sexChange" :value="index" :range="sexList" range-key="dictLabel">
|
|
|
|
|
|
+ <picker name="sex" @change="sexChange" :value="index" :range="sexList" range-key="dictLabel">
|
|
<view class="picker">{{form.sex||'请选择性别'}}</view>
|
|
<view class="picker">{{form.sex||'请选择性别'}}</view>
|
|
</picker>
|
|
</picker>
|
|
</view>
|
|
</view>
|
|
@@ -34,12 +35,12 @@
|
|
<view class="value other">
|
|
<view class="value other">
|
|
<view class="title">手机号</view>
|
|
<view class="title">手机号</view>
|
|
<view class="label">
|
|
<view class="label">
|
|
- <input class="input" :value="form.phone" placeholder="请输入手机号" />
|
|
|
|
|
|
+ <input name="phone" class="input" :value="form.phone" placeholder="请输入手机号" />
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="value other">
|
|
<view class="value other">
|
|
<view class="title">城市</view>
|
|
<view class="title">城市</view>
|
|
- <view class="label" @tap="toCity">
|
|
|
|
|
|
+ <view class="label" @tap="toCity" name="city">
|
|
<text v-if="form.city">{{form.city}}</text>
|
|
<text v-if="form.city">{{form.city}}</text>
|
|
<text v-else>请选择城市</text>
|
|
<text v-else>请选择城市</text>
|
|
</view>
|
|
</view>
|
|
@@ -47,19 +48,19 @@
|
|
<view class="value other">
|
|
<view class="value other">
|
|
<view class="title">身高</view>
|
|
<view class="title">身高</view>
|
|
<view class="label">
|
|
<view class="label">
|
|
- <input class="input" :value="form.height" placeholder="请输入身高" />
|
|
|
|
|
|
+ <input name="height" class="input" :value="form.height" placeholder="请输入身高(cm)" />
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="value other">
|
|
<view class="value other">
|
|
<view class="title">体重</view>
|
|
<view class="title">体重</view>
|
|
<view class="label">
|
|
<view class="label">
|
|
- <input class="input" :value="form.weight" placeholder="请输入体重" />
|
|
|
|
|
|
+ <input name="weight" class="input" :value="form.weight" placeholder="请输入体重(kg)" />
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="value other margin">
|
|
<view class="value other margin">
|
|
<view class="title">主要项目</view>
|
|
<view class="title">主要项目</view>
|
|
<view class="label">
|
|
<view class="label">
|
|
- <picker @change="typeChange" :value="index" :range="typeList" range-key="dictLabel">
|
|
|
|
|
|
+ <picker name="type" @change="typeChange" :value="index" :range="typeList" range-key="dictLabel">
|
|
<view class="picker">{{form.type||'请选择主要项目'}}</view>
|
|
<view class="picker">{{form.type||'请选择主要项目'}}</view>
|
|
</picker>
|
|
</picker>
|
|
</view>
|
|
</view>
|
|
@@ -67,13 +68,17 @@
|
|
<view class="value other">
|
|
<view class="value other">
|
|
<view class="title">球龄</view>
|
|
<view class="title">球龄</view>
|
|
<view class="label">
|
|
<view class="label">
|
|
- <input class="input" :value="form.ballYears" placeholder="请输入球龄" />
|
|
|
|
|
|
+ <picker name="ballYears" @change="ballYearsChange" :value="index" :range="ballYearsList"
|
|
|
|
+ range-key="dictLabel">
|
|
|
|
+ <view class="picker">{{form.ballYears||'请选择球龄'}}</view>
|
|
|
|
+ </picker>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="value other">
|
|
<view class="value other">
|
|
<view class="title">队内位置</view>
|
|
<view class="title">队内位置</view>
|
|
<view class="label">
|
|
<view class="label">
|
|
- <picker @change="placeChange" :value="index" :range="placeList" range-key="dictLabel">
|
|
|
|
|
|
+ <picker name="place" @change="placeChange" :value="index" :range="placeList"
|
|
|
|
+ range-key="dictLabel">
|
|
<view class="picker">{{form.place||'请选择队内位置'}}</view>
|
|
<view class="picker">{{form.place||'请选择队内位置'}}</view>
|
|
</picker>
|
|
</picker>
|
|
</view>
|
|
</view>
|
|
@@ -106,6 +111,7 @@
|
|
const sexList = ref([]);
|
|
const sexList = ref([]);
|
|
const typeList = ref([]);
|
|
const typeList = ref([]);
|
|
const placeList = ref([]);
|
|
const placeList = ref([]);
|
|
|
|
+ const ballYearsList = ref([]);
|
|
onLoad(async () => {
|
|
onLoad(async () => {
|
|
await searchOther();
|
|
await searchOther();
|
|
await searchConfig();
|
|
await searchConfig();
|
|
@@ -126,6 +132,9 @@
|
|
// 队内位置
|
|
// 队内位置
|
|
res = await $api(`dict/data/list`, 'GET', { dictType: 'sys_user_place' });
|
|
res = await $api(`dict/data/list`, 'GET', { dictType: 'sys_user_place' });
|
|
if (res.code === 200 && res.total > 0) placeList.value = res.rows
|
|
if (res.code === 200 && res.total > 0) placeList.value = res.rows
|
|
|
|
+ // 球龄
|
|
|
|
+ res = await $api(`dict/data/list`, 'GET', { dictType: 'sys_user_year' });
|
|
|
|
+ if (res.code === 200 && res.total > 0) ballYearsList.value = res.rows
|
|
};
|
|
};
|
|
// config信息
|
|
// config信息
|
|
const searchConfig = async () => {
|
|
const searchConfig = async () => {
|
|
@@ -137,7 +146,13 @@
|
|
openid: openid.value
|
|
openid: openid.value
|
|
});
|
|
});
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
- if (res.data) console.log(res.data);
|
|
|
|
|
|
+ if (res.data) {
|
|
|
|
+ form.value = res.data
|
|
|
|
+ form.value.sex = toData(form.value.sex, sexList.value)
|
|
|
|
+ form.value.type = toData(form.value.type, typeList.value)
|
|
|
|
+ form.value.place = toData(form.value.place, placeList.value)
|
|
|
|
+ form.value.ballYears = toData(form.value.ballYears, ballYearsList.value)
|
|
|
|
+ }
|
|
else {
|
|
else {
|
|
uni.navigateTo({
|
|
uni.navigateTo({
|
|
url: `/pages/login/index`,
|
|
url: `/pages/login/index`,
|
|
@@ -150,6 +165,10 @@
|
|
});
|
|
});
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+ // 处理字典表数据
|
|
|
|
+ const toData = (value, list) => {
|
|
|
|
+ if (value) return value = list[value].dictLabel
|
|
|
|
+ };
|
|
// 城市选择
|
|
// 城市选择
|
|
const toCity = () => {
|
|
const toCity = () => {
|
|
if (form.value.city) {
|
|
if (form.value.city) {
|
|
@@ -177,6 +196,11 @@
|
|
const data = placeList.value[e.detail.value]
|
|
const data = placeList.value[e.detail.value]
|
|
if (data) form.value.place = data.dictLabel
|
|
if (data) form.value.place = data.dictLabel
|
|
};
|
|
};
|
|
|
|
+ // 球龄选择
|
|
|
|
+ const ballYearsChange = (e) => {
|
|
|
|
+ const data = ballYearsList.value[e.detail.value]
|
|
|
|
+ if (data) form.value.ballYears = data.dictLabel
|
|
|
|
+ };
|
|
// 上传图片
|
|
// 上传图片
|
|
const Preview = () => {
|
|
const Preview = () => {
|
|
uni.chooseImage({
|
|
uni.chooseImage({
|
|
@@ -198,6 +222,31 @@
|
|
}
|
|
}
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
+ // 去除obj里为null的数据
|
|
|
|
+ const delEmptyQueryNodes = (obj = {}) => {
|
|
|
|
+ Object.keys(obj).forEach((key) => {
|
|
|
|
+ let value = obj[key];
|
|
|
|
+ value && typeof value === 'object' && delEmptyQueryNodes(value);
|
|
|
|
+ (value === '' || value === null || value === undefined || value.length === 0 || Object.keys(value).length === 0) && delete obj[key];
|
|
|
|
+ });
|
|
|
|
+ return obj;
|
|
|
|
+ };
|
|
|
|
+ // 保存
|
|
|
|
+ const formSubmit = async (e) => {
|
|
|
|
+ const data = delEmptyQueryNodes(e.detail.value)
|
|
|
|
+ data.id = form.value.id
|
|
|
|
+ if (form.value.icon) data.icon = form.value.icon
|
|
|
|
+ if (form.value.city) data.city = form.value.city
|
|
|
|
+ const arr = await $api(`matchUser`, 'put', data);
|
|
|
|
+ if (arr.code === 200) {
|
|
|
|
+ search();
|
|
|
|
+ } else {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: arr.msg,
|
|
|
|
+ icon: 'error'
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ };
|
|
</script>
|
|
</script>
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
.content {
|
|
.content {
|