This commit is contained in:
simple321vip
2022-07-16 10:23:01 +08:00
parent 3e3db3c904
commit 39b417b6d3
10 changed files with 82 additions and 29 deletions
+8 -8
View File
@@ -6,14 +6,14 @@ const headers = {
const listAll = () => {
return request({
url: '/author/blog/list',
url: '/api/v1/author/blog/list',
method: 'GET'
})
}
const updateBtName = (data: Object) => {
return request({
url: '/author/blog_type',
url: '/api/v1/author/blog_type',
method: 'POST',
headers: headers,
data: data
@@ -22,7 +22,7 @@ const updateBtName = (data: Object) => {
const putBlogType = (data: Object) => {
return request({
url: '/author/blog_type',
url: '/api/v1/author/blog_type',
method: 'PUT',
headers: headers,
data: data
@@ -31,7 +31,7 @@ const putBlogType = (data: Object) => {
const removeBlogType = (data: Object) => {
return request({
url: '/author/blog_type',
url: '/api/v1/author/blog_type',
method: 'DELETE',
headers: headers,
data: data
@@ -40,7 +40,7 @@ const removeBlogType = (data: Object) => {
const getContent = (id: string) => {
return request({
url: '/author/blog/content/' + id,
url: '/api/v1/author/blog/content/' + id,
method: 'GET',
headers: headers,
})
@@ -48,7 +48,7 @@ const getContent = (id: string) => {
const putBlog = (postData: Object) => {
return request({
url: '/author/blog/content',
url: '/api/v1/author/blog/content',
method: 'PUT',
headers: headers,
data: postData
@@ -57,7 +57,7 @@ const putBlog = (postData: Object) => {
const updateContent = (postData: Object) => {
return request({
url: '/author/blog/content',
url: '/api/v1/author/blog/content',
method: 'POST',
headers: headers,
data: postData
@@ -66,7 +66,7 @@ const updateContent = (postData: Object) => {
const deleteContent = (bid: string) => {
return request({
url: '/author/blog/' + bid,
url: '/api/v1/author/blog/' + bid,
method: 'DELETE',
headers: headers,
})
+3 -3
View File
@@ -7,7 +7,7 @@ const headers = {
const getBlogs = (params: Object) => {
return request({
url: '/reader/blogs',
url: '/api/v1/reader/blogs',
method: 'GET',
params: params,
paramsSerializer: (params) => {
@@ -18,7 +18,7 @@ const getBlogs = (params: Object) => {
const getBtName = () => {
return request({
url: '/reader/blog_type',
url: '/api/v1/reader/blog_type',
method: 'GET',
headers: headers
})
@@ -26,7 +26,7 @@ const getBtName = () => {
const getBlog = (bid: string) => {
return request({
url: '/reader/blog/' + bid,
url: '/api/v1/reader/blog/' + bid,
method: 'GET',
headers: headers
})
+5 -5
View File
@@ -2,7 +2,7 @@ import request from '../utils/request'
import Qs from 'qs'
const search_bookmark = (params: Object) => {
return request({
url: '/bookmark',
url: '/api/v1/bookmark',
method: 'get',
params: params,
paramsSerializer: (params) => {
@@ -13,7 +13,7 @@ const search_bookmark = (params: Object) => {
const put_bookmark = (params: Object) => {
return request({
url: '/bookmark/insert',
url: '/api/v1/bookmark/insert',
method: 'put',
data: params
})
@@ -21,7 +21,7 @@ const put_bookmark = (params: Object) => {
const update_bookmark = (params: Object) => {
return request({
url: '/bookmark/update',
url: '/api/v1/bookmark/update',
method: 'post',
data: params
})
@@ -29,14 +29,14 @@ const update_bookmark = (params: Object) => {
const delete_bookmark = (query: number) => {
return request({
url: '/bookmark/delete/' + query,
url: '/api/v1/bookmark/delete/' + query,
method: 'delete',
})
}
const delete_bookmarks = (params: Object) => {
return request({
url: '/bookmark',
url: '/api/v1/bookmark',
method: 'delete',
headers: {},
data: params
+1 -1
View File
@@ -6,7 +6,7 @@ const headers = {
const getAudioInfo = (url: string) => {
return request({
url: '/common/audio-info',
url: '/api/v1/common/audio-info',
method: 'GET',
params: { url: url },
})
+15
View File
@@ -0,0 +1,15 @@
import request from '../utils/request'
const headers = {
'Content-Type': 'application/json;charsetset=UTF-8'
}
const getQrCode = () => {
return request({
url: '/authorize/baidu',
method: 'GET',
headers: headers,
})
}
export { getQrCode }
+1 -1
View File
@@ -1,7 +1,7 @@
import request from '../utils/request'
const bookmark_type = () => {
return request({
url: '/master/bookmark/type',
url: '/api/v1/master/bookmark/type',
method: 'get',
data: {}
})
+4 -4
View File
@@ -2,7 +2,7 @@ import request from '../utils/request'
const get_notes = (params: Object) => {
return request({
url: '/one_note',
url: '/api/v1/one_note',
method: 'get',
params: params
})
@@ -10,7 +10,7 @@ const get_notes = (params: Object) => {
const update_page = (params: Object) => {
return request({
url: '/one_note/update_page',
url: '/api/v1/one_note/update_page',
method: 'post',
data: params
})
@@ -18,7 +18,7 @@ const update_page = (params: Object) => {
const update_section = (params: Object) => {
return request({
url: '/one_note/update_section',
url: '/api/v1/one_note/update_section',
method: 'post',
data: params
})
@@ -26,7 +26,7 @@ const update_section = (params: Object) => {
const insert_section = () => {
return request({
url: '/one_note/insert_section',
url: '/api/v1/one_note/insert_section',
method: 'put'
})
}
+10 -2
View File
@@ -1,10 +1,18 @@
import request from '../utils/request'
const authorize = (params: any) => {
return request({
url: '/authorize',
url: '/auth/v1/authorize',
method: 'post',
data: params
})
}
export { authorize }
const obtainUserInfo = (token: string) => {
return request({
url: '/auth/v1/user_info',
method: 'GET',
params: { token: token }
})
}
export { authorize, obtainUserInfo }
+22 -3
View File
@@ -1,19 +1,26 @@
<template>
<div class="yuliu"></div>
<el-card class="box-card">
<el-form ref="ruleFormRef" :model="loginForm" :rules="loginRules" status-icon label-width="120px"
class="demo-ruleForm">
<div class="title-container">
<h3>私人空间</h3>
</div>
<el-form-item label="用户名" prop="pass">
<!-- <el-form-item label="用户名" prop="pass">
<el-input v-model="loginForm.user_id" type="password" autocomplete="off" />
</el-form-item>
<el-form-item label="用户凭证" prop="checkPass">
<el-input v-model="loginForm.password" type="password" autocomplete="off" />
</el-form-item>
</el-form-item> -->
<p class="tang-pass-qrcode-title">请使用<a class="pass-link" href="http://openapi.baidu.com/oauth/2.0/authorize?response_type=code&client_id=WksD0FOVAp8zSRV62qNKxtnCexArVPOf&
redirect_uri=https://www.violin-home.cn/auth/v1/authorize/baidu&scope=basic,netdisk&device_id=26202308&qrcode=1"
target="new">百度App</a>扫码登录</p>
<el-button @click="loginWithBaiDu">
百度App
</el-button>
<el-form-item>
<el-button type="primary" @click="dologin(ruleFormRef)">login</el-button>
<!-- <el-button type="primary" @click="dologin(ruleFormRef)">login</el-button> -->
</el-form-item>
</el-form>
------------------------------------------------------------
@@ -29,6 +36,9 @@ import { reactive, ref } from 'vue'
import type { FormInstance } from 'element-plus'
import { useUserStore } from '../../store/user'
import router from '../../router'
import { getQrCode } from '../../api/login'
const user = useUserStore()
const ruleFormRef = ref<FormInstance>()
@@ -37,6 +47,13 @@ const loginForm = reactive({
password: ''
})
const loginWithBaiDu = () => {
window.open("", "11");
// getQrCode().then((response) => {
// })
}
const validateUserName = (rule: any, value: string, callback: Function) => {
if (!value) {
callback(new Error("请输入的用户名"))
@@ -76,6 +93,8 @@ const dologin = (form: any) => {
})
}
</script>
<style scoped>
.text {
+13 -2
View File
@@ -12,11 +12,22 @@ let app = createApp(App)
app.use(router)
app.use(ElementPlus)
app.use(store)
import { getToken, getUser } from './utils/auth'
import { getToken, getUser, setToken, setUser } from './utils/auth'
import { User } from './entity/index'
import Cookies from 'js-cookie';
import Cookies from 'js-cookie'
import { obtainUserInfo } from './api/user'
const whiteList = ['/login']
let url = window.location.href
if (url.search("token") != -1) {
let authorizeToken = url.split("token=")[1]
setToken(authorizeToken)
await obtainUserInfo(authorizeToken).then(response => {
setUser(response.data)
})
router.push({
path: '/home',
})
}
/**
* ルーター監視