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.

166 lines
4.4 KiB

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
import store from '@/store/index';
/**
* 等待token执行api
* 没有token 就延时执行自己 直到有了token在请求
* @param {function} requestFn 执行请求的函数
*/
export const waitTokenRequest = requestFn => {
if (!requestFn || typeof requestFn !== 'function') throw new Error(`requestFn must be a function`);
if (uni.$t.storage.getStorageSync(uni.$t.app.tokenKey)) {
requestFn();
} else {
setTimeout(() => waitTokenRequest(requestFn), 10);
}
};
export default {
/**
* 通过项目id获取角色信息
* @param {object} params 提交的参数
*/
findShowRole(params, fn) {
let remote = false;
if (store.getters.useStorage) {
// 有缓存 且 服务端数据未返回 就先返回缓存
uni.$t.cache
.getShowRole(params.projectId)
.then(data => {
!remote && fn(null, data);
})
.catch(err => !remote && fn(err));
}
waitTokenRequest(() => {
// 拿到api数据后 再用api的数据
uni.$u.api
.findShowRole(params)
.then(data => {
remote = true;
fn(null, data);
// 存api到cache里
uni.$t.cache.putShowRole(params.projectId, data);
})
.catch(err => fn(err));
});
},
/**
* 根据时间基准点和角色查找定期任务
* @param {object} params 提交的参数
*/
getRegularTask(params, fn) {
let remote = false;
if (store.getters.useStorage) {
// 有缓存 且 服务端数据未返回 就先返回缓存
uni.$t.cache
.getStorageRegularTask(params)
.then(data => {
console.log('cache data: ', data);
!remote && fn(null, data);
})
.catch(err => !remote && fn(err));
}
waitTokenRequest(() => {
// 拿到api数据后 再用api的数据
uni.$u.api
.getRegularTask(params)
.then(data => {
console.log('api data: ', uni.$u.deepClone(data));
remote = true;
fn(null, uni.$u.deepClone(data));
// 存api到cache里
uni.$t.cache.putStorageRegularTask(params, data);
})
.catch(err => fn(err));
});
},
/**
* 根据角色查找永久的日常任务
* @param {object} params 提交的参数
*/
getPermanent(params, fn) {
let remote = false;
if (store.getters.useStorage) {
// 有缓存 且 服务端数据未返回 就先返回缓存
uni.$t.cache
.getStoragePermanent(params)
.then(data => {
!remote && fn(null, data);
})
.catch(err => !remote && fn(err));
}
waitTokenRequest(() => {
// 拿到api数据后 再用api的数据
uni.$u.api
.getPermanent(params)
.then(data => {
remote = true;
fn(null, data);
// 存api到cache里
uni.$t.cache.putStoragePermanent(params, data);
})
.catch(err => fn(err));
});
},
/**
* 根据时间和角色查找日常任务
* @param {object} params 提交的参数
*/
getGlobal(params, fn) {
let remote = false;
if (store.getters.useStorage) {
// 有缓存 且 服务端数据未返回 就先返回缓存
uni.$t.cache
.getDailyTask(params)
.then(data => {
!remote && fn(null, data);
})
.catch(err => !remote && fn(err));
}
waitTokenRequest(() => {
// 拿到api数据后 再用api的数据
uni.$u.api
.getGlobal(params)
.then(data => {
remote = true;
fn(null, data);
// 存api到cache里
uni.$t.cache.putDailyTask(params, data);
})
.catch(err => fn(err));
});
},
/**
* 获取插件信息
* @param {object} params 提交的参数
*/
getOtherPlugin(params, fn) {
let remote = false;
if (store.getters.useStorage) {
// 有缓存 且 服务端数据未返回 就先返回缓存
uni.$t.cache
.getPlugin(params.pluginId)
.then(data => {
!remote && fn(null, data);
})
.catch(err => !remote && fn(err));
}
waitTokenRequest(() => {
// 拿到api数据后 再用api的数据
uni.$u.api
.getOtherPlugin(params)
.then(data => {
remote = true;
fn(null, data);
// 存api到cache里
uni.$t.cache.putPlugin(params.pluginId, data);
})
.catch(err => fn(err));
});
},
};