Showing
4 changed files
with
166 additions
and
12 deletions
| 1 | /* | 1 | /* |
| 2 | * @Date: 2022-10-20 13:15:00 | 2 | * @Date: 2022-10-20 13:15:00 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2022-10-26 10:09:46 | 4 | + * @LastEditTime: 2022-10-26 11:36:29 |
| 5 | * @FilePath: /swx/src/api/Activity/index.js | 5 | * @FilePath: /swx/src/api/Activity/index.js |
| 6 | * @Description: 活动信息 | 6 | * @Description: 活动信息 |
| 7 | */ | 7 | */ |
| ... | @@ -11,6 +11,8 @@ const Api = { | ... | @@ -11,6 +11,8 @@ const Api = { |
| 11 | ACTIVITY_JOIN_LIST: '/srv/?a=activity_join_list', | 11 | ACTIVITY_JOIN_LIST: '/srv/?a=activity_join_list', |
| 12 | ACTIVITY_ADD_LIST: '/srv/?a=activity_add_list', | 12 | ACTIVITY_ADD_LIST: '/srv/?a=activity_add_list', |
| 13 | ACTIVITY_COPY: '/srv/?a=activity_copy', | 13 | ACTIVITY_COPY: '/srv/?a=activity_copy', |
| 14 | + ACTIVITY_END: '/srv/?a=activity_end', | ||
| 15 | + ACTIVITY_DEL: '/srv/?a=activity_del', | ||
| 14 | } | 16 | } |
| 15 | 17 | ||
| 16 | /** | 18 | /** |
| ... | @@ -29,4 +31,16 @@ export const addListAPI = (params) => fn(fetch.get(Api.ACTIVITY_ADD_LIST, params | ... | @@ -29,4 +31,16 @@ export const addListAPI = (params) => fn(fetch.get(Api.ACTIVITY_ADD_LIST, params |
| 29 | * @description: 复制活动 | 31 | * @description: 复制活动 |
| 30 | * @returns | 32 | * @returns |
| 31 | */ | 33 | */ |
| 32 | -export const copyListAPI = (params) => fn(fetch.get(Api.ACTIVITY_COPY, params)); | 34 | +export const copyActivityAPI = (params) => fn(fetch.get(Api.ACTIVITY_COPY, params)); |
| 35 | + | ||
| 36 | +/** | ||
| 37 | + * @description: 结束活动 | ||
| 38 | + * @returns | ||
| 39 | + */ | ||
| 40 | +export const endActivityAPI = (params) => fn(fetch.get(Api.ACTIVITY_END, params)); | ||
| 41 | + | ||
| 42 | +/** | ||
| 43 | + * @description: 删除活动 | ||
| 44 | + * @returns | ||
| 45 | + */ | ||
| 46 | +export const delActivityAPI = (params) => fn(fetch.get(Api.ACTIVITY_DEL, params)); | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2022-09-20 15:39:37 | 2 | * @Date: 2022-09-20 15:39:37 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2022-10-26 10:23:46 | 4 | + * @LastEditTime: 2022-10-26 11:39:21 |
| 5 | * @FilePath: /swx/src/components/activity-card.vue | 5 | * @FilePath: /swx/src/components/activity-card.vue |
| 6 | * @Description: 活动卡片组件 | 6 | * @Description: 活动卡片组件 |
| 7 | --> | 7 | --> |
| ... | @@ -28,7 +28,11 @@ | ... | @@ -28,7 +28,11 @@ |
| 28 | </view> | 28 | </view> |
| 29 | </van-col> | 29 | </van-col> |
| 30 | </van-row> | 30 | </van-row> |
| 31 | - <view v-if="status === 'edit' || status === 'copy'" style="position: absolute; right: 0; bottom: 1rem; background-color: #BBBBBB; color: white; padding: 0.25rem; padding-left: 1rem; padding-right: 0.5rem; border-top-left-radius: 1rem; border-bottom-left-radius: 1rem; font-size: 0.85rem;">编辑</view> | 31 | + <view v-if="status === 'creator'"> |
| 32 | + <view @tap="editActivity(data)" class="edit-button">编辑</view> | ||
| 33 | + <view @tap="finishActivity(data)" v-if="formatStatus(data) === '报名未开始' || formatStatus(data) === '报名中' || formatStatus(data) === '报名结束'" class="finish-button">结束</view> | ||
| 34 | + <view @tap="delActivity(data)" v-if="formatStatus(data) === '未发布' || formatStatus(data) === '已结束'" class="close-button">删除</view> | ||
| 35 | + </view> | ||
| 32 | </view> | 36 | </view> |
| 33 | <view class="card-sub"> | 37 | <view class="card-sub"> |
| 34 | <van-row v-if="data.address"> | 38 | <van-row v-if="data.address"> |
| ... | @@ -52,7 +56,7 @@ | ... | @@ -52,7 +56,7 @@ |
| 52 | </view> | 56 | </view> |
| 53 | </van-col> | 57 | </van-col> |
| 54 | </van-row> | 58 | </van-row> |
| 55 | - <view v-if="status === 'copy' && formatStatus(data) !== '已结束'" @tap="copyActivity(data.id)" style="position: absolute; right: 0; bottom: 1rem; background-color: #199A74; color: white; padding: 0.25rem; padding-left: 1rem; padding-right: 0.5rem; border-top-left-radius: 1rem; border-bottom-left-radius: 1rem;">复制</view> | 59 | + <view v-if="status === 'creator' && formatStatus(data) !== '已结束'" @tap="copyActivity(data.id)" class="copy-button">复制</view> |
| 56 | </view> | 60 | </view> |
| 57 | </view> | 61 | </view> |
| 58 | <van-toast id="van-toast" /> | 62 | <van-toast id="van-toast" /> |
| ... | @@ -64,9 +68,10 @@ import { ref, defineProps, computed } from 'vue' | ... | @@ -64,9 +68,10 @@ import { ref, defineProps, computed } from 'vue' |
| 64 | import icon_address from '@/images/icon/address@2x.png' | 68 | import icon_address from '@/images/icon/address@2x.png' |
| 65 | import Taro from '@tarojs/taro' | 69 | import Taro from '@tarojs/taro' |
| 66 | import * as dayjs from 'dayjs' | 70 | import * as dayjs from 'dayjs' |
| 67 | -import { copyListAPI } from '@/api/Activity/index' | 71 | +import { copyActivityAPI } from '@/api/Activity/index' |
| 68 | import Toast from '@/components/vant-weapp/toast/toast'; | 72 | import Toast from '@/components/vant-weapp/toast/toast'; |
| 69 | import Dialog from '@vant/weapp/dist/dialog/dialog'; | 73 | import Dialog from '@vant/weapp/dist/dialog/dialog'; |
| 74 | +import { endActivityAPI, delActivityAPI } from '@/api/Activity/index'; | ||
| 70 | 75 | ||
| 71 | const props = defineProps({ | 76 | const props = defineProps({ |
| 72 | data: Object, | 77 | data: Object, |
| ... | @@ -103,7 +108,7 @@ const goTo = (id, status) => { | ... | @@ -103,7 +108,7 @@ const goTo = (id, status) => { |
| 103 | }) | 108 | }) |
| 104 | } | 109 | } |
| 105 | 110 | ||
| 106 | -const emit = defineEmits(['on-copy']); | 111 | +const emit = defineEmits(['on-handle']); |
| 107 | const copyActivity = async (id) => { | 112 | const copyActivity = async (id) => { |
| 108 | Dialog.confirm({ | 113 | Dialog.confirm({ |
| 109 | title: '温馨提示', | 114 | title: '温馨提示', |
| ... | @@ -112,14 +117,83 @@ const copyActivity = async (id) => { | ... | @@ -112,14 +117,83 @@ const copyActivity = async (id) => { |
| 112 | }) | 117 | }) |
| 113 | .then(async () => { | 118 | .then(async () => { |
| 114 | // 复制活动 | 119 | // 复制活动 |
| 115 | - const { code, data } = await copyListAPI({ i: id }); | 120 | + const { code, data } = await copyActivityAPI({ i: id }); |
| 116 | if (code) { | 121 | if (code) { |
| 117 | Toast({ | 122 | Toast({ |
| 118 | duration: 1000, | 123 | duration: 1000, |
| 119 | type: 'success', | 124 | type: 'success', |
| 120 | message: '复制成功', | 125 | message: '复制成功', |
| 121 | onClose: () => { | 126 | onClose: () => { |
| 122 | - emit('on-copy', id); | 127 | + emit('on-handle', id); |
| 128 | + }, | ||
| 129 | + }); | ||
| 130 | + } | ||
| 131 | + }) | ||
| 132 | + .catch(() => { | ||
| 133 | + // on cancel | ||
| 134 | + }); | ||
| 135 | +} | ||
| 136 | + | ||
| 137 | +// 编辑活动 | ||
| 138 | +const editActivity = ({ id }) => { | ||
| 139 | + Dialog.confirm({ | ||
| 140 | + title: '温馨提示', | ||
| 141 | + message: '是否确认编辑活动?', | ||
| 142 | + confirmButtonColor: '#199A74' | ||
| 143 | + }) | ||
| 144 | + .then(async () => { | ||
| 145 | + Taro.navigateTo({ | ||
| 146 | + url: '../createActivity/index?id=' + id + '&type=edit' | ||
| 147 | + }) | ||
| 148 | + }) | ||
| 149 | + .catch(() => { | ||
| 150 | + // on cancel | ||
| 151 | + }); | ||
| 152 | +} | ||
| 153 | + | ||
| 154 | +// 结束活动 | ||
| 155 | +const finishActivity = ({ id }) => { | ||
| 156 | + Dialog.confirm({ | ||
| 157 | + title: '温馨提示', | ||
| 158 | + message: '是否确认结束活动?', | ||
| 159 | + confirmButtonColor: '#199A74' | ||
| 160 | + }) | ||
| 161 | + .then(async () => { | ||
| 162 | + // 结束活动 | ||
| 163 | + const { code, data } = await endActivityAPI({ i: id }); | ||
| 164 | + if (code) { | ||
| 165 | + Toast({ | ||
| 166 | + duration: 1000, | ||
| 167 | + type: 'success', | ||
| 168 | + message: '结束成功', | ||
| 169 | + onClose: () => { | ||
| 170 | + emit('on-handle', id); | ||
| 171 | + }, | ||
| 172 | + }); | ||
| 173 | + } | ||
| 174 | + }) | ||
| 175 | + .catch(() => { | ||
| 176 | + // on cancel | ||
| 177 | + }); | ||
| 178 | +} | ||
| 179 | + | ||
| 180 | +// 删除活动 | ||
| 181 | +const delActivity = ({ id }) => { | ||
| 182 | + Dialog.confirm({ | ||
| 183 | + title: '温馨提示', | ||
| 184 | + message: '是否确认删除活动?', | ||
| 185 | + confirmButtonColor: '#199A74' | ||
| 186 | + }) | ||
| 187 | + .then(async () => { | ||
| 188 | + // 复制活动 | ||
| 189 | + const { code, data } = await delActivityAPI({ i: id }); | ||
| 190 | + if (code) { | ||
| 191 | + Toast({ | ||
| 192 | + duration: 1000, | ||
| 193 | + type: 'success', | ||
| 194 | + message: '删除成功', | ||
| 195 | + onClose: () => { | ||
| 196 | + emit('on-handle', id); | ||
| 123 | }, | 197 | }, |
| 124 | }); | 198 | }); |
| 125 | } | 199 | } |
| ... | @@ -144,11 +218,62 @@ const copyActivity = async (id) => { | ... | @@ -144,11 +218,62 @@ const copyActivity = async (id) => { |
| 144 | .card-main-text { | 218 | .card-main-text { |
| 145 | padding: 0 0.5rem; | 219 | padding: 0 0.5rem; |
| 146 | } | 220 | } |
| 221 | + .edit-button { | ||
| 222 | + position: absolute; | ||
| 223 | + right: 0; | ||
| 224 | + bottom: 1rem; | ||
| 225 | + background-color: #BBBBBB; | ||
| 226 | + color: white; | ||
| 227 | + padding: 0.25rem; | ||
| 228 | + padding-left: 1rem; | ||
| 229 | + padding-right: 0.5rem; | ||
| 230 | + border-top-left-radius: 1rem; | ||
| 231 | + border-bottom-left-radius: 1rem; | ||
| 232 | + font-size: 0.85rem; | ||
| 233 | + } | ||
| 234 | + .finish-button { | ||
| 235 | + position: absolute; | ||
| 236 | + right: 0; | ||
| 237 | + bottom: 4rem; | ||
| 238 | + background-color: #DABE73; | ||
| 239 | + color: white; | ||
| 240 | + padding: 0.25rem; | ||
| 241 | + padding-left: 1rem; | ||
| 242 | + padding-right: 0.5rem; | ||
| 243 | + border-top-left-radius: 1rem; | ||
| 244 | + border-bottom-left-radius: 1rem; | ||
| 245 | + font-size: 0.85rem; | ||
| 246 | + } | ||
| 247 | + .close-button { | ||
| 248 | + position: absolute; | ||
| 249 | + right: 0; | ||
| 250 | + bottom: 4rem; | ||
| 251 | + background-color: #E32525; | ||
| 252 | + color: white; | ||
| 253 | + padding: 0.25rem; | ||
| 254 | + padding-left: 1rem; | ||
| 255 | + padding-right: 0.5rem; | ||
| 256 | + border-top-left-radius: 1rem; | ||
| 257 | + border-bottom-left-radius: 1rem; | ||
| 258 | + font-size: 0.85rem; | ||
| 259 | + } | ||
| 147 | } | 260 | } |
| 148 | .card-sub { | 261 | .card-sub { |
| 149 | padding: 0.85rem; | 262 | padding: 0.85rem; |
| 150 | font-size: 0.85rem; | 263 | font-size: 0.85rem; |
| 151 | position: relative; | 264 | position: relative; |
| 265 | + .copy-button { | ||
| 266 | + position: absolute; | ||
| 267 | + right: 0; | ||
| 268 | + bottom: 1rem; | ||
| 269 | + background-color: #199A74; | ||
| 270 | + color: white; | ||
| 271 | + padding: 0.25rem; | ||
| 272 | + padding-left: 1rem; | ||
| 273 | + padding-right: 0.5rem; | ||
| 274 | + border-top-left-radius: 1rem; | ||
| 275 | + border-bottom-left-radius: 1rem; | ||
| 276 | + } | ||
| 152 | } | 277 | } |
| 153 | } | 278 | } |
| 154 | 279 | ... | ... |
| ... | @@ -30,9 +30,21 @@ | ... | @@ -30,9 +30,21 @@ |
| 30 | 30 | ||
| 31 | .activity-title { | 31 | .activity-title { |
| 32 | background-color: #FFFFFF; | 32 | background-color: #FFFFFF; |
| 33 | + position: relative; | ||
| 33 | .box { | 34 | .box { |
| 34 | padding: 1rem 1rem 0.5rem 1rem; | 35 | padding: 1rem 1rem 0.5rem 1rem; |
| 35 | } | 36 | } |
| 37 | + .partner-box { | ||
| 38 | + position: absolute; | ||
| 39 | + right: -0.5rem; | ||
| 40 | + top: 1rem; | ||
| 41 | + background-color: #6CA4F6; | ||
| 42 | + color: #FFF; | ||
| 43 | + border-top-left-radius: 1rem; | ||
| 44 | + border-bottom-left-radius: 1rem; | ||
| 45 | + padding: 0.25rem 0.5rem 0.25rem 0.8rem; | ||
| 46 | + font-size: 0.9rem; | ||
| 47 | + } | ||
| 36 | } | 48 | } |
| 37 | 49 | ||
| 38 | .bg-gradient { | 50 | .bg-gradient { | ... | ... |
| 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-10-26 10:29:22 | 4 | + * @LastEditTime: 2022-10-26 11:39:02 |
| 5 | * @FilePath: /swx/src/pages/myCreateActivity/index.vue | 5 | * @FilePath: /swx/src/pages/myCreateActivity/index.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -29,6 +29,7 @@ | ... | @@ -29,6 +29,7 @@ |
| 29 | <view class="box"> | 29 | <view class="box"> |
| 30 | <text class="bg-gradient" style="font-size: 1.15rem;">活动统计</text> | 30 | <text class="bg-gradient" style="font-size: 1.15rem;">活动统计</text> |
| 31 | </view> | 31 | </view> |
| 32 | + <view class="partner-box">用户陪伴</view> | ||
| 32 | </view> | 33 | </view> |
| 33 | <view class="header-info"> | 34 | <view class="header-info"> |
| 34 | <view class="activity"> | 35 | <view class="activity"> |
| ... | @@ -68,7 +69,7 @@ | ... | @@ -68,7 +69,7 @@ |
| 68 | </view> | 69 | </view> |
| 69 | <scroll-view :scroll-y="true" :style="scrollStyle" @scrolltolower="onScrollToLower"> | 70 | <scroll-view :scroll-y="true" :style="scrollStyle" @scrolltolower="onScrollToLower"> |
| 70 | <view style=""> | 71 | <view style=""> |
| 71 | - <activity-card @on-copy="onCopy" v-for="(item, index) in activity_list" :key="index" :data="item" status="copy" style="margin-bottom: 1rem;"></activity-card> | 72 | + <activity-card @on-handle="onHandle" v-for="(item, index) in activity_list" :key="index" :data="item" status="creator" style="margin-bottom: 1rem;"></activity-card> |
| 72 | </view> | 73 | </view> |
| 73 | </scroll-view> | 74 | </scroll-view> |
| 74 | <view style="height: 3rem;"></view> | 75 | <view style="height: 3rem;"></view> |
| ... | @@ -272,6 +273,8 @@ export default { | ... | @@ -272,6 +273,8 @@ export default { |
| 272 | this.show_host_popup = false; | 273 | this.show_host_popup = false; |
| 273 | this.host_id = value.key; | 274 | this.host_id = value.key; |
| 274 | this.host_name = value.text; | 275 | this.host_name = value.text; |
| 276 | + // 缓存主办方ID | ||
| 277 | + // wx.setStorageSync('chang_host_id', value.key); | ||
| 275 | // 查询数据 | 278 | // 查询数据 |
| 276 | this.activity_list = []; | 279 | this.activity_list = []; |
| 277 | this.flag = true; | 280 | this.flag = true; |
| ... | @@ -290,7 +293,7 @@ export default { | ... | @@ -290,7 +293,7 @@ export default { |
| 290 | this.page = 0; | 293 | this.page = 0; |
| 291 | this.getList(); | 294 | this.getList(); |
| 292 | }, | 295 | }, |
| 293 | - onCopy () { // 活动复制时间回调 | 296 | + onHandle () { // 活动操作后回调 |
| 294 | // 查询数据 | 297 | // 查询数据 |
| 295 | this.activity_list = []; | 298 | this.activity_list = []; |
| 296 | this.flag = true; | 299 | this.flag = true; | ... | ... |
-
Please register or login to post a comment