hookehuyr

✨ feat(活动详情页逻辑API联调):

...@@ -11,6 +11,7 @@ const Api = { ...@@ -11,6 +11,7 @@ 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_HOMEPAGE: '/srv/?a=activity_app_homepage', 13 ACTIVITY_HOMEPAGE: '/srv/?a=activity_app_homepage',
14 + ACTIVITY_INFO: '/srv/?a=activity_info',
14 } 15 }
15 16
16 /** 17 /**
...@@ -30,3 +31,9 @@ export const addActivityAPI = (params) => fn(fetch.post(Api.ACTIVITY_ADD, params ...@@ -30,3 +31,9 @@ export const addActivityAPI = (params) => fn(fetch.post(Api.ACTIVITY_ADD, params
30 * @returns 31 * @returns
31 */ 32 */
32 export const activityHomeAPI = (params) => fn(fetch.get(Api.ACTIVITY_HOMEPAGE, params)); 33 export const activityHomeAPI = (params) => fn(fetch.get(Api.ACTIVITY_HOMEPAGE, params));
34 +
35 +/**
36 + * @description: 活动详情
37 + * @returns
38 + */
39 +export const activityInfoAPI = (params) => fn(fetch.get(Api.ACTIVITY_INFO, params));
......
1 /* 1 /*
2 * @Date: 2022-05-18 22:56:08 2 * @Date: 2022-05-18 22:56:08
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-10-17 13:19:28 4 + * @LastEditTime: 2022-10-18 15:06:40
5 * @FilePath: /swx/src/api/fn.js 5 * @FilePath: /swx/src/api/fn.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
...@@ -66,7 +66,7 @@ export const uploadFn = (api) => { ...@@ -66,7 +66,7 @@ export const uploadFn = (api) => {
66 */ 66 */
67 export const fetch = { 67 export const fetch = {
68 get: function (api, params) { 68 get: function (api, params) {
69 - return axios.get(api, { params }) 69 + return axios.get(api, params)
70 }, 70 },
71 post: function (api, params) { 71 post: function (api, params) {
72 return axios.post(api, params) 72 return axios.post(api, params)
......
1 <!-- 1 <!--
2 * @Date: 2022-09-26 16:10:35 2 * @Date: 2022-09-26 16:10:35
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-09-29 09:52:40 4 + * @LastEditTime: 2022-10-18 17:40:02
5 * @FilePath: /swx/src/components/activity-bar.vue 5 * @FilePath: /swx/src/components/activity-bar.vue
6 - * @Description: 文件描述 6 + * @Description: 活动详情页底部导航栏
7 --> 7 -->
8 <template> 8 <template>
9 <view class="activity-bar-page"> 9 <view class="activity-bar-page">
...@@ -17,21 +17,21 @@ ...@@ -17,21 +17,21 @@
17 </view> 17 </view>
18 </van-col> 18 </van-col>
19 <van-col span="19"> 19 <van-col span="19">
20 - <view v-if="userType === '1'" class="user-not-reg"> 20 + <view v-if="userType === 'volunteer'" class="user-not-reg">
21 <view class="button" @tap="goTo('volunteer')">义工报名</view> 21 <view class="button" @tap="goTo('volunteer')">义工报名</view>
22 <view class="button" @tap="goTo('join')">活动报名</view> 22 <view class="button" @tap="goTo('join')">活动报名</view>
23 </view> 23 </view>
24 - <view v-if="userType === '2'" class="user-reg"> 24 + <view v-if="userType === 'player_join'" class="user-reg">
25 <view class="button" @tap="goTo('info')">报名信息</view> 25 <view class="button" @tap="goTo('info')">报名信息</view>
26 </view> 26 </view>
27 - <view v-if="userType === '3'" class="admin-control"> 27 + <view v-if="userType === 'creator'" class="admin-control">
28 <view class="edit" @tap="goTo('edit')">修改活动</view> 28 <view class="edit" @tap="goTo('edit')">修改活动</view>
29 <view class="list" @tap="goTo('list')">报名列表</view> 29 <view class="list" @tap="goTo('list')">报名列表</view>
30 </view> 30 </view>
31 - <view v-if="userType === '4'" class="staff-join"> 31 + <view v-if="userType === 'player'" class="staff-join">
32 <view class="button" @tap="goTo('join')">报名活动</view> 32 <view class="button" @tap="goTo('join')">报名活动</view>
33 </view> 33 </view>
34 - <view v-if="userType === '5'" class="staff-not-join"> 34 + <view v-if="userType === 'volunteer_only'" class="staff-not-join">
35 <view class="button" @tap="goTo('volunteer')">义工报名</view> 35 <view class="button" @tap="goTo('volunteer')">义工报名</view>
36 </view> 36 </view>
37 </van-col> 37 </van-col>
...@@ -46,6 +46,11 @@ import icon_home1 from '@/images/icon/home01@2x.png' ...@@ -46,6 +46,11 @@ import icon_home1 from '@/images/icon/home01@2x.png'
46 import Taro from '@tarojs/taro' 46 import Taro from '@tarojs/taro'
47 47
48 const props = defineProps({ 48 const props = defineProps({
49 + // player=参与者,可报名活动。
50 + // player_join=查看报名信息
51 + // volunteer=义工,可报名义工,如果活动允许内部人员参加,则也可报名活动。
52 + // volunteer_only=只能报名义工
53 + // creator=创建人,可管理活动
49 userType: String 54 userType: String
50 }) 55 })
51 56
......
...@@ -40,6 +40,14 @@ ...@@ -40,6 +40,14 @@
40 } 40 }
41 } 41 }
42 42
43 +.activity-note {
44 + padding: 0.5rem 1rem 1rem 1rem;
45 + image {
46 + width: 100%;
47 + object-fit: contain;
48 + }
49 +}
50 +
43 .activity-info-wrapper { 51 .activity-info-wrapper {
44 .box { 52 .box {
45 padding: 0 1rem; 53 padding: 0 1rem;
......
1 <!-- 1 <!--
2 * @Date: 2022-09-26 14:36:57 2 * @Date: 2022-09-26 14:36:57
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-09-29 09:46:53 4 + * @LastEditTime: 2022-10-18 17:47:13
5 * @FilePath: /swx/src/pages/activityDetail/index.vue 5 * @FilePath: /swx/src/pages/activityDetail/index.vue
6 - * @Description: 文件描述 6 + * @Description: 活动详情页
7 --> 7 -->
8 <template> 8 <template>
9 <view class="activity-detail-page"> 9 <view class="activity-detail-page">
10 <view class="share-wrapper"> 10 <view class="share-wrapper">
11 - <van-image 11 + <van-image width="100%" height="15rem" fit="cover" :src="activity.cover" />
12 - width="100%"
13 - height="15rem"
14 - fit="cover"
15 - :src="img_demo"
16 - />
17 <view @tap="shareActivity" class="share-button"> 12 <view @tap="shareActivity" class="share-button">
18 <van-icon name="share-o" /> 13 <van-icon name="share-o" />
19 <text>分享</text> 14 <text>分享</text>
20 </view> 15 </view>
21 </view> 16 </view>
22 - <view class="title">八段锦</view> 17 + <view class="title">{{ activity.name }}</view>
23 <view class="activity-title"> 18 <view class="activity-title">
24 <view class="box"> 19 <view class="box">
25 <text class="bg-gradient" style="font-size: 1.25rem;">活动信息</text> 20 <text class="bg-gradient" style="font-size: 1.25rem;">活动信息</text>
...@@ -33,7 +28,7 @@ ...@@ -33,7 +28,7 @@
33 <text class="label">主办方:</text> 28 <text class="label">主办方:</text>
34 </van-col> 29 </van-col>
35 <van-col span="17"> 30 <van-col span="17">
36 - <text class="value">周三读书会</text> 31 + <text class="value">{{ host.name }}</text>
37 </van-col> 32 </van-col>
38 </van-row> 33 </van-row>
39 </view> 34 </view>
...@@ -45,7 +40,7 @@ ...@@ -45,7 +40,7 @@
45 <text class="label">活动时间:</text> 40 <text class="label">活动时间:</text>
46 </van-col> 41 </van-col>
47 <van-col span="17"> 42 <van-col span="17">
48 - <text class="value">2023-08-27 23:49</text> 43 + <text class="value">{{ formatDate(activity.activity_time) }}</text>
49 </van-col> 44 </van-col>
50 </van-row> 45 </van-row>
51 </view> 46 </view>
...@@ -57,7 +52,8 @@ ...@@ -57,7 +52,8 @@
57 <text class="label">活动方式:</text> 52 <text class="label">活动方式:</text>
58 </van-col> 53 </van-col>
59 <van-col span="17"> 54 <van-col span="17">
60 - <text class="value">现场活动</text> 55 + <text v-if="activity.mode === 'offline'" class="value">现场活动</text>
56 + <text v-if="activity.mode === 'online'" class="value">线上活动</text>
61 </van-col> 57 </van-col>
62 </van-row> 58 </van-row>
63 </view> 59 </view>
...@@ -69,7 +65,7 @@ ...@@ -69,7 +65,7 @@
69 <text class="label">活动地址:</text> 65 <text class="label">活动地址:</text>
70 </van-col> 66 </van-col>
71 <van-col span="17"> 67 <van-col span="17">
72 - <text class="value">上海市杨浦区军工路100号A座05室上海市杨浦区军工路100号A座05室</text> 68 + <text class="value">{{ activity.address }}</text>
73 </van-col> 69 </van-col>
74 </van-row> 70 </van-row>
75 </view> 71 </view>
...@@ -81,7 +77,7 @@ ...@@ -81,7 +77,7 @@
81 <text class="label">报名开始时间:</text> 77 <text class="label">报名开始时间:</text>
82 </van-col> 78 </van-col>
83 <van-col span="17"> 79 <van-col span="17">
84 - <text class="value">2022-08-28 00:22</text> 80 + <text class="value">{{ formatDate(activity.reg_begin_time) }}</text>
85 </van-col> 81 </van-col>
86 </van-row> 82 </van-row>
87 </view> 83 </view>
...@@ -93,7 +89,7 @@ ...@@ -93,7 +89,7 @@
93 <text class="label">报名截止时间:</text> 89 <text class="label">报名截止时间:</text>
94 </van-col> 90 </van-col>
95 <van-col span="17"> 91 <van-col span="17">
96 - <text class="value">2022-08-28 00:22</text> 92 + <text class="value">{{ formatDate(activity.reg_end_time) }}</text>
97 </van-col> 93 </van-col>
98 </van-row> 94 </van-row>
99 </view> 95 </view>
...@@ -105,17 +101,8 @@ ...@@ -105,17 +101,8 @@
105 <text class="bg-gradient" style="font-size: 1.25rem;">活动详情</text> 101 <text class="bg-gradient" style="font-size: 1.25rem;">活动详情</text>
106 </view> 102 </view>
107 </view> 103 </view>
108 - <view style="padding: 0.5rem 1rem 1rem 1rem;"> 104 + <view class="activity-note">
109 - <van-image 105 + <view v-html="activity.note"></view>
110 - width="100%"
111 - height="32rem"
112 - fit="contain"
113 - :src="img_demo1"
114 - />
115 - </view>
116 - <view style="padding: 0.5rem 1rem 1rem 1rem;">
117 - 八段锦对人体的好处,简单来说就是滋阴助阳,培补元气,舒经活络,活血生津。长期习练,便可身心调和,耳聪目明,延年益寿。
118 - 每天早七点,一起八段锦!
119 </view> 106 </view>
120 </view> 107 </view>
121 <view style="height: 6rem;"></view> 108 <view style="height: 6rem;"></view>
...@@ -152,17 +139,15 @@ ...@@ -152,17 +139,15 @@
152 </template> 139 </template>
153 140
154 <script setup> 141 <script setup>
155 -import img_demo from '@/images/demo@2x.png'
156 -import img_demo1 from '@/images/demo@2x-1.png'
157 import activityBar from '@/components/activity-bar.vue' 142 import activityBar from '@/components/activity-bar.vue'
158 import Taro from '@tarojs/taro' 143 import Taro from '@tarojs/taro'
159 import PosterBuilder from '@/components/PosterBuilder/index.vue'; 144 import PosterBuilder from '@/components/PosterBuilder/index.vue';
145 +import { ref, computed } from "vue";
146 +import * as dayjs from 'dayjs'
160 147
161 -import { ref } from "vue"; 148 +const formatDate = (date) => {
162 - 149 + return dayjs(date).format('YYYY-MM-DD HH:mm')
163 -// TEMP: 等待真实数据类型 150 +}
164 -// 根据用户类型显示对应操作栏
165 -const userType = ref('3')
166 151
167 const show_share = ref(false); 152 const show_share = ref(false);
168 const actions_share = ref([{ 153 const actions_share = ref([{
...@@ -468,7 +453,61 @@ const onSelectSave = ({ detail }) => { ...@@ -468,7 +453,61 @@ const onSelectSave = ({ detail }) => {
468 453
469 <script> 454 <script>
470 import "./index.less"; 455 import "./index.less";
456 +import { activityInfoAPI } from '@/api/Host/index';
457 +import { pageQuery } from '@/utils/tools.js'
458 +import mixin from '@/utils/mixin';
459 +
471 export default { 460 export default {
472 - name: "demoPage", 461 + name: "activityInfoPage",
462 + mixins: [mixin.init],
463 + async onShow () {
464 + // 获取活动详情
465 + const id = pageQuery().id;
466 + const { code, data } = await activityInfoAPI({ i: id });
467 + if (code) {
468 + this.activity = data.activity;
469 + this.host = data.host;
470 + this.member_role = data.member_role;
471 + this.reg_id = data.reg_id;
472 + }
473 + },
474 + mounted() {
475 + },
476 + data () {
477 + return {
478 + activity: {},
479 + host: {},
480 + member_role: '',
481 + reg_id: '',
482 + }
483 + },
484 + computed: {
485 + // player=参与者,可报名活动。
486 + // player_join=查看报名信息
487 + // volunteer=义工,可报名义工,如果活动允许内部人员参加,则也可报名活动。
488 + // volunteer_only=只能报名义工
489 + // creator=创建人,可管理活动
490 + userType () {
491 + let status = ''
492 + if (this.member_role === 'creator') {
493 + status = 'creator'
494 + }
495 + if (this.member_role === 'player') {
496 + if (this.reg_id) {
497 + status = 'player_join'
498 + } else {
499 + status = 'player'
500 + }
501 + }
502 + if (this.member_role === 'volunteer') {
503 + if (this.activity.is_inner) {
504 + status = 'volunteer'
505 + } else {
506 + status = 'volunteer_only'
507 + }
508 + }
509 + return status
510 + }
511 + }
473 }; 512 };
474 </script> 513 </script>
......
1 /* 1 /*
2 * @Date: 2022-04-18 15:59:42 2 * @Date: 2022-04-18 15:59:42
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2022-10-17 15:27:10 4 + * @LastEditTime: 2022-10-18 14:55:28
5 * @FilePath: /swx/src/utils/tools.js 5 * @FilePath: /swx/src/utils/tools.js
6 * @Description: 文件描述 6 * @Description: 文件描述
7 */ 7 */
8 import dayjs from 'dayjs'; 8 import dayjs from 'dayjs';
9 +import Taro from '@tarojs/taro'
9 10
10 // 格式化时间 11 // 格式化时间
11 const formatDate = (date) => { 12 const formatDate = (date) => {
...@@ -82,4 +83,14 @@ const randomId = (n) => { ...@@ -82,4 +83,14 @@ const randomId = (n) => {
82 return res; 83 return res;
83 } 84 }
84 85
85 -export { formatDate, wxInfo, hasEllipsis, parseQueryString, strExist, randomId }; 86 +/**
87 + * 获取页面query参数
88 + */
89 +const pageQuery = () => {
90 + const instance = Taro.getCurrentInstance();
91 + let $query = '';
92 + $query = JSON.stringify(instance.router.params);
93 + return JSON.parse($query)
94 +}
95 +
96 +export { formatDate, wxInfo, hasEllipsis, parseQueryString, strExist, randomId, pageQuery };
......