|
- <template>
- <div class="page justify-around">
- <el-alert :title="`当前币值:${currentValue}`" type="success" :closable="false" />
-
- <el-table :data="tableData" style="width: 100%; height: 90%" size="large" align="center" border>
- <el-table-column
- prop="title"
- label="名称"
- align="center"
- />
-
- <el-table-column
- prop="address"
- label="图片"
- align="center"
- />
- <el-table-column
- prop="createTime"
- label="创建时间"
- align="center"
- >
- <template #default="scope">
- {{ getDate(scope.row.createTime) }}
- </template>
- </el-table-column>
- <el-table-column
- fixed="right"
- label="操作"
- width="400"
- align="center"
- >
- <template #default="scope">
- <el-button link type="primary" size="small">查看</el-button>
- </template>
- </el-table-column>
- </el-table>
-
- <div class="pagination">
- <el-pagination
- v-model:current-page="pageNum"
- v-model:page-size="pageSize"
- :page-sizes="[10, 50, 100]"
- :small="false"
- :disabled="false"
- :background="true"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total"
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- />
- </div>
- <el-dialog v-model="dialogVisible" title="查看详情" width="40%" :before-close="handleClose" >
- <detail @close="handleClose"></detail>
- </el-dialog>
- </div>
- </template>
-
- <!-- videoType==1为竖,==2为横 -->
- <script setup>
- //#region 导入
- import { coindedApi, getDetailApi, getUserPoinsApi } from '@/apis/my.js'
- import dayjs from "dayjs";
- import detail from './detail.vue'
-
- const tableData = ref([]);
-
- const pageNum = ref(1);
- const pageSize = ref(10);
- const total = ref(0);
-
- const getDate = (val) => {
- return dayjs(val).format("YYYY-MM-DD");
- };
-
- const handleSizeChange = (val) => {
- pageSize.value = val;
- getListData(pageNum.value, pageSize.value);
- };
-
- const handleCurrentChange = (val) => {
- pageNum.value = val;
- getListData(pageNum.value, pageSize.value);
- };
-
- const getListData = async (PageNum, PageSize) => {
- try {
- let data = {
- projectType: 2,
- pageNum: 1,
- pageSize: 10
- }
- const res = await coindedApi(data);
- tableData.value = res.data.list;
- total.value = res.data.total * 1;
- } catch (error) {
- console.log(error, "err");
- }
- };
-
- // 当前币值
- const currentValue = ref('')
- function currentValFn() {
- getUserPoinsApi().then(res => {
- currentValue.value = res.data
- })
- }
-
- // 查看详情
- const dialogVisible = ref(false)
-
- onMounted(() => {
- getListData(1, 10);
- currentValFn()
- });
- </script>
-
- <style lang="scss" scoped>
- .page {
- height: calc(100vh - 80px);
- // height: calc(100vh - 80px);
- background-color: #ffffff;
- border-radius: 30px 0 0 0;
- overflow: hidden;
- padding: 10vh;
- .addbtn {
- margin-bottom: 2vh;
- }
- .formData {
- padding: 5vh 3vh;
- }
-
- .pagination {
- position: fixed;
- left: 55%;
- bottom: 8vh;
- transform: translateX(-50%);
- border-radius: 5px;
- padding: 10px 20px;
- z-index: 99;
- transition: all 0.3s;
- cursor: pointer;
- &:hover {
- background-color: #b8b8b873;
- }
- }
- }
- </style>
|