Showing
6 changed files
with
98 additions
and
44 deletions
| ... | @@ -20,10 +20,10 @@ | ... | @@ -20,10 +20,10 @@ |
| 20 | "@vant/weapp": "^1.10.3", | 20 | "@vant/weapp": "^1.10.3", |
| 21 | "axios": "^0.27.2", | 21 | "axios": "^0.27.2", |
| 22 | "axios-miniprogram": "^2.0.0-rc-2", | 22 | "axios-miniprogram": "^2.0.0-rc-2", |
| 23 | + "dayjs": "^1.11.5", | ||
| 23 | "pinia": "^2.0.6", | 24 | "pinia": "^2.0.6", |
| 24 | "taro-plugin-pinia": "^1.0.0", | 25 | "taro-plugin-pinia": "^1.0.0", |
| 25 | "taro-ui-vue3": "^1.0.0-alpha.21", | 26 | "taro-ui-vue3": "^1.0.0-alpha.21", |
| 26 | - "uuid": "^9.0.0", | ||
| 27 | "vant": "^4.0.0-alpha.3", | 27 | "vant": "^4.0.0-alpha.3", |
| 28 | "vue": "^3.2.24" | 28 | "vue": "^3.2.24" |
| 29 | }, | 29 | }, |
| ... | @@ -18386,15 +18386,6 @@ | ... | @@ -18386,15 +18386,6 @@ |
| 18386 | "node": ">= 0.4.0" | 18386 | "node": ">= 0.4.0" |
| 18387 | } | 18387 | } |
| 18388 | }, | 18388 | }, |
| 18389 | - "node_modules/uuid": { | ||
| 18390 | - "version": "9.0.0", | ||
| 18391 | - "resolved": "https://mirrors.cloud.tencent.com/npm/uuid/-/uuid-9.0.0.tgz", | ||
| 18392 | - "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", | ||
| 18393 | - "license": "MIT", | ||
| 18394 | - "bin": { | ||
| 18395 | - "uuid": "dist/bin/uuid" | ||
| 18396 | - } | ||
| 18397 | - }, | ||
| 18398 | "node_modules/v8-compile-cache": { | 18389 | "node_modules/v8-compile-cache": { |
| 18399 | "version": "2.3.0", | 18390 | "version": "2.3.0", |
| 18400 | "resolved": "https://mirrors.tencent.com/npm/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", | 18391 | "resolved": "https://mirrors.tencent.com/npm/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", |
| ... | @@ -32664,11 +32655,6 @@ | ... | @@ -32664,11 +32655,6 @@ |
| 32664 | "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", | 32655 | "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", |
| 32665 | "devOptional": true | 32656 | "devOptional": true |
| 32666 | }, | 32657 | }, |
| 32667 | - "uuid": { | ||
| 32668 | - "version": "9.0.0", | ||
| 32669 | - "resolved": "https://mirrors.cloud.tencent.com/npm/uuid/-/uuid-9.0.0.tgz", | ||
| 32670 | - "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==" | ||
| 32671 | - }, | ||
| 32672 | "v8-compile-cache": { | 32658 | "v8-compile-cache": { |
| 32673 | "version": "2.3.0", | 32659 | "version": "2.3.0", |
| 32674 | "resolved": "https://mirrors.tencent.com/npm/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", | 32660 | "resolved": "https://mirrors.tencent.com/npm/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", | ... | ... |
| ... | @@ -45,10 +45,10 @@ | ... | @@ -45,10 +45,10 @@ |
| 45 | "@vant/weapp": "^1.10.3", | 45 | "@vant/weapp": "^1.10.3", |
| 46 | "axios": "^0.27.2", | 46 | "axios": "^0.27.2", |
| 47 | "axios-miniprogram": "^2.0.0-rc-2", | 47 | "axios-miniprogram": "^2.0.0-rc-2", |
| 48 | + "dayjs": "^1.11.5", | ||
| 48 | "pinia": "^2.0.6", | 49 | "pinia": "^2.0.6", |
| 49 | "taro-plugin-pinia": "^1.0.0", | 50 | "taro-plugin-pinia": "^1.0.0", |
| 50 | "taro-ui-vue3": "^1.0.0-alpha.21", | 51 | "taro-ui-vue3": "^1.0.0-alpha.21", |
| 51 | - "uuid": "^9.0.0", | ||
| 52 | "vant": "^4.0.0-alpha.3", | 52 | "vant": "^4.0.0-alpha.3", |
| 53 | "vue": "^3.2.24" | 53 | "vue": "^3.2.24" |
| 54 | }, | 54 | }, | ... | ... |
| 1 | /* | 1 | /* |
| 2 | * @Date: 2022-10-14 17:26:56 | 2 | * @Date: 2022-10-14 17:26:56 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2022-10-14 17:31:38 | 4 | + * @LastEditTime: 2022-10-18 09:28:54 |
| 5 | * @FilePath: /swx/src/api/Host/index.js | 5 | * @FilePath: /swx/src/api/Host/index.js |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | */ | 7 | */ |
| ... | @@ -9,6 +9,7 @@ import { fn, fetch } from '../fn'; | ... | @@ -9,6 +9,7 @@ import { fn, fetch } from '../fn'; |
| 9 | 9 | ||
| 10 | const Api = { | 10 | const Api = { |
| 11 | HOST_LIST: '/srv/?a=host_list', | 11 | HOST_LIST: '/srv/?a=host_list', |
| 12 | + ACTIVITY_ADD: '/srv/?a=activity_add', | ||
| 12 | } | 13 | } |
| 13 | 14 | ||
| 14 | /** | 15 | /** |
| ... | @@ -16,3 +17,9 @@ const Api = { | ... | @@ -16,3 +17,9 @@ const Api = { |
| 16 | * @returns | 17 | * @returns |
| 17 | */ | 18 | */ |
| 18 | export const hostListAPI = (params) => fn(fetch.post(Api.HOST_LIST, params)); | 19 | export const hostListAPI = (params) => fn(fetch.post(Api.HOST_LIST, params)); |
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * @description: 新增活动 | ||
| 23 | + * @returns | ||
| 24 | + */ | ||
| 25 | +export const addActivityAPI = (params) => fn(fetch.post(Api.ACTIVITY_ADD, params)); | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2022-09-26 21:52:25 | 2 | * @Date: 2022-09-26 21:52:25 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2022-10-17 13:40:57 | 4 | + * @LastEditTime: 2022-10-18 09:52:24 |
| 5 | * @FilePath: /swx/src/components/activity-editor.vue | 5 | * @FilePath: /swx/src/components/activity-editor.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -146,11 +146,12 @@ export default { | ... | @@ -146,11 +146,12 @@ export default { |
| 146 | }, | 146 | }, |
| 147 | //监控输入 | 147 | //监控输入 |
| 148 | _onInputting: function (e) { | 148 | _onInputting: function (e) { |
| 149 | - let html = e.detail.html; | 149 | + this.$emit('on-input', e.detail) |
| 150 | - let text = e.detail.text; | 150 | + // let html = e.detail.html; |
| 151 | + // let text = e.detail.text; | ||
| 151 | // this.triggerEvent("input", { html: html, text: text }, {}); | 152 | // this.triggerEvent("input", { html: html, text: text }, {}); |
| 152 | - console.warn(html); | 153 | + // console.warn(html); |
| 153 | - console.warn(text); | 154 | + // console.warn(text); |
| 154 | } | 155 | } |
| 155 | } | 156 | } |
| 156 | } | 157 | } | ... | ... |
| 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-10-17 18:30:58 | 4 | + * @LastEditTime: 2022-10-18 11:09:05 |
| 5 | * @FilePath: /swx/src/pages/createActivity/index.vue | 5 | * @FilePath: /swx/src/pages/createActivity/index.vue |
| 6 | * @Description: 创建活动页面 | 6 | * @Description: 创建活动页面 |
| 7 | --> | 7 | --> |
| ... | @@ -31,7 +31,7 @@ | ... | @@ -31,7 +31,7 @@ |
| 31 | <view class="divide-line"></view> | 31 | <view class="divide-line"></view> |
| 32 | <view class="form-item"> | 32 | <view class="form-item"> |
| 33 | <view class="form-item-title border">活动详情</view> | 33 | <view class="form-item-title border">活动详情</view> |
| 34 | - <activity-editor name="editor" :showTabBar="true" placeholder="开始输入活动详情介绍"></activity-editor> | 34 | + <activity-editor name="editor" :showTabBar="true" placeholder="开始输入活动详情介绍" @on-input="onEditorInput"></activity-editor> |
| 35 | </view> | 35 | </view> |
| 36 | <view class="divide-line"></view> | 36 | <view class="divide-line"></view> |
| 37 | <view class="form-item"> | 37 | <view class="form-item"> |
| ... | @@ -261,7 +261,7 @@ | ... | @@ -261,7 +261,7 @@ |
| 261 | </template> | 261 | </template> |
| 262 | 262 | ||
| 263 | <script setup> | 263 | <script setup> |
| 264 | -import { ref, onMounted, nextTick } from "vue"; | 264 | +import { ref, onMounted, nextTick, toRefs } from "vue"; |
| 265 | // import icon_home1 from '@/images/icon/home01@2x.png' | 265 | // import icon_home1 from '@/images/icon/home01@2x.png' |
| 266 | import icon_upload from '@/images/icon/upload@2x.png' | 266 | import icon_upload from '@/images/icon/upload@2x.png' |
| 267 | import icon_vip from '@/images/icon/vip@2x.png' | 267 | import icon_vip from '@/images/icon/vip@2x.png' |
| ... | @@ -269,12 +269,12 @@ import icon_sel from '@/images/icon/sel@2x.png' | ... | @@ -269,12 +269,12 @@ import icon_sel from '@/images/icon/sel@2x.png' |
| 269 | import timePickerData from "@/components/time-picker-data/picker"; | 269 | import timePickerData from "@/components/time-picker-data/picker"; |
| 270 | import activityEditor from "@/components/activity-editor"; | 270 | import activityEditor from "@/components/activity-editor"; |
| 271 | import { getCurrentPageUrl, getCurrentPageParam } from "@/utils/weapp"; | 271 | import { getCurrentPageUrl, getCurrentPageParam } from "@/utils/weapp"; |
| 272 | -import request from '../../utils/request'; | ||
| 273 | import Taro from '@tarojs/taro' | 272 | import Taro from '@tarojs/taro' |
| 274 | -import mixin from '../../utils/mixin'; | 273 | +import mixin from '@/utils/mixin'; |
| 275 | import BASE_URL from '@/utils/config'; | 274 | import BASE_URL from '@/utils/config'; |
| 276 | import Toast from '@/components/vant-weapp/toast/toast'; | 275 | import Toast from '@/components/vant-weapp/toast/toast'; |
| 277 | import { randomId } from '@/utils/tools' | 276 | import { randomId } from '@/utils/tools' |
| 277 | +import * as dayjs from 'dayjs' | ||
| 278 | 278 | ||
| 279 | const activity_name = ref(''); | 279 | const activity_name = ref(''); |
| 280 | const onChange = ({ detail }) => { | 280 | const onChange = ({ detail }) => { |
| ... | @@ -285,13 +285,7 @@ const onChange = ({ detail }) => { | ... | @@ -285,13 +285,7 @@ const onChange = ({ detail }) => { |
| 285 | const show_org_popup = ref(false); | 285 | const show_org_popup = ref(false); |
| 286 | const org_type = ref(''); | 286 | const org_type = ref(''); |
| 287 | const host_id = ref(''); | 287 | const host_id = ref(''); |
| 288 | -// const org_type_columns = ref([]); | ||
| 289 | const onOrgTypeChange = (event) => { | 288 | const onOrgTypeChange = (event) => { |
| 290 | - // const { picker, value, index } = event.detail; | ||
| 291 | - // console.warn(value); | ||
| 292 | - // console.warn(index); | ||
| 293 | - // org_type.value = value.text; | ||
| 294 | - // host_id.value = value.id; // 主办方ID | ||
| 295 | } | 289 | } |
| 296 | const onOrgTypeConfirm = (event) => { // 主办方弹框确认按钮回调 | 290 | const onOrgTypeConfirm = (event) => { // 主办方弹框确认按钮回调 |
| 297 | const detail = event.detail; | 291 | const detail = event.detail; |
| ... | @@ -444,7 +438,9 @@ const confirmEditSign = () => { // 确认报名信息回调 | ... | @@ -444,7 +438,9 @@ const confirmEditSign = () => { // 确认报名信息回调 |
| 444 | label: sign_filed.value.name, | 438 | label: sign_filed.value.name, |
| 445 | checked: 1, | 439 | checked: 1, |
| 446 | required: sign_filed.value.checked ? 1 : 0, | 440 | required: sign_filed.value.checked ? 1 : 0, |
| 447 | - nop: false | 441 | + nop: false, |
| 442 | + type: 'player', | ||
| 443 | + field: sign_filed.value.name | ||
| 448 | }); | 444 | }); |
| 449 | } | 445 | } |
| 450 | } | 446 | } |
| ... | @@ -625,20 +621,89 @@ const onExtendChange = ({ detail }) => { | ... | @@ -625,20 +621,89 @@ const onExtendChange = ({ detail }) => { |
| 625 | extend.value = detail.split(','); | 621 | extend.value = detail.split(','); |
| 626 | } | 622 | } |
| 627 | const onExtendBlur = () => { // TODO:提交时可以才检查一次 | 623 | const onExtendBlur = () => { // TODO:提交时可以才检查一次 |
| 628 | - console.warn(job_post.value.indexOf(',')); | ||
| 629 | if (job_post.value.indexOf(',') >= 0) { | 624 | if (job_post.value.indexOf(',') >= 0) { |
| 630 | Toast('请使用中文标点逗号'); | 625 | Toast('请使用中文标点逗号'); |
| 631 | } | 626 | } |
| 632 | } | 627 | } |
| 633 | 628 | ||
| 634 | -const onSubmit = () => { | 629 | +// 活动详情富文本 |
| 635 | - console.warn(extend.value); | 630 | +const activity_note = ref(''); |
| 631 | +const onEditorInput = ({ html, text }) => { | ||
| 632 | + activity_note.value = html; | ||
| 633 | +} | ||
| 634 | + | ||
| 635 | +const validForm = () => { // 校验表单 | ||
| 636 | + if (!host_id.value) { | ||
| 637 | + Toast('主办方不能为空'); | ||
| 638 | + return false; | ||
| 639 | + } | ||
| 640 | + if (!activity_name.value) { | ||
| 641 | + Toast('活动主题不能为空'); | ||
| 642 | + return false; | ||
| 643 | + } | ||
| 644 | + if (!uploader_image.value) { | ||
| 645 | + Toast('活动封面不能为空'); | ||
| 646 | + return false; | ||
| 647 | + } | ||
| 648 | + if (!activity_time.value) { | ||
| 649 | + Toast('活动时间不能为空'); | ||
| 650 | + return false; | ||
| 651 | + } | ||
| 652 | + if (!reg_begin_time.value) { | ||
| 653 | + Toast('报名开始时间不能为空'); | ||
| 654 | + return false; | ||
| 655 | + } | ||
| 656 | + if (!reg_end_time.value) { | ||
| 657 | + Toast('报名截止时间不能为空'); | ||
| 658 | + return false; | ||
| 659 | + } | ||
| 660 | + if (!dayjs(reg_begin_time.value).isBefore(dayjs(reg_end_time.value))) { | ||
| 661 | + Toast('报名开始时间不能晚于报名截止时间'); | ||
| 662 | + return false; | ||
| 663 | + } | ||
| 664 | + if (reg_max.value === '') { | ||
| 665 | + Toast('报名人数不能为空'); | ||
| 666 | + return false; | ||
| 667 | + } | ||
| 668 | + if (address.value === '') { | ||
| 669 | + Toast('活动地址不能为空'); | ||
| 670 | + return false; | ||
| 671 | + } | ||
| 672 | + return true; | ||
| 673 | +} | ||
| 674 | + | ||
| 675 | +const onSubmit = async () => { | ||
| 676 | + const fields = signInfo.value.filter(item => !item.nop && item.checked); // 处理报名信息结构,剔除固定字段,获取选中字段 | ||
| 677 | + if (validForm()) { | ||
| 678 | + const params = { | ||
| 679 | + host_id: host_id.value, // 主办方 | ||
| 680 | + name: activity_name.value, // 活动主题 | ||
| 681 | + cover: uploader_image.value, // 活动封面 | ||
| 682 | + note: activity_note.value, // 活动详情 | ||
| 683 | + fields: JSON.stringify(fields), // 报名信息 | ||
| 684 | + activity_time: activity_time.value, // 活动(开始)时间 | ||
| 685 | + reg_begin_time: reg_begin_time.value, // 报名开始时间 | ||
| 686 | + reg_end_time: reg_end_time.value, // 报名截止时间 | ||
| 687 | + reg_max: reg_max.value === '无限制' ? 0 : reg_max.value, // 报名限制人数 | ||
| 688 | + status: publish_status.value === '暂不发布' ? 0 : 1, // 状态 | ||
| 689 | + mode: activity_type.value === '现场活动' ? 0 : 1, // 活动方式 | ||
| 690 | + address: address.value, // 活动地址 | ||
| 691 | + is_public: public_type.value === '不公开' ? 0 : 1, // 是否公开 | ||
| 692 | + is_inner: is_inner.value ? 1 : 0, // 是否允许内部人员报名 | ||
| 693 | + is_black: is_black.value ? 1 : 0, // 是否屏蔽黑名单 | ||
| 694 | + extend: JSON.stringify(extend.value), // 义工岗位 | ||
| 695 | + } | ||
| 696 | + const { code } = await addActivityAPI(params); | ||
| 697 | + if (code) { | ||
| 698 | + Taro.navigateBack() | ||
| 699 | + } | ||
| 700 | + } | ||
| 636 | } | 701 | } |
| 637 | </script> | 702 | </script> |
| 638 | 703 | ||
| 639 | <script> | 704 | <script> |
| 640 | import "./index.less"; | 705 | import "./index.less"; |
| 641 | -import { hostListAPI } from '../../api/Host/index' | 706 | +import { hostListAPI, addActivityAPI } from '@/api/Host/index' |
| 642 | 707 | ||
| 643 | export default { | 708 | export default { |
| 644 | name: "createActivityPage", | 709 | name: "createActivityPage", | ... | ... |
| ... | @@ -3772,7 +3772,7 @@ | ... | @@ -3772,7 +3772,7 @@ |
| 3772 | "whatwg-mimetype" "^2.3.0" | 3772 | "whatwg-mimetype" "^2.3.0" |
| 3773 | "whatwg-url" "^8.0.0" | 3773 | "whatwg-url" "^8.0.0" |
| 3774 | 3774 | ||
| 3775 | -"dayjs@^1.8.29": | 3775 | +"dayjs@^1.11.5", "dayjs@^1.8.29": |
| 3776 | "integrity" "sha512-CAdX5Q3YW3Gclyo5Vpqkgpj8fSdLQcRuzfX6mC6Phy0nfJ0eGYOeS7m4mt2plDWLAtA4TqTakvbboHvUxfe4iA==" | 3776 | "integrity" "sha512-CAdX5Q3YW3Gclyo5Vpqkgpj8fSdLQcRuzfX6mC6Phy0nfJ0eGYOeS7m4mt2plDWLAtA4TqTakvbboHvUxfe4iA==" |
| 3777 | "resolved" "https://mirrors.cloud.tencent.com/npm/dayjs/-/dayjs-1.11.5.tgz" | 3777 | "resolved" "https://mirrors.cloud.tencent.com/npm/dayjs/-/dayjs-1.11.5.tgz" |
| 3778 | "version" "1.11.5" | 3778 | "version" "1.11.5" |
| ... | @@ -10253,11 +10253,6 @@ | ... | @@ -10253,11 +10253,6 @@ |
| 10253 | "resolved" "https://mirrors.cloud.tencent.com/npm/uuid/-/uuid-3.4.0.tgz" | 10253 | "resolved" "https://mirrors.cloud.tencent.com/npm/uuid/-/uuid-3.4.0.tgz" |
| 10254 | "version" "3.4.0" | 10254 | "version" "3.4.0" |
| 10255 | 10255 | ||
| 10256 | -"uuid@^9.0.0": | ||
| 10257 | - "integrity" "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==" | ||
| 10258 | - "resolved" "https://mirrors.cloud.tencent.com/npm/uuid/-/uuid-9.0.0.tgz" | ||
| 10259 | - "version" "9.0.0" | ||
| 10260 | - | ||
| 10261 | "v8-compile-cache@^2.0.3": | 10256 | "v8-compile-cache@^2.0.3": |
| 10262 | "integrity" "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==" | 10257 | "integrity" "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==" |
| 10263 | "resolved" "https://mirrors.tencent.com/npm/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz" | 10258 | "resolved" "https://mirrors.tencent.com/npm/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz" | ... | ... |
-
Please register or login to post a comment