mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-09-11 06:57:10 +08:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -10,7 +10,7 @@ export function listOption(query: System.OptionQuery) {
|
|||||||
|
|
||||||
/** @desc 修改参数 */
|
/** @desc 修改参数 */
|
||||||
export function updateOption(data: any) {
|
export function updateOption(data: any) {
|
||||||
return http.patch(`${BASE_URL}`, data)
|
return http.put(`${BASE_URL}`, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @desc 重置参数 */
|
/** @desc 重置参数 */
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<span v-if="!dictItem"></span>
|
<span v-if="!dictItem"></span>
|
||||||
<span v-else-if="!dictItem.color">{{ dictItem.label }}</span>
|
<span v-else-if="!dictItem.extend">{{ dictItem.label }}</span>
|
||||||
<a-tag v-else-if="dictItem.color === 'primary'" color="arcoblue">{{ dictItem.label }}</a-tag>
|
<a-tag v-else-if="dictItem.extend === 'primary'" color="arcoblue">{{ dictItem.label }}</a-tag>
|
||||||
<a-tag v-else-if="dictItem.color === 'success'" color="green">{{ dictItem.label }}</a-tag>
|
<a-tag v-else-if="dictItem.extend === 'success'" color="green">{{ dictItem.label }}</a-tag>
|
||||||
<a-tag v-else-if="dictItem.color === 'warning'" color="orangered">{{ dictItem.label }}</a-tag>
|
<a-tag v-else-if="dictItem.extend === 'warning'" color="orangered">{{ dictItem.label }}</a-tag>
|
||||||
<a-tag v-else-if="dictItem.color === 'error'" color="red">{{ dictItem.label }}</a-tag>
|
<a-tag v-else-if="dictItem.extend === 'error'" color="red">{{ dictItem.label }}</a-tag>
|
||||||
<a-tag v-else-if="dictItem.color === 'default'" color="gray">{{ dictItem.label }}</a-tag>
|
<a-tag v-else-if="dictItem.extend === 'default'" color="gray">{{ dictItem.label }}</a-tag>
|
||||||
<a-tag v-else :color="dictItem.color">{{ dictItem.label }}</a-tag>
|
<a-tag v-else :color="dictItem.extend">{{ dictItem.label }}</a-tag>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
@@ -93,7 +93,7 @@ onBeforeUnmount(() => {
|
|||||||
const unreadMessageCount = ref(0)
|
const unreadMessageCount = ref(0)
|
||||||
// 初始化 WebSocket
|
// 初始化 WebSocket
|
||||||
const initWebSocket = (token: string) => {
|
const initWebSocket = (token: string) => {
|
||||||
socket = new WebSocket(`${import.meta.env.VITE_API_WS_URL}/ws?token=${token}`)
|
socket = new WebSocket(`${import.meta.env.VITE_API_WS_URL}/websocket?token=${token}`)
|
||||||
socket.onopen = () => {
|
socket.onopen = () => {
|
||||||
// console.log('WebSocket connection opened')
|
// console.log('WebSocket connection opened')
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { type RouteRecordRaw, createRouter, createWebHashHistory } from 'vue-router'
|
import { type RouteRecordRaw, createRouter, createWebHistory } from 'vue-router'
|
||||||
import { useRouteStore } from '@/stores'
|
import { useRouteStore } from '@/stores'
|
||||||
|
|
||||||
/** 默认布局 */
|
/** 默认布局 */
|
||||||
@@ -19,6 +19,7 @@ export const constantRoutes: RouteRecordRaw[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/login',
|
path: '/login',
|
||||||
|
name: 'Login',
|
||||||
component: () => import('@/views/login/index.vue'),
|
component: () => import('@/views/login/index.vue'),
|
||||||
meta: { hidden: true }
|
meta: { hidden: true }
|
||||||
},
|
},
|
||||||
@@ -75,7 +76,7 @@ export const constantRoutes: RouteRecordRaw[] = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHashHistory(import.meta.env.BASE_URL),
|
history: createWebHistory(import.meta.env.BASE_URL),
|
||||||
routes: constantRoutes,
|
routes: constantRoutes,
|
||||||
scrollBehavior: () => ({ left: 0, top: 0 })
|
scrollBehavior: () => ({ left: 0, top: 0 })
|
||||||
})
|
})
|
||||||
|
@@ -58,7 +58,6 @@ const formatAsyncRoutes = (menus: RouteItem[]) => {
|
|||||||
title: item.title,
|
title: item.title,
|
||||||
hidden: item.isHidden,
|
hidden: item.isHidden,
|
||||||
keepAlive: item.isCache,
|
keepAlive: item.isCache,
|
||||||
alwaysShow: item.type === 1,
|
|
||||||
icon: item.icon
|
icon: item.icon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
src/types/global.d.ts
vendored
2
src/types/global.d.ts
vendored
@@ -11,7 +11,7 @@ interface Options {
|
|||||||
export interface LabelValueState {
|
export interface LabelValueState {
|
||||||
label: string
|
label: string
|
||||||
value: any
|
value: any
|
||||||
color?: string
|
extend?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 字典类型 */
|
/** 字典类型 */
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<a-spin :loading="loading" :tip="isLogin() ? '绑定中。。。' : '登录中。。。'">
|
<a-spin :loading="loading" :tip="isLogin() ? '绑定中...' : '登录中...'">
|
||||||
<div></div>
|
<div></div>
|
||||||
</a-spin>
|
</a-spin>
|
||||||
</template>
|
</template>
|
||||||
@@ -8,10 +8,12 @@
|
|||||||
import { Message } from '@arco-design/web-vue'
|
import { Message } from '@arco-design/web-vue'
|
||||||
import { useRoute, useRouter } from 'vue-router'
|
import { useRoute, useRouter } from 'vue-router'
|
||||||
import { bindSocialAccount } from '@/apis'
|
import { bindSocialAccount } from '@/apis'
|
||||||
|
import { useUserStore } from '@/stores'
|
||||||
import { isLogin } from '@/utils/auth'
|
import { isLogin } from '@/utils/auth'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
const userStore = useUserStore()
|
||||||
const source = route.query.source as string
|
const source = route.query.source as string
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
|
||||||
@@ -50,14 +52,14 @@ const handleBindSocial = () => {
|
|||||||
loading.value = true
|
loading.value = true
|
||||||
const { ...othersQuery } = router.currentRoute.value.query
|
const { ...othersQuery } = router.currentRoute.value.query
|
||||||
bindSocialAccount(source, othersQuery)
|
bindSocialAccount(source, othersQuery)
|
||||||
.then((res) => {
|
.then(() => {
|
||||||
router.push({
|
router.push({
|
||||||
path: '/setting/profile',
|
path: '/setting/profile',
|
||||||
query: {
|
query: {
|
||||||
...othersQuery
|
...othersQuery
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
proxy.$message.success(res.msg)
|
Message.success('绑定成功')
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
router.push({
|
router.push({
|
||||||
@@ -80,6 +82,10 @@ if (isLogin()) {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
|
:deep(.arco-spin-mask) {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
div {
|
div {
|
||||||
width: 150px;
|
width: 150px;
|
||||||
height: 150px;
|
height: 150px;
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
>
|
>
|
||||||
<GiForm ref="formRef" v-model="form" :options="options" :columns="columns">
|
<GiForm ref="formRef" v-model="form" :options="options" :columns="columns">
|
||||||
<template #captcha>
|
<template #captcha>
|
||||||
<a-input v-model="form.captcha" placeholder="请输入验证码" :max-length="4" allow-clear style="flex: 1 1" />
|
<a-input v-model="form.captcha" placeholder="请输入验证码" :max-length="6" allow-clear style="flex: 1 1" />
|
||||||
<a-button
|
<a-button
|
||||||
class="captcha-btn"
|
class="captcha-btn"
|
||||||
:loading="captchaLoading"
|
:loading="captchaLoading"
|
||||||
@@ -36,8 +36,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useWindowSize } from '@vueuse/core'
|
import { useWindowSize } from '@vueuse/core'
|
||||||
import { Message } from '@arco-design/web-vue'
|
import { Message } from '@arco-design/web-vue'
|
||||||
// import { getSmsCaptcha, getEmailCaptcha, updateUserEmail, updateUserPhone } from '@/apis'
|
import { getEmailCaptcha, updateUserEmail, updateUserPassword } from '@/apis'
|
||||||
import { updateUserPassword } from '@/apis'
|
|
||||||
import { encryptByRsa } from '@/utils/encrypt'
|
import { encryptByRsa } from '@/utils/encrypt'
|
||||||
import { useUserStore } from '@/stores'
|
import { useUserStore } from '@/stores'
|
||||||
import { type Columns, GiForm } from '@/components/GiForm'
|
import { type Columns, GiForm } from '@/components/GiForm'
|
||||||
@@ -199,9 +199,9 @@ const getCaptcha = async () => {
|
|||||||
// phone: form.phone
|
// phone: form.phone
|
||||||
// })
|
// })
|
||||||
} else if (verifyType.value === 'email') {
|
} else if (verifyType.value === 'email') {
|
||||||
// await getEmailCaptcha({
|
await getEmailCaptcha({
|
||||||
// email: form.email
|
email: form.email
|
||||||
// })
|
})
|
||||||
}
|
}
|
||||||
captchaLoading.value = false
|
captchaLoading.value = false
|
||||||
captchaDisable.value = true
|
captchaDisable.value = true
|
||||||
@@ -234,11 +234,11 @@ const save = async () => {
|
|||||||
// oldPassword: encryptByRsa(form.oldPassword) as string
|
// oldPassword: encryptByRsa(form.oldPassword) as string
|
||||||
// })
|
// })
|
||||||
} else if (verifyType.value === 'email') {
|
} else if (verifyType.value === 'email') {
|
||||||
// await updateUserEmail({
|
await updateUserEmail({
|
||||||
// email: form.email,
|
email: form.email,
|
||||||
// captcha: form.captcha,
|
captcha: form.captcha,
|
||||||
// oldPassword: encryptByRsa(form.oldPassword) as string
|
oldPassword: encryptByRsa(form.oldPassword) as string
|
||||||
// })
|
})
|
||||||
} else if (verifyType.value === 'password') {
|
} else if (verifyType.value === 'password') {
|
||||||
if (form.newPassword !== form.rePassword) {
|
if (form.newPassword !== form.rePassword) {
|
||||||
Message.error('两次新密码不一致')
|
Message.error('两次新密码不一致')
|
||||||
|
@@ -44,33 +44,38 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { Message } from '@arco-design/web-vue'
|
||||||
import type { ModeItem } from '../type'
|
import type { ModeItem } from '../type'
|
||||||
import VerifyModel from '../components/VerifyModel.vue'
|
import VerifyModel from '../components/VerifyModel.vue'
|
||||||
import { listUserSocial, socialAuth, unbindSocialAccount } from '@/apis'
|
import { listUserSocial, socialAuth, unbindSocialAccount } from '@/apis'
|
||||||
import { useUserStore } from '@/stores'
|
|
||||||
|
|
||||||
const userStore = useUserStore()
|
|
||||||
|
|
||||||
const socialList = ref<any>([])
|
const socialList = ref<any>([])
|
||||||
const modeList = ref<ModeItem[]>([])
|
const modeList = ref<ModeItem[]>([])
|
||||||
modeList.value = [
|
|
||||||
{
|
// 初始化数据
|
||||||
title: '绑定 Gitee',
|
const initData = () => {
|
||||||
icon: 'gitee',
|
listUserSocial().then((res) => {
|
||||||
subtitle: `${socialList.value.includes('gitee') ? '' : '绑定后,'}可通过 Gitee 进行登录`,
|
socialList.value = res.data.map((el) => el.source)
|
||||||
jumpMode: 'link',
|
modeList.value = [
|
||||||
type: 'gitee',
|
{
|
||||||
status: socialList.value.includes('gitee')
|
title: '绑定 Gitee',
|
||||||
},
|
icon: 'gitee',
|
||||||
{
|
subtitle: `${socialList.value.includes('GITEE') ? '' : '绑定后,'}可通过 Gitee 进行登录`,
|
||||||
title: '绑定 GitHub',
|
jumpMode: 'link',
|
||||||
icon: 'github',
|
type: 'gitee',
|
||||||
subtitle: `${socialList.value.includes('gitee') ? '' : '绑定后,'}可通过 GitHub 进行登录`,
|
status: socialList.value.includes('GITEE')
|
||||||
type: 'github',
|
},
|
||||||
jumpMode: 'link',
|
{
|
||||||
status: socialList.value.includes('github')
|
title: '绑定 GitHub',
|
||||||
}
|
icon: 'github',
|
||||||
]
|
subtitle: `${socialList.value.includes('GITHUB') ? '' : '绑定后,'}可通过 GitHub 进行登录`,
|
||||||
|
type: 'github',
|
||||||
|
jumpMode: 'link',
|
||||||
|
status: socialList.value.includes('GITHUB')
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 绑定
|
// 绑定
|
||||||
const onBinding = (type: string, status: boolean) => {
|
const onBinding = (type: string, status: boolean) => {
|
||||||
@@ -79,10 +84,9 @@ const onBinding = (type: string, status: boolean) => {
|
|||||||
window.open(res.data.authorizeUrl, '_self')
|
window.open(res.data.authorizeUrl, '_self')
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
unbindSocialAccount(type).then((res) => {
|
unbindSocialAccount(type).then(() => {
|
||||||
if (res.code === 200) {
|
initData()
|
||||||
userStore.getInfo()
|
Message.success('解绑成功')
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -93,13 +97,6 @@ const onUpdate = (type: string) => {
|
|||||||
verifyModelRef.value?.open(type)
|
verifyModelRef.value?.open(type)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化数据
|
|
||||||
const initData = () => {
|
|
||||||
listUserSocial().then((res) => {
|
|
||||||
socialList.value = res.data.map((el) => el.source)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
initData()
|
initData()
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user