Skip to content

Commit

Permalink
add 统计
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyueyi committed Jul 7, 2022
1 parent d06eaa6 commit 8120931
Show file tree
Hide file tree
Showing 7 changed files with 177 additions and 38 deletions.
39 changes: 39 additions & 0 deletions components/Footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<div>
<span> {{ this.nowTime }} </span>
</div>
<div id="self_count_cnt" v-if="visit" v-html="visit">
</div>
</div>
</template>

Expand All @@ -33,7 +35,38 @@ export default {
});
return {
toolNum: num,
visit: "",
}
},
mounted() {
this.cnt();
},
methods: {
cnt() {
let site = this.$store.state.env.url + this.$route.path;
this.$axios
.get('https://story.hhui.top/count/ncc?appKey=tool&referer=' + decodeURI(site))
.then(e => {
let result = e.data;
console.log(result);
if (result.status.code === 200) {
result = result.result;
this.visit = '本站总访量: <span class="visit_cnt">' + result.appVO.hot + '</span> &nbsp;| 总访问人次: <span class="visit_cnt">' + result.appVO.uv + '</span> &nbsp;| 恭喜您为第 <span class="visit_cnt">' + result.appVO.rank + '</span>&nbsp; 访问者';
let node = document.getElementById("tool_visit_count")
if (node) {
node.innerHTML = '当前工具访问次数:' + result.uriVO.hot;
}
}
})
.catch(err => {
this.$swal({
type: 'error',
title: '计数失败',
text: `ERROR: 获取数据失败,请刷新页面重试 ${err}`
});
});
},
}
};
</script>
Expand All @@ -57,5 +90,11 @@ export default {
margin: 4px;
font-size: .8em;
}
.visit_cnt {
color: #e96900;
font-size: 1.4em;
}
}
</style>
4 changes: 4 additions & 0 deletions components/SideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
:copy-icon="true">
</NyaReadonlyInput>

<nya-panel v-show="this.$route.path !== '/'">
<div id="tool_visit_count"/>
</nya-panel>

<nya-panel
title="神奇工具箱"
text="一个神奇的百宝箱,收集各路直接在本地浏览器实现全功能的小工具,安全无风险,还支持离线使用哦,欢迎品鉴">
Expand Down
4 changes: 2 additions & 2 deletions pages/tools/editor/md.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="markdown">
<client-only>
<mavon-editor
<mavonEditor
ref="md"
v-model="content"
class="typo"
Expand Down Expand Up @@ -55,7 +55,7 @@ export default {
}
}
this.$nextTick(() => {
this.$refs.md.markdownIt.set({
mavonEditor.getMarkdownIt().set({
highlight: function(str, lang) {
if (lang && hljs.getLanguage(lang)) {
return hljs.highlight(lang, str).value;
Expand Down
29 changes: 18 additions & 11 deletions pages/tools/text/table_format.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="table_format">
<nya-container title="表格数据格式化">
<div class="nya-subtitle mt-15">
直接拷贝表格/excel/csv中的数据,转换为插入sql,json对象
转换类型
</div>
<div class="radio-group form-control no-border">
<nya-radio-group v-model="index">
Expand Down Expand Up @@ -41,7 +41,7 @@
type="textarea"
autofocus
autocomplete="off"
label="csv|excel|table格式数据"
label="请输入csv|excel|table格式数据"
placeholder="id uname age
1 yihui 18
2 一灰灰 19
Expand All @@ -56,13 +56,16 @@
</nya-container>

<nya-foot-info title="Tips">
<li>
插件源码:<a
href="https://github.com/liuyueyi/quick-jsdemo"
target="_blank"
rel="noopener noreferrer"
>quick-jsdemo</a> 表格数据格式化
</li>
<li>
直接拷贝表格/excel/csv中的数据,即可转换为插入sql,json对象,markdown表格
</li>
<li>
插件源码:<a
href="https://github.com/liuyueyi/quick-jsdemo"
target="_blank"
rel="noopener noreferrer"
>quick-jsdemo</a> 表格数据格式化
</li>
</nya-foot-info>

</div>
Expand All @@ -71,7 +74,7 @@
<script>
import Dynamic from '@/components/Dynamic';
import {table2insertSql, table2jsonStr} from '/static/js/tableDataFormat.js';
import {table2insertSql, table2jsonStr, table2markdown} from '/static/js/tableDataFormat.js';
let oo, os;
Expand All @@ -90,13 +93,15 @@ export default {
labels: [
{label: "sql", t1: '表名', t2: '排除列'},
{label: "json", t1: '分组字段', t2: ''},
{label: "markdown", t1: '排除列', t2: ''},
]
};
},
watch: {
index() {
this.t1 = '';
this.t2 = '';
this.tableFormat();
},
t1() {
this.tableFormat();
Expand All @@ -120,8 +125,10 @@ export default {
}
if (this.index === 0) {
this.results = table2insertSql(this.tableString, this.t1 ? this.t1 : "替换表名", this.t2).str;
} else {
} else if (this.index === 1) {
this.results = table2jsonStr(this.tableString, this.t1).str;
} else {
this.results = table2markdown(this.tableString, this.t1).str;
}
}
}
Expand Down
Binary file modified static/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8120931

Please sign in to comment.