You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

164 lines
5.7 KiB

4 years ago
import { name } from '@/config/db';
import { curry } from 'lodash';
4 years ago
4 years ago
// 创建表
4 years ago
const createCollection = (Vue, db) => {
4 years ago
// projects项目表
4 years ago
!db.objectStoreNames.contains('projects') && db.createObjectStore('projects', { keyPath: 'id' });
4 years ago
// roles 角色表
4 years ago
!db.objectStoreNames.contains('roles') && db.createObjectStore('roles', { keyPath: 'id' });
4 years ago
// plan_tasks 定期任务
4 years ago
!db.objectStoreNames.contains('plan_tasks') && db.createObjectStore('plan_tasks', { keyPath: 'id' });
4 years ago
// fixed_tasks 固定全局任务
4 years ago
Vue.prototype.$db.fixed_tasks = !db.objectStoreNames.contains('fixed_tasks') && db.createObjectStore('fixed_tasks', { keyPath: 'id' });
4 years ago
// variable_tasks 可变全局任务
4 years ago
Vue.prototype.$db.variable_tasks =
!db.objectStoreNames.contains('variable_tasks') && db.createObjectStore('variable_tasks', { keyPath: 'id' });
4 years ago
// plugins 插件表
4 years ago
Vue.prototype.$db.plugins = !db.objectStoreNames.contains('plugins') && db.createObjectStore('plugins', { keyPath: 'id' });
4 years ago
};
4 years ago
/**
* 新增数据
*
* @param {object} db 数据库database
* @param {string} collection 集合/
* @param {object} data 数据
*/
const create = (db, collection, data) => {
return new Promise((resolve, reject) => {
const request = db.transaction([collection], 'readwrite').objectStore(collection).add(data);
project (#1) fix: 交付物+考勤管理 chore: 关掉了treeShaking Merge remote-tracking branch 'origin/lucky' into project chore(node-sass): 替换node-sass为sass(dart-sass) /deep/替换为::deep fix: 检查交付物传参修改 fix: 检查交付物传参修改 feat: 检查交付物 refactor: puppeteer升级v10 refactor: 重构时间刻度渲染任务 解决了时间刻度未替换的问题;解决重复渲染的问题 feat: 添加内置插件-交付物 fix: 调试定期任务bug;不能合并使用 fix: 滚动id函数优化 feat: network控制本地缓存的使用 network控制本地缓存的使用;删除了projects相关的代码 refactor(tailwindcss): tailwindcss CDN引入;移除相关配置文件及包;开启treeShaking chore: 删除vuedragable及修改运行端口为9000 refactor: 只保留project内容 feat: 细节调整,添加project-webview 准备分离project feat(phone-bind): 验证码validate feat(mp): 兼容小程序,去除window,document等 feat(bind phone): 图形验证码;短信验证码;绑定手机号 Merge remote-tracking branch 'origin/songsong' into temp feat: 添加项目排序 feat: 绑定手机号 Merge remote-tracking branch 'origin/songsong' into temp feat: 适配小程序;小程序登录 fix: 定期任务本地缓存和api赋值,未完成 fix(定期任务本地缓存和api赋值,未完成): 定期任务本地缓存和api赋值,未完成 fix: api 存storage feat: api封装 Merge remote-tracking branch 'origin/lucky' into song perf: 小红点api缓存修改 feat: 缓存修改 style: indexedDB.js格式整理 feat: cache indexedDB处理 Co-authored-by: song <srf428110@163.com> Reviewed-on: https://dd.tall.wiki/gitea/wally/tall-mui-3-project/pulls/1
4 years ago
request.onsuccess = () => resolve();
4 years ago
request.onerror = event => {
project (#1) fix: 交付物+考勤管理 chore: 关掉了treeShaking Merge remote-tracking branch 'origin/lucky' into project chore(node-sass): 替换node-sass为sass(dart-sass) /deep/替换为::deep fix: 检查交付物传参修改 fix: 检查交付物传参修改 feat: 检查交付物 refactor: puppeteer升级v10 refactor: 重构时间刻度渲染任务 解决了时间刻度未替换的问题;解决重复渲染的问题 feat: 添加内置插件-交付物 fix: 调试定期任务bug;不能合并使用 fix: 滚动id函数优化 feat: network控制本地缓存的使用 network控制本地缓存的使用;删除了projects相关的代码 refactor(tailwindcss): tailwindcss CDN引入;移除相关配置文件及包;开启treeShaking chore: 删除vuedragable及修改运行端口为9000 refactor: 只保留project内容 feat: 细节调整,添加project-webview 准备分离project feat(phone-bind): 验证码validate feat(mp): 兼容小程序,去除window,document等 feat(bind phone): 图形验证码;短信验证码;绑定手机号 Merge remote-tracking branch 'origin/songsong' into temp feat: 添加项目排序 feat: 绑定手机号 Merge remote-tracking branch 'origin/songsong' into temp feat: 适配小程序;小程序登录 fix: 定期任务本地缓存和api赋值,未完成 fix(定期任务本地缓存和api赋值,未完成): 定期任务本地缓存和api赋值,未完成 fix: api 存storage feat: api封装 Merge remote-tracking branch 'origin/lucky' into song perf: 小红点api缓存修改 feat: 缓存修改 style: indexedDB.js格式整理 feat: cache indexedDB处理 Co-authored-by: song <srf428110@163.com> Reviewed-on: https://dd.tall.wiki/gitea/wally/tall-mui-3-project/pulls/1
4 years ago
const { name, message } = event.target.error;
if (name === 'ConstraintError') {
reject('数据已存在');
} else {
reject(message);
}
4 years ago
};
});
};
/**
* 找到1条数据
*
* @param {object} db 数据库database
* @param {string} collection 集合/
* @param {string} key 索引关键字 一般是id
*/
const findOne = (db, collection, key) => {
return new Promise((resolve, reject) => {
const request = db.transaction([collection]).objectStore(collection).get(key);
project (#1) fix: 交付物+考勤管理 chore: 关掉了treeShaking Merge remote-tracking branch 'origin/lucky' into project chore(node-sass): 替换node-sass为sass(dart-sass) /deep/替换为::deep fix: 检查交付物传参修改 fix: 检查交付物传参修改 feat: 检查交付物 refactor: puppeteer升级v10 refactor: 重构时间刻度渲染任务 解决了时间刻度未替换的问题;解决重复渲染的问题 feat: 添加内置插件-交付物 fix: 调试定期任务bug;不能合并使用 fix: 滚动id函数优化 feat: network控制本地缓存的使用 network控制本地缓存的使用;删除了projects相关的代码 refactor(tailwindcss): tailwindcss CDN引入;移除相关配置文件及包;开启treeShaking chore: 删除vuedragable及修改运行端口为9000 refactor: 只保留project内容 feat: 细节调整,添加project-webview 准备分离project feat(phone-bind): 验证码validate feat(mp): 兼容小程序,去除window,document等 feat(bind phone): 图形验证码;短信验证码;绑定手机号 Merge remote-tracking branch 'origin/songsong' into temp feat: 添加项目排序 feat: 绑定手机号 Merge remote-tracking branch 'origin/songsong' into temp feat: 适配小程序;小程序登录 fix: 定期任务本地缓存和api赋值,未完成 fix(定期任务本地缓存和api赋值,未完成): 定期任务本地缓存和api赋值,未完成 fix: api 存storage feat: api封装 Merge remote-tracking branch 'origin/lucky' into song perf: 小红点api缓存修改 feat: 缓存修改 style: indexedDB.js格式整理 feat: cache indexedDB处理 Co-authored-by: song <srf428110@163.com> Reviewed-on: https://dd.tall.wiki/gitea/wally/tall-mui-3-project/pulls/1
4 years ago
request.onerror = event => reject(event.target.error.message);
request.onsuccess = event => resolve(event.target.result);
4 years ago
});
};
/**
* 找到所有数据
*
* @param {object} db 数据库database
* @param {string} collection 集合/
*/
const find = (db, collection) => {
return new Promise((resolve, reject) => {
const request = db.transaction(collection).objectStore(collection).openCursor();
project (#1) fix: 交付物+考勤管理 chore: 关掉了treeShaking Merge remote-tracking branch 'origin/lucky' into project chore(node-sass): 替换node-sass为sass(dart-sass) /deep/替换为::deep fix: 检查交付物传参修改 fix: 检查交付物传参修改 feat: 检查交付物 refactor: puppeteer升级v10 refactor: 重构时间刻度渲染任务 解决了时间刻度未替换的问题;解决重复渲染的问题 feat: 添加内置插件-交付物 fix: 调试定期任务bug;不能合并使用 fix: 滚动id函数优化 feat: network控制本地缓存的使用 network控制本地缓存的使用;删除了projects相关的代码 refactor(tailwindcss): tailwindcss CDN引入;移除相关配置文件及包;开启treeShaking chore: 删除vuedragable及修改运行端口为9000 refactor: 只保留project内容 feat: 细节调整,添加project-webview 准备分离project feat(phone-bind): 验证码validate feat(mp): 兼容小程序,去除window,document等 feat(bind phone): 图形验证码;短信验证码;绑定手机号 Merge remote-tracking branch 'origin/songsong' into temp feat: 添加项目排序 feat: 绑定手机号 Merge remote-tracking branch 'origin/songsong' into temp feat: 适配小程序;小程序登录 fix: 定期任务本地缓存和api赋值,未完成 fix(定期任务本地缓存和api赋值,未完成): 定期任务本地缓存和api赋值,未完成 fix: api 存storage feat: api封装 Merge remote-tracking branch 'origin/lucky' into song perf: 小红点api缓存修改 feat: 缓存修改 style: indexedDB.js格式整理 feat: cache indexedDB处理 Co-authored-by: song <srf428110@163.com> Reviewed-on: https://dd.tall.wiki/gitea/wally/tall-mui-3-project/pulls/1
4 years ago
let result = [];
request.onerror = event => reject(event.target.error.message);
4 years ago
request.onsuccess = event => {
const cursor = event.target.result;
if (cursor) {
project (#1) fix: 交付物+考勤管理 chore: 关掉了treeShaking Merge remote-tracking branch 'origin/lucky' into project chore(node-sass): 替换node-sass为sass(dart-sass) /deep/替换为::deep fix: 检查交付物传参修改 fix: 检查交付物传参修改 feat: 检查交付物 refactor: puppeteer升级v10 refactor: 重构时间刻度渲染任务 解决了时间刻度未替换的问题;解决重复渲染的问题 feat: 添加内置插件-交付物 fix: 调试定期任务bug;不能合并使用 fix: 滚动id函数优化 feat: network控制本地缓存的使用 network控制本地缓存的使用;删除了projects相关的代码 refactor(tailwindcss): tailwindcss CDN引入;移除相关配置文件及包;开启treeShaking chore: 删除vuedragable及修改运行端口为9000 refactor: 只保留project内容 feat: 细节调整,添加project-webview 准备分离project feat(phone-bind): 验证码validate feat(mp): 兼容小程序,去除window,document等 feat(bind phone): 图形验证码;短信验证码;绑定手机号 Merge remote-tracking branch 'origin/songsong' into temp feat: 添加项目排序 feat: 绑定手机号 Merge remote-tracking branch 'origin/songsong' into temp feat: 适配小程序;小程序登录 fix: 定期任务本地缓存和api赋值,未完成 fix(定期任务本地缓存和api赋值,未完成): 定期任务本地缓存和api赋值,未完成 fix: api 存storage feat: api封装 Merge remote-tracking branch 'origin/lucky' into song perf: 小红点api缓存修改 feat: 缓存修改 style: indexedDB.js格式整理 feat: cache indexedDB处理 Co-authored-by: song <srf428110@163.com> Reviewed-on: https://dd.tall.wiki/gitea/wally/tall-mui-3-project/pulls/1
4 years ago
result.push(cursor.value);
4 years ago
cursor.continue();
} else {
project (#1) fix: 交付物+考勤管理 chore: 关掉了treeShaking Merge remote-tracking branch 'origin/lucky' into project chore(node-sass): 替换node-sass为sass(dart-sass) /deep/替换为::deep fix: 检查交付物传参修改 fix: 检查交付物传参修改 feat: 检查交付物 refactor: puppeteer升级v10 refactor: 重构时间刻度渲染任务 解决了时间刻度未替换的问题;解决重复渲染的问题 feat: 添加内置插件-交付物 fix: 调试定期任务bug;不能合并使用 fix: 滚动id函数优化 feat: network控制本地缓存的使用 network控制本地缓存的使用;删除了projects相关的代码 refactor(tailwindcss): tailwindcss CDN引入;移除相关配置文件及包;开启treeShaking chore: 删除vuedragable及修改运行端口为9000 refactor: 只保留project内容 feat: 细节调整,添加project-webview 准备分离project feat(phone-bind): 验证码validate feat(mp): 兼容小程序,去除window,document等 feat(bind phone): 图形验证码;短信验证码;绑定手机号 Merge remote-tracking branch 'origin/songsong' into temp feat: 添加项目排序 feat: 绑定手机号 Merge remote-tracking branch 'origin/songsong' into temp feat: 适配小程序;小程序登录 fix: 定期任务本地缓存和api赋值,未完成 fix(定期任务本地缓存和api赋值,未完成): 定期任务本地缓存和api赋值,未完成 fix: api 存storage feat: api封装 Merge remote-tracking branch 'origin/lucky' into song perf: 小红点api缓存修改 feat: 缓存修改 style: indexedDB.js格式整理 feat: cache indexedDB处理 Co-authored-by: song <srf428110@163.com> Reviewed-on: https://dd.tall.wiki/gitea/wally/tall-mui-3-project/pulls/1
4 years ago
resolve(result);
4 years ago
}
};
});
};
/**
* 更新数据
*
* @param {object} db 数据库database
* @param {string} collection 集合/
* @param {object} newData 新数据
*/
const update = (db, collection, newData) => {
return new Promise((resolve, reject) => {
const request = db.transaction([collection], 'readwrite').objectStore(collection).put(newData);
project (#1) fix: 交付物+考勤管理 chore: 关掉了treeShaking Merge remote-tracking branch 'origin/lucky' into project chore(node-sass): 替换node-sass为sass(dart-sass) /deep/替换为::deep fix: 检查交付物传参修改 fix: 检查交付物传参修改 feat: 检查交付物 refactor: puppeteer升级v10 refactor: 重构时间刻度渲染任务 解决了时间刻度未替换的问题;解决重复渲染的问题 feat: 添加内置插件-交付物 fix: 调试定期任务bug;不能合并使用 fix: 滚动id函数优化 feat: network控制本地缓存的使用 network控制本地缓存的使用;删除了projects相关的代码 refactor(tailwindcss): tailwindcss CDN引入;移除相关配置文件及包;开启treeShaking chore: 删除vuedragable及修改运行端口为9000 refactor: 只保留project内容 feat: 细节调整,添加project-webview 准备分离project feat(phone-bind): 验证码validate feat(mp): 兼容小程序,去除window,document等 feat(bind phone): 图形验证码;短信验证码;绑定手机号 Merge remote-tracking branch 'origin/songsong' into temp feat: 添加项目排序 feat: 绑定手机号 Merge remote-tracking branch 'origin/songsong' into temp feat: 适配小程序;小程序登录 fix: 定期任务本地缓存和api赋值,未完成 fix(定期任务本地缓存和api赋值,未完成): 定期任务本地缓存和api赋值,未完成 fix: api 存storage feat: api封装 Merge remote-tracking branch 'origin/lucky' into song perf: 小红点api缓存修改 feat: 缓存修改 style: indexedDB.js格式整理 feat: cache indexedDB处理 Co-authored-by: song <srf428110@163.com> Reviewed-on: https://dd.tall.wiki/gitea/wally/tall-mui-3-project/pulls/1
4 years ago
request.onerror = event => reject(event.target.error.message);
request.onsuccess = () => resolve(newData);
4 years ago
});
};
/**
* 移除数据 通过关键字
*
* @param {object} db 数据库database
* @param {string} collection 集合/
* @param {string} key 关键字
*/
const remove = (db, collection, key) => {
return new Promise((resolve, reject) => {
const request = db.transaction([collection], 'readwrite').objectStore(collection).delete(key);
project (#1) fix: 交付物+考勤管理 chore: 关掉了treeShaking Merge remote-tracking branch 'origin/lucky' into project chore(node-sass): 替换node-sass为sass(dart-sass) /deep/替换为::deep fix: 检查交付物传参修改 fix: 检查交付物传参修改 feat: 检查交付物 refactor: puppeteer升级v10 refactor: 重构时间刻度渲染任务 解决了时间刻度未替换的问题;解决重复渲染的问题 feat: 添加内置插件-交付物 fix: 调试定期任务bug;不能合并使用 fix: 滚动id函数优化 feat: network控制本地缓存的使用 network控制本地缓存的使用;删除了projects相关的代码 refactor(tailwindcss): tailwindcss CDN引入;移除相关配置文件及包;开启treeShaking chore: 删除vuedragable及修改运行端口为9000 refactor: 只保留project内容 feat: 细节调整,添加project-webview 准备分离project feat(phone-bind): 验证码validate feat(mp): 兼容小程序,去除window,document等 feat(bind phone): 图形验证码;短信验证码;绑定手机号 Merge remote-tracking branch 'origin/songsong' into temp feat: 添加项目排序 feat: 绑定手机号 Merge remote-tracking branch 'origin/songsong' into temp feat: 适配小程序;小程序登录 fix: 定期任务本地缓存和api赋值,未完成 fix(定期任务本地缓存和api赋值,未完成): 定期任务本地缓存和api赋值,未完成 fix: api 存storage feat: api封装 Merge remote-tracking branch 'origin/lucky' into song perf: 小红点api缓存修改 feat: 缓存修改 style: indexedDB.js格式整理 feat: cache indexedDB处理 Co-authored-by: song <srf428110@163.com> Reviewed-on: https://dd.tall.wiki/gitea/wally/tall-mui-3-project/pulls/1
4 years ago
request.onerror = event => reject(event.target.error.message);
request.onsuccess = () => resolve();
4 years ago
});
};
/**
* 创建索引
*
* @param {object} db 数据库database
* @param {string} collection 集合/
* @param {string} field 创建索引的字段名称
* @param {string} key 关键字
*/
const createIndexAndFind = (db, collection, field, key) => {
return new Promise((resolve, reject) => {
project (#1) fix: 交付物+考勤管理 chore: 关掉了treeShaking Merge remote-tracking branch 'origin/lucky' into project chore(node-sass): 替换node-sass为sass(dart-sass) /deep/替换为::deep fix: 检查交付物传参修改 fix: 检查交付物传参修改 feat: 检查交付物 refactor: puppeteer升级v10 refactor: 重构时间刻度渲染任务 解决了时间刻度未替换的问题;解决重复渲染的问题 feat: 添加内置插件-交付物 fix: 调试定期任务bug;不能合并使用 fix: 滚动id函数优化 feat: network控制本地缓存的使用 network控制本地缓存的使用;删除了projects相关的代码 refactor(tailwindcss): tailwindcss CDN引入;移除相关配置文件及包;开启treeShaking chore: 删除vuedragable及修改运行端口为9000 refactor: 只保留project内容 feat: 细节调整,添加project-webview 准备分离project feat(phone-bind): 验证码validate feat(mp): 兼容小程序,去除window,document等 feat(bind phone): 图形验证码;短信验证码;绑定手机号 Merge remote-tracking branch 'origin/songsong' into temp feat: 添加项目排序 feat: 绑定手机号 Merge remote-tracking branch 'origin/songsong' into temp feat: 适配小程序;小程序登录 fix: 定期任务本地缓存和api赋值,未完成 fix(定期任务本地缓存和api赋值,未完成): 定期任务本地缓存和api赋值,未完成 fix: api 存storage feat: api封装 Merge remote-tracking branch 'origin/lucky' into song perf: 小红点api缓存修改 feat: 缓存修改 style: indexedDB.js格式整理 feat: cache indexedDB处理 Co-authored-by: song <srf428110@163.com> Reviewed-on: https://dd.tall.wiki/gitea/wally/tall-mui-3-project/pulls/1
4 years ago
const store = db.transaction([collection], 'readonly').objectStore(collection);
store.createIndex(field, field);
const index = store.index(field);
4 years ago
const request = index.get(key);
project (#1) fix: 交付物+考勤管理 chore: 关掉了treeShaking Merge remote-tracking branch 'origin/lucky' into project chore(node-sass): 替换node-sass为sass(dart-sass) /deep/替换为::deep fix: 检查交付物传参修改 fix: 检查交付物传参修改 feat: 检查交付物 refactor: puppeteer升级v10 refactor: 重构时间刻度渲染任务 解决了时间刻度未替换的问题;解决重复渲染的问题 feat: 添加内置插件-交付物 fix: 调试定期任务bug;不能合并使用 fix: 滚动id函数优化 feat: network控制本地缓存的使用 network控制本地缓存的使用;删除了projects相关的代码 refactor(tailwindcss): tailwindcss CDN引入;移除相关配置文件及包;开启treeShaking chore: 删除vuedragable及修改运行端口为9000 refactor: 只保留project内容 feat: 细节调整,添加project-webview 准备分离project feat(phone-bind): 验证码validate feat(mp): 兼容小程序,去除window,document等 feat(bind phone): 图形验证码;短信验证码;绑定手机号 Merge remote-tracking branch 'origin/songsong' into temp feat: 添加项目排序 feat: 绑定手机号 Merge remote-tracking branch 'origin/songsong' into temp feat: 适配小程序;小程序登录 fix: 定期任务本地缓存和api赋值,未完成 fix(定期任务本地缓存和api赋值,未完成): 定期任务本地缓存和api赋值,未完成 fix: api 存storage feat: api封装 Merge remote-tracking branch 'origin/lucky' into song perf: 小红点api缓存修改 feat: 缓存修改 style: indexedDB.js格式整理 feat: cache indexedDB处理 Co-authored-by: song <srf428110@163.com> Reviewed-on: https://dd.tall.wiki/gitea/wally/tall-mui-3-project/pulls/1
4 years ago
request.onerror = event => reject(event.target.error.message);
request.onsuccess = event => resolve(event.target.result);
4 years ago
});
};
const curriedCreate = curry(create);
export const curriedFindOne = curry(findOne);
export const curriedFind = curry(find);
export const curriedRemove = curry(remove);
export const curriedUpdate = curry(update);
export const curriedIndex = curry(createIndexAndFind);
4 years ago
const install = Vue => {
project (#1) fix: 交付物+考勤管理 chore: 关掉了treeShaking Merge remote-tracking branch 'origin/lucky' into project chore(node-sass): 替换node-sass为sass(dart-sass) /deep/替换为::deep fix: 检查交付物传参修改 fix: 检查交付物传参修改 feat: 检查交付物 refactor: puppeteer升级v10 refactor: 重构时间刻度渲染任务 解决了时间刻度未替换的问题;解决重复渲染的问题 feat: 添加内置插件-交付物 fix: 调试定期任务bug;不能合并使用 fix: 滚动id函数优化 feat: network控制本地缓存的使用 network控制本地缓存的使用;删除了projects相关的代码 refactor(tailwindcss): tailwindcss CDN引入;移除相关配置文件及包;开启treeShaking chore: 删除vuedragable及修改运行端口为9000 refactor: 只保留project内容 feat: 细节调整,添加project-webview 准备分离project feat(phone-bind): 验证码validate feat(mp): 兼容小程序,去除window,document等 feat(bind phone): 图形验证码;短信验证码;绑定手机号 Merge remote-tracking branch 'origin/songsong' into temp feat: 添加项目排序 feat: 绑定手机号 Merge remote-tracking branch 'origin/songsong' into temp feat: 适配小程序;小程序登录 fix: 定期任务本地缓存和api赋值,未完成 fix(定期任务本地缓存和api赋值,未完成): 定期任务本地缓存和api赋值,未完成 fix: api 存storage feat: api封装 Merge remote-tracking branch 'origin/lucky' into song perf: 小红点api缓存修改 feat: 缓存修改 style: indexedDB.js格式整理 feat: cache indexedDB处理 Co-authored-by: song <srf428110@163.com> Reviewed-on: https://dd.tall.wiki/gitea/wally/tall-mui-3-project/pulls/1
4 years ago
uni.$db = Vue.prototype.$db = {};
4 years ago
Vue.prototype.$db.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB;
4 years ago
const request = Vue.prototype.$db.indexedDB.open(name, Date.now()); // IDBRequest 对象
4 years ago
request.onerror = error => console.error('打开数据库失败', error);
request.onsuccess = event => {
4 years ago
console.log('INDEXED_DB OPEN SUCCESS');
4 years ago
Vue.prototype.$db.db = event.target.result;
};
request.onupgradeneeded = event => {
4 years ago
console.log('INDEXED_DB OPEN onupgradeneeded');
4 years ago
Vue.prototype.$db.db = event.target.result;
// 创建表
4 years ago
createCollection(Vue, Vue.prototype.$db.db);
project (#1) fix: 交付物+考勤管理 chore: 关掉了treeShaking Merge remote-tracking branch 'origin/lucky' into project chore(node-sass): 替换node-sass为sass(dart-sass) /deep/替换为::deep fix: 检查交付物传参修改 fix: 检查交付物传参修改 feat: 检查交付物 refactor: puppeteer升级v10 refactor: 重构时间刻度渲染任务 解决了时间刻度未替换的问题;解决重复渲染的问题 feat: 添加内置插件-交付物 fix: 调试定期任务bug;不能合并使用 fix: 滚动id函数优化 feat: network控制本地缓存的使用 network控制本地缓存的使用;删除了projects相关的代码 refactor(tailwindcss): tailwindcss CDN引入;移除相关配置文件及包;开启treeShaking chore: 删除vuedragable及修改运行端口为9000 refactor: 只保留project内容 feat: 细节调整,添加project-webview 准备分离project feat(phone-bind): 验证码validate feat(mp): 兼容小程序,去除window,document等 feat(bind phone): 图形验证码;短信验证码;绑定手机号 Merge remote-tracking branch 'origin/songsong' into temp feat: 添加项目排序 feat: 绑定手机号 Merge remote-tracking branch 'origin/songsong' into temp feat: 适配小程序;小程序登录 fix: 定期任务本地缓存和api赋值,未完成 fix(定期任务本地缓存和api赋值,未完成): 定期任务本地缓存和api赋值,未完成 fix: api 存storage feat: api封装 Merge remote-tracking branch 'origin/lucky' into song perf: 小红点api缓存修改 feat: 缓存修改 style: indexedDB.js格式整理 feat: cache indexedDB处理 Co-authored-by: song <srf428110@163.com> Reviewed-on: https://dd.tall.wiki/gitea/wally/tall-mui-3-project/pulls/1
4 years ago
Vue.prototype.$db.create = curriedCreate(Vue.prototype.$db.db); // create 新增数据,颗粒化以后就不用再传db数据了
Vue.prototype.$db.findOne = curriedFindOne(Vue.prototype.$db.db); // 查一条
Vue.prototype.$db.find = curriedFind(Vue.prototype.$db.db); // 查集合里的所有数据
Vue.prototype.$db.update = curriedUpdate(Vue.prototype.$db.db); // 更新某条数据
Vue.prototype.$db.remove = curriedRemove(Vue.prototype.$db.db); // 删除某条数据
// Vue.prototype.$db.createIndex = curriedIndex(Vue.prototype.$db.db); // 创建索引
};
4 years ago
};
export default { install };