|
@@ -24,16 +24,32 @@
|
|
|
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
|
|
|
</template> </BasicTable
|
|
|
></div>
|
|
|
+ <Modal v-model:open="openCode" title="赛事二维码">
|
|
|
+ <div class="p-20px flex items-center justify-center">
|
|
|
+ <div
|
|
|
+ ><QRCode :value="CodeText" ref="qrcodeCanvasRef" /> <a-button type="link" block class="mt20px" @click="downloadImage">下载图片</a-button></div
|
|
|
+ >
|
|
|
+ </div>
|
|
|
+ </Modal>
|
|
|
+ <competitionModal @register="registerModal" @success="reload"></competitionModal>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts" name="businessManagement-competition">
|
|
|
+ import { QRCode, Modal } from 'ant-design-vue';
|
|
|
import { BasicTable, TableAction } from '/@/components/Table';
|
|
|
import { useListPage } from '/@/hooks/system/useListPage';
|
|
|
import { searchFormSchema, columns } from './competition.data';
|
|
|
import { deleteOne, list } from './competition.api';
|
|
|
import { getcompetition } from '@/api/businessManagement/competition';
|
|
|
+ import competitionModal from './competitonModel.vue';
|
|
|
import { router } from '/@/router';
|
|
|
-
|
|
|
+ import { ref } from 'vue';
|
|
|
+ import { useRouteTabText } from '/@/hooks/web/useRouteTab';
|
|
|
+ import { useModal } from '/@/components/Modal';
|
|
|
+ const openCode = ref(false);
|
|
|
+ const qrcodeCanvasRef = ref();
|
|
|
+ const CodeText = ref('');
|
|
|
+ useRouteTabText(['添加赛事', '编辑赛事', '查看赛事']);
|
|
|
const { prefixCls, tableContext } = useListPage({
|
|
|
designScope: 'competition-template',
|
|
|
tableProps: {
|
|
@@ -66,6 +82,7 @@
|
|
|
// },
|
|
|
});
|
|
|
const [registerTable, { reload, expandAll, collapseAll }] = tableContext;
|
|
|
+ const [registerModal, { openModal }] = useModal();
|
|
|
function getTableAction(record) {
|
|
|
return [
|
|
|
{
|
|
@@ -94,8 +111,22 @@
|
|
|
},
|
|
|
// auth: 'courses:nm_courses:delete',
|
|
|
},
|
|
|
+ {
|
|
|
+ label: '发布成绩',
|
|
|
+ onClick: handleEditGrades.bind(null, record),
|
|
|
+ // auth: 'courses:nm_courses:delete',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '赛事二维码',
|
|
|
+ onClick: handleViewCode.bind(null, record),
|
|
|
+ // auth: 'courses:nm_courses:delete',
|
|
|
+ },
|
|
|
];
|
|
|
}
|
|
|
+ function handleViewCode(record) {
|
|
|
+ CodeText.value = `/pages/index/eventsDetail/index?id=${record.id}`;
|
|
|
+ openCode.value = true;
|
|
|
+ }
|
|
|
async function handleDelete(record) {
|
|
|
await deleteOne({ id: record.id }, reload);
|
|
|
}
|
|
@@ -106,24 +137,23 @@
|
|
|
function handleEdit(record) {
|
|
|
router.push({ name: 'businessManagement-competitionCommon', query: { type: 1, id: record.id } });
|
|
|
}
|
|
|
-</script>
|
|
|
|
|
|
-<script lang="ts">
|
|
|
- import { useMultipleTabStore } from '@/store/modules/multipleTab';
|
|
|
- import { storeToRefs } from 'pinia';
|
|
|
- const typeList = ['添加赛事', '编辑赛事', '查看赛事'];
|
|
|
- export default {
|
|
|
- async beforeRouteLeave(to, from, next) {
|
|
|
- to.meta.title = typeList[Number(to.query.type)];
|
|
|
- const { getTabList } = storeToRefs(useMultipleTabStore());
|
|
|
- const closeTab = getTabList.value.filter((it) => it.name == to.name).filter((it) => it.fullPath != to.fullPath);
|
|
|
- if (closeTab.length) {
|
|
|
- useMultipleTabStore().closeTabByKey(closeTab[0].fullPath, router);
|
|
|
- }
|
|
|
- await useMultipleTabStore().updateCacheTab();
|
|
|
- next();
|
|
|
- },
|
|
|
- };
|
|
|
+ function handleEditGrades(record) {
|
|
|
+ openModal(true, {
|
|
|
+ record: record.game,
|
|
|
+ isUpdate: true,
|
|
|
+ showFooter: true,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ async function downloadImage() {
|
|
|
+ const url = await qrcodeCanvasRef.value.toDataURL();
|
|
|
+ const a = document.createElement('a');
|
|
|
+ a.download = 'competition.png';
|
|
|
+ a.href = url;
|
|
|
+ document.body.appendChild(a);
|
|
|
+ a.click();
|
|
|
+ document.body.removeChild(a);
|
|
|
+ }
|
|
|
</script>
|
|
|
|
|
|
<style scoped></style>
|