wiki保存修改
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import { MockMethod } from 'vite-plugin-mock'
|
||||
|
||||
export default [
|
||||
{
|
||||
url: '/auth/api/v1/reader/blogs',
|
||||
method: 'get',
|
||||
response: () => {
|
||||
return [
|
||||
{
|
||||
bid: "string",
|
||||
btId: "string",
|
||||
btName: "string",
|
||||
title: "string",
|
||||
blog_prex: "string",
|
||||
content: "string"
|
||||
},
|
||||
{
|
||||
bid: "string",
|
||||
btId: "string",
|
||||
btName: "string",
|
||||
title: "string",
|
||||
blog_prex: "string",
|
||||
content: "string"
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
url: '/auth/api/v1/reader/blog_type',
|
||||
method: 'get',
|
||||
response: () => {
|
||||
return [
|
||||
{
|
||||
btId: "string",
|
||||
btName: "string",
|
||||
},
|
||||
{
|
||||
btId: "string",
|
||||
btName: "string",
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
] as MockMethod[]
|
||||
@@ -8,21 +8,11 @@
|
||||
<div class="title-container">
|
||||
<h3>秘密基地</h3>
|
||||
</div>
|
||||
<!-- <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> -->
|
||||
<p class="tang-pass-qrcode-title">百度网盘扫码登陆<a class="pass-link" :href="qrcode" target="_self">请使用微信扫一扫登录</a></p>
|
||||
<!-- <el-link :icon="Edit">Edit</el-link> -->
|
||||
<!-- <el-button @click="loginWithBaiDu">
|
||||
百度App
|
||||
</el-button> -->
|
||||
<el-avatar :size="28" :src="baiduCloudImage" />
|
||||
<div>
|
||||
<el-avatar :size="28" :src="baiduCloudImage" @click="scan(qrcode)" />
|
||||
</div>
|
||||
<el-form-item>
|
||||
其他登录方式
|
||||
<!-- <el-button type="primary" @click="dologin(ruleFormRef)">login</el-button> -->
|
||||
其他登录方式暂时还没有哦
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
------------------------------------------------------------
|
||||
@@ -39,7 +29,7 @@ import type { FormInstance } from 'element-plus'
|
||||
import { tenantStore } from '../../store/tenant'
|
||||
import router from '../../router'
|
||||
import baiduCloudImage from "../../assets/baiducloud.png"
|
||||
import config from '../../const/config'
|
||||
import { config, scan } from '../../const/config'
|
||||
|
||||
|
||||
let qrcode = config.BAIDU_CLOUD_URL + config.RESPONSE_TYPE + config.CLIENT_ID + config.REDIRECT_URI + config.SCOPE + config.DEVICE_ID + config.QR_CODE + config.DISPLAY
|
||||
@@ -104,12 +94,6 @@ style.width = window.innerWidth * 0.7 + 'px'
|
||||
padding: 18px 0;
|
||||
}
|
||||
|
||||
.box-card {
|
||||
|
||||
/* top: 50%;
|
||||
left: 50%; */
|
||||
}
|
||||
|
||||
.yuliu {
|
||||
/* width: 600px; */
|
||||
height: 600px;
|
||||
|
||||
+27
-3
@@ -1,4 +1,5 @@
|
||||
import { type } from "os";
|
||||
import router from '../router'
|
||||
import { setToken, setTenant } from '../utils/auth'
|
||||
|
||||
// config/index.js
|
||||
const env = process.env.NODE_ENV!;
|
||||
@@ -34,6 +35,29 @@ const configObj: any = {
|
||||
QR_CODE: '&qrcode=' + '1',
|
||||
DISPLAY: '&display=popup'
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default { ...configObj[env] };
|
||||
const scan_method: any = {
|
||||
production: (qrcode: string) => {
|
||||
window.location.href = qrcode
|
||||
},
|
||||
development: () => {
|
||||
setToken("token")
|
||||
setTenant(
|
||||
{
|
||||
tenantId: "111"
|
||||
}
|
||||
)
|
||||
router.push({
|
||||
path: '/home'
|
||||
})
|
||||
},
|
||||
test: (qrcode: string) => {
|
||||
window.location.href = qrcode
|
||||
},
|
||||
}
|
||||
|
||||
const scan = scan_method[env]
|
||||
const config = configObj[env]
|
||||
|
||||
export { scan, config }
|
||||
|
||||
@@ -66,8 +66,8 @@
|
||||
</el-input>
|
||||
|
||||
<div style="width: 60px;">
|
||||
<span v-if="!updated">已保存</span>
|
||||
<span v-if="updated">更新中</span>
|
||||
<!-- <span v-if="!updated">已保存</span>
|
||||
<span v-if="updated">更新中</span> -->
|
||||
</div>
|
||||
</div>
|
||||
<div :style="cWholeStyle">
|
||||
@@ -165,8 +165,6 @@ let checkedIndex = ref<number>(0)
|
||||
let checkedBlogIndex = ref<number>(0)
|
||||
let isclicked = ref(false)
|
||||
let isReady = ref(false)
|
||||
let updated = ref(false)
|
||||
let startTime = reactive($moment());
|
||||
// tmp btName for create, edit, delete
|
||||
let btName = ref("")
|
||||
let deleteBtName = ref("")
|
||||
@@ -232,18 +230,23 @@ const getTestData = async () => {
|
||||
* 获取上一次修改时间,startTime
|
||||
*
|
||||
*/
|
||||
watch(current_blog, (newVal, oldVal) => {
|
||||
|
||||
let current = $moment() // 获取当前时间,current 09:00:00 09:00:00.500
|
||||
const tmp = startTime // 获取开始时间,将值赋给tmp 8:30:00 09:00:00
|
||||
startTime = current // 更新开始时间为当前 09:00:00 09:00:00.500
|
||||
setTimeout(() => {
|
||||
if ($moment(current).diff($moment(tmp), 'seconds') >= 1) {
|
||||
saveContent()
|
||||
let old_blog = {
|
||||
bid: current_blog.bid,
|
||||
content: current_blog.content,
|
||||
}
|
||||
}, 1000)
|
||||
updated.value = false
|
||||
setInterval(async () => {
|
||||
if (current_blog.bid == old_blog.bid) {
|
||||
if (old_blog.content == current_blog.content) {
|
||||
return
|
||||
}
|
||||
await saveContent().then(() => {
|
||||
old_blog.content = current_blog.content
|
||||
})
|
||||
} else {
|
||||
old_blog.bid = current_blog.bid
|
||||
old_blog.content = current_blog.content
|
||||
}
|
||||
}, 5000)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -254,7 +257,6 @@ const onclickTypeTab = (order: number) => {
|
||||
const bid = blogTypes[order].blogs[0].bid
|
||||
deleteBtName.value = ""
|
||||
getContent(bid).then(response => {
|
||||
updated.value = true
|
||||
blogTypes[order].blogs[0].content = response.data.content
|
||||
checkedBlogIndex.value = order
|
||||
checkedIndex.value = 0
|
||||
@@ -268,7 +270,6 @@ const onclickBlogTab = (blog: Blog) => {
|
||||
checkedIndex.value = blog.order
|
||||
blogTypes[checkedBlogIndex.value].blogs[checkedIndex.value].content = response.data.content
|
||||
copy(current_blog, blog)
|
||||
updated.value = true
|
||||
}).catch(() => {
|
||||
checkedIndex.value = blog.order
|
||||
})
|
||||
@@ -277,18 +278,13 @@ const onclickBlogTab = (blog: Blog) => {
|
||||
/**
|
||||
* Blog内容修正
|
||||
*/
|
||||
const saveContent = () => {
|
||||
updated.value = true
|
||||
const saveContent = async () => {
|
||||
const query = {
|
||||
bid: current_blog.bid,
|
||||
content: current_blog.content
|
||||
}
|
||||
updateContent(query).then(() => {
|
||||
ElMessage({
|
||||
message: h('p', null, [
|
||||
h('i', { style: 'color: teal' }, "文章保存成功"),
|
||||
]),
|
||||
})
|
||||
|
||||
}).catch(() => {
|
||||
ElMessage({
|
||||
message: h('p', null, [
|
||||
|
||||
Reference in New Issue
Block a user