|
@@ -1,12 +1,11 @@
|
|
|
<script setup>
|
|
|
-import { onMounted, ref } from 'vue'
|
|
|
-import Download from '@/components/icon/download.vue'
|
|
|
-import Warning from '@/components/icon/warning.vue'
|
|
|
-import Search from '@/components/icon/search.vue'
|
|
|
-import { get } from '../../utils/request'
|
|
|
+import { onMounted, ref, getCurrentInstance } from 'vue'
|
|
|
+import copy from 'copy-to-clipboard'
|
|
|
+import { get, post } from '../../utils/request'
|
|
|
import { userStore } from '@/store/userInfo'
|
|
|
import { productListNameMapping } from '../../utils/mapping'
|
|
|
|
|
|
+const { proxy } = getCurrentInstance()
|
|
|
const currentPage = ref(1)
|
|
|
const size = ref(5)
|
|
|
const tableData = ref([])
|
|
@@ -18,6 +17,9 @@ const productList = ref([])
|
|
|
const productId = ref('')
|
|
|
const url = ref('')
|
|
|
const role = userStore().user.role
|
|
|
+const serverId = ref('')
|
|
|
+const serverIdDialogVisible = ref(false)
|
|
|
+const file = ref(null)
|
|
|
|
|
|
onMounted(() => {
|
|
|
let pageText = document.getElementsByClassName('el-pagination__jump')[0]
|
|
@@ -78,10 +80,89 @@ const handleCurrentChange = (value) => {
|
|
|
currentPage.value = value
|
|
|
pagingQuery()
|
|
|
}
|
|
|
+
|
|
|
+const upLoadChange = (value) => {
|
|
|
+ file.value = value.raw
|
|
|
+ const formData = new FormData()
|
|
|
+ formData.append("keyFile", file.value)
|
|
|
+ post('/pdf-tech/vppKeyFile/parseKeyFile', formData)
|
|
|
+ .then((res) => {
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ proxy.$message({
|
|
|
+ duration: 5000,
|
|
|
+ message: 'Upload Successfully',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ proxy.$message({
|
|
|
+ duration: 5000,
|
|
|
+ message: 'Upload Failed',
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ proxy.$message({
|
|
|
+ duration: 5000,
|
|
|
+ message: 'Upload Failed',
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+const handleGetKeyFile = async () => {
|
|
|
+ await post('/pdf-tech/vppDevice/getServerId').then((res) => {
|
|
|
+ if (res.data.code === 200) {
|
|
|
+ serverId.value = res.data.result
|
|
|
+ }
|
|
|
+ })
|
|
|
+ dialogVisible.value = false
|
|
|
+ serverIdDialogVisible.value = true
|
|
|
+}
|
|
|
+
|
|
|
+const copyServerId = () => {
|
|
|
+ copy(serverId.value)
|
|
|
+ proxy.$message({
|
|
|
+ duration: 5000,
|
|
|
+ message: 'Copy Successfully',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ serverIdDialogVisible.value = false
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
<div class="flex flex-col items-center">
|
|
|
+ <el-dialog title="" :visible.sync="dialogVisible" width="376px" top="30vh" center :show-close="false">
|
|
|
+ <h3 class="text-16px font-bold mt-16px">Update Your License</h3>
|
|
|
+ <p>
|
|
|
+ Don't have a key file yet? <span class="text-16px text-[#1460F3] cursor-pointer" @click="handleGetKeyFile">Get one</span>
|
|
|
+ </p>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="dialogVisible = false">Cancel</el-button>
|
|
|
+ <el-upload
|
|
|
+ class="inline-block ml-8px"
|
|
|
+ :on-change="upLoadChange"
|
|
|
+ :auto-upload="false"
|
|
|
+ :show-file-list="false"
|
|
|
+ action=""
|
|
|
+ >
|
|
|
+ <el-button type="primary">
|
|
|
+ Upload a key file
|
|
|
+ </el-button>
|
|
|
+ </el-upload>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ <el-dialog title="" :visible.sync="serverIdDialogVisible" width="376px" top="30vh" :show-close="false">
|
|
|
+ <h3 class="text-16px font-bold mt-16px">Copy Server ID</h3>
|
|
|
+ <p>Contact us with your Server ID to get your key file</p>
|
|
|
+ <h3 class="text-16px font-bold mt-16px">Sever ID:</h3>
|
|
|
+ <p>{{ serverId }}</p>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="serverIdDialogVisible = false">Cancel</el-button>
|
|
|
+ <el-button type="primary" @click="copyServerId">Copy</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
<div class="w-full">
|
|
|
<h1 class="leading-40px">Product Management</h1>
|
|
|
<div
|
|
@@ -96,13 +177,12 @@ const handleCurrentChange = (value) => {
|
|
|
"
|
|
|
>
|
|
|
<span>Content</span>
|
|
|
- <a
|
|
|
+ <button
|
|
|
v-if="role === '1'"
|
|
|
- target="_blank"
|
|
|
- :href="url"
|
|
|
class="h-28px px-10px py-4px bg-[#1460F3] rounded-4px text-14px leading-20px font-400 text-[#fff] cursor-pointer hover:opacity-80"
|
|
|
+ @click="handleClick"
|
|
|
>
|
|
|
- Buy More Product</a>
|
|
|
+ Update Key File</button>
|
|
|
</div>
|
|
|
<div class="flex bg-[#fff] pt-32px px-24px rounded-t-8px w-full">
|
|
|
<select v-model="productId" class="w-140px" :class="{ '!text-[#232A40]': productId !== '' }">
|