hookehuyr

新增报名信息模块

...@@ -37,3 +37,80 @@ ...@@ -37,3 +37,80 @@
37 top: -0.5rem; 37 top: -0.5rem;
38 } 38 }
39 } 39 }
40 +
41 +.form-item {
42 + padding: 0.5rem 1rem;
43 + background-color: #FFFFFF;
44 + .form-item-title {
45 + font-size: 1rem;
46 + &.border {
47 + padding-bottom: 0.5rem;
48 + border-bottom: 1px solid #F2F2F2;
49 + }
50 + &.required::before {
51 + color: red;
52 + content: "*";
53 + font-size: 0.9rem;
54 + left: 0.5rem;
55 + position: absolute;
56 + }
57 + .sub {
58 + color: #999;
59 + }
60 + }
61 +}
62 +
63 +.sign-box {
64 + width: 100%;
65 + display: flex;
66 + flex-wrap: wrap;
67 + background-color: #FFFFFF;
68 + padding-bottom: 1rem;
69 + .sign-item {
70 + flex: 1;
71 + width: 27%;
72 + min-width: 27%;
73 + max-width: 27%;
74 + border: 1px solid #999999;
75 + color: #999999;
76 + margin: 1rem;
77 + margin-right: 0;
78 + margin-bottom: 0;
79 + text-align: center;
80 + padding: 0.5rem 0;
81 + text {
82 + position: relative;
83 + &.required::before {
84 + color: red;
85 + content: "*";
86 + font-size: 0.9rem;
87 + left: -0.5rem;
88 + position: absolute;
89 + }
90 + }
91 + &.checked {
92 + border: 1px solid #199A74;
93 + color: #199A74;
94 + }
95 + }
96 +}
97 +
98 +.wrapper {
99 + display: flex;
100 + align-items: center;
101 + justify-content: center;
102 + height: 100%;
103 +}
104 +
105 +.block {
106 + background-color: #fff;
107 + border-radius: 0.6rem;
108 +}
109 +
110 +.bg-gradient {
111 + background: linear-gradient(#B3DDC9, #B3DDC9) no-repeat;
112 + /*调整下划线的宽度占百分之百 高度是3px */
113 + background-size: 100% 1vw;
114 + /* 调整下划线的起始位置 左侧是0 上边是1.15em */
115 + background-position: 0 1rem;
116 +}
......
1 <!-- 1 <!--
2 * @Date: 2022-09-21 16:04:10 2 * @Date: 2022-09-21 16:04:10
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-09-21 18:15:10 4 + * @LastEditTime: 2022-09-22 14:47:45
5 * @FilePath: /swx/src/pages/createActivity/index.vue 5 * @FilePath: /swx/src/pages/createActivity/index.vue
6 * @Description: 创建活动页面 6 * @Description: 创建活动页面
7 --> 7 -->
8 <template> 8 <template>
9 <view> 9 <view>
10 <van-cell-group inset> 10 <van-cell-group inset>
11 - <van-field :value="value1" 11 + <van-field
12 + :value="value1"
12 label-class="label-class" 13 label-class="label-class"
13 input-class="input-class" 14 input-class="input-class"
14 label="主办方" 15 label="主办方"
...@@ -33,8 +34,8 @@ ...@@ -33,8 +34,8 @@
33 @change="onChange" 34 @change="onChange"
34 /> 35 />
35 <view class="divide-line"></view> 36 <view class="divide-line"></view>
36 - <view style="padding: 0.5rem; background-color: #FFFFFF;"> 37 + <view class="form-item">
37 - <view class="uploader-title" style="font-size: 1rem;"><text style="color: red;">*</text>活动封面图<text style="color: #999;">(图片比例16:9展示最佳)</text></view> 38 + <view class="form-item-title required">活动封面图<text class="sub">(图片比例16:9展示最佳)</text></view>
38 <van-uploader v-if="!has_image" @after-read="afterRead"> 39 <van-uploader v-if="!has_image" @after-read="afterRead">
39 <view class="upload-box" :style="uploaderStyle"> 40 <view class="upload-box" :style="uploaderStyle">
40 <van-icon :name="icon_upload" size="5rem" class="upload-icon" /> 41 <van-icon :name="icon_upload" size="5rem" class="upload-icon" />
...@@ -45,17 +46,90 @@ ...@@ -45,17 +46,90 @@
45 <van-icon name="clear" size="1.5rem" color="#000" class="upload-close" @tap="removeUploadImage" /> 46 <van-icon name="clear" size="1.5rem" color="#000" class="upload-close" @tap="removeUploadImage" />
46 </view> 47 </view>
47 </view> 48 </view>
49 + <view class="divide-line"></view>
50 + <view class="form-item">
51 + <view class="form-item-title border">活动详情</view>
52 + <van-field
53 + :value="message"
54 + input-class="input-class"
55 + label=""
56 + type="textarea"
57 + placeholder="开始输入活动详情介绍"
58 + :autosize="{ maxHeight: 200, minHeight: 100 }"
59 + custom-style="padding-left: 0;"
60 + />
61 + </view>
62 + <view class="divide-line"></view>
63 + <view class="form-item">
64 + <view class="form-item-title">报名信息<text class="sub">( <text style="color: red;">*</text>为必填项,单击启用,长按修改)</text></view>
65 + </view>
66 + <view class="sign-box">
67 + <view @tap="onTapSign(item)" @longpress="onLongPressSign(item)" v-for="(item, index) in signInfo" :key="index" class="sign-item" :class="{ 'checked': item.checked }"><text class="required">{{ item.label }}</text></view>
68 + <!-- <view class="sign-item"><text class="">推荐人</text></view> -->
69 + <view class="sign-item"><van-icon name="plus" /></view>
70 + </view>
48 </van-cell-group> 71 </van-cell-group>
49 </view> 72 </view>
50 <view @tap="onSubmit">确定发布</view> 73 <view @tap="onSubmit">确定发布</view>
74 + <van-overlay :show="show_edit_sign" z-index="999">
75 + <view class="wrapper">
76 + <view class="block">
77 + <view style="padding: 1rem 1rem 0.5rem 1rem; text-align: center;">
78 + <text class="bg-gradient" style="font-size: 1.15rem;">报名信息</text>
79 + </view>
80 + <!-- <view>
81 + <AtInput
82 + name='value1'
83 + title='标准五个字'
84 + type='text'
85 + placeholder='使用 v-model:value 更新 value 值'
86 + v-model:value="value1"
87 + />
88 + </view> -->
89 + <view style="width: 22rem;">
90 + <van-field
91 + :value="message"
92 + label-class="label-class"
93 + input-class="input-class"
94 + rows="1"
95 + autosize
96 + label="字段名称"
97 + type="textarea"
98 + placeholder="请输入字段名称(6个字以内)"
99 + placeholder-style="color: #999;"
100 + :required="true"
101 + :maxlength="6"
102 + :border="true"
103 + @change="onChange"
104 + />
105 + <view class="form-item" style="overflow: auto; border-bottom: 1px solid #F2F2F2;">
106 + <view class="form-item-title" style="float: left; padding-top: 0.5rem;">是否必填</view>
107 + <van-switch
108 + style="float: right; padding-top: 0.5rem;"
109 + :checked="checked"
110 + @change="onChangeEdit"
111 + size="1.5rem"
112 + active-color="#199A74"
113 + inactive-color="#FFFFFF"
114 + />
115 + </view>
116 + <view style="padding: 1rem 0; margin: 1rem; text-align: center;">
117 + <view @tap="closeEditSign" style="color: #FFFFFF; background-color: #199A74; padding: 0.5rem 1rem; border-radius: 1rem;">确定</view>
118 + </view>
119 + </view>
120 + </view>
121 + </view>
122 + </van-overlay>
51 </template> 123 </template>
52 124
53 <script setup> 125 <script setup>
54 import { ref, onMounted, nextTick } from "vue"; 126 import { ref, onMounted, nextTick } from "vue";
55 // import icon_home1 from '@/images/icon/home01@2x.png' 127 // import icon_home1 from '@/images/icon/home01@2x.png'
56 import icon_upload from '@/images/icon/upload@2x.png' 128 import icon_upload from '@/images/icon/upload@2x.png'
129 +
57 const value1 = ref(''); 130 const value1 = ref('');
58 const message = ref(''); 131 const message = ref('');
132 +const checked = ref(false);
59 133
60 const onSubmit = () => { 134 const onSubmit = () => {
61 console.warn(message.value); 135 console.warn(message.value);
...@@ -87,7 +161,7 @@ onMounted(() => { ...@@ -87,7 +161,7 @@ onMounted(() => {
87 nextTick(() => { 161 nextTick(() => {
88 setTimeout(() => { 162 setTimeout(() => {
89 // 获取元素宽度 163 // 获取元素宽度
90 - wx.createSelectorQuery().selectAll('.uploader-title').boundingClientRect(function (rect) { 164 + wx.createSelectorQuery().selectAll('.form-item-title').boundingClientRect(function (rect) {
91 uploaderStyle.value = { 165 uploaderStyle.value = {
92 width: rect[0].width - 8 + 'px' 166 width: rect[0].width - 8 + 'px'
93 } 167 }
...@@ -95,7 +169,49 @@ onMounted(() => { ...@@ -95,7 +169,49 @@ onMounted(() => {
95 }).exec() 169 }).exec()
96 }, 100) 170 }, 100)
97 }) 171 })
98 -}) 172 +});
173 +
174 +const signInfo = ref([{
175 + key: 'name',
176 + label: '姓名',
177 + checked: 1,
178 + required: 1
179 +}, {
180 + key: 'phone',
181 + label: '手机号',
182 + checked: 1,
183 + required: 1
184 +}, {
185 + key: 'sex',
186 + label: '性别',
187 + checked: 1,
188 + required: 1
189 +}, {
190 + key: 'age',
191 + label: '年龄段',
192 + checked: 1,
193 + required: 1
194 +}]);
195 +
196 +const onTapSign = (item) => {
197 + item.checked = !item.checked
198 +}
199 +
200 +const onLongPressSign = (item) => {
201 + console.warn(item);
202 + show_edit_sign.value = true;
203 +}
204 +
205 +const show_edit_sign = ref(false)
206 +
207 +const onChangeEdit = ({ detail }) => {
208 + console.warn(detail);
209 + checked.value = detail;
210 +}
211 +
212 +const closeEditSign = () => {
213 + show_edit_sign.value = false;
214 +}
99 215
100 </script> 216 </script>
101 217
......
1 /* 1 /*
2 * @Date: 2022-09-19 14:11:06 2 * @Date: 2022-09-19 14:11:06
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-09-21 16:12:09 4 + * @LastEditTime: 2022-09-22 14:02:05
5 * @FilePath: /swx/vantComponentConf.js 5 * @FilePath: /swx/vantComponentConf.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
...@@ -32,6 +32,7 @@ const vantComponentNames = [ ...@@ -32,6 +32,7 @@ const vantComponentNames = [
32 "checkbox", 32 "checkbox",
33 "transition", 33 "transition",
34 "uploader", 34 "uploader",
35 + "switch",
35 ]; 36 ];
36 37
37 module.exports = vantComponentNames; 38 module.exports = vantComponentNames;
......