no message
This commit is contained in:
parent
adb4e7f031
commit
84f308f94e
@ -3,10 +3,12 @@ import AV from 'leancloud-storage'
|
||||
export const saveObject = (className, params) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const Todo = AV.Object.extend(className)
|
||||
const user = AV.User.current()
|
||||
var todo = new Todo()
|
||||
for (var i in params) {
|
||||
todo.set(i, params[i])
|
||||
}
|
||||
todo.set(user, user)
|
||||
todo.save().then((res) => {
|
||||
resolve(res)
|
||||
}, (error) => {
|
||||
@ -20,11 +22,13 @@ export const getObject = (className, params) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const query = new AV.Query(className)
|
||||
// 查询多个条件
|
||||
const user = AV.User.current()
|
||||
for (const v in params) {
|
||||
if (params[v]) {
|
||||
query.equalTo(v, params[v])
|
||||
}
|
||||
}
|
||||
query.equalTo('user', user)
|
||||
query.find().then((res) => {
|
||||
resolve(res)
|
||||
}, (error) => {
|
||||
|
@ -82,7 +82,7 @@ import Dialog from './components/Dialog.vue'
|
||||
import Login from './components/Login.vue'
|
||||
import gsap from 'gsap'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { importBookmark, exportBookmark } from './components/utils.js'
|
||||
import { importBookmark, exportBookmark, getRemoteList } from './components/utils.js'
|
||||
import Cookie from 'js-cookie'
|
||||
import Api from './Api/user.js'
|
||||
var rowData = []
|
||||
@ -125,7 +125,7 @@ export default {
|
||||
username: '未登录'
|
||||
}
|
||||
})
|
||||
|
||||
// 设置用户
|
||||
const setUsername = () => {
|
||||
if (Cookie.get('userInfo')) {
|
||||
data.userInfo = JSON.parse(Cookie.get('userInfo'))
|
||||
@ -135,6 +135,8 @@ export default {
|
||||
}
|
||||
setUsername()
|
||||
|
||||
getRemoteList()
|
||||
|
||||
// 全部数据筛选功能
|
||||
watch(
|
||||
() => data.searchVal,
|
||||
|
@ -1,3 +1,6 @@
|
||||
import {saveObject, getObject} from '../Api/common.js'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
function walkBookmarksTree(root) {
|
||||
const result = []
|
||||
// 深度优先遍历
|
||||
@ -61,6 +64,13 @@ export function importBookmark() {
|
||||
reader.onload = function () {
|
||||
mybookmark.innerHTML = reader.result
|
||||
console.log(walkBookmarksTree(mybookmark))
|
||||
const formDatas = localStorage.getItem('BOOKMARK')
|
||||
const params = {formDatas: formDatas}
|
||||
console.log(params)
|
||||
saveObject('BOOKMARK', params).then(res => {
|
||||
console.log('导入成功', res)
|
||||
ElMessage.success('导入成功')
|
||||
})
|
||||
// const myData = walkBookmarksTree(mybookmark)
|
||||
// myData && localStorage.setItem('BOOKMARK', myData)
|
||||
}
|
||||
@ -85,3 +95,10 @@ export function exportBookmark() {
|
||||
this.$message.warning('暂无可导出数据')
|
||||
}
|
||||
}
|
||||
|
||||
// 获取远程书签
|
||||
export const getRemoteList = () => {
|
||||
getObject('BOOKMARK').then(res => {
|
||||
console.log('获取书签', res)
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user