123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- <template>
- <view class="content">
- <view class="one">
- <form @submit="formSubmit">
- <view class="value icon">
- <view class="title">头像</view>
- <view class="label">
- <image class="image" mode="aspectFill" :src="form.icon||config.logoUrl"></image>
- </view>
- </view>
- <view class="remark">
- 实名信息(仅用于赛事报名、参赛证功能)
- </view>
- <view class="value other">
- <view class="title">姓名</view>
- <view class="label">
- <input class="input" :value="form.name" placeholder="点击登录" />
- </view>
- </view>
- <view class="value other margin">
- <view class="title">昵称</view>
- <view class="label">
- <input class="input" :value="form.nickname" placeholder="请输入昵称" />
- </view>
- </view>
- <view class="value other">
- <view class="title">性别</view>
- <view class="label">
- <picker @change="sexChange" :value="index" :range="sexList" range-key="dictLabel">
- <view class="picker">{{form.sex||'请选择性别'}}</view>
- </picker>
- </view>
- </view>
- <view class="value other">
- <view class="title">手机号</view>
- <view class="label">
- <input class="input" :value="form.phone" placeholder="请输入手机号" />
- </view>
- </view>
- <view class="value other">
- <view class="title">城市</view>
- <view class="label">
- <cityPicker :showSheetView="showSheetView" :defaultIndexs="[0,0,0]" @onSelected="onSelected">
- </cityPicker>
- </view>
- </view>
- <view class="value other">
- <view class="title">身高</view>
- <view class="label">
- <input class="input" :value="form.height" placeholder="请输入身高" />
- </view>
- </view>
- <view class="value other">
- <view class="title">体重</view>
- <view class="label">
- <input class="input" :value="form.weight" placeholder="请输入体重" />
- </view>
- </view>
- <view class="value other margin">
- <view class="title">主要项目</view>
- <view class="label">
- <picker @change="typeChange" :value="index" :range="typeList" range-key="dictLabel">
- <view class="picker">{{form.type||'请选择主要项目'}}</view>
- </picker>
- </view>
- </view>
- <view class="value other">
- <view class="title">球龄</view>
- <view class="label">
- <input class="input" :value="form.ballYears" placeholder="请输入球龄" />
- </view>
- </view>
- <view class="value other">
- <view class="title">队内位置</view>
- <view class="label">
- <picker @change="placeChange" :value="index" :range="placeList" range-key="dictLabel">
- <view class="picker">{{form.place||'请选择队内位置'}}</view>
- </picker>
- </view>
- </view>
- <view class="button">
- <button type="primary" size="mini" form-type="submit">保存</button>
- </view>
- </form>
- </view>
- </view>
- </template>
- <script setup lang="ts">
- import { getCurrentInstance, computed, ref } from 'vue';
- import cityPicker from '../../components/cityPicker.vue';
- //该依赖已内置不需要单独安装
- import { onLoad } from "@dcloudio/uni-app";
- // 请求接口
- const $api = getCurrentInstance()?.appContext.config.globalProperties.$api;
- // openid
- const openid = computed(() => {
- return uni.getStorageSync('openid');
- })
- // 基本信息
- const config = ref({ logoUrl: '' });
- // 用户信息
- const form = ref({ icon: '' });
- // 城市选择器
- const showSheetView = ref(true);
- // 字典表
- const sexList = ref([]);
- const typeList = ref([]);
- const placeList = ref([]);
- onLoad(async () => {
- await searchOther();
- await searchConfig();
- await search()
- })
- // 查询其他信息
- const searchOther = async () => {
- let res;
- // 性别
- res = await $api(`dict/data/list`, 'GET', { dictType: 'sys_user_sex' });
- if (res.code === 200 && res.total > 0) sexList.value = res.rows
- // 主要项目
- res = await $api(`dict/data/list`, 'GET', { dictType: 'sys_user_type' });
- if (res.code === 200 && res.total > 0) typeList.value = res.rows
- // 队内位置
- res = await $api(`dict/data/list`, 'GET', { dictType: 'sys_user_place' });
- if (res.code === 200 && res.total > 0) placeList.value = res.rows
- };
- // config信息
- const searchConfig = async () => {
- config.value = uni.getStorageSync('config');
- };
- // 查询
- const search = async () => {
- const res = await $api(`matchUser/find`, 'GET', {
- openid: openid.value
- });
- if (res.code === 200) {
- if (res.data) console.log(res.data);
- else {
- uni.navigateTo({
- url: `/pages/login/index`,
- })
- }
- } else {
- uni.showToast({
- title: res.msg || '',
- icon: 'error',
- });
- }
- };
- // 选择市
- const onSelected = (row) => {
- console.log(row, '1');
- showSheetView.value = false
- };
- // 性别选择
- const sexChange = (e) => {
- const data = sexList.value[e.detail.value]
- if (data) form.value.sex = data.dictLabel
- };
- // 主要项目选择
- const typeChange = (e) => {
- const data = typeList.value[e.detail.value]
- if (data) form.value.type = data.dictLabel
- };
- // 队内位置别选择
- const placeChange = (e) => {
- const data = placeList.value[e.detail.value]
- if (data) form.value.place = data.dictLabel
- };
- </script>
- <style lang="scss" scoped>
- .content {
- display: flex;
- flex-direction: column;
- background-color: var(--footColor);
- .one {
- .icon {
- padding: 2vw;
- }
- .margin {
- margin: 3vw 0 0 0;
- }
- .other {
- padding: 3vw 2vw;
- border-bottom: 1px solid var(--footColor);
- }
- .value {
- display: flex;
- justify-content: space-between;
- align-items: center;
- background-color: var(--mainColor);
- .label {
- .input {
- text-align: right;
- }
- .image {
- width: 15vw;
- height: 15vw;
- border-radius: 20vw;
- }
- }
- }
- .remark {
- padding: 4vw 2vw;
- text-align: center;
- color: var(--f99Color);
- font-size: var(--font18Size);
- }
- .button {
- margin: 2vw 0 0 0;
- text-align: center;
- button {
- font-size: var(--font14Size);
- border-radius: 2vw;
- background: linear-gradient(to right, #00BFFF, #3F94F1, #7B68EE);
- }
- }
- }
- }
- </style>
|