Showing
2 changed files
with
36 additions
and
6 deletions
| 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-18 11:34:45 | 4 | + * @LastEditTime: 2022-10-19 16:44:53 |
| 5 | * @FilePath: /swx/src/api/Host/index.js | 5 | * @FilePath: /swx/src/api/Host/index.js |
| 6 | * @Description: 活动相关接口 | 6 | * @Description: 活动相关接口 |
| 7 | */ | 7 | */ |
| ... | @@ -10,6 +10,7 @@ import { fn, fetch } from '../fn'; | ... | @@ -10,6 +10,7 @@ import { fn, fetch } from '../fn'; |
| 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 | ACTIVITY_ADD: '/srv/?a=activity_add', |
| 13 | + ACTIVITY_EDIT: '/srv/?a=activity_edit', | ||
| 13 | ACTIVITY_HOMEPAGE: '/srv/?a=activity_app_homepage', | 14 | ACTIVITY_HOMEPAGE: '/srv/?a=activity_app_homepage', |
| 14 | ACTIVITY_INFO: '/srv/?a=activity_info', | 15 | ACTIVITY_INFO: '/srv/?a=activity_info', |
| 15 | } | 16 | } |
| ... | @@ -27,6 +28,12 @@ export const hostListAPI = (params) => fn(fetch.post(Api.HOST_LIST, params)); | ... | @@ -27,6 +28,12 @@ export const hostListAPI = (params) => fn(fetch.post(Api.HOST_LIST, params)); |
| 27 | export const addActivityAPI = (params) => fn(fetch.post(Api.ACTIVITY_ADD, params)); | 28 | export const addActivityAPI = (params) => fn(fetch.post(Api.ACTIVITY_ADD, params)); |
| 28 | 29 | ||
| 29 | /** | 30 | /** |
| 31 | + * @description: 修改活动 | ||
| 32 | + * @returns | ||
| 33 | + */ | ||
| 34 | +export const editActivityAPI = (params) => fn(fetch.post(Api.ACTIVITY_EDIT, params)); | ||
| 35 | + | ||
| 36 | +/** | ||
| 30 | * @description: 首页活动和轮播 | 37 | * @description: 首页活动和轮播 |
| 31 | * @returns | 38 | * @returns |
| 32 | */ | 39 | */ | ... | ... |
| 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-19 16:07:06 | 4 | + * @LastEditTime: 2022-10-19 17:15:26 |
| 5 | * @FilePath: /swx/src/pages/createActivity/index.vue | 5 | * @FilePath: /swx/src/pages/createActivity/index.vue |
| 6 | * @Description: 创建活动页面 | 6 | * @Description: 创建活动页面 |
| 7 | --> | 7 | --> |
| ... | @@ -704,9 +704,17 @@ const onSubmit = async () => { | ... | @@ -704,9 +704,17 @@ const onSubmit = async () => { |
| 704 | is_black: is_black.value ? 1 : 0, // 是否屏蔽黑名单 | 704 | is_black: is_black.value ? 1 : 0, // 是否屏蔽黑名单 |
| 705 | extend: JSON.stringify(extend.value), // 义工岗位 | 705 | extend: JSON.stringify(extend.value), // 义工岗位 |
| 706 | } | 706 | } |
| 707 | - const { code } = await addActivityAPI(params); | 707 | + if (getCurrentPageParam().type === 'edit') { // 修改 |
| 708 | - if (code) { | 708 | + params.i = activity_id.value; |
| 709 | - Taro.navigateBack() | 709 | + const { code } = await editActivityAPI(params); |
| 710 | + if (code) { | ||
| 711 | + Taro.navigateBack() | ||
| 712 | + } | ||
| 713 | + } else { | ||
| 714 | + const { code } = await addActivityAPI(params); | ||
| 715 | + if (code) { | ||
| 716 | + Taro.navigateBack() | ||
| 717 | + } | ||
| 710 | } | 718 | } |
| 711 | } | 719 | } |
| 712 | } | 720 | } |
| ... | @@ -723,11 +731,13 @@ const formatInfoDate = (date) => { | ... | @@ -723,11 +731,13 @@ const formatInfoDate = (date) => { |
| 723 | 731 | ||
| 724 | // 获取活动信息,还原 | 732 | // 获取活动信息,还原 |
| 725 | const html_content = ref(''); | 733 | const html_content = ref(''); |
| 734 | +const activity_id = ref(''); | ||
| 726 | const updateActivityInfo = async ({ activity, host }) => { | 735 | const updateActivityInfo = async ({ activity, host }) => { |
| 727 | // 获取主办方列表信息 | 736 | // 获取主办方列表信息 |
| 728 | const { code, data } = await hostListAPI(); | 737 | const { code, data } = await hostListAPI(); |
| 729 | if (code) { | 738 | if (code) { |
| 730 | const my_hosts = data.my_hosts; | 739 | const my_hosts = data.my_hosts; |
| 740 | + activity_id.value = activity.id; | ||
| 731 | // 主办方 | 741 | // 主办方 |
| 732 | org_type.value = my_hosts.filter(item => item.id === host.id)[0]['name']; | 742 | org_type.value = my_hosts.filter(item => item.id === host.id)[0]['name']; |
| 733 | host_id.value = host.id; | 743 | host_id.value = host.id; |
| ... | @@ -761,13 +771,26 @@ const updateActivityInfo = async ({ activity, host }) => { | ... | @@ -761,13 +771,26 @@ const updateActivityInfo = async ({ activity, host }) => { |
| 761 | limit_number.value = true; | 771 | limit_number.value = true; |
| 762 | reg_max.value = '无限制'; | 772 | reg_max.value = '无限制'; |
| 763 | } | 773 | } |
| 774 | + // 是否发布 | ||
| 775 | + publish_status.value = activity.status === 'disable' ? '暂不发布' : '立即发布'; | ||
| 776 | + // 活动方法 | ||
| 777 | + activity_type.value = activity.status === 'offline' ? '现场活动' : '线上活动'; | ||
| 778 | + // 活动地址 | ||
| 779 | + address.value = activity.address; | ||
| 780 | + // 是否公开显示 | ||
| 781 | + public_type.value = activity.is_public === 0 ? '不公开' : '公开'; | ||
| 782 | + // | ||
| 783 | + is_inner.value = activity.is_inner ? true : false; | ||
| 784 | + is_black.value = activity.is_black ? true : false; | ||
| 785 | + // 义工岗位 | ||
| 786 | + job_post.value = activity.extend.length ? activity.extend.join(',') : ''; | ||
| 764 | } | 787 | } |
| 765 | } | 788 | } |
| 766 | </script> | 789 | </script> |
| 767 | 790 | ||
| 768 | <script> | 791 | <script> |
| 769 | import "./index.less"; | 792 | import "./index.less"; |
| 770 | -import { hostListAPI, addActivityAPI } from '@/api/Host/index' | 793 | +import { hostListAPI, addActivityAPI, editActivityAPI } from '@/api/Host/index' |
| 771 | 794 | ||
| 772 | export default { | 795 | export default { |
| 773 | name: "createActivityPage", | 796 | name: "createActivityPage", | ... | ... |
-
Please register or login to post a comment