Skip to content

Commit

Permalink
Decode: add external url
Browse files Browse the repository at this point in the history
  • Loading branch information
PeratX committed Jan 19, 2020
1 parent 225a934 commit 3434740
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 31 deletions.
1 change: 0 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
<script>
import Drawer from "@/components/Drawer";
import bus from "@/store/bus.js";
import router from "./router";
export default {
data: () => {
Expand Down
5 changes: 3 additions & 2 deletions src/lang/chs.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ module.exports = {
name: '名称',
value: '值',
copy: '复制',
copySucc: '复制成功',
copyFail: '复制失败',
copySucc: '复制成功',
copyFail: '复制失败',
close: '关闭',
flashIds: '闪存ID',
flashId: '闪存ID',
Expand All @@ -72,5 +72,6 @@ module.exports = {
pageSize: '页大小',
blocks: '块',
pagesPerBlock: '页/块',
description: '描述',
about: '<a href="https://github.com/iTXTech/FlashMaster" target="_blank">iTXTech FlashMaster</a><br/>使用 <a href="https://vuejs.org" target="_blank">Vue.js</a> 和 <a href="https://vuetifyjs.com/" target="_blank">Vuetify</a> 构建<br/>本程序遵循 Apache License 2.0 开源<br/><br/>主要维护者:<br/><a href="https://peratx.net" target="_blank">PeratX</a><br/><br/><a href="https://market.m.taobao.com/app/idleFish-F2e/IdleFishWeexPersonalPage/PersonalHome?ut_sk=1.WmC0tf46/fADAD7YJeN2DyOW_12431167_1573698250610.QRCode.mypage.894797966.894797966&userid=894797966&wh_weex=true&forceFlush=1" target="_blank">去作者的闲鱼主页看看</a><br/><br/>Copyright (C) 2019-2020 <a href="https://itxtech.org" target="_blank">iTX Technologies</a>'
}
3 changes: 2 additions & 1 deletion src/lang/eng.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ module.exports = {
value: 'Value',
copy: 'Copy',
copySucc: 'Copy successfully.',
copyFail: 'Copy failed: {0}',
copyFail: 'Copy failed.',
close: 'Close',
flashIds: 'Flash Ids',
flashId: 'Flash Id',
Expand All @@ -72,5 +72,6 @@ module.exports = {
pageSize: 'Page Size',
blocks: 'Blocks',
pagesPerBlock: 'Pages/Block',
description: 'Description',
about: '<a href="https://github.com/iTXTech/FlashMaster" target="_blank">iTXTech FlashMaster</a><br/>Built with <a href="https://vuejs.org" target="_blank">Vue.js</a> and <a href="https://vuetifyjs.com/" target="_blank">Vuetify</a><br/>This program is licensed under Apache License 2.0<br/><br/>Maintainers:<br/><a href="https://peratx.net" target="_blank">PeratX</a><br/><br/>Copyright (C) 2019-2020 <a href="https://itxtech.org" target="_blank">iTX Technologies</a>'
}
59 changes: 53 additions & 6 deletions src/views/Decode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,30 @@
</v-card-text>
</v-card>
</v-flex>

<v-flex lg5 sm12 xs12>
<v-card>
<v-card-title>链接</v-card-title>
<v-card-text>
<v-data-table
:headers="urlHeaders"
:items="urls"
hide-default-footer
disable-sort
class="elevation-1"
no-data-text=""
:mobile-breakpoint="NaN"
:items-per-page="itemsPerPage"
>
<template v-slot:item.action="{ item }">
<v-btn icon @click="open(item.url)">
<v-icon>mdi-open-in-new</v-icon>
</v-btn>
</template>
</v-data-table>
</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-container>
</template>
Expand Down Expand Up @@ -170,7 +194,9 @@
rawVendor: "",
controllers: "",
extraInfo: [],
flashIds: []
flashIds: [],
urls: [],
sum: "",
};
},
computed: {
Expand All @@ -186,6 +212,12 @@
{text: this.$t("flashIds"), value: "id", align: "left"},
{text: this.$t("action"), value: "action"}
];
},
urlHeaders() {
return [
{text: this.$t("description"), value: "description", align: "left"},
{text: this.$t("action"), value: "action"}
]
}
},
methods: {
Expand All @@ -205,6 +237,7 @@
});
}
bus.$emit("loading", true);
this.fetchSummary();
fetch(store.getServerAddress() + "/decode?trans=" + store.autoTranslation() + "&pn=" + this.partNumber)
.then(r => r.json())
.then(data => {
Expand Down Expand Up @@ -263,6 +296,16 @@
});
}
}
this.urls = [];
if (data.url != null && typeof data.url !== "string") {
for (let url in data.url) {
this.urls.push({
description: url,
url: data.url[url]
})
}
}
bus.$emit("loading", false);
store.statDecodeIdInc();
})
Expand Down Expand Up @@ -326,7 +369,7 @@
bus.$emit("snackbar", {
timeout: 3000,
show: true,
text: this.$t("copyFail", [e])
text: this.$t("copyFail")
});
}
);
Expand Down Expand Up @@ -376,14 +419,13 @@
query: {id: item.id}
});
},
summary() {
fetchSummary() {
if (this.partNumber != null && this.partNumber !== "") {
this.processPn();
bus.$emit("loading", true);
fetch(store.getServerAddress() + "/summary?pn=" + this.partNumber)
.then(r => r.json())
.then(data => {
this.c(data.data);
this.sum = data.data;
bus.$emit("loading", false);
})
.catch(err => {
Expand All @@ -392,9 +434,14 @@
show: true,
text: this.$t("alert.fetchFailed", [err])
});
bus.$emit("loading", false);
});
}
},
summary() {
this.c(this.sum);
},
open(url) {
window.open(url, '_blank')
}
},
created: function () {
Expand Down
21 changes: 0 additions & 21 deletions src/views/SearchPn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@
<v-btn icon @click="decodeFlashId(item)">
<v-icon>mdi-arrow-top-left-thick</v-icon>
</v-btn>
<v-btn icon @click="copyFlashId(item)">
<v-icon>mdi-content-copy</v-icon>
</v-btn>
</template>
</v-data-table>
</v-card-text>
Expand Down Expand Up @@ -122,24 +119,6 @@
});
}
},
copyFlashId(item) {
this.$copyText(item.pn).then(
e => {
bus.$emit("snackbar", {
timeout: 3000,
show: true,
text: this.$t("copySucc")
});
},
e => {
bus.$emit("snackbar", {
timeout: 3000,
show: true,
text: this.$t("copyFail", [e])
});
}
);
},
decodeFlashId(item) {
router.push({
path: "/decode",
Expand Down

0 comments on commit 3434740

Please sign in to comment.