diff --git a/src/router/index.ts b/src/router/index.ts index b1db757..dd865cf 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -72,7 +72,7 @@ const routes: Array = [ path: '/strategy', component: () => import('../view/trader/cta_strategy_file.vue'), meta: { - name: '策略文件' + name: '策略模板' } }, { diff --git a/src/utils/number.ts b/src/utils/number.ts new file mode 100644 index 0000000..ab3a01c --- /dev/null +++ b/src/utils/number.ts @@ -0,0 +1,5 @@ +const toPercent = (num: number) => { + return (num * 100).toFixed(2) + "%" +} + +export { toPercent } \ No newline at end of file diff --git a/src/view/blog/createBlog.vue b/src/view/blog/createBlog.vue index a2b97e3..400f536 100644 --- a/src/view/blog/createBlog.vue +++ b/src/view/blog/createBlog.vue @@ -531,7 +531,7 @@ const onUploadImg = async (files: FileList, callback: (urls: string[]) => void) return new Promise((resolve, reject) => { const formData = new FormData() formData.append('img', file) - onUploadImg(formData,) + // onUploadImg(formData,) }) }) ) diff --git a/src/view/blog/index.vue b/src/view/blog/index.vue index 6a07053..451bd11 100644 --- a/src/view/blog/index.vue +++ b/src/view/blog/index.vue @@ -34,8 +34,8 @@

{{ item.title }}

{{ - item.content - }}

+ item.content +}}

重新发布
@@ -52,20 +52,22 @@ import Cookies from 'js-cookie'; import { reactive } from 'vue'; import { getBlogs, getBtName, publish, publishAll } from '../../api/blogView' import router from '../../router/index' -type Blog = { - bid: string, - btId: string, - btName: string, - title: string, - blog_prex: string, + +// -- INTERFACE OR TYPE DEFINITION -- +interface Blog { + bid: string + btId: string + btName: string + title: string + blog_prex: string content: string } -type Blog_Type = { - btId: string, +interface Blog_Type { + btId: string btName: string } -// 変数定義 +// -- REACTIVE OBJECT -- const form = reactive({ key_word: '', btId: '', @@ -78,26 +80,7 @@ const form = reactive({ const data_list = reactive([]) const btNameList = reactive([]) -// 関数定義 -const init = () => { - getBlogs({}).then(response => { - response.data.forEach((item: Blog) => { - data_list.push(item) - }) - }) - getBtName().then(response => { - btNameList.push({ btId: "", btName: "选择分类" }) - response.data.forEach((item: any) => { - const bts = { - btId: item.btId, - btName: item.btName - } - btNameList.push(bts) - }) - }) -} - - +// -- EVENT DEFINITION const onSubmit = () => { getBlogs(form).then(response => { data_list.splice(0, data_list.length); @@ -134,9 +117,28 @@ const publishbyBid = (bid: string) => { publish(bid) } -// 初期化処理 -init() +/** + * AUTO INVOKE FUNCTION + */ +(() => { + getBlogs({}).then(response => { + response.data.forEach((item: Blog) => { + data_list.push(item) + }) + }) + getBtName().then(response => { + btNameList.push({ btId: "", btName: "选择分类" }) + response.data.forEach((item: any) => { + const bts = { + btId: item.btId, + btName: item.btName + } + btNameList.push(bts) + }) + }) + +})()