Skip to content

Commit

Permalink
[*] 你所热爱的,就是你的驼峰
Browse files Browse the repository at this point in the history
  • Loading branch information
Muska-Ami committed Oct 6, 2024
1 parent bee3f71 commit b3d5fd5
Show file tree
Hide file tree
Showing 18 changed files with 207 additions and 213 deletions.
10 changes: 5 additions & 5 deletions src/components/TheFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ import { get } from '@/utils/request'
const gitHash = GIT_COMMITHASH
const nowYear = new Date().getFullYear()
const hitokoto_content = ref('Loading')
const hitokotoContent = ref('Loading')
onMounted(async () => {
let rs
try {
rs = await get('https://v1.hitokoto.cn/', {})
} catch (e) {
hitokoto_content.value = '加载失败'
hitokotoContent.value = '加载失败'
}
if (!rs) {
hitokoto_content.value = '加载失败'
hitokotoContent.value = '加载失败'
return
}
// 一言
let content = rs.data.hitokoto
let from = rs.data.from
hitokoto_content.value = content + ' —— ' + from
hitokotoContent.value = content + ' —— ' + from
})
</script>

Expand All @@ -32,7 +32,7 @@ onMounted(async () => {
<template #icon>
<i class="twa-sm twa-speech-balloon"></i>
</template>
{{ hitokoto_content }}
{{ hitokotoContent }}
</n-alert>
<br />
<br />
Expand Down
8 changes: 4 additions & 4 deletions src/components/TheHeader.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<n-modal
v-model:show="announcementShow"
v-model:show="showAnnouncement"
class="custom-card"
preset="card"
style="width: 600px"
Expand All @@ -26,7 +26,7 @@
<n-button
circle
style="margin-top: 15px; margin-right: 10px"
@click="() => (announcementShow = true)"
@click="() => (showAnnouncement = true)"
>
<template #icon>
<n-icon><MdNotifications /></n-icon>
Expand All @@ -53,7 +53,7 @@ import { changeUserInfoShow } from '@components/UserInfo.vue'
const avatar = ref('')
const announcementHtml = ref('')
const announcementShow = ref(false)
const showAnnouncement = ref(false)
avatar.value = userData.getters.get_avatar
onMounted(async () => {
Expand All @@ -66,7 +66,7 @@ onMounted(async () => {
let result = await notice.getNotice()
announcementHtml.value = result.announcement
if (localStorage.getItem('dashboard_last_show_ads_date') !== current)
announcementShow.value = true
showAnnouncement.value = true
localStorage.setItem('dashboard_last_show_ads_date', current)
})
</script>
44 changes: 20 additions & 24 deletions src/components/UserInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
@click="unBindQQ"
:loading="binding"
>
{{ bindQQ.unBindmsg }}
{{ bindQQ.unBindMsg }}
</n-button>
</n-space>
<n-h2>修改信息</n-h2>
Expand All @@ -42,7 +42,7 @@
<n-button @click="changeEmail" v-bind:disabled="tEmail.isBtnDisable" type="info"
>{{ tEmail.msg }}
</n-button>
<n-space v-bind:style="tEmail.isEditDisable1">
<n-space v-bind:style="tEmail.isEditDisable ? '' : 'display: none;'">
<n-input
v-model:value="tEmail.verify.code"
style="max-width: 200px"
Expand All @@ -61,7 +61,7 @@
<!-- 密码 -->
<n-space vertical>
<n-h5 style="margin: 3px"> 密码:</n-h5>
<n-input v-model:value="tPassword.oldPaxsword" placeholder="原密码" type="password" />
<n-input v-model:value="tPassword.oldPassword" placeholder="原密码" type="password" />
<n-input v-model:value="tPassword.newPassword" placeholder="新密码" type="password" />
<n-input
v-model:value="tPassword.confirmPassword"
Expand Down Expand Up @@ -114,13 +114,12 @@ const bindQQ = ref({
isDisable: true,
msg: '正在获取',
unBindDisable: true,
unBindmsg: '正在获取'
unBindMsg: '正在获取'
})
const tEmail = ref({
email: userData.getters.get_email,
msg: '修改',
isEditDisable1: 'display:none',
isEditDisable: true,
isBtnDisable: false,
verify: {
Expand All @@ -132,7 +131,7 @@ const tEmail = ref({
const tPassword = ref({
msg: '重置',
oldPaxsword: '',
oldPassword: '',
newPassword: '',
confirmPassword: '',
isLoading: false
Expand All @@ -147,19 +146,19 @@ onMounted(async () => {
} catch (e) {
logger.error(e)
bindQQ.value.isDisable = true
bindQQ.value.msg = ref('未知')
bindQQ.value.msg = '未知'
}
if (!rs) return
if (rs.status === 200) {
bindQQ.value.isDisable = true
bindQQ.value.msg = ref('已绑定')
bindQQ.value.msg = '已绑定'
bindQQ.value.unBindDisable = false
bindQQ.value.unBindmsg = ref('解除绑定')
bindQQ.value.unBindMsg = '解除绑定'
} else if (rs.status === 404) {
bindQQ.value.isDisable = false
bindQQ.value.msg = ref('点击绑定')
bindQQ.value.msg = '点击绑定'
bindQQ.value.unBindDisable = true
bindQQ.value.unBindmsg = ref('尚未绑定')
bindQQ.value.unBindMsg = '尚未绑定'
} else {
sendErrorMessage('获取 QQ 绑定状态失败: ' + rs.message)
}
Expand Down Expand Up @@ -188,7 +187,6 @@ async function changeEmail() {
message.error('请求换绑失败: ' + e)
tEmail.value.isEditDisable = true
tEmail.value.isBtnDisable = false
tEmail.value.isEditDisable1 = ref('display:none')
tEmail.value.msg = '修改'
}
if (!rs) {
Expand All @@ -199,13 +197,11 @@ async function changeEmail() {
message.success(rs.message)
tEmail.value.isEditDisable = true
tEmail.value.isBtnDisable = false
tEmail.value.isEditDisable1 = ref('display:none')
tEmail.value.msg = '修改'
} else {
message.error(rs.message)
tEmail.value.isEditDisable = true
tEmail.value.isBtnDisable = false
tEmail.value.isEditDisable1 = ref('display:none')
tEmail.value.msg = '修改'
}
ldb.finish()
Expand Down Expand Up @@ -269,29 +265,29 @@ async function unBindQQ() {
logger.error(e)
binding.value = false
bindQQ.value.unBindDisable = false
bindQQ.value.unBindmsg = ref('解绑失败')
bindQQ.value.unBindMsg = '解绑失败'
message.error('请求失败: ' + e)
setTimeout(() => {
bindQQ.value.unBindmsg = ref('解除绑定')
bindQQ.value.unBindMsg = '解除绑定'
}, 1000)
}
if (!rs) return
if (rs.status === 200) {
binding.value = false
bindQQ.value.unBindDisable = true
bindQQ.value.unBindmsg = ref('解绑成功')
bindQQ.value.unBindMsg = '解绑成功'
bindQQ.value.isDisable = false
bindQQ.value.msg = ref('点击绑定')
bindQQ.value.msg = '点击绑定'
setTimeout(() => {
bindQQ.value.unBindmsg = ref('尚未绑定')
bindQQ.value.unBindMsg = '尚未绑定'
}, 1000)
} else {
binding.value = false
bindQQ.value.unBindDisable = false
bindQQ.value.unBindmsg = ref('解绑失败')
bindQQ.value.unBindMsg = '解绑失败'
message.error('解绑失败,服务器错误')
setTimeout(() => {
bindQQ.value.unBindmsg = ref('解除绑定')
bindQQ.value.unBindMsg = '解除绑定'
}, 1000)
}
}
Expand All @@ -312,12 +308,12 @@ async function changePassword() {
}
const data = {
username: userData.getters.get_username,
old_password: tPassword.value.oldPaxsword,
new_password: tPassword.value.newPassword
oldPassword: tPassword.value.oldPassword,
newPassword: tPassword.value.newPassword
}
let rs
try {
rs = await api.v2.user.password(data.username, data.old_password, data.new_password)
rs = await api.v2.user.password(data.username, data.oldPassword, data.newPassword)
} catch (e) {
logger.error(e)
tPassword.value.isLoading = false
Expand Down
4 changes: 1 addition & 3 deletions src/components/sidebar/MainSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
collapse-mode="width"
:collapsed-width="64"
:native-scrollbar="true"
:inverted="inverted"
:inverted="false"
id="sider"
style="height: 100%; bottom: 0"
>
Expand Down Expand Up @@ -198,8 +198,6 @@ const menuOptions = [
}
]
const inverted = false
const active = ref('')
// const menuInstRef = ref(null)
Expand Down
4 changes: 2 additions & 2 deletions src/views/DashboardView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</n-grid-item>-->
<n-grid-item span="0:3 600:1">
<n-card title="个人信息" size="medium">
<span>{{ username }},{{ howtosayhi() }}</span>
<span>{{ username }},{{ helloMessage() }}</span>
<br />
<span>您的邮箱为:{{ email }}</span>
<br />
Expand Down Expand Up @@ -201,7 +201,7 @@ async function changeShowFrpToken() {
const traffic = ref(Number(localStorage.getItem('traffic')) / 1024 + 'GB')
const trafficRef = ref(null)
function howtosayhi() {
function helloMessage() {
const currentHour = new Date().getHours()
switch (currentHour) {
case 4:
Expand Down
Loading

0 comments on commit b3d5fd5

Please sign in to comment.