index.vue 3.4 KB
<!--
 * @Date: 2022-09-27 17:13:05
 * @LastEditors: hookehuyr hookehuyr@gmail.com
 * @LastEditTime: 2022-10-20 16:56:34
 * @FilePath: /swx/src/pages/joinInfo/index.vue
 * @Description: 活动报名
-->
<template>
  <view class="join-activity-page">
    <view class="activity-title">
      <view class="box">
        <text class="bg-gradient" style="font-size: 1.25rem;">活动报名信息</text>
      </view>
    </view>
    <view class="at-input">
      <view class="at-input__container">
        <label class="h5-label at-input__title at-input__title">姓名</label>
        <input class="h5-input at-input__input" placeholder-class="placeholder" :value="username" placeholder="" :disabled="true"/>
      </view>
    </view>
    <view class="at-input">
      <view class="at-input__container">
        <label class="h5-label at-input__title at-input__title">手机号</label>
        <input class="h5-input at-input__input" placeholder-class="placeholder" :value="phone" placeholder="" :disabled="true"/>
      </view>
    </view>
    <view class="at-input">
      <view class="at-input__container">
        <label class="h5-label at-input__title at-input__title">年龄段</label>
        <input class="h5-input at-input__input" placeholder-class="placeholder" :value="age_group" placeholder="" :disabled="true"/>
      </view>
    </view>
    <view class="at-input">
      <view class="at-input__container">
        <label class="h5-label at-input__title at-input__title">性别</label>
        <input class="h5-input at-input__input" placeholder-class="placeholder" :value="user_sex" placeholder="" :disabled="true"/>
      </view>
    </view>
    <view v-for="(item, index) in extend" :key="index">
      <view class="at-input">
        <view class="at-input__container">
          <label class="h5-label at-input__title at-input__title">{{ item.title }}</label>
          <input class="h5-input at-input__input" placeholder-class="placeholder" :value="item.value" placeholder="" :disabled="true"/>
        </view>
      </view>
    </view>
  </view>

  <view class="confirm-wrapper-page">
    <view class="box">
      <view @tap="cancelJoin" class="button">取消报名</view>
    </view>
    <view class="box">
      <view @tap="editJoin" class="button">确认修改报名</view>
    </view>
  </view>
</template>

<script setup>
import { ref, onMounted } from "vue";
import "taro-ui-vue3/dist/style/components/input.scss";
import Taro from '@tarojs/taro'
import { myInfoAPI } from '@/api/Reg/index';
import { getCurrentPageParam } from "@/utils/weapp";

const username = ref('');
const phone = ref('');
const age_group = ref('');
const user_sex = ref('');
const extend = ref([]);

onMounted(async () => {
  const { code, data } = await myInfoAPI({ i: getCurrentPageParam().reg_id });
  if (code) {
    username.value = data.name;
    phone.value = data.phone;
    age_group.value = data.age_group;
    user_sex.value = data.gender === 'man' ? '男士' : '女士';
    // 额外信息
    if (data.extend) {
      for (const key in data.extend) {
        extend.value.push({
          title: key,
          value: data.extend[key],
        });
      }
    }
  }
})

const cancelJoin = (val) => {
  Taro.showToast({
    title: '取消成功',
    icon: 'success',
    duration: 2000
  });
}

const editJoin = (val) => {
  Taro.navigateTo({
    url: '../joinActivity/index'
  })
}
</script>

<script>
import "./index.less";
export default {
  name: "demoPage",
};
</script>