mirror of
https://github.com/silenty4ng/k5web
synced 2025-01-15 16:22:44 +00:00
Compare commits
2 commits
81ff1e2174
...
3e7bb8e3ad
Author | SHA1 | Date | |
---|---|---|---|
3e7bb8e3ad | |||
dfa63b90ad |
8 changed files with 168 additions and 97 deletions
|
@ -6,8 +6,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div style="color: #AAAAAA;">{{ ua }}</div>
|
<div style="color: #AAAAAA;">{{ ua }}</div>
|
||||||
</div>
|
</div>
|
||||||
<t-config-provider v-if="reloadLang && !((isWeixin || isQQ) && route.path !== '/satloc')" :global-config="locale">
|
<t-config-provider v-if="reloadLang && !((isWeixin || isQQ) && route.path !== '/satloc')" :global-config="locale[0]">
|
||||||
<a-config-provider :locale="locale">
|
<a-config-provider :locale="locale[1]">
|
||||||
<router-view />
|
<router-view />
|
||||||
<global-setting />
|
<global-setting />
|
||||||
</a-config-provider>
|
</a-config-provider>
|
||||||
|
@ -60,12 +60,12 @@
|
||||||
case 'zh-CN':
|
case 'zh-CN':
|
||||||
sessionStorage.setItem('noticeConnectK5', '请先连接手台!')
|
sessionStorage.setItem('noticeConnectK5', '请先连接手台!')
|
||||||
sessionStorage.setItem('noticeVersionNoSupport', '固件版本不匹配')
|
sessionStorage.setItem('noticeVersionNoSupport', '固件版本不匹配')
|
||||||
lang = {...zhCN, ...tdesignZhCN};
|
lang = [tdesignZhCN, zhCN];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sessionStorage.setItem('noticeConnectK5', 'Connect first!')
|
sessionStorage.setItem('noticeConnectK5', 'Connect first!')
|
||||||
sessionStorage.setItem('noticeVersionNoSupport', 'Firmware not supported')
|
sessionStorage.setItem('noticeVersionNoSupport', 'Firmware not supported')
|
||||||
lang = {...enUS, ...tdesignEnUS};
|
lang = [tdesignEnUS, enUS];
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
reloadLang.value = true;
|
reloadLang.value = true;
|
||||||
|
|
|
@ -40,7 +40,7 @@ axios.interceptors.response.use(
|
||||||
(response: AxiosResponse<HttpResponse>) => {
|
(response: AxiosResponse<HttpResponse>) => {
|
||||||
const res = response.data;
|
const res = response.data;
|
||||||
// if the custom code is not 20000, it is judged as an error.
|
// if the custom code is not 20000, it is judged as an error.
|
||||||
if (res.code !== 200) {
|
if (res.code !== 200 && res.code !== 1) {
|
||||||
Message.error({
|
Message.error({
|
||||||
content: res.msg || 'Error',
|
content: res.msg || 'Error',
|
||||||
duration: 5 * 1000,
|
duration: 5 * 1000,
|
||||||
|
|
|
@ -48,6 +48,14 @@
|
||||||
</t-input>
|
</t-input>
|
||||||
</t-form-item>
|
</t-form-item>
|
||||||
|
|
||||||
|
<t-form-item name="nickname">
|
||||||
|
<t-input v-model="formData.nickname" clearable :placeholder="$t('global.nickname')">
|
||||||
|
<template #prefix-icon>
|
||||||
|
<desktop-icon />
|
||||||
|
</template>
|
||||||
|
</t-input>
|
||||||
|
</t-form-item>
|
||||||
|
|
||||||
<t-form-item name="password">
|
<t-form-item name="password">
|
||||||
<t-input v-model="formData.password" type="password" clearable :placeholder="$t('global.password')">
|
<t-input v-model="formData.password" type="password" clearable :placeholder="$t('global.password')">
|
||||||
<template #prefix-icon>
|
<template #prefix-icon>
|
||||||
|
@ -64,6 +72,14 @@
|
||||||
</t-input>
|
</t-input>
|
||||||
</t-form-item>
|
</t-form-item>
|
||||||
|
|
||||||
|
<t-form-item name="motto">
|
||||||
|
<t-input v-model="formData.motto" clearable :placeholder="$t('global.motto')">
|
||||||
|
<template #prefix-icon>
|
||||||
|
<desktop-icon />
|
||||||
|
</template>
|
||||||
|
</t-input>
|
||||||
|
</t-form-item>
|
||||||
|
|
||||||
<t-form-item>
|
<t-form-item>
|
||||||
<t-button theme="primary" type="submit" block>{{$t('global.register')}}</t-button>
|
<t-button theme="primary" type="submit" block>{{$t('global.register')}}</t-button>
|
||||||
</t-form-item>
|
</t-form-item>
|
||||||
|
@ -131,28 +147,32 @@
|
||||||
|
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
account: '',
|
account: '',
|
||||||
|
nickname: '',
|
||||||
password: '',
|
password: '',
|
||||||
password2: ''
|
password2: '',
|
||||||
|
motto: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
const onLogin = async () => {
|
const onLogin = async () => {
|
||||||
const resp : any = await axios.post("https://k5.vicicode.cn/wsapi/login", {
|
const resp : any = await axios.post("https://k5ws.vicicode.cn/api/user/checkIn?server=1", {
|
||||||
'username': formData.account,
|
'username': formData.account,
|
||||||
'password': formData.password
|
'password': formData.password,
|
||||||
|
'tab': 'login',
|
||||||
|
'keep': false
|
||||||
})
|
})
|
||||||
if(resp.code == 200){
|
if(resp.code == 1){
|
||||||
userStore.setInfo({
|
userStore.setInfo({
|
||||||
showLogin: false,
|
showLogin: false,
|
||||||
name: formData.account,
|
name: resp.data.userInfo.nickname,
|
||||||
accountId: resp.token
|
accountId: resp.data.userInfo.token
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const onRegister = async () => {
|
const onRegister = async () => {
|
||||||
if(formData.password == '' || formData.account == ''){
|
if(formData.password == '' || formData.account == '' || formData.nickname == ''){
|
||||||
Message.error({
|
Message.error({
|
||||||
content: '用户名及密码不能为空',
|
content: '用户名、昵称及密码不能为空',
|
||||||
duration: 5 * 1000,
|
duration: 5 * 1000,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
@ -164,14 +184,18 @@
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const resp : any = await axios.post("https://k5.vicicode.cn/wsapi/register", {
|
const resp : any = await axios.post("https://k5ws.vicicode.cn/api/user/checkIn?server=1", {
|
||||||
'username': formData.account,
|
'username': formData.account,
|
||||||
'password': formData.password
|
'password': formData.password,
|
||||||
|
'nickname': formData.nickname,
|
||||||
|
'motto': formData.motto,
|
||||||
|
'tab': 'register',
|
||||||
})
|
})
|
||||||
if(resp.code == 200){
|
if(resp.code == 1){
|
||||||
userStore.setInfo({
|
userStore.setInfo({
|
||||||
showRegister: false,
|
showRegister: false,
|
||||||
showLogin: true
|
name: formData.nickname,
|
||||||
|
accountId: resp.data.userInfo.token
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,8 +150,10 @@ export default {
|
||||||
'tool.writessbpatch': 'SSB Patch Write',
|
'tool.writessbpatch': 'SSB Patch Write',
|
||||||
'global.login': 'Login',
|
'global.login': 'Login',
|
||||||
'global.register': 'Register',
|
'global.register': 'Register',
|
||||||
|
'global.motto': 'Motto',
|
||||||
'global.logout': 'Logout',
|
'global.logout': 'Logout',
|
||||||
'global.username': 'Username',
|
'global.username': 'Username',
|
||||||
|
'global.nickname': 'Nickname',
|
||||||
'global.password': 'Password',
|
'global.password': 'Password',
|
||||||
'global.password2': 'Retype password ',
|
'global.password2': 'Retype password ',
|
||||||
'image.negative': 'Negative',
|
'image.negative': 'Negative',
|
||||||
|
|
|
@ -150,10 +150,12 @@ export default {
|
||||||
'tool.writessbpatch': '写入单边带补丁',
|
'tool.writessbpatch': '写入单边带补丁',
|
||||||
'global.login': '登录',
|
'global.login': '登录',
|
||||||
'global.register': '注册',
|
'global.register': '注册',
|
||||||
|
'global.motto': '联系方式(用于找回密码)',
|
||||||
'global.logout': '退出',
|
'global.logout': '退出',
|
||||||
'global.username': '请输入用户名',
|
'global.username': '*请输入用户名',
|
||||||
'global.password': '请输入密码',
|
'global.nickname': '*请输入昵称',
|
||||||
'global.password2': '请再次输入密码',
|
'global.password': '*请输入密码',
|
||||||
|
'global.password2': '*请再次输入密码',
|
||||||
'image.negative': '反色',
|
'image.negative': '反色',
|
||||||
'workplace.clickNotice': '(官方固件只能检测 8KB/64Kbit)',
|
'workplace.clickNotice': '(官方固件只能检测 8KB/64Kbit)',
|
||||||
'menu.cps.radio': '收音机',
|
'menu.cps.radio': '收音机',
|
||||||
|
|
|
@ -24,13 +24,14 @@
|
||||||
:description="item.desc"
|
:description="item.desc"
|
||||||
>
|
>
|
||||||
<template #title>
|
<template #title>
|
||||||
<t-tag theme="primary" variant="outline">{{ item.upload }}</t-tag> {{ item.title }}
|
<t-tag theme="primary" variant="outline">{{ item.user?.nickname }}</t-tag> {{ item.title }}
|
||||||
</template>
|
</template>
|
||||||
</a-list-item-meta>
|
</a-list-item-meta>
|
||||||
<template #actions>
|
<template #actions>
|
||||||
<a-link @click="onStar(item.id)">👍</a-link>
|
<t-tag style="margin-left: 1rem;">{{ item.create_time_text }}</t-tag>
|
||||||
<a-link @click="iDownload('https://k5.vicicode.cn/wsapi/download?id=' + item.id, item.title)">{{$t('global.download')}}</a-link>
|
<a-link @click="onStar(item.id)">👍({{ item.star }})</a-link>
|
||||||
<a-link @click="useFirmware('https://k5.vicicode.cn/wsapi/download?id=' + item.id)">{{$t('global.use')}}</a-link>
|
<a-link @click="iDownload('https://k5ws.vicicode.cn' + item.file, item.title)">{{$t('global.download')}}</a-link>
|
||||||
|
<a-link @click="useFirmware('https://k5ws.vicicode.cn' + item.file)">{{$t('global.use')}}</a-link>
|
||||||
</template>
|
</template>
|
||||||
</a-list-item>
|
</a-list-item>
|
||||||
</a-list>
|
</a-list>
|
||||||
|
@ -49,12 +50,15 @@
|
||||||
<t-list-item v-for="item in state.myList">
|
<t-list-item v-for="item in state.myList">
|
||||||
<div style="display: flex; width: 100%;">
|
<div style="display: flex; width: 100%;">
|
||||||
<div style="width: 90%;">
|
<div style="width: 90%;">
|
||||||
<t-tag theme="primary" variant="outline">{{ item.audit ? '已审核' : '审核中' }}</t-tag>
|
<t-tag theme="primary" variant="outline" v-if="item.status == 0">审核中{{ item.remark && `(${item.remark})` }}</t-tag>
|
||||||
|
<t-tag theme="primary" variant="outline" v-else-if="item.status == 1">已审核{{ item.remark && `(${item.remark})` }}</t-tag>
|
||||||
|
<t-tag theme="primary" variant="outline" v-else="item.status == 2">已驳回{{ item.remark && `(${item.remark})` }}</t-tag>
|
||||||
{{ item.title }}
|
{{ item.title }}
|
||||||
<br>
|
<br>
|
||||||
{{ item.desc }}
|
{{ item.desc }}
|
||||||
</div>
|
</div>
|
||||||
<div style="width: 10%; margin: auto; text-align: center;">
|
<div style="width: 40%; margin: auto; text-align: center;">
|
||||||
|
<t-tag>{{ item.create_time_text }}</t-tag>
|
||||||
<t-link theme="primary" hover="color" @click="onDT(item.id)">删除</t-link>
|
<t-link theme="primary" hover="color" @click="onDT(item.id)">删除</t-link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -72,13 +76,16 @@
|
||||||
<t-input v-model="formData.title"></t-input>
|
<t-input v-model="formData.title"></t-input>
|
||||||
</t-form-item>
|
</t-form-item>
|
||||||
<t-form-item label="分享描述" name="desc" label-align="top">
|
<t-form-item label="分享描述" name="desc" label-align="top">
|
||||||
<t-textarea :autosize="{ minRows: 5, maxRows: 10 }" v-model="formData.desc" clearable />
|
<t-textarea :maxlength="200" :autosize="{ minRows: 5, maxRows: 10 }" v-model="formData.desc" clearable />
|
||||||
</t-form-item>
|
</t-form-item>
|
||||||
<t-form-item label="信道文件" name="firmware" label-align="top">
|
<t-form-item label="信道文件" name="firmware" label-align="top">
|
||||||
<t-upload
|
<t-upload
|
||||||
v-model="formData.firmware"
|
v-model="formData.firmware"
|
||||||
action="https://k5.vicicode.cn/wsapi/base64"
|
action="https://k5ws.vicicode.cn/api/ajax/upload?server=1"
|
||||||
:abridge-name="[8, 6]"
|
:abridge-name="[8, 6]"
|
||||||
|
:headers="{
|
||||||
|
'ba-user-token': userStore.accountId
|
||||||
|
}"
|
||||||
theme="file-input"
|
theme="file-input"
|
||||||
placeholder="未选择文件"
|
placeholder="未选择文件"
|
||||||
></t-upload>
|
></t-upload>
|
||||||
|
@ -138,17 +145,18 @@
|
||||||
|
|
||||||
const loadit = async (page: any) => {
|
const loadit = async (page: any) => {
|
||||||
state.page = page.current
|
state.page = page.current
|
||||||
const resp : any = await axios.get("https://k5.vicicode.cn/wsapi/list?type=2&limit=12&page=" + page.current + "&t=" + Date.now())
|
const resp : any = await axios.get("https://k5ws.vicicode.cn/api/channel/index?server=1&limit=12&page=" + page.current + "&t=" + Date.now())
|
||||||
state.total = resp.total
|
state.total = resp.data.total
|
||||||
state.nowpage = resp.data
|
state.nowpage = resp.data.list
|
||||||
}
|
}
|
||||||
|
|
||||||
const showPanel = async () => {
|
const showPanel = async () => {
|
||||||
state.refLoading = true;
|
state.refLoading = true;
|
||||||
state.showPanel = true
|
state.showPanel = true
|
||||||
const resp : any = await axios.post("https://k5.vicicode.cn/wsapi/my_list", {
|
const resp : any = await axios.post("https://k5ws.vicicode.cn/api/channel/my?server=1", {}, {
|
||||||
'type': 2,
|
headers: {
|
||||||
'token': userStore.accountId
|
'ba-user-token': userStore.accountId
|
||||||
|
}
|
||||||
})
|
})
|
||||||
state.myList = resp.data
|
state.myList = resp.data
|
||||||
state.refLoading = false;
|
state.refLoading = false;
|
||||||
|
@ -162,34 +170,40 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const onUF = async () => {
|
const onUF = async () => {
|
||||||
if(formData.title == "" || formData.firmware.length == 0){
|
if(formData.title == "" || formData.firmware.code == 0){
|
||||||
Message.error({
|
Message.error({
|
||||||
content: '未填写名称及上传文件',
|
content: '未填写名称及上传文件',
|
||||||
duration: 5 * 1000,
|
duration: 5 * 1000,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await axios.post("https://k5.vicicode.cn/wsapi/upload", {
|
await axios.post("https://k5ws.vicicode.cn/api/channel/add?server=1", {
|
||||||
'type': 2,
|
|
||||||
'token': userStore.accountId,
|
|
||||||
'title': formData.title,
|
'title': formData.title,
|
||||||
'desc': formData.desc,
|
'desc': formData.desc,
|
||||||
'data': formData.firmware[0].url
|
'data': formData.firmware[0].response.data.file.url
|
||||||
|
}, {
|
||||||
|
headers: {
|
||||||
|
'ba-user-token': userStore.accountId
|
||||||
|
}
|
||||||
})
|
})
|
||||||
state.showUpload = false;
|
state.showUpload = false;
|
||||||
showPanel()
|
showPanel()
|
||||||
}
|
}
|
||||||
|
|
||||||
const onDT = async (id: any) => {
|
const onDT = async (id: any) => {
|
||||||
await axios.post("https://k5.vicicode.cn/wsapi/delete", {
|
await axios.post("https://k5ws.vicicode.cn/api/channel/del?server=1", {
|
||||||
'id': id,
|
'id': id,
|
||||||
'token': userStore.accountId,
|
}, {
|
||||||
|
headers: {
|
||||||
|
'ba-user-token': userStore.accountId
|
||||||
|
}
|
||||||
})
|
})
|
||||||
showPanel()
|
showPanel()
|
||||||
}
|
}
|
||||||
|
|
||||||
const onStar = async (id: any) => {
|
const onStar = async (id: any) => {
|
||||||
await axios.post("https://k5.vicicode.cn/wsapi/star", {
|
state.nowpage.filter((e: any)=>{e.id == id ? e.star += 1 : undefined})
|
||||||
|
await axios.post("https://k5ws.vicicode.cn/api/channel/star?server=1", {
|
||||||
'id': id
|
'id': id
|
||||||
})
|
})
|
||||||
Message.success({
|
Message.success({
|
||||||
|
|
|
@ -24,13 +24,14 @@
|
||||||
:description="item.desc"
|
:description="item.desc"
|
||||||
>
|
>
|
||||||
<template #title>
|
<template #title>
|
||||||
<t-tag theme="primary" variant="outline">{{ item.upload }}</t-tag> {{ item.title }}
|
<t-tag theme="primary" variant="outline">{{ item.user?.nickname }}</t-tag> {{ item.title }}
|
||||||
</template>
|
</template>
|
||||||
</a-list-item-meta>
|
</a-list-item-meta>
|
||||||
<template #actions>
|
<template #actions>
|
||||||
<a-link @click="onStar(item.id)">👍</a-link>
|
<t-tag style="margin-left: 1rem;">{{ item.create_time_text }}</t-tag>
|
||||||
<a-link @click="iDownload('https://k5.vicicode.cn/wsapi/download?id=' + item.id, item.title)">{{$t('global.download')}}</a-link>
|
<a-link @click="onStar(item.id)">👍({{ item.star }})</a-link>
|
||||||
<a-link @click="useFirmware('https://k5.vicicode.cn/wsapi/download?id=' + item.id + '&n=/' + item.title)">{{$t('global.use')}}</a-link>
|
<a-link @click="iDownload('https://k5ws.vicicode.cn' + item.file, item.title)">{{$t('global.download')}}</a-link>
|
||||||
|
<a-link @click="useFirmware('https://k5ws.vicicode.cn' + item.file + '?n=/' + item.title)">{{$t('global.use')}}</a-link>
|
||||||
</template>
|
</template>
|
||||||
</a-list-item>
|
</a-list-item>
|
||||||
</a-list>
|
</a-list>
|
||||||
|
@ -49,12 +50,15 @@
|
||||||
<t-list-item v-for="item in state.myList">
|
<t-list-item v-for="item in state.myList">
|
||||||
<div style="display: flex; width: 100%;">
|
<div style="display: flex; width: 100%;">
|
||||||
<div style="width: 90%;">
|
<div style="width: 90%;">
|
||||||
<t-tag theme="primary" variant="outline">{{ item.audit ? '已审核' : '审核中' }}</t-tag>
|
<t-tag theme="primary" variant="outline" v-if="item.status == 0">审核中{{ item.remark && `(${item.remark})` }}</t-tag>
|
||||||
|
<t-tag theme="primary" variant="outline" v-else-if="item.status == 1">已审核{{ item.remark && `(${item.remark})` }}</t-tag>
|
||||||
|
<t-tag theme="primary" variant="outline" v-else="item.status == 2">已驳回{{ item.remark && `(${item.remark})` }}</t-tag>
|
||||||
{{ item.title }}
|
{{ item.title }}
|
||||||
<br>
|
<br>
|
||||||
{{ item.desc }}
|
{{ item.desc }}
|
||||||
</div>
|
</div>
|
||||||
<div style="width: 10%; margin: auto; text-align: center;">
|
<div style="width: 40%; margin: auto; text-align: center;">
|
||||||
|
<t-tag>{{ item.create_time_text }}</t-tag>
|
||||||
<t-link theme="primary" hover="color" @click="onDT(item.id)">删除</t-link>
|
<t-link theme="primary" hover="color" @click="onDT(item.id)">删除</t-link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -72,13 +76,16 @@
|
||||||
<t-input v-model="formData.title"></t-input>
|
<t-input v-model="formData.title"></t-input>
|
||||||
</t-form-item>
|
</t-form-item>
|
||||||
<t-form-item label="固件描述" name="desc" label-align="top">
|
<t-form-item label="固件描述" name="desc" label-align="top">
|
||||||
<t-textarea :autosize="{ minRows: 5, maxRows: 10 }" v-model="formData.desc" clearable />
|
<t-textarea :maxlength="200" :autosize="{ minRows: 5, maxRows: 10 }" v-model="formData.desc" clearable />
|
||||||
</t-form-item>
|
</t-form-item>
|
||||||
<t-form-item label="固件文件" name="firmware" label-align="top">
|
<t-form-item label="固件文件" name="firmware" label-align="top">
|
||||||
<t-upload
|
<t-upload
|
||||||
v-model="formData.firmware"
|
v-model="formData.firmware"
|
||||||
action="https://k5.vicicode.cn/wsapi/base64"
|
action="https://k5ws.vicicode.cn/api/ajax/upload?server=1"
|
||||||
:abridge-name="[8, 6]"
|
:abridge-name="[8, 6]"
|
||||||
|
:headers="{
|
||||||
|
'ba-user-token': userStore.accountId
|
||||||
|
}"
|
||||||
theme="file-input"
|
theme="file-input"
|
||||||
placeholder="未选择文件"
|
placeholder="未选择文件"
|
||||||
></t-upload>
|
></t-upload>
|
||||||
|
@ -138,17 +145,18 @@
|
||||||
|
|
||||||
const loadit = async (page: any) => {
|
const loadit = async (page: any) => {
|
||||||
state.page = page.current
|
state.page = page.current
|
||||||
const resp : any = await axios.get("https://k5.vicicode.cn/wsapi/list?type=0&limit=12&page=" + page.current + "&t=" + Date.now())
|
const resp : any = await axios.get("https://k5ws.vicicode.cn/api/firmware/index?server=1&limit=12&page=" + page.current + "&t=" + Date.now())
|
||||||
state.total = resp.total
|
state.total = resp.data.total
|
||||||
state.nowpage = resp.data
|
state.nowpage = resp.data.list
|
||||||
}
|
}
|
||||||
|
|
||||||
const showPanel = async () => {
|
const showPanel = async () => {
|
||||||
state.refLoading = true;
|
state.refLoading = true;
|
||||||
state.showPanel = true
|
state.showPanel = true
|
||||||
const resp : any = await axios.post("https://k5.vicicode.cn/wsapi/my_list", {
|
const resp : any = await axios.post("https://k5ws.vicicode.cn/api/firmware/my?server=1", {}, {
|
||||||
'type': 0,
|
headers: {
|
||||||
'token': userStore.accountId
|
'ba-user-token': userStore.accountId
|
||||||
|
}
|
||||||
})
|
})
|
||||||
state.myList = resp.data
|
state.myList = resp.data
|
||||||
state.refLoading = false;
|
state.refLoading = false;
|
||||||
|
@ -162,34 +170,40 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
const onUF = async () => {
|
const onUF = async () => {
|
||||||
if(formData.title == "" || formData.firmware.length == 0){
|
if(formData.title == "" || formData.firmware.code == 0){
|
||||||
Message.error({
|
Message.error({
|
||||||
content: '未填写名称及上传文件',
|
content: '未填写名称及上传文件',
|
||||||
duration: 5 * 1000,
|
duration: 5 * 1000,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await axios.post("https://k5.vicicode.cn/wsapi/upload", {
|
await axios.post("https://k5ws.vicicode.cn/api/firmware/add?server=1", {
|
||||||
'type': 0,
|
|
||||||
'token': userStore.accountId,
|
|
||||||
'title': formData.title,
|
'title': formData.title,
|
||||||
'desc': formData.desc,
|
'desc': formData.desc,
|
||||||
'data': formData.firmware[0].url
|
'data': formData.firmware[0].response.data.file.url
|
||||||
|
}, {
|
||||||
|
headers: {
|
||||||
|
'ba-user-token': userStore.accountId
|
||||||
|
}
|
||||||
})
|
})
|
||||||
state.showUpload = false;
|
state.showUpload = false;
|
||||||
showPanel()
|
showPanel()
|
||||||
}
|
}
|
||||||
|
|
||||||
const onDT = async (id: any) => {
|
const onDT = async (id: any) => {
|
||||||
await axios.post("https://k5.vicicode.cn/wsapi/delete", {
|
await axios.post("https://k5ws.vicicode.cn/api/firmware/del?server=1", {
|
||||||
'id': id,
|
'id': id,
|
||||||
'token': userStore.accountId,
|
}, {
|
||||||
|
headers: {
|
||||||
|
'ba-user-token': userStore.accountId
|
||||||
|
}
|
||||||
})
|
})
|
||||||
showPanel()
|
showPanel()
|
||||||
}
|
}
|
||||||
|
|
||||||
const onStar = async (id: any) => {
|
const onStar = async (id: any) => {
|
||||||
await axios.post("https://k5.vicicode.cn/wsapi/star", {
|
state.nowpage.filter((e: any)=>{e.id == id ? e.star += 1 : undefined})
|
||||||
|
await axios.post("https://k5ws.vicicode.cn/api/firmware/star?server=1", {
|
||||||
'id': id
|
'id': id
|
||||||
})
|
})
|
||||||
Message.success({
|
Message.success({
|
||||||
|
|
|
@ -22,7 +22,10 @@
|
||||||
<a-col :span="4" v-for="i in state.nowpage">
|
<a-col :span="4" v-for="i in state.nowpage">
|
||||||
<t-card :style="{ width: '100%', marginBottom: '10px' }">
|
<t-card :style="{ width: '100%', marginBottom: '10px' }">
|
||||||
<template #cover>
|
<template #cover>
|
||||||
<img style="height: 6.75vw;" :title="i.title + ' [' + i.upload + ']'" :src="'https://k5.vicicode.cn/wsapi/download?id=' + i.id + '&n=' + i.title + '.jpg'">
|
<div style="display: block; position: absolute; background-color: rgba(0, 0, 0, 0.3); min-width: 80px; color: white; padding-left: 10px;; padding-right: 10px; font-size: 0.9rem;">
|
||||||
|
点赞:{{ i.star }}
|
||||||
|
</div>
|
||||||
|
<img style="height: 6.75vw;" :title="i.title + ' [' + i.user.nickname + ']'" :src="'https://k5ws.vicicode.cn' + i.image">
|
||||||
</template>
|
</template>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<t-row :align="'middle'" justify="center" style="gap: 24px">
|
<t-row :align="'middle'" justify="center" style="gap: 24px">
|
||||||
|
@ -32,7 +35,7 @@
|
||||||
</t-button>
|
</t-button>
|
||||||
</t-col>
|
</t-col>
|
||||||
<t-col flex="auto" style="display: inline-flex; justify-content: center">
|
<t-col flex="auto" style="display: inline-flex; justify-content: center">
|
||||||
<t-button variant="text" shape="square" @click="useImg('https://k5.vicicode.cn/wsapi/download?id=' + i.id + '&n=' + i.title + '.jpg')">
|
<t-button variant="text" shape="square" @click="useImg('https://k5ws.vicicode.cn' + i.image)">
|
||||||
<check-double-icon />
|
<check-double-icon />
|
||||||
</t-button>
|
</t-button>
|
||||||
</t-col>
|
</t-col>
|
||||||
|
@ -56,12 +59,15 @@
|
||||||
<t-list-item v-for="item in state.myList">
|
<t-list-item v-for="item in state.myList">
|
||||||
<div style="display: flex; width: 100%;">
|
<div style="display: flex; width: 100%;">
|
||||||
<div style="width: 90%;">
|
<div style="width: 90%;">
|
||||||
<t-tag theme="primary" variant="outline">{{ item.audit ? '已审核' : '审核中' }}</t-tag>
|
<t-tag theme="primary" variant="outline" v-if="item.status == 0">审核中{{ item.remark && `(${item.remark})` }}</t-tag>
|
||||||
|
<t-tag theme="primary" variant="outline" v-else-if="item.status == 1">已审核{{ item.remark && `(${item.remark})` }}</t-tag>
|
||||||
|
<t-tag theme="primary" variant="outline" v-else="item.status == 2">已驳回{{ item.remark && `(${item.remark})` }}</t-tag>
|
||||||
{{ item.title }}
|
{{ item.title }}
|
||||||
<br>
|
<br>
|
||||||
{{ item.desc }}
|
{{ item.desc }}
|
||||||
</div>
|
</div>
|
||||||
<div style="width: 10%; margin: auto; text-align: center;">
|
<div style="width: 40%; margin: auto; text-align: center;">
|
||||||
|
<t-tag>{{ item.create_time_text }}</t-tag>
|
||||||
<t-link theme="primary" hover="color" @click="onDT(item.id)">删除</t-link>
|
<t-link theme="primary" hover="color" @click="onDT(item.id)">删除</t-link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -84,8 +90,11 @@
|
||||||
<t-form-item label="图片文件" name="firmware" label-align="top">
|
<t-form-item label="图片文件" name="firmware" label-align="top">
|
||||||
<t-upload
|
<t-upload
|
||||||
v-model="formData.firmware"
|
v-model="formData.firmware"
|
||||||
action="https://k5.vicicode.cn/wsapi/base64"
|
action="https://k5ws.vicicode.cn/api/ajax/upload?server=1"
|
||||||
:abridge-name="[8, 6]"
|
:abridge-name="[8, 6]"
|
||||||
|
:headers="{
|
||||||
|
'ba-user-token': userStore.accountId
|
||||||
|
}"
|
||||||
theme="file-input"
|
theme="file-input"
|
||||||
placeholder="未选择文件"
|
placeholder="未选择文件"
|
||||||
></t-upload>
|
></t-upload>
|
||||||
|
@ -150,27 +159,26 @@
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
const fileToBase64Async = (file: any) => {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
let reader = new FileReader();
|
|
||||||
reader.readAsDataURL(file);
|
|
||||||
reader.onload = (e) => {
|
|
||||||
resolve(e.target.result);
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const dropFile = async (event: any) => {
|
const dropFile = async (event: any) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
state.dropzoneActive = false;
|
state.dropzoneActive = false;
|
||||||
const files = event.dataTransfer.files;
|
const files = event.dataTransfer.files;
|
||||||
for(let i=0;i<files.length;i++){
|
for(let i=0;i<files.length;i++){
|
||||||
await axios.post("https://k5.vicicode.cn/wsapi/upload", {
|
const formData = new FormData();
|
||||||
'type': 1,
|
formData.append('file', files[i])
|
||||||
'token': userStore.accountId,
|
let resp1 = await axios.post("https://k5ws.vicicode.cn/api/ajax/upload?server=1", formData, {
|
||||||
|
headers: {
|
||||||
|
'ba-user-token': userStore.accountId
|
||||||
|
}
|
||||||
|
})
|
||||||
|
await axios.post("https://k5ws.vicicode.cn/api/image/add?server=1", {
|
||||||
'title': files[i].name,
|
'title': files[i].name,
|
||||||
'desc': '',
|
'desc': '',
|
||||||
'data': (await fileToBase64Async(files[i]))?.split(',')[1]
|
'image': resp1.data.file.url
|
||||||
|
}, {
|
||||||
|
headers: {
|
||||||
|
'ba-user-token': userStore.accountId
|
||||||
|
}
|
||||||
})
|
})
|
||||||
showPanel()
|
showPanel()
|
||||||
}
|
}
|
||||||
|
@ -188,17 +196,18 @@
|
||||||
|
|
||||||
const loadit = async (page: any) => {
|
const loadit = async (page: any) => {
|
||||||
state.page = page.current
|
state.page = page.current
|
||||||
const resp : any = await axios.get("https://k5.vicicode.cn/wsapi/list?type=1&limit=24&page=" + page.current + "&t=" + Date.now())
|
const resp : any = await axios.get("https://k5ws.vicicode.cn/api/image/index?server=1&limit=24&page=" + page.current + "&t=" + Date.now())
|
||||||
state.total = resp.total
|
state.total = resp.data.total
|
||||||
state.nowpage = resp.data
|
state.nowpage = resp.data.list
|
||||||
}
|
}
|
||||||
|
|
||||||
const showPanel = async () => {
|
const showPanel = async () => {
|
||||||
state.refLoading = true;
|
state.refLoading = true;
|
||||||
state.showPanel = true
|
state.showPanel = true
|
||||||
const resp : any = await axios.post("https://k5.vicicode.cn/wsapi/my_list", {
|
const resp : any = await axios.post("https://k5ws.vicicode.cn/api/image/my?server=1", {}, {
|
||||||
'type': 1,
|
headers: {
|
||||||
'token': userStore.accountId
|
'ba-user-token': userStore.accountId
|
||||||
|
}
|
||||||
})
|
})
|
||||||
state.myList = resp.data
|
state.myList = resp.data
|
||||||
state.refLoading = false;
|
state.refLoading = false;
|
||||||
|
@ -219,27 +228,33 @@
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await axios.post("https://k5.vicicode.cn/wsapi/upload", {
|
await axios.post("https://k5ws.vicicode.cn/api/image/add?server=1", {
|
||||||
'type': 1,
|
|
||||||
'token': userStore.accountId,
|
|
||||||
'title': formData.title,
|
'title': formData.title,
|
||||||
'desc': formData.desc,
|
'desc': formData.desc,
|
||||||
'data': formData.firmware[0].url
|
'data': formData.firmware[0].response.data.file.url
|
||||||
|
}, {
|
||||||
|
headers: {
|
||||||
|
'ba-user-token': userStore.accountId
|
||||||
|
}
|
||||||
})
|
})
|
||||||
state.showUpload = false;
|
state.showUpload = false;
|
||||||
showPanel()
|
showPanel()
|
||||||
}
|
}
|
||||||
|
|
||||||
const onDT = async (id: any) => {
|
const onDT = async (id: any) => {
|
||||||
await axios.post("https://k5.vicicode.cn/wsapi/delete", {
|
await axios.post("https://k5ws.vicicode.cn/api/image/del?server=1", {
|
||||||
'id': id,
|
'id': id
|
||||||
'token': userStore.accountId,
|
}, {
|
||||||
|
headers: {
|
||||||
|
'ba-user-token': userStore.accountId
|
||||||
|
}
|
||||||
})
|
})
|
||||||
showPanel()
|
showPanel()
|
||||||
}
|
}
|
||||||
|
|
||||||
const onStar = async (id: any) => {
|
const onStar = async (id: any) => {
|
||||||
await axios.post("https://k5.vicicode.cn/wsapi/star", {
|
state.nowpage.filter((e: any)=>{e.id == id ? e.star += 1 : undefined})
|
||||||
|
await axios.post("https://k5ws.vicicode.cn/api/image/star?server=1", {
|
||||||
'id': id
|
'id': id
|
||||||
})
|
})
|
||||||
Message.success({
|
Message.success({
|
||||||
|
|
Loading…
Reference in a new issue