mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-10-10 07:23:23 +08:00
规范utools引用
This commit is contained in:
@@ -83,6 +83,7 @@ import EditorTools from "components/editor/EditorTools";
|
||||
import CommandRunResult from "components/CommandRunResult";
|
||||
import CommandComposer from "components/composer/CommandComposer.vue";
|
||||
import programs from "js/options/programs.js";
|
||||
import { dbManager } from "js/utools.js";
|
||||
|
||||
// 预加载 MonacoEditor
|
||||
const MonacoEditorPromise = import("components/editor/MonacoEditor");
|
||||
@@ -169,7 +170,7 @@ export default {
|
||||
// 命令初始化
|
||||
commandInit() {
|
||||
let quickCommandInfo = this.isRunCodePage
|
||||
? this.$root.utools.getDB("cfg_codeHistory")
|
||||
? dbManager.getDB("cfg_codeHistory")
|
||||
: this.action.data;
|
||||
quickCommandInfo?.program &&
|
||||
Object.assign(
|
||||
@@ -233,7 +234,7 @@ export default {
|
||||
case "apply":
|
||||
return this.replaceText(actionData);
|
||||
case "close":
|
||||
return this.showComposer = false;
|
||||
return (this.showComposer = false);
|
||||
}
|
||||
},
|
||||
// 保存
|
||||
@@ -245,7 +246,7 @@ export default {
|
||||
window.lodashM.cloneDeep(updatedData)
|
||||
);
|
||||
let newQuickcommandInfo = window.lodashM.cloneDeep(this.quickcommandInfo);
|
||||
this.$root.utools.putDB(
|
||||
dbManager.putDB(
|
||||
newQuickcommandInfo,
|
||||
"qc_" + this.quickcommandInfo.features.code
|
||||
);
|
||||
@@ -272,7 +273,7 @@ export default {
|
||||
if (this.action.type !== "run") return;
|
||||
let command = window.lodashM.cloneDeep(this.quickcommandInfo);
|
||||
command.cursorPosition = this.$refs.editor.getCursorPosition();
|
||||
this.$root.utools.putDB(command, "cfg_codeHistory");
|
||||
dbManager.putDB(command, "cfg_codeHistory");
|
||||
},
|
||||
monacoTyping(val) {
|
||||
this.quickcommandInfo.cmd = val;
|
||||
|
@@ -77,6 +77,7 @@ import ResultArea from "components/ResultArea.vue";
|
||||
import ResultMenu from "components/popup/ResultMenu.vue";
|
||||
import { generateFlowsCode } from "js/composer/generateCode";
|
||||
import { getValidCommand } from "js/commandManager";
|
||||
import { dbManager } from "js/utools.js";
|
||||
|
||||
export default {
|
||||
components: { ResultArea, ResultMenu },
|
||||
@@ -225,7 +226,7 @@ export default {
|
||||
},
|
||||
// 特殊变量赋值
|
||||
assignSpecialVars(cmd) {
|
||||
let userData = this.$root.utools.userData.all();
|
||||
let userData = dbManager.userData.all();
|
||||
let spVars = window.lodashM.filter(specialVars, (sp) => sp.repl);
|
||||
window.lodashM.forIn(spVars, (val, key) => {
|
||||
let label = val.label.slice(0, -2);
|
||||
|
@@ -59,6 +59,7 @@
|
||||
|
||||
<script>
|
||||
import draggable from "vuedraggable";
|
||||
import { dbManager } from "js/utools.js";
|
||||
|
||||
const FIXED_TAGS = ["未分类", "默认", "搜索结果"];
|
||||
const TAG_ORDER_KEY = "cfg_tagOrder";
|
||||
@@ -98,7 +99,7 @@ export default {
|
||||
},
|
||||
created() {
|
||||
// 初始化时读取一次数据库
|
||||
this.savedTagOrder = this.$root.utools.getDB(TAG_ORDER_KEY);
|
||||
this.savedTagOrder = dbManager.getDB(TAG_ORDER_KEY);
|
||||
if (!this.savedTagOrder.length) {
|
||||
this.savedTagOrder = this.allQuickCommandTags;
|
||||
}
|
||||
@@ -145,7 +146,7 @@ export default {
|
||||
// 更新内部缓存
|
||||
this.savedTagOrder = value;
|
||||
// 保存到数据库
|
||||
this.$root.utools.putDB(value, TAG_ORDER_KEY);
|
||||
dbManager.putDB(value, TAG_ORDER_KEY);
|
||||
// 触发标签重排序事件
|
||||
this.$emit("tags-reordered", value);
|
||||
},
|
||||
@@ -158,7 +159,7 @@ export default {
|
||||
// 更新内部缓存
|
||||
this.savedTagOrder = newOrder;
|
||||
// 保存到数据库
|
||||
this.$root.utools.putDB(newOrder, TAG_ORDER_KEY);
|
||||
dbManager.putDB(newOrder, TAG_ORDER_KEY);
|
||||
// 触发重新加载标签
|
||||
this.$emit("tags-reordered", newOrder);
|
||||
}
|
||||
|
@@ -142,16 +142,22 @@
|
||||
|
||||
<script>
|
||||
import features from "js/options/quickFeatures.js";
|
||||
import { utoolsFull } from "js/utools.js";
|
||||
|
||||
export default {
|
||||
name: "UtilityFeaturesMenu",
|
||||
data() {
|
||||
return {
|
||||
utools: utoolsFull,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
toggleFeature(type, enable) {
|
||||
enable
|
||||
? this.$root.utools.whole.setFeature(
|
||||
? this.utools.setFeature(
|
||||
window.lodashM.cloneDeep(features[type])
|
||||
)
|
||||
: this.$root.utools.whole.removeFeature(features[type].code);
|
||||
: this.utools.removeFeature(features[type].code);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@@ -103,6 +103,7 @@ import UtilityFeaturesMenu from "./UtilityFeaturesMenu.vue";
|
||||
import EnvConfigMenu from "./EnvConfigMenu.vue";
|
||||
import PersonalizeMenu from "./PersonalizeMenu.vue";
|
||||
import UserData from "../popup/UserData.vue";
|
||||
import { utoolsFull } from "js/utools.js";
|
||||
|
||||
export default {
|
||||
name: "ConfigurationMenu",
|
||||
@@ -121,6 +122,7 @@ export default {
|
||||
showAbout: false,
|
||||
showPanelConf: false,
|
||||
showUserData: false,
|
||||
utools: utoolsFull,
|
||||
};
|
||||
},
|
||||
props: {
|
||||
@@ -140,7 +142,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
unMarkTag() {
|
||||
this.$root.utools.whole.removeFeature(
|
||||
this.utools.removeFeature(
|
||||
`panel_${window.hexEncode(this.currentTag)}`
|
||||
);
|
||||
window.lodashM.pull(
|
||||
|
@@ -51,11 +51,13 @@
|
||||
|
||||
<script>
|
||||
import IconPicker from "components/popup/IconPicker";
|
||||
import { utoolsFull } from "js/utools.js";
|
||||
|
||||
export default {
|
||||
components: { IconPicker },
|
||||
data() {
|
||||
return {
|
||||
utools: utoolsFull,
|
||||
features: {
|
||||
explain: `进入${this.currentTag}的面板视图`,
|
||||
icon: "logo/quickcommand.png",
|
||||
@@ -71,9 +73,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
markTag() {
|
||||
this.$root.utools.whole.setFeature(
|
||||
window.lodashM.cloneDeep(this.features)
|
||||
);
|
||||
this.utools.setFeature(window.lodashM.cloneDeep(this.features));
|
||||
this.$root.$refs.view.activatedQuickPanels.push(this.currentTag);
|
||||
quickcommand.showMessageBox(
|
||||
`主输入框输入『${this.features.cmds.join("、")}』即可直接进入『${
|
||||
|
@@ -62,7 +62,7 @@ const joinLink = [
|
||||
"https://www.yuque.com/g/fofolee/qcshares4/collaborator/join?token=DXb4XAVatwn2OoGK#",
|
||||
"https://www.yuque.com/g/fofolee/qcshares5/collaborator/join?token=tw1kyfD2T4jjsQHc#",
|
||||
];
|
||||
|
||||
import { dbManager } from "js/utools.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -167,10 +167,10 @@ export default {
|
||||
});
|
||||
},
|
||||
loadYuQueInfo() {
|
||||
return this.$root.utools.getDB("cfg_extraInfo");
|
||||
return dbManager.getDB("cfg_extraInfo");
|
||||
},
|
||||
saveYuQueInfo() {
|
||||
this.$root.utools.putDB(
|
||||
dbManager.putDB(
|
||||
window.lodashM.cloneDeep(this.yuQueInfo),
|
||||
"cfg_extraInfo"
|
||||
);
|
||||
|
@@ -58,6 +58,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { dbManager } from "js/utools.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -68,18 +69,18 @@ export default {
|
||||
showInsertBtn: Boolean,
|
||||
},
|
||||
mounted() {
|
||||
this.allUserData = this.$root.utools.userData.all();
|
||||
this.allUserData = dbManager.userData.all();
|
||||
},
|
||||
methods: {
|
||||
saveUserData() {
|
||||
this.allUserData.forEach((item) => {
|
||||
this.$root.utools.userData.put(item.value, item.id, item.isNative);
|
||||
dbManager.userData.put(item.value, item.id, item.isNative);
|
||||
});
|
||||
quickcommand.showMessageBox("更新完毕!");
|
||||
},
|
||||
delUserData(id) {
|
||||
quickcommand.showConfirmBox("删除后不可恢复").then(() => {
|
||||
this.$root.utools.userData.del(id);
|
||||
dbManager.userData.del(id);
|
||||
this.allUserData = this.allUserData.filter((item) => item.id !== id);
|
||||
});
|
||||
},
|
||||
@@ -97,7 +98,7 @@ export default {
|
||||
value,
|
||||
isNative: true,
|
||||
});
|
||||
this.$root.utools.userData.put(value, id, true);
|
||||
dbManager.userData.put(value, id, true);
|
||||
});
|
||||
},
|
||||
},
|
||||
|
@@ -130,10 +130,12 @@
|
||||
|
||||
<script>
|
||||
import levelDetail from "js/options/levelDetail.js";
|
||||
import { dbManager, utoolsFull } from "js/utools.js";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
utools: utoolsFull,
|
||||
userInfo: {
|
||||
exp: 0,
|
||||
level: 1,
|
||||
@@ -160,8 +162,8 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
async getUserInfo() {
|
||||
Object.assign(this.userInfo, this.$root.utools.whole.getUser());
|
||||
this.userInfo.exp = this.$root.utools.getDB("cfg_exp");
|
||||
Object.assign(this.userInfo, this.utools.getUser());
|
||||
this.userInfo.exp = dbManager.getDB("cfg_exp");
|
||||
this.userInfo.level = this.levelDetail
|
||||
.filter((x) => this.userInfo.exp > x.minExp)
|
||||
.pop().lv;
|
||||
@@ -174,8 +176,7 @@ export default {
|
||||
).toFixed(2)
|
||||
)
|
||||
: 1;
|
||||
let ret = await this.$root.utools.whole.fetchUserPayments();
|
||||
console.log("PayInfo:", ret);
|
||||
let ret = await this.utools.fetchUserPayments();
|
||||
|
||||
this.isPluginVIP = ret.find((x) => x.goods_id === this.goodsId);
|
||||
this.isUtoolsVIP = this.userInfo.type === "member";
|
||||
@@ -189,7 +190,7 @@ export default {
|
||||
}, 3000);
|
||||
},
|
||||
payForMember() {
|
||||
this.$root.utools.whole.openPayment({ goodsId: this.goodsId }, () => {
|
||||
this.utools.openPayment({ goodsId: this.goodsId }, () => {
|
||||
this.isPluginVIP = true;
|
||||
this.showPayPage = false;
|
||||
});
|
||||
|
@@ -37,6 +37,7 @@ import ConfirmBox from "components/quickcommandUI/ConfirmBox";
|
||||
import TextArea from "components/quickcommandUI/TextArea";
|
||||
import SelectList from "components/quickcommandUI/SelectList";
|
||||
import programs from "js/options/programs";
|
||||
import { dbManager } from "js/utools.js";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@@ -264,7 +265,7 @@ export default {
|
||||
Object.assign(window.quickcommand, quickcommandUI);
|
||||
|
||||
// 获取用户数据
|
||||
window.quickcommand.userData = this.$root.utools.userData;
|
||||
window.quickcommand.userData = dbManager.userData;
|
||||
|
||||
/**
|
||||
* 执行代码
|
||||
|
Reference in New Issue
Block a user