Commit f157c72111a993d6ed9a863cfa7c2e30c664c01d
1 parent
81d95a24
活动评价
Showing
6 changed files
with
282 additions
and
2 deletions
docs/develop/dict.md
| @@ -153,4 +153,12 @@ | @@ -153,4 +153,12 @@ | ||
| 153 | | 进行中 | | 2 | | 153 | | 进行中 | | 2 | |
| 154 | | 已结束 | | 3 | | 154 | | 已结束 | | 3 | |
| 155 | | 活动结束 | 草稿 | 4 | | 155 | | 活动结束 | 草稿 | 4 | |
| 156 | - | 活动结束 | 发布 | 5 | | ||
| 157 | \ No newline at end of file | 156 | \ No newline at end of file |
| 157 | + | 活动结束 | 发布 | 5 | | ||
| 158 | + | ||
| 159 | + * 活动状态和总结状态 `onlineStatus: Array` [查看代码](http://bj.gitlab.cnlive.com/cnlive_project/cnlive-community-web-vue/blob/dev/src/views/event/config.ts) | ||
| 160 | + | 活动状态 | 总结状态 | value | | ||
| 161 | + | :-----: | :------: | :---: | | ||
| 162 | + | 初始状态 | | 0 | | ||
| 163 | + | 机审通过 | | 1 | | ||
| 164 | + | 上线 | | 2 | | ||
| 165 | + | 机审失败 | | -1 | | ||
| 158 | \ No newline at end of file | 166 | \ No newline at end of file |
docs/index.html
| @@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
| 19 | <!-- 顶部导航 --> | 19 | <!-- 顶部导航 --> |
| 20 | <nav> | 20 | <nav> |
| 21 | <a href="http://bj.gitlab.cnlive.com/cnlive_project/cnlive-community-web-vue">代码仓库</a> | 21 | <a href="http://bj.gitlab.cnlive.com/cnlive_project/cnlive-community-web-vue">代码仓库</a> |
| 22 | - <a href="http://test.community.web.cnlive.com/doc.html">接口API</a> | 22 | + <a href="http://test.community.cnlive.com/doc.html">接口API</a> |
| 23 | <a href="http://testweb.community.cnlive.com">中国网+智慧社区平台</a> | 23 | <a href="http://testweb.community.cnlive.com">中国网+智慧社区平台</a> |
| 24 | </nav> | 24 | </nav> |
| 25 | <div id="app"></div> | 25 | <div id="app"></div> |
src/api/event/index.ts
| @@ -78,4 +78,30 @@ export const eventCategory = async ( params: any ) => { | @@ -78,4 +78,30 @@ export const eventCategory = async ( params: any ) => { | ||
| 78 | data: data | 78 | data: data |
| 79 | }) | 79 | }) |
| 80 | return res | 80 | return res |
| 81 | +} | ||
| 82 | + | ||
| 83 | +/** | ||
| 84 | + * @description 活动评价列表 | ||
| 85 | + * @function feedbackList | ||
| 86 | + */ | ||
| 87 | + export const feedbackList = async ( params: any ) => { | ||
| 88 | + let res: any = await request({ | ||
| 89 | + method: 'get', | ||
| 90 | + url: '/feedback/list', | ||
| 91 | + params: deleteEmptyParam(params) | ||
| 92 | + }) | ||
| 93 | + return res | ||
| 94 | +} | ||
| 95 | + | ||
| 96 | +/** | ||
| 97 | + * @description 活动评价上下线 | ||
| 98 | + * @function feedbackStatus | ||
| 99 | + */ | ||
| 100 | + export const feedbackStatus = async ( params: any ) => { | ||
| 101 | + let res: any = await request({ | ||
| 102 | + method: 'post', | ||
| 103 | + url: '/feedback/status', | ||
| 104 | + params: params | ||
| 105 | + }) | ||
| 106 | + return res | ||
| 81 | } | 107 | } |
| 82 | \ No newline at end of file | 108 | \ No newline at end of file |
src/router/modules/event.ts
| @@ -18,6 +18,11 @@ const event = { | @@ -18,6 +18,11 @@ const event = { | ||
| 18 | name: 'handworkEdit', | 18 | name: 'handworkEdit', |
| 19 | component: () => import('@/views/event/handwork/edit.vue'), | 19 | component: () => import('@/views/event/handwork/edit.vue'), |
| 20 | meta: { title: '手工活动编辑' } | 20 | meta: { title: '手工活动编辑' } |
| 21 | + }, { | ||
| 22 | + path: '/event/feedback', | ||
| 23 | + name: 'feedback', | ||
| 24 | + component: () => import('@/views/event/feedback/index.vue'), | ||
| 25 | + meta: { title: '活动评价' } | ||
| 21 | }] | 26 | }] |
| 22 | } | 27 | } |
| 23 | 28 |
src/views/event/config.ts
| 1 | +import type { EnumArrayItem } from "@/@type/module/basic" | ||
| 2 | + | ||
| 1 | interface Item { | 3 | interface Item { |
| 2 | status: string, | 4 | status: string, |
| 3 | publish: string, | 5 | publish: string, |
| @@ -36,4 +38,21 @@ export const statusData: Item[] = [ | @@ -36,4 +38,21 @@ export const statusData: Item[] = [ | ||
| 36 | publish: '发布', | 38 | publish: '发布', |
| 37 | value: 5 | 39 | value: 5 |
| 38 | } | 40 | } |
| 41 | +] | ||
| 42 | + | ||
| 43 | +// 活动评价展示到前台状态 | ||
| 44 | +export const onlineStatus: EnumArrayItem[] = [ | ||
| 45 | + { | ||
| 46 | + label: '初始状态', | ||
| 47 | + value: 0 | ||
| 48 | + }, { | ||
| 49 | + label: '机审通过', | ||
| 50 | + value: 1 | ||
| 51 | + }, { | ||
| 52 | + label: '机审失败', | ||
| 53 | + value: -1 | ||
| 54 | + }, { | ||
| 55 | + label: '上线', | ||
| 56 | + value: 2 | ||
| 57 | + } | ||
| 39 | ] | 58 | ] |
| 40 | \ No newline at end of file | 59 | \ No newline at end of file |
src/views/event/feedback/index.vue
0 → 100644
| 1 | +<script setup lang="ts"> | ||
| 2 | +import { reactive, ref, onMounted, getCurrentInstance } from "vue"; | ||
| 3 | +import { feedbackStatus, feedbackList } from "@/api/event"; | ||
| 4 | +import { parseTime, globalFilters } from "@/utils/tool"; | ||
| 5 | +import { onlineStatus } from "./../config"; | ||
| 6 | +import Pagination from "@/components/Pagination/index.vue"; | ||
| 7 | +import { ElMessageBox, ElMessage } from "element-plus"; | ||
| 8 | +import type { ElTable } from "element-plus"; | ||
| 9 | +interface Form { | ||
| 10 | + page: number; | ||
| 11 | + pageSize: number; | ||
| 12 | + handworkName: string; | ||
| 13 | + startTime: string; | ||
| 14 | + endTime: string; | ||
| 15 | +} | ||
| 16 | +interface Params { | ||
| 17 | + total: number; | ||
| 18 | + query: Form; | ||
| 19 | +} | ||
| 20 | +interface Data { | ||
| 21 | + loading: boolean; | ||
| 22 | + list: any[] | null; | ||
| 23 | + onlineStatus: any[] | null; | ||
| 24 | + params: Params; | ||
| 25 | +} | ||
| 26 | +let data = reactive({ | ||
| 27 | + list: [], | ||
| 28 | + onlineStatus: onlineStatus, | ||
| 29 | + loading: false, | ||
| 30 | + params: { | ||
| 31 | + total: 0, | ||
| 32 | + query: { | ||
| 33 | + page: 1, | ||
| 34 | + pageSize: 10, | ||
| 35 | + handworkName: "", | ||
| 36 | + startTime: "", | ||
| 37 | + endTime: "", | ||
| 38 | + }, | ||
| 39 | + }, | ||
| 40 | +}); | ||
| 41 | +const value1 = ref([]); | ||
| 42 | +let multipleSelection = ref<any[]>([]); | ||
| 43 | +const multipleTableRef = ref<InstanceType<typeof ElTable>>(); | ||
| 44 | +/** | ||
| 45 | + * 表格选中响应 | ||
| 46 | + * @param {array} data 选中的一条数据 | ||
| 47 | + */ | ||
| 48 | +const handleSelectionChange = (data: array) => { | ||
| 49 | + multipleSelection.value = data; | ||
| 50 | +}; | ||
| 51 | +/** | ||
| 52 | + * 时间组件回调 | ||
| 53 | + * @param {array} value [开始时间, 结束时间] | ||
| 54 | + */ | ||
| 55 | +const handleTimeChange = (value: array) => { | ||
| 56 | + data.params.query.beginTime = value ? value[0] : ""; | ||
| 57 | + data.params.query.endTime = value ? value[1] : ""; | ||
| 58 | + getList(); | ||
| 59 | +}; | ||
| 60 | +/** | ||
| 61 | + * 上下线状态切换 | ||
| 62 | + * @param {object} obj 要操作的数据对象 | ||
| 63 | + */ | ||
| 64 | +const handleLine = (obj: any) => { | ||
| 65 | + ElMessageBox.confirm("确认切换显示状态吗?", "警告", { | ||
| 66 | + confirmButtonText: "确认", | ||
| 67 | + cancelButtonText: "取消", | ||
| 68 | + type: "warning", | ||
| 69 | + }) | ||
| 70 | + .then(async () => { | ||
| 71 | + try { | ||
| 72 | + let res = await feedbackStatus({ | ||
| 73 | + ids: obj.id, | ||
| 74 | + status: obj.status | ||
| 75 | + }); | ||
| 76 | + if (res?.data) { | ||
| 77 | + ElMessage({ | ||
| 78 | + type: "success", | ||
| 79 | + message: "操作成功", | ||
| 80 | + }); | ||
| 81 | + getList(); | ||
| 82 | + } else { | ||
| 83 | + ElMessage({ | ||
| 84 | + type: "error", | ||
| 85 | + message: "操作失败", | ||
| 86 | + }); | ||
| 87 | + } | ||
| 88 | + } catch (e) { | ||
| 89 | + console.log(e); | ||
| 90 | + } | ||
| 91 | + }) | ||
| 92 | + .catch(() => { | ||
| 93 | + console.log("取消"); | ||
| 94 | + }); | ||
| 95 | +}; | ||
| 96 | +/** | ||
| 97 | + * 列表 | ||
| 98 | + */ | ||
| 99 | +const getList = async () => { | ||
| 100 | + data.loading = true; | ||
| 101 | + try { | ||
| 102 | + const res = await feedbackList(data.params.query); | ||
| 103 | + data.list = res?.data?.data?.list; | ||
| 104 | + data.params.total = res?.data?.data?.total; | ||
| 105 | + } catch (e) { | ||
| 106 | + console.log(e); | ||
| 107 | + } finally { | ||
| 108 | + data.loading = false; | ||
| 109 | + } | ||
| 110 | +}; | ||
| 111 | +onMounted(() => { | ||
| 112 | + getList(); | ||
| 113 | +}); | ||
| 114 | +</script> | ||
| 115 | + | ||
| 116 | +<template> | ||
| 117 | + <div class="page-container"> | ||
| 118 | + <h1>活动评价</h1> | ||
| 119 | + <el-row style="padding-bottom: 20px"> | ||
| 120 | + <el-form :inline="true" label-width="70px"> | ||
| 121 | + <el-form-item label="时间"> | ||
| 122 | + <el-date-picker | ||
| 123 | + v-model="value1" | ||
| 124 | + type="datetimerange" | ||
| 125 | + range-separator="至" | ||
| 126 | + format="YYYY-MM-DD HH:mm:ss" | ||
| 127 | + value-format="YYYY-MM-DD HH:mm:ss" | ||
| 128 | + start-placeholder="开始时间" | ||
| 129 | + end-placeholder="结束时间" | ||
| 130 | + @change="handleTimeChange" | ||
| 131 | + > | ||
| 132 | + </el-date-picker> | ||
| 133 | + </el-form-item> | ||
| 134 | + <el-form-item label="名称"> | ||
| 135 | + <el-input | ||
| 136 | + v-model.trim="data.params.query.handworkName" | ||
| 137 | + placeholder="请填写名称" | ||
| 138 | + maxlength="15" | ||
| 139 | + @change="getList" | ||
| 140 | + /> | ||
| 141 | + </el-form-item> | ||
| 142 | + <el-form-item> | ||
| 143 | + <el-button type="primary" @click="getList">查询</el-button> | ||
| 144 | + <el-button | ||
| 145 | + type="success" | ||
| 146 | + @click=" | ||
| 147 | + handleLine({ id: multipleSelection.map((i) => i.id).join(','), status: 2 }) | ||
| 148 | + " | ||
| 149 | + :disabled="!multipleSelection.length" | ||
| 150 | + >批量上线</el-button | ||
| 151 | + > | ||
| 152 | + <el-button | ||
| 153 | + type="info" | ||
| 154 | + @click=" | ||
| 155 | + handleLine({ id: multipleSelection.map((i) => i.id).join(','), status: 1 }) | ||
| 156 | + " | ||
| 157 | + :disabled="!multipleSelection.length" | ||
| 158 | + >批量下线</el-button | ||
| 159 | + > | ||
| 160 | + </el-form-item> | ||
| 161 | + </el-form> | ||
| 162 | + </el-row> | ||
| 163 | + <el-table | ||
| 164 | + :data="data.list" | ||
| 165 | + style="width: 100%" | ||
| 166 | + border | ||
| 167 | + v-loading="data.loading" | ||
| 168 | + align="center" | ||
| 169 | + element-loading-text="拼命加载中" | ||
| 170 | + ref="multipleTableRef" | ||
| 171 | + @selection-change="handleSelectionChange" | ||
| 172 | + > | ||
| 173 | + <el-table-column | ||
| 174 | + type="selection" | ||
| 175 | + align="center" | ||
| 176 | + /> | ||
| 177 | + <el-table-column prop="id" label="ID" align="center"></el-table-column> | ||
| 178 | + <el-table-column | ||
| 179 | + prop="userName" | ||
| 180 | + label="用户" | ||
| 181 | + align="center" | ||
| 182 | + ></el-table-column> | ||
| 183 | + <el-table-column | ||
| 184 | + prop="handworkName" | ||
| 185 | + label="活动名称" | ||
| 186 | + align="center" | ||
| 187 | + ></el-table-column> | ||
| 188 | + <el-table-column | ||
| 189 | + prop="comment" | ||
| 190 | + label="评价" | ||
| 191 | + align="center" | ||
| 192 | + ></el-table-column> | ||
| 193 | + <el-table-column prop="isAnonymity" label="匿名状态" align="center"> | ||
| 194 | + <template #default="scope"> | ||
| 195 | + {{ scope.row.isAnonymity ? "匿名" : "实名" }} | ||
| 196 | + </template> | ||
| 197 | + </el-table-column> | ||
| 198 | + <el-table-column prop="status" label="显示到前台" align="center"> | ||
| 199 | + <template #default="scope"> | ||
| 200 | + {{ globalFilters(scope.row.status, data.onlineStatus) }} | ||
| 201 | + </template> | ||
| 202 | + </el-table-column> | ||
| 203 | + <el-table-column prop="createTime" label="评价时间" align="center"> | ||
| 204 | + <template #default="scope"> | ||
| 205 | + {{ parseTime(new Date(scope.row.createTime).getTime()) }} | ||
| 206 | + </template> | ||
| 207 | + </el-table-column> | ||
| 208 | + <el-table-column label="操作" align="center"> | ||
| 209 | + <template #default="scope"> | ||
| 210 | + <el-button type="text" v-if="~~scope.row.status === 1" @click="handleLine({id: scope.row.id, status: 2})">上线</el-button> | ||
| 211 | + <el-button type="text" v-if="~~scope.row.status === 2" @click="handleLine({id: scope.row.id, status: 1})">下线</el-button> | ||
| 212 | + </template> | ||
| 213 | + </el-table-column> | ||
| 214 | + </el-table> | ||
| 215 | + <Pagination | ||
| 216 | + :total="data.params.total" | ||
| 217 | + v-model:currentPage="data.params.query.page" | ||
| 218 | + v-model:pageSize="data.params.query.pageSize" | ||
| 219 | + @pageChange="getList" | ||
| 220 | + ></Pagination> | ||
| 221 | + </div> | ||
| 222 | +</template> |