This commit is contained in:
Silent YANG 2024-10-06 14:30:54 +08:00
parent 81ff1e2174
commit dfa63b90ad
8 changed files with 168 additions and 97 deletions

View file

@ -6,8 +6,8 @@
</div>
<div style="color: #AAAAAA;">{{ ua }}</div>
</div>
<t-config-provider v-if="reloadLang && !((isWeixin || isQQ) && route.path !== '/satloc')" :global-config="locale">
<a-config-provider :locale="locale">
<t-config-provider v-if="reloadLang && !((isWeixin || isQQ) && route.path !== '/satloc')" :global-config="locale[0]">
<a-config-provider :locale="locale[1]">
<router-view />
<global-setting />
</a-config-provider>
@ -60,12 +60,12 @@
case 'zh-CN':
sessionStorage.setItem('noticeConnectK5', '请先连接手台!')
sessionStorage.setItem('noticeVersionNoSupport', '固件版本不匹配')
lang = {...zhCN, ...tdesignZhCN};
lang = [tdesignZhCN, zhCN];
break;
default:
sessionStorage.setItem('noticeConnectK5', 'Connect first!')
sessionStorage.setItem('noticeVersionNoSupport', 'Firmware not supported')
lang = {...enUS, ...tdesignEnUS};
lang = [tdesignEnUS, enUS];
}
setTimeout(() => {
reloadLang.value = true;

View file

@ -40,7 +40,7 @@ axios.interceptors.response.use(
(response: AxiosResponse<HttpResponse>) => {
const res = response.data;
// 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({
content: res.msg || 'Error',
duration: 5 * 1000,

View file

@ -48,6 +48,14 @@
</t-input>
</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-input v-model="formData.password" type="password" clearable :placeholder="$t('global.password')">
<template #prefix-icon>
@ -64,6 +72,14 @@
</t-input>
</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-button theme="primary" type="submit" block>{{$t('global.register')}}</t-button>
</t-form-item>
@ -131,28 +147,32 @@
const formData = reactive({
account: '',
nickname: '',
password: '',
password2: ''
password2: '',
motto: ''
});
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,
'password': formData.password
'password': formData.password,
'tab': 'login',
'keep': false
})
if(resp.code == 200){
if(resp.code == 1){
userStore.setInfo({
showLogin: false,
name: formData.account,
accountId: resp.token
name: resp.data.userInfo.nickname,
accountId: resp.data.userInfo.token
})
}
}
const onRegister = async () => {
if(formData.password == '' || formData.account == ''){
if(formData.password == '' || formData.account == '' || formData.nickname == ''){
Message.error({
content: '用户名及密码不能为空',
content: '用户名、昵称及密码不能为空',
duration: 5 * 1000,
});
return;
@ -164,14 +184,18 @@
});
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,
'password': formData.password
'password': formData.password,
'nickname': formData.nickname,
'motto': formData.motto,
'tab': 'register',
})
if(resp.code == 200){
if(resp.code == 1){
userStore.setInfo({
showRegister: false,
showLogin: true
name: formData.nickname,
accountId: resp.data.userInfo.token
})
}
}

View file

@ -150,8 +150,10 @@ export default {
'tool.writessbpatch': 'SSB Patch Write',
'global.login': 'Login',
'global.register': 'Register',
'global.motto': 'Motto',
'global.logout': 'Logout',
'global.username': 'Username',
'global.nickname': 'Nickname',
'global.password': 'Password',
'global.password2': 'Retype password ',
'image.negative': 'Negative',

View file

@ -150,10 +150,12 @@ export default {
'tool.writessbpatch': '写入单边带补丁',
'global.login': '登录',
'global.register': '注册',
'global.motto': '联系方式(用于找回密码)',
'global.logout': '退出',
'global.username': '请输入用户名',
'global.password': '请输入密码',
'global.password2': '请再次输入密码',
'global.username': '*请输入用户名',
'global.nickname': '*请输入昵称',
'global.password': '*请输入密码',
'global.password2': '*请再次输入密码',
'image.negative': '反色',
'workplace.clickNotice': '(官方固件只能检测 8KB/64Kbit',
'menu.cps.radio': '收音机',

View file

@ -24,13 +24,14 @@
:description="item.desc"
>
<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>
</a-list-item-meta>
<template #actions>
<a-link @click="onStar(item.id)">👍</a-link>
<a-link @click="iDownload('https://k5.vicicode.cn/wsapi/download?id=' + item.id, item.title)">{{$t('global.download')}}</a-link>
<a-link @click="useFirmware('https://k5.vicicode.cn/wsapi/download?id=' + item.id)">{{$t('global.use')}}</a-link>
<t-tag style="margin-left: 1rem;">{{ item.create_time_text }}</t-tag>
<a-link @click="onStar(item.id)">👍{{ item.star }}</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>
</a-list-item>
</a-list>
@ -49,12 +50,15 @@
<t-list-item v-for="item in state.myList">
<div style="display: flex; width: 100%;">
<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">审核中</t-tag>
<t-tag theme="primary" variant="outline" v-else-if="item.status == 1">已审核</t-tag>
<t-tag theme="primary" variant="outline" v-else="item.status == 2">已驳回</t-tag>
{{ item.title }}
<br>
{{ item.desc }}
</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>&nbsp;
<t-link theme="primary" hover="color" @click="onDT(item.id)">删除</t-link>
</div>
</div>
@ -72,13 +76,16 @@
<t-input v-model="formData.title"></t-input>
</t-form-item>
<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 label="信道文件" name="firmware" label-align="top">
<t-upload
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]"
:headers="{
'ba-user-token': userStore.accountId
}"
theme="file-input"
placeholder="未选择文件"
></t-upload>
@ -138,17 +145,18 @@
const loadit = async (page: any) => {
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())
state.total = resp.total
state.nowpage = resp.data
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.data.total
state.nowpage = resp.data.list
}
const showPanel = async () => {
state.refLoading = true;
state.showPanel = true
const resp : any = await axios.post("https://k5.vicicode.cn/wsapi/my_list", {
'type': 2,
'token': userStore.accountId
const resp : any = await axios.post("https://k5ws.vicicode.cn/api/channel/my?server=1", {}, {
headers: {
'ba-user-token': userStore.accountId
}
})
state.myList = resp.data
state.refLoading = false;
@ -162,34 +170,40 @@
}
const onUF = async () => {
if(formData.title == "" || formData.firmware.length == 0){
if(formData.title == "" || formData.firmware.code == 0){
Message.error({
content: '未填写名称及上传文件',
duration: 5 * 1000,
});
return;
}
await axios.post("https://k5.vicicode.cn/wsapi/upload", {
'type': 2,
'token': userStore.accountId,
await axios.post("https://k5ws.vicicode.cn/api/channel/add?server=1", {
'title': formData.title,
'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;
showPanel()
}
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,
'token': userStore.accountId,
}, {
headers: {
'ba-user-token': userStore.accountId
}
})
showPanel()
}
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
})
Message.success({

View file

@ -24,13 +24,14 @@
:description="item.desc"
>
<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>
</a-list-item-meta>
<template #actions>
<a-link @click="onStar(item.id)">👍</a-link>
<a-link @click="iDownload('https://k5.vicicode.cn/wsapi/download?id=' + item.id, item.title)">{{$t('global.download')}}</a-link>
<a-link @click="useFirmware('https://k5.vicicode.cn/wsapi/download?id=' + item.id + '&n=/' + item.title)">{{$t('global.use')}}</a-link>
<t-tag style="margin-left: 1rem;">{{ item.create_time_text }}</t-tag>
<a-link @click="onStar(item.id)">👍{{ item.star }}</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>
</a-list-item>
</a-list>
@ -49,12 +50,15 @@
<t-list-item v-for="item in state.myList">
<div style="display: flex; width: 100%;">
<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">审核中</t-tag>
<t-tag theme="primary" variant="outline" v-else-if="item.status == 1">已审核</t-tag>
<t-tag theme="primary" variant="outline" v-else="item.status == 2">已驳回</t-tag>
{{ item.title }}
<br>
{{ item.desc }}
</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>&nbsp;
<t-link theme="primary" hover="color" @click="onDT(item.id)">删除</t-link>
</div>
</div>
@ -72,13 +76,16 @@
<t-input v-model="formData.title"></t-input>
</t-form-item>
<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 label="固件文件" name="firmware" label-align="top">
<t-upload
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]"
:headers="{
'ba-user-token': userStore.accountId
}"
theme="file-input"
placeholder="未选择文件"
></t-upload>
@ -138,17 +145,18 @@
const loadit = async (page: any) => {
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())
state.total = resp.total
state.nowpage = resp.data
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.data.total
state.nowpage = resp.data.list
}
const showPanel = async () => {
state.refLoading = true;
state.showPanel = true
const resp : any = await axios.post("https://k5.vicicode.cn/wsapi/my_list", {
'type': 0,
'token': userStore.accountId
const resp : any = await axios.post("https://k5ws.vicicode.cn/api/firmware/my?server=1", {}, {
headers: {
'ba-user-token': userStore.accountId
}
})
state.myList = resp.data
state.refLoading = false;
@ -162,34 +170,40 @@
}
const onUF = async () => {
if(formData.title == "" || formData.firmware.length == 0){
if(formData.title == "" || formData.firmware.code == 0){
Message.error({
content: '未填写名称及上传文件',
duration: 5 * 1000,
});
return;
}
await axios.post("https://k5.vicicode.cn/wsapi/upload", {
'type': 0,
'token': userStore.accountId,
await axios.post("https://k5ws.vicicode.cn/api/firmware/add?server=1", {
'title': formData.title,
'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;
showPanel()
}
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,
'token': userStore.accountId,
}, {
headers: {
'ba-user-token': userStore.accountId
}
})
showPanel()
}
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
})
Message.success({

View file

@ -22,7 +22,10 @@
<a-col :span="4" v-for="i in state.nowpage">
<t-card :style="{ width: '100%', marginBottom: '10px' }">
<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 #footer>
<t-row :align="'middle'" justify="center" style="gap: 24px">
@ -32,7 +35,7 @@
</t-button>
</t-col>
<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 />
</t-button>
</t-col>
@ -56,12 +59,15 @@
<t-list-item v-for="item in state.myList">
<div style="display: flex; width: 100%;">
<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">审核中</t-tag>
<t-tag theme="primary" variant="outline" v-else-if="item.status == 1">已审核</t-tag>
<t-tag theme="primary" variant="outline" v-else="item.status == 2">已驳回</t-tag>
{{ item.title }}
<br>
{{ item.desc }}
</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>&nbsp;
<t-link theme="primary" hover="color" @click="onDT(item.id)">删除</t-link>
</div>
</div>
@ -84,8 +90,11 @@
<t-form-item label="图片文件" name="firmware" label-align="top">
<t-upload
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]"
:headers="{
'ba-user-token': userStore.accountId
}"
theme="file-input"
placeholder="未选择文件"
></t-upload>
@ -150,27 +159,26 @@
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) => {
event.preventDefault();
state.dropzoneActive = false;
const files = event.dataTransfer.files;
for(let i=0;i<files.length;i++){
await axios.post("https://k5.vicicode.cn/wsapi/upload", {
'type': 1,
'token': userStore.accountId,
const formData = new FormData();
formData.append('file', files[i])
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,
'desc': '',
'data': (await fileToBase64Async(files[i]))?.split(',')[1]
'image': resp1.data.file.url
}, {
headers: {
'ba-user-token': userStore.accountId
}
})
showPanel()
}
@ -188,17 +196,18 @@
const loadit = async (page: any) => {
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())
state.total = resp.total
state.nowpage = resp.data
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.data.total
state.nowpage = resp.data.list
}
const showPanel = async () => {
state.refLoading = true;
state.showPanel = true
const resp : any = await axios.post("https://k5.vicicode.cn/wsapi/my_list", {
'type': 1,
'token': userStore.accountId
const resp : any = await axios.post("https://k5ws.vicicode.cn/api/image/my?server=1", {}, {
headers: {
'ba-user-token': userStore.accountId
}
})
state.myList = resp.data
state.refLoading = false;
@ -219,27 +228,33 @@
});
return;
}
await axios.post("https://k5.vicicode.cn/wsapi/upload", {
'type': 1,
'token': userStore.accountId,
await axios.post("https://k5ws.vicicode.cn/api/image/add?server=1", {
'title': formData.title,
'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;
showPanel()
}
const onDT = async (id: any) => {
await axios.post("https://k5.vicicode.cn/wsapi/delete", {
'id': id,
'token': userStore.accountId,
await axios.post("https://k5ws.vicicode.cn/api/image/del?server=1", {
'id': id
}, {
headers: {
'ba-user-token': userStore.accountId
}
})
showPanel()
}
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
})
Message.success({