fix
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
<el-row :gutter="10">
|
||||
<el-col :span="1.5">
|
||||
<el-button @click="handleAdd" type="primary" size="small" icon="plus"
|
||||
>新增
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
@ -13,7 +13,7 @@
|
||||
type="danger"
|
||||
size="small"
|
||||
:disabled="multiple"
|
||||
>批量删除
|
||||
>批量删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -37,7 +37,7 @@
|
||||
<div>
|
||||
<a
|
||||
class="short-link"
|
||||
:href="`//${row.urlPrefix}/dlj/${row.urlSuffix}`"
|
||||
:href="`${row.urlPrefix}/dlj/${row.urlSuffix}`"
|
||||
>
|
||||
{{ row.urlPrefix }}/dlj/{{ row.urlSuffix }}
|
||||
</a>
|
||||
@ -60,7 +60,7 @@
|
||||
:style="{
|
||||
cursor: 'pointer',
|
||||
}"
|
||||
@click="copyToClipboard(row.jumpUrl)"
|
||||
@click="copyToClipboard(row)"
|
||||
>
|
||||
<CopyDocument />
|
||||
</el-icon>
|
||||
@ -96,21 +96,21 @@
|
||||
link
|
||||
size="small"
|
||||
type="warning"
|
||||
>编辑
|
||||
>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
@click="handleDelete(row.id)"
|
||||
link
|
||||
size="small"
|
||||
type="danger"
|
||||
>删除
|
||||
>删除
|
||||
</el-button>
|
||||
<el-button
|
||||
@click="goLogList(row.urlSuffix)"
|
||||
link
|
||||
size="small"
|
||||
type="primary"
|
||||
>访问记录
|
||||
>访问记录
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -174,14 +174,20 @@
|
||||
width: '100%',
|
||||
marginTop: '10px',
|
||||
}"
|
||||
>下载二维码
|
||||
>下载二维码
|
||||
</el-button>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="GenShortLink">
|
||||
import { addShortLink, deleteShortLink, getDetailById, listShortLink, updateShortLink } from "@/api/shortlink";
|
||||
import {
|
||||
addShortLink,
|
||||
deleteShortLink,
|
||||
getDetailById,
|
||||
listShortLink,
|
||||
updateShortLink,
|
||||
} from "@/api/shortlink";
|
||||
import { reactive, ref, toRefs } from "vue";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import type { ShortLink } from "@/models/shortLink";
|
||||
@ -204,7 +210,7 @@ const data = reactive<{
|
||||
}>({
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10
|
||||
pageSize: 10,
|
||||
},
|
||||
form: {},
|
||||
rules: {
|
||||
@ -212,31 +218,31 @@ const data = reactive<{
|
||||
{
|
||||
required: true,
|
||||
message: "请输入短链接名称",
|
||||
trigger: "blur"
|
||||
}
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
jumpUrl: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入短链接",
|
||||
trigger: "blur"
|
||||
}
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
urlPrefix: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入URL前缀",
|
||||
trigger: "blur"
|
||||
}
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
validityTime: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择过期时间",
|
||||
trigger: "change"
|
||||
}
|
||||
]
|
||||
}
|
||||
trigger: "change",
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
const { form, queryParams, rules } = toRefs(data);
|
||||
const total = ref<number>(0);
|
||||
@ -253,7 +259,7 @@ const handleShowQrCode = (data: ShortLink) => {
|
||||
};
|
||||
const goLogList = (suffix: string) => {
|
||||
router.push({
|
||||
path: `/log-list/${suffix}`
|
||||
path: `/log-list/${suffix}`,
|
||||
});
|
||||
};
|
||||
const reset = () => {
|
||||
@ -286,8 +292,8 @@ const handleSelectionChange = (selection: ShortLink[]) => {
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
const copyToClipboard = (data: string) => {
|
||||
navigator.clipboard.writeText(data);
|
||||
const copyToClipboard = (data: ShortLink) => {
|
||||
navigator.clipboard.writeText(`${data.urlPrefix}/dlj/${data.urlSuffix}`);
|
||||
ElMessage.success("短链接已拷贝到剪贴板");
|
||||
};
|
||||
const handleAdd = () => {
|
||||
@ -310,7 +316,7 @@ const handleDelete = (id?: string) => {
|
||||
ids = linkIds.value.join(",");
|
||||
}
|
||||
ElMessageBox.confirm("确认删除该短链接吗", "删除短链接", {
|
||||
type: "warning"
|
||||
type: "warning",
|
||||
}).then(async () => {
|
||||
await deleteShortLink(ids);
|
||||
ElMessage.success("删除短链接成功");
|
||||
@ -377,7 +383,7 @@ getList();
|
||||
margin-top: 20px;
|
||||
margin-right: 10px;
|
||||
display: flex;
|
||||
justify-content: end;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user