| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722 |
- <!--
- 临时页面
- -->
- <template>
- <view class="box">
- <u-navbar :autoBack="true" title="志愿报名" bgColor="rgba(255,255,255,0)" :placeholder="true" titleStyle="font-weight:bold;color:#000000"></u-navbar>
- <view class="ban_box">
- <view class="ban_item2">
- <image class="top_img" src="https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/bm_top.png"></image>
- </view>
- <view class="ban_item1">
- <image class="top_img" src="https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/dt_ban2.png"></image>
- </view>
- </view>
- <text v-if="false">
- 你将作为一个指令处理助手,为我处理用户口述的指令。
- 用户将输入一些操作指令,例如:为我开灯,打开风扇,关灯,开卧室灯,空调调到16度等等。
- 你需要根据用户的指令,提取以下关键信息并输出,json格式:
- 1. success: 指令是否处理成功。
- 2. object: 指令的操作对象(例如:灯、风扇、空调等)
- 3. action: 指令的操作动作(例如:打开、关闭、调到等)
- 4. parameter: 指令的操作参数(例如:温度、亮度等)
- 你需要注意,用户的指令可能会有错误或不完整,若指令不完整,请输出1指令处理不成功。
- </text>
- <!-- 表单 -->
- <view class="example">
- <uni-forms style="padding: 0 20rpx 0 20rpx" label-position="top" ref="valiForm" :rules="rules" :modelValue="valiFormData">
- <uni-forms-item label="您的姓名" label-width="80px" required name="name">
- <uni-easyinput v-model="valiFormData.name" placeholder="请输入姓名" />
- </uni-forms-item>
- <uni-forms-item label="您的联系电话" label-width="100px" required name="mobile">
- <uni-easyinput type="number" v-model="valiFormData.mobile" placeholder="请输入联系电话" />
- </uni-forms-item>
- <uni-forms-item label="您的身份证" label-width="100px" required name="id_card">
- <uni-easyinput type="idcard" v-model="valiFormData.id_card" placeholder="请输入身份证号" />
- </uni-forms-item>
- <uni-forms-item label="您的区域" label-width="100px" required name="id_card">
- <uni-data-picker :localdata="regionList" popup-title="请选择班级" @change="onchange" @nodeclick="onnodeclick"></uni-data-picker>
- </uni-forms-item>
- <uni-forms-item label="住址" label-width="100px" required name="address">
- <uni-easyinput v-model="valiFormData.address" placeholder="请输入住址" />
- </uni-forms-item>
- <uni-forms-item label="单位" label-width="80px" required name="unit_name">
- <uni-easyinput v-model="valiFormData.unit_name" placeholder="请输入单位名称" />
- </uni-forms-item>
- <!-- <uni-forms-item label="备注" label-width="80px" required name="notesVal">
- <uni-easyinput v-model="valiFormData.notesVal" placeholder="请输入申请类型(个人、家庭、机构)" />
- </uni-forms-item> -->
- <uni-forms-item label="相关特长" label-width="80px" required name="intro">
- <uni-easyinput type="textarea" v-model="valiFormData.intro" placeholder="请输入相关特长或个人介绍(可上传个人优秀证明、奖项)" />
- <view @click="chooseFile" class="scfj">
- <view>上传文件</view>
- <view>
- <uni-icons type="wallet" size="18"></uni-icons>
- </view>
- </view>
- </uni-forms-item>
-
- <!-- 政治面貌 -->
- <uni-forms-item label="政治面貌" label-width="100px" required name="political_status">
- <uni-data-select v-model="valiFormData.political_status" :localdata="politicalStatusList" placeholder="请选择政治面貌" />
- </uni-forms-item>
-
- <!-- 联系邮箱 -->
- <uni-forms-item label="联系邮箱" label-width="100px" name="email">
- <uni-easyinput type="email" v-model="valiFormData.email" placeholder="请输入联系邮箱" />
- </uni-forms-item>
-
- <!-- 报名选项 -->
- <uni-forms-item label="报名选项" label-width="100px" required name="type">
- <view class="checkbox-group">
- <uni-data-checkbox v-model="valiFormData.type" :localdata="[
- {value: 'volunteer', text: '巡查守护'},
- {value: 'xuanjiang', text: '宣讲传播'}
- ]" multiple="true" />
- </view>
- </uni-forms-item>
-
- <!-- 本人承诺 -->
- <uni-forms-item label="本人承诺" label-width="100px" required name="commitment" >
- <view class="commitment-text">
- 本人保证以上所填信息真实、有效,如有虚假,由此产生的一切后果由本人承担。
- </view>
- <view style="background-color: #fdfaf6;">
- <uni-data-checkbox v-model="valiFormData.commitment" :localdata="[
- {value: 1, text: '我已阅读并同意以上承诺'},
- {value: 0, text: '不同意'}
- ]" />
- </view>
- </uni-forms-item>
- </uni-forms>
- </view>
- <view class="text-wrapper_3" @click="submit('valiForm')">
- <view class="bm_tit">报名</view>
- </view>
-
- <!-- 对话框 -->
- <uni-popup ref="popup" type="center">
- <view class="modal-container">
- <text class="modal-title">{{ modalTitle }}</text>
- <view class="modal-content">
- <u-parse :content="modalContent"></u-parse>
- </view>
- <view class="modal-footer">
- <view class="modal-btn" @click="$refs.popup.close()">关闭</view>
- </view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- import { mapGetters } from 'vuex';
- let that;
- export default {
- data() {
- return {
- regionList: [],
- region_id: '',
- cr_id: '' /* 文物id */,
- modifyId: '' /* 修改资料的文物id */,
- volunteer_id: '' /* 志愿者id */,
-
- // 对话框相关变量
- showModal: false,
- modalContent: '' /* 对话框富文本内容 */,
- modalTitle: '' /* 对话框标题 */,
-
- // 性别列表
- genderList: [
- { value: '男', text: '男' },
- { value: '女', text: '女' }
- ],
-
- // 政治面貌列表
- politicalStatusList: [
- { value: '中共党员', text: '中共党员' },
- { value: '中共预备党员', text: '中共预备党员' },
- { value: '共青团员', text: '共青团员' },
- { value: '民主党派', text: '民主党派' },
- { value: '群众', text: '群众' }
- ],
-
-
- /* 表单数据 */
- valiFormData: {
- name: '',
- mobile: '',
- address: '',
- id_card: '',
- unit_name: '',
- fullurl: '',
- intro: '',
- political_status: '',
- email: '',
- type: [],
- },
- /* 校验规则 */
- rules: {
-
- // 对name字段进行必填验证
- name: {
- // name 字段的校验规则
- rules: [
- // 校验 name 不能为空
- {
- required: true,
- errorMessage: '请输入姓名'
- },
- // 对name字段进行长度验证
- {
- minLength: 1,
- maxLength: 6,
- errorMessage: '{label}长度在 {minLength} 到 {maxLength} 个字符'
- }
- ],
- // 当前表单域的字段中文名,可不输入
- label: '姓名',
- validateTrigger: 'submit'
- },
- /* 手机号校验 */
- mobile: {
- // mobile 字段的校验规则
- rules: [
- // 校验 mobile 不能为空
- {
- required: true,
- errorMessage: '请输入联系电话'
- },
- // 对mobile字段进行长度验证
- {
- minLength: 11,
- maxLength: 11,
- errorMessage: '{label}长度为 {minLength} 个字符'
- }
- ],
- // 当前表单域的字段中文名,可不输入
- label: '手机号',
- validateTrigger: 'submit'
- },
- /* 身份证校验 */
- id_card: {
- // idCard 字段的校验规则
- rules: [
- // 校验 idCard 不能为空
- {
- required: true,
- errorMessage: '请输入身份证号'
- }
- // 对idCard字段进行长度验证
- // {
- // minLength: 18,
- // maxLength: 18,
- // errorMessage: '{label}长度为 {minLength} 个字符'
- // }
- ],
- // 当前表单域的字段中文名,可不输入
- label: '身份证号',
- validateTrigger: 'submit'
- },
- /* 单位 */
- unit_name: {
- rules: [
- // 校验 unit 不能为空
- {
- required: true,
- errorMessage: '请输入单位名称'
- }
- ]
- },
- address: {
- rules: [
- // 校验 住址 不能为空
- {
- required: true,
- errorMessage: '请输入单位名称'
- }
- ]
- },
- // notesVal: {
- // rules: [
- // // 校验 申请类型 不能为空
- // {
- // required: true,
- // errorMessage: '请输入申请类型'
- // }
- // ]
- // },
- intro: {
- rules: [
- {
- required: true,
- errorMessage: '请输入认领原因或个人介绍'
- }
- ]
- },
-
- // 政治面貌校验
- political_status: {
- rules: [
- {
- required: true,
- errorMessage: '请选择政治面貌'
- }
- ],
- label: '政治面貌',
- validateTrigger: 'submit'
- },
-
- // 联系邮箱校验
- email: {
- rules: [
- {
- required: false,
- errorMessage: '请输入联系邮箱'
- },
- {
- pattern: /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]{2,6}$/,
- errorMessage: '请输入正确的邮箱格式'
- }
- ],
- label: '联系邮箱',
- validateTrigger: 'submit'
- },
-
- // 报名选项校验
- type: {
- rules: [
- {
- required: true,
- errorMessage: '请至少选择一个报名选项'
- },
- {
- type: 'array',
- minLength: 1,
- errorMessage: '请至少选择一个报名选项'
- }
- ],
- label: '报名选项',
- validateTrigger: 'submit'
- },
-
- // 本人承诺校验
- commitment: {
- rules: [
- {
- required: true,
- errorMessage: '请阅读并同意本人承诺'
- },
- {
- type: 'boolean',
- enum: [true],
- errorMessage: '请阅读并同意本人承诺'
- }
- ],
- label: '本人承诺',
- validateTrigger: 'submit'
- }
- }
- };
- },
- onLoad(o) {
- that = this;
- this.user = this.$common.userInfo();
- this.cr_id = o.id;
- this.volunteer_id = o.volunteer_id;
- this.modifyId = o.modifyId;
- this.getCategoryCascadeList();
- if (this.isLogin) {
- setTimeout(() => {
- // 调用API获取对话框内容并显示
- this.$api.getVolunteerNotify({}, function (res) {
- if (res.data.status === 1) {
- that.modalContent = res.data.introduce;
- that.modalTitle = res.data.title;
- that.$refs.popup.open();
- }
- });
- }, 200);
- }
- },
- computed: {
- ...mapGetters(['isLogin'])
- },
- methods: {
- onchange(e) {
- const value = e.detail.value;
- },
- onnodeclick(node) {
- this.region_id = node.value;
- console.log(node);
- },
- // 区域
- getCategoryCascadeList() {
- this.$api.getCategoryCascadeList({ main_body_id: 1, pid: 5, level: 2 }, function (res) {
- that.regionList = res.data;
- });
- },
- // 测试上传文件
- chooseFile() {
- let userToken = '';
- let auth = this.$db.get('auth');
- userToken = auth.token;
- wx.chooseMessageFile({
- count: 1,
- type: 'file', // 修改为支持的文档类型
- // 配置后导致读取不到聊天文件
- // extension: ['.doc', '.xlsx', '.docx', '.ppt'],
- success(res) {
- const tempFilePaths = res.tempFiles;
- uni.uploadFile({
- url: that.$config.baseUrl + 'api/common/upload?token=' + userToken,
- filePath: tempFilePaths[0].path,
- name: 'file',
- header: {
- 'content-type': 'multipart/form-data' // 根据实际情况设置请求头
- },
- formData: {}, // 如果需要,添加额外的form数据
- success: (res) => {
- console.log('上传成功,服务器响应数据:', res.data);
- let url = JSON.parse(res.data);
- that.valiFormData.fullurl = url.data.fullurl;
- // console.log('生成的链接', that.valiFormData.fullurl);
- that.$common.errorToShow('上传成功');
- },
- fail: (err) => {
- console.error('文件上传失败:', err);
- }
- });
- }
- });
- },
- submit() {
- this.$refs.valiForm.validate(['id'], async (err, valiFormData) => {
- console.log('this.valiFormData.commitment', this.valiFormData.commitment);
-
- if (this.valiFormData.commitment !== 1) {
- that.$common.errorToShow('请先阅读并同意本人承诺');
- return;
- }
- if (!err) {
- console.log('校验成功');
- /* 检验成功 */
- const {
- name, mobile, address, id_card,
- political_status,
- unit_name, intro, fullurl,
- email,
- } = this.valiFormData;
- this.$api.scanApplyVolunteer(
- {
- main_body_id: 1,
- name: name,
- mobile: mobile,
- address: address,
- unit_name: unit_name,
- id_card: id_card,
- intro: intro,
- file: fullurl,
- politics_status: political_status,
- email: email,
- type: this.valiFormData.type,
- region_id: this.region_id,
- },
- function (res) {
- if (res.code === 1) {
- that.$common.errorToShow(res.msg);
- setTimeout(() => {
- uni.switchTab({
- url: '/pages/shouhu/shouhu'
- });
- }, 1000);
- } else {
- if (res.data) {
- setTimeout(() => {
- uni.switchTab({
- url: '/pages/shouhu/shouhu'
- });
- }, 1000);
- }
- that.$common.errorToShow(res.msg);
- }
- }
- );
- } else {
- that.$common.errorToShow('请完善信息');
- }
- });
- },
- }
- };
- </script>
- <style>
- .box {
- width: 100%;
- padding-bottom: 50rpx;
- background-image: url('https://huli-app.wenlvti.net/app_static/WenWuGuanJia/image/xy_bgt.png');
- background-size: 100% 100%;
- background-repeat: repeat-y;
- height: auto;
- }
- .ban_box {
- position: relative;
- margin-top: 40rpx;
- }
- .top_img {
- width: 100%;
- height: 100%;
- }
- .ban_item1 {
- position: absolute;
- top: -20rpx;
- left: 233rpx;
- width: 290rpx;
- height: 290rpx;
- margin: auto;
- }
- .ban_item2 {
- width: 250rpx;
- height: 250rpx;
- margin: auto;
- }
- /deep/.uni-forms-item__error {
- color: red !important;
- }
- /deep/ .uni-stat__select {
- padding: 0!important;
- }
- .is-input-border {
- background-color: #f7dfc0 !important;
- }
- .uni-forms-item__label {
- color: #000000 !important;
- }
- .text-wrapper_3 {
- margin: auto;
- margin-top: 50rpx;
- height: 80rpx;
- flex-direction: column;
- width: 240rpx;
- background: url('/static/img/dt_bg2.png') no-repeat;
- background-size: 100% 100%;
- }
- .bm_tit {
- text-align: center;
- font-size: 36rpx;
- line-height: 80rpx;
- letter-spacing: 6rpx;
- text-align: center;
- font-weight: 700;
- background: linear-gradient(180deg, #af7e44 0%, #934b36 100%);
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- }
- .example {
- height: 87%;
- margin: 20rpx 32rpx 0 32rpx;
- }
- .uni-forms {
- padding: 0 20rpx 0 20rpx;
- }
- .uni-forms-item {
- margin-bottom: 30rpx !important;
- }
- .active {
- border: 6rpx solid #efb57a;
- border-radius: 10rpx;
- }
- .img {
- width: 230rpx;
- height: 250rpx;
- border: 6rpx solid #efb57a;
- border-radius: 10rpx;
- }
- .map_tit {
- display: flex;
- align-items: center;
- margin-left: 60rpx;
- margin-top: 40rpx;
- font-size: 40rpx;
- font-family: Songti SC, Songti SC;
- font-weight: 900;
- line-height: 52rpx;
- color: #444444;
- }
- .scarch_box {
- width: 430rpx;
- height: 82rpx;
- padding: 15rpx 0 0 30rpx;
- /* background-image: url('/static/img/search_bg1.png');
- background-size: 100% 100%; */
- }
- .rl_box {
- width: 90%;
- margin: auto;
- margin-top: 40rpx;
- display: flex;
- justify-content: space-between;
- }
- .rl_item {
- width: 188rpx;
- height: 102rpx;
- background-image: url('/static/img/rl_bg.png');
- background-size: 100% 100%;
- }
- .tit {
- text-align: center;
- line-height: 102rpx;
- font-weight: 700;
- font-size: 36rpx;
- letter-spacing: 6rpx;
- background: linear-gradient(180deg, #af7e44 0%, #934b36 100%);
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- }
- .scfj {
- width: 170rpx;
- height: 50rpc;
- line-height: 50rpx;
- align-items: center;
- display: flex;
- background-color: #f7dfc0;
- position: absolute;
- top: -60rpx;
- right: 2rpx;
- border-radius: 5rpx;
- justify-content: space-around;
- }
- .tit2 {
- text-align: center;
- line-height: 66rpx;
- font-weight: 700;
- font-size: 32rpx;
- letter-spacing: 6rpx;
- background: linear-gradient(180deg, #af7e44 0%, #934b36 100%);
- -webkit-background-clip: text;
- -webkit-text-fill-color: transparent;
- }
- .is-input-error-border {
- border: none !important;
- }
- .xx_box {
- padding: 20rpx;
- background-color: #e1bf9a;
- width: 660rpx;
- height: 560rpx;
- padding-top: 80rpx;
- }
- .xx_tit {
- height: 360rpx;
- font-size: 30rpx;
- padding: 20rpx;
- text-indent: 2em;
- background-color: #f3e3d3;
- overflow: scroll;
- }
- /* 性别选择样式 */
- .gender-select {
- display: flex;
- align-items: center;
- }
- /* 政治面貌选择样式 */
- .political-status-select {
- width: 100%;
- }
- /* 报名选项多选框样式 */
- .checkbox-group {
- display: flex;
- flex-direction: column;
- gap: 20rpx;
- }
- .checkbox-item {
- display: flex;
- align-items: center;
- gap: 10rpx;
- }
- .checkbox-item text {
- font-size: 32rpx;
- color: #333;
- }
- /* 本人承诺样式 */
- .commitment-text {
- font-size: 28rpx;
- color: #666;
- line-height: 44rpx;
- padding-bottom: 20rpx;
- text-indent: 2em;
- background-color: #fdfaf6;
- }
- .commitment-agree {
- font-size: 30rpx;
- color: #333;
- margin-left: 10rpx;
- }
-
- /* 对话框样式 */
- .modal-container {
- width: 80%;
- background-color: #ffffff;
- border-radius: 12rpx;
- overflow: hidden;
- margin-left: 10%;
- }
-
-
- .modal-title {
- display: block;
- font-size: 36rpx;
- font-weight: 700;
- color: #444444;
- text-align: center;
- padding: 20rpx 0;
- }
- .modal-content {
- padding: 30rpx;
- max-height: 500rpx;
- overflow-y: auto;
- }
-
- .modal-footer {
- padding: 20rpx;
- text-align: center;
- border-top: 1rpx solid #e5e5e5;
- }
-
- .modal-btn {
- width: 200rpx;
- height: 70rpx;
- line-height: 70rpx;
- background-color: #af7e44;
- color: #ffffff;
- border-radius: 35rpx;
- text-align: center;
- margin: 0 auto;
- font-size: 30rpx;
- font-weight: 500;
- }
- </style>
|