index.vue 3.24 KB
<!--
 * @Date: 2022-09-27 17:13:05
 * @LastEditors: hookehuyr hookehuyr@gmail.com
 * @LastEditTime: 2022-09-28 16:35:18
 * @FilePath: /swx/src/pages/joinVolunteer/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 @tap="show_post_popup=true" class="h5-input at-input__input" placeholder-class="placeholder" :value="age_range" placeholder="请选择义工岗位" :disabled="true"/>
        <view style="margin-right: 1rem; margin-top: 0.5rem;"><van-icon :name="icon_sel" color="" /></view>
      </view>
    </view>
    <AtInput :border="true" title="姓名" type='text' placeholder='请输入姓名' v-model:value="username" />
    <AtInput :border="true" title="手机号" type='phone' placeholder='请输入手机号' v-model:value="phone" />
    <view class="at-input">
      <view class="at-input__container">
        <label class="h5-label at-input__title at-input__title">性别</label>
        <van-radio-group
          :value="user_sex"
          @change="onSexChange"
          direction="horizontal"
        >
          <van-radio name="female" checked-color="#199A74">男士</van-radio>
          <van-radio name="male" checked-color="#199A74">女士</van-radio>
        </van-radio-group>
      </view>
    </view>
  </view>
  <bottom-button @on-submit="onSubmit">确认报名</bottom-button>

  <!-- 年龄段弹出框 -->
  <van-popup :show="show_post_popup" position="bottom" custom-style="height: 40%;" :lock-scroll="true">
    <van-picker :show-toolbar="true" title="" confirm-button-text="确定" :columns="columns" toolbar-class="picker-toolbar"
      @confirm="onPostConfirm" @cancel="onPostCancel" @change="onPostChange" />
  </van-popup>
</template>

<script setup>
import { ref, onMounted } from "vue";
import { AtInput } from 'taro-ui-vue3'
import "taro-ui-vue3/dist/style/components/input.scss";
import icon_sel from '@/images/icon/sel@2x.png'
import bottomButton from "@/components/bottom-button";
import Taro from '@tarojs/taro'

const username = ref('');
const phone = ref('');
const age_range = ref('');
const user_sex = ref('');

onMounted(() => {
})

// const handleInput = (value) => {
//   console.warn(arr.value);
// }
const onSexChange = ({ detail }) => {
  user_sex.value = detail;
}

const show_post_popup = ref(false);
const post_status = ref('前台');
const columns = ref(['前台', '后台']);
const onPostChange = (event) => {
  const { picker, value, index } = event.detail;
  console.warn(value);
  console.warn(index);
  post_status.value = value;
}
const onPostConfirm = (event) => {
  show_post_popup.value = false;
}
const onPostCancel = (event) => {
  show_post_popup.value = false;
}

const onSubmit = (val) => {
  console.warn(val);
  Taro.showToast({
    title: '请检查输入项',
    icon: 'error',
    duration: 2000
  });
  // Taro.redirectTo({
  //   url: '../joinSuccess/index'
  // })
}
</script>

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