diff --git a/src/api/group.js b/src/api/group.js index ea48bc0..5894b1f 100644 --- a/src/api/group.js +++ b/src/api/group.js @@ -36,11 +36,3 @@ export function remove (data) { data, }) } - -export function changePwd (data) { - return request({ - url: '/group/changePwd', - method: 'post', - data, - }) -} diff --git a/src/api/login_log.js b/src/api/login_log.js new file mode 100644 index 0000000..c9d13a9 --- /dev/null +++ b/src/api/login_log.js @@ -0,0 +1,16 @@ +import request from '@/utils/request' + +export function list (params) { + return request({ + url: '/login_log/list', + params, + }) +} + +export function remove (data) { + return request({ + url: '/login_log/delete', + method: 'post', + data, + }) +} diff --git a/src/api/oauth.js b/src/api/oauth.js new file mode 100644 index 0000000..fa7f3b0 --- /dev/null +++ b/src/api/oauth.js @@ -0,0 +1,76 @@ +import request from '@/utils/request' + +export function info (params) { + return request({ + url: '/oauth/info', + params, + }) + +} + +export function confirm (data) { + return request({ + url: '/oauth/confirm', + method: 'post', + data, + }) +} + +export function bind (data) { + return request({ + url: '/oauth/bind', + method: 'post', + data, + }) +} + +export function bindConfirm (data) { + return request({ + url: '/oauth/bindConfirm', + method: 'post', + data, + }) +} +export function unbind (data) { + return request({ + url: '/oauth/unbind', + method: 'post', + data, + }) +} +export function list (params) { + return request({ + url: '/oauth/list', + params, + }) +} + +export function detail (id) { + return request({ + url: `/oauth/detail/${id}`, + }) +} + +export function create (data) { + return request({ + url: '/oauth/create', + method: 'post', + data, + }) +} + +export function update (data) { + return request({ + url: '/oauth/update', + method: 'post', + data, + }) +} + +export function remove (data) { + return request({ + url: '/oauth/delete', + method: 'post', + data, + }) +} diff --git a/src/api/peer.js b/src/api/peer.js index e7a24ec..21c17ea 100644 --- a/src/api/peer.js +++ b/src/api/peer.js @@ -36,11 +36,3 @@ export function remove (data) { data, }) } - -export function changePwd (data) { - return request({ - url: '/peer/changePwd', - method: 'post', - data, - }) -} diff --git a/src/api/tag.js b/src/api/tag.js index eade62f..b6953a7 100644 --- a/src/api/tag.js +++ b/src/api/tag.js @@ -37,10 +37,3 @@ export function remove (data) { }) } -export function changePwd (data) { - return request({ - url: '/tag/changePwd', - method: 'post', - data, - }) -} diff --git a/src/api/user.js b/src/api/user.js index 8b83815..a26eb8f 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -67,3 +67,10 @@ export function changeCurPwd (data) { data, }) } + +export function myOauth () { + return request({ + url: '/user/myOauth', + method: 'post', + }) +} diff --git a/src/components/changePwdDialog.vue b/src/components/changePwdDialog.vue new file mode 100644 index 0000000..5088578 --- /dev/null +++ b/src/components/changePwdDialog.vue @@ -0,0 +1,115 @@ + + + + + diff --git a/src/layout/components/setting/index.vue b/src/layout/components/setting/index.vue index a37dd77..098f770 100644 --- a/src/layout/components/setting/index.vue +++ b/src/layout/components/setting/index.vue @@ -16,31 +16,14 @@ - - - - - - - - - - - - - 取消 - 确定 - - - + diff --git a/src/router/index.js b/src/router/index.js index 3214d03..440314a 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -13,7 +13,16 @@ const constantRoutes = [ component: () => import('@/views/error-page/404.vue'), hidden: true, }, - + { + path: '/oauth/:code', + component: () => import('@/views/oauth/login.vue'), + hidden: true, + }, + { + path: '/oauth/bind/:code', + component: () => import('@/views/oauth/bind.vue'), + hidden: true, + }, ] export const asyncRoutes = [ // { @@ -35,18 +44,24 @@ export const asyncRoutes = [ { path: '/my', name: 'My', - redirect: '/my/tag/index', + redirect: '/my/info', meta: { title: '我的', icon: 'UserFilled' }, component: () => import('@/layout/index.vue'), children: [ { path: '/', + name: 'MyInfo', + meta: { title: '个人信息', icon: 'User' /*keepAlive: true*/ }, + component: () => import('@/views/my/info.vue'), + }, + { + path: 'address_book', name: 'MyAddressBookList', meta: { title: '地址簿管理', icon: 'Notebook' /*keepAlive: true*/ }, component: () => import('@/views/my/address_book/index.vue'), }, { - path: 'tag/index', + path: 'tag', name: 'MyTagList', meta: { title: '标签管理', icon: 'CollectionTag' /*keepAlive: true*/ }, component: () => import('@/views/my/tag/index.vue'), @@ -103,7 +118,18 @@ export const asyncRoutes = [ meta: { title: '标签管理', icon: 'CollectionTag' /*keepAlive: true*/ }, component: () => import('@/views/tag/index.vue'), }, - + { + path: '/oauth', + name: 'Oauth', + meta: { title: 'Oauth管理', icon: 'Link' /*keepAlive: true*/ }, + component: () => import('@/views/oauth/index.vue'), + }, + { + path: '/loginLog', + name: 'LoginLog', + meta: { title: '登录日志', icon: 'List' /*keepAlive: true*/ }, + component: () => import('@/views/login/log.vue'), + }, ], }, ] diff --git a/src/views/login/log.js b/src/views/login/log.js new file mode 100644 index 0000000..0c1f2dc --- /dev/null +++ b/src/views/login/log.js @@ -0,0 +1,61 @@ +import { reactive } from 'vue' +import { list, remove } from '@/api/login_log' +import { ElMessage, ElMessageBox } from 'element-plus' +import { useRoute } from 'vue-router' + +export function useRepositories () { + const route = useRoute() + const user_id = route.query?.user_id + + const listRes = reactive({ + list: [], total: 0, loading: false, + }) + const listQuery = reactive({ + page: 1, + page_size: 10, + is_my: 0, + user_id: user_id ? parseInt(user_id) : null, + }) + + const getList = async () => { + listRes.loading = true + const res = await list(listQuery).catch(_ => false) + listRes.loading = false + if (res) { + listRes.list = res.data.list + listRes.total = res.data.total + } + } + const handlerQuery = () => { + if (listQuery.page === 1) { + getList() + } else { + listQuery.page = 1 + } + } + + const del = async (row) => { + const cf = await ElMessageBox.confirm('确定删除么?', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning', + }).catch(_ => false) + if (!cf) { + return false + } + + const res = await remove({ id: row.id }).catch(_ => false) + if (res) { + ElMessage.success('操作成功') + getList() + } + } + + return { + listRes, + listQuery, + getList, + handlerQuery, + del, + } +} diff --git a/src/views/login/log.vue b/src/views/login/log.vue new file mode 100644 index 0000000..f42dd7e --- /dev/null +++ b/src/views/login/log.vue @@ -0,0 +1,86 @@ + + + + + diff --git a/src/views/login/login.vue b/src/views/login/login.vue index 142b399..47fc20d 100644 --- a/src/views/login/login.vue +++ b/src/views/login/login.vue @@ -28,9 +28,22 @@ const userStore = useUserStore() const route = useRoute() const router = useRouter() + + let platform = window.navigator.platform + if (navigator.platform.indexOf('Mac') === 0) { + platform = 'mac' + } else if (navigator.platform.indexOf('Win') === 0) { + platform = 'windows' + } else if (navigator.platform.indexOf('Linux armv') === 0) { + platform = 'android' + } else if (navigator.platform.indexOf('Linux') === 0) { + platform = 'linux' + } + const form = reactive({ username: '', password: '', + platform: platform, }) const redirect = route.query?.redirect const login = async () => { @@ -50,42 +63,44 @@ diff --git a/src/views/my/info.vue b/src/views/my/info.vue new file mode 100644 index 0000000..756daf9 --- /dev/null +++ b/src/views/my/info.vue @@ -0,0 +1,86 @@ + + + + + diff --git a/src/views/oauth/bind.vue b/src/views/oauth/bind.vue new file mode 100644 index 0000000..80ca07c --- /dev/null +++ b/src/views/oauth/bind.vue @@ -0,0 +1,94 @@ + + + + + diff --git a/src/views/oauth/index.vue b/src/views/oauth/index.vue new file mode 100644 index 0000000..712035f --- /dev/null +++ b/src/views/oauth/index.vue @@ -0,0 +1,177 @@ + + + + + diff --git a/src/views/oauth/login.vue b/src/views/oauth/login.vue new file mode 100644 index 0000000..1a2d5e9 --- /dev/null +++ b/src/views/oauth/login.vue @@ -0,0 +1,95 @@ + + + + +