util.db
Former-commit-id: 85a4564a9c26d25680e068390a9dce8081ff8301 [formerly 85a4564a9c26d25680e068390a9dce8081ff8301 [formerly 85a4564a9c26d25680e068390a9dce8081ff8301 [formerly 85a4564a9c26d25680e068390a9dce8081ff8301 [formerly 0c90f29ccfaf0af85cfee68a37e127969e1f403b [formerly 81d2e7a8b5e7b94b6707f2f7165948c23cb8fe97]]]]] Former-commit-id: 4be8876f52078af7d2f09d5be200e14c4b103b9d Former-commit-id: 0206f4b4d31c60ce01c43ceead230b7a242d6671 Former-commit-id: ca9b786629bc220dc77090732ec55ef682a65749 [formerly edc8fe2a03ccb155face81d2caa41898ffcc43da] Former-commit-id: 9bcb79d27c3671cdf2efa9bc8bb3bc746b536f76 Former-commit-id: ca8fa5fae99b3c2f29982295366d3b57dbd69ea8 Former-commit-id: ada47bd1e953a2977d08741b07f6dfa7a43a4c0f Former-commit-id: f7ae61fb796145f9e7cdc39c161876e4b1a70c3c Former-commit-id: eba7ec27792eebd4cc8cde53318b952a92f86a06
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import log from './util.log.js'
|
||||
import cookies from './util.cookies.js'
|
||||
import cookies from './util.cookies'
|
||||
import db from './util.db'
|
||||
import log from './util.log'
|
||||
|
||||
let util = {
|
||||
const util = {
|
||||
cookies,
|
||||
db,
|
||||
log
|
||||
}
|
||||
|
||||
@@ -23,10 +25,10 @@ util.open = function (url) {
|
||||
var a = document.createElement('a')
|
||||
a.setAttribute('href', url)
|
||||
a.setAttribute('target', '_blank')
|
||||
a.setAttribute('id', 'd2admin-menu-link')
|
||||
a.setAttribute('id', 'd2admin-link-temp')
|
||||
document.body.appendChild(a)
|
||||
a.click()
|
||||
document.body.removeChild(document.getElementById('d2admin-menu-link'))
|
||||
document.body.removeChild(document.getElementById('d2admin-link-temp'))
|
||||
}
|
||||
|
||||
export default util
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import db from '@/libs/db.js'
|
||||
import util from '@/libs/util'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
@@ -29,7 +29,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
load () {
|
||||
this.dbData = JSON.stringify(db.value(), null, 2)
|
||||
this.dbData = JSON.stringify(util.db.value(), null, 2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import db from '@/libs/db.js'
|
||||
import util from '@/libs/util.js'
|
||||
import util from '@/libs/util'
|
||||
import { cloneDeep } from 'lodash'
|
||||
|
||||
/**
|
||||
@@ -20,7 +19,7 @@ function pathInit ({
|
||||
}) {
|
||||
const uuid = util.cookies.get('uuid') || 'ghost-uuid'
|
||||
const currentPath = `${dbName}.${user ? `user.${uuid}` : 'public'}${path ? `.${path}` : ''}`
|
||||
const value = db.get(currentPath).value()
|
||||
const value = util.db.get(currentPath).value()
|
||||
// console.group('pathInit')
|
||||
// console.log('dbName', dbName)
|
||||
// console.log('path', path)
|
||||
@@ -29,7 +28,7 @@ function pathInit ({
|
||||
// console.log('value', value)
|
||||
// console.groupEnd()
|
||||
if (!(value !== undefined && validator(value))) {
|
||||
db
|
||||
util.db
|
||||
.set(currentPath, defaultValue)
|
||||
.write()
|
||||
}
|
||||
@@ -53,7 +52,7 @@ export default {
|
||||
value = '',
|
||||
user = false
|
||||
}) {
|
||||
db.set(pathInit({
|
||||
util.db.set(pathInit({
|
||||
dbName,
|
||||
path,
|
||||
user
|
||||
@@ -74,7 +73,7 @@ export default {
|
||||
user = false
|
||||
}) {
|
||||
return new Promise(resolve => {
|
||||
resolve(cloneDeep(db.get(pathInit({
|
||||
resolve(cloneDeep(util.db.get(pathInit({
|
||||
dbName,
|
||||
path,
|
||||
user,
|
||||
@@ -91,7 +90,7 @@ export default {
|
||||
user = false
|
||||
} = {}) {
|
||||
return new Promise(resolve => {
|
||||
resolve(db.get(pathInit({
|
||||
resolve(util.db.get(pathInit({
|
||||
dbName: 'database',
|
||||
path: '',
|
||||
user,
|
||||
@@ -108,7 +107,7 @@ export default {
|
||||
user = false
|
||||
} = {}) {
|
||||
return new Promise(resolve => {
|
||||
resolve(db.get(pathInit({
|
||||
resolve(util.db.get(pathInit({
|
||||
dbName: 'database',
|
||||
path: '',
|
||||
user,
|
||||
@@ -130,7 +129,7 @@ export default {
|
||||
user = false
|
||||
} = {}) {
|
||||
return new Promise(resolve => {
|
||||
resolve(db.get(pathInit({
|
||||
resolve(util.db.get(pathInit({
|
||||
dbName: 'database',
|
||||
path: `$page.${vm.$route[basis]}`,
|
||||
user,
|
||||
@@ -151,7 +150,7 @@ export default {
|
||||
user = false
|
||||
} = {}) {
|
||||
return new Promise(resolve => {
|
||||
resolve(db.get(pathInit({
|
||||
resolve(util.db.get(pathInit({
|
||||
dbName: 'database',
|
||||
path: `$page.${vm.$route[basis]}`,
|
||||
user,
|
||||
@@ -173,7 +172,7 @@ export default {
|
||||
user = false
|
||||
}) {
|
||||
return new Promise(resolve => {
|
||||
resolve(db.get(pathInit({
|
||||
resolve(util.db.get(pathInit({
|
||||
dbName: 'database',
|
||||
path: `$page.${vm.$route[basis]}.$data`,
|
||||
user,
|
||||
@@ -195,7 +194,7 @@ export default {
|
||||
user = false
|
||||
}) {
|
||||
return new Promise(resolve => {
|
||||
resolve(cloneDeep(db.get(pathInit({
|
||||
resolve(cloneDeep(util.db.get(pathInit({
|
||||
dbName: 'database',
|
||||
path: `$page.${vm.$route[basis]}.$data`,
|
||||
user,
|
||||
@@ -216,7 +215,7 @@ export default {
|
||||
user = false
|
||||
}) {
|
||||
return new Promise(resolve => {
|
||||
resolve(db.get(pathInit({
|
||||
resolve(util.db.get(pathInit({
|
||||
dbName: 'database',
|
||||
path: `$page.${vm.$route[basis]}.$data`,
|
||||
user,
|
||||
|
||||
Reference in New Issue
Block a user