From a24058013d509abed5a38f560889ec2e203ed478 Mon Sep 17 00:00:00 2001 From: marvzhang Date: Sat, 8 Feb 2020 09:32:42 +0800 Subject: [PATCH] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=85=81=E8=AE=B8=E5=8F=91?= =?UTF-8?q?=E9=80=81=E7=BB=9F=E8=AE=A1=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/App.vue | 48 +++++++++++++------------- frontend/src/i18n/zh.js | 4 ++- frontend/src/views/setting/Setting.vue | 28 ++++++++++++--- 3 files changed, 51 insertions(+), 29 deletions(-) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 4ab95376..ec60d28b 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -35,32 +35,32 @@ export default { }, methods: {}, async mounted () { - window.setUseStats = (value) => { - document.querySelector('.el-message__closeBtn').click() - if (value === 1) { - this.$st.sendPv('/allow_stats') - this.$st.sendEv('全局', '允许/禁止统计', '允许') - } else { - this.$st.sendPv('/disallow_stats') - this.$st.sendEv('全局', '允许/禁止统计', '禁止') - } - localStorage.setItem('useStats', value) - } + // window.setUseStats = (value) => { + // document.querySelector('.el-message__closeBtn').click() + // if (value === 1) { + // this.$st.sendPv('/allow_stats') + // this.$st.sendEv('全局', '允许/禁止统计', '允许') + // } else { + // this.$st.sendPv('/disallow_stats') + // this.$st.sendEv('全局', '允许/禁止统计', '禁止') + // } + // localStorage.setItem('useStats', value) + // } // first-time user - if (this.useStats === undefined || this.useStats === null) { - this.$message({ - type: 'info', - dangerouslyUseHTMLString: true, - showClose: true, - duration: 0, - message: '

' + this.$t('Do you allow us to collect some statistics to improve Crawlab?') + '

' + - '
' + - '' + - '' + - '
' - }) - } + // if (this.useStats === undefined || this.useStats === null) { + // this.$message({ + // type: 'info', + // dangerouslyUseHTMLString: true, + // showClose: true, + // duration: 0, + // message: '

' + this.$t('Do you allow us to collect some statistics to improve Crawlab?') + '

' + + // '
' + + // '' + + // '' + + // '
' + // }) + // } // set uid if first visit if (this.uid === undefined || this.uid === null) { diff --git a/frontend/src/i18n/zh.js b/frontend/src/i18n/zh.js index 2329257d..c904a8bd 100644 --- a/frontend/src/i18n/zh.js +++ b/frontend/src/i18n/zh.js @@ -380,11 +380,13 @@ export default { 'DingTalk Robot Webhook': '钉钉机器人 Webhook', 'Wechat Robot Webhook': '微信机器人 Webhook', 'Password Settings': '密码设置', - 'Notify Settings': '通知设置', + 'Notifications': '消息通知', 'Global Variable': '全局变量', 'Add Global Variable': '新增全局变量', 'Are you sure to delete this global variable': '确定删除该全局变量?', 'Key': '设置', + 'Allow Sending Statistics': '允许发送统计信息', + 'General': '通用', // 其他 tagsView: { diff --git a/frontend/src/views/setting/Setting.vue b/frontend/src/views/setting/Setting.vue index fb74d41c..73ff9260 100644 --- a/frontend/src/views/setting/Setting.vue +++ b/frontend/src/views/setting/Setting.vue @@ -32,7 +32,7 @@ - + @@ -41,6 +41,14 @@ + + +
@@ -50,7 +58,7 @@ - + @@ -165,7 +173,7 @@ export default { 'setting.wechat_robot_webhook': [{ trigger: 'blur', validator: validateWechatRobotWebhook }] }, isShowDingTalkAppSecret: false, - activeName: 'password', + activeName: 'general', addDialogVisible: false, tourSteps: [ { @@ -204,7 +212,8 @@ export default { } this.$utils.tour.nextStep('setting', currentStep) } - } + }, + isAllowSendingStatistics: localStorage.getItem('useStats') === '1' } }, computed: { @@ -271,6 +280,17 @@ export default { this.$st.sendEv('设置', '保存') }, tabActiveHandle () { + }, + onAllowSendingStatisticsChange (value) { + if (value) { + this.$st.sendPv('/allow_stats') + this.$st.sendEv('全局', '允许/禁止统计', '允许') + } else { + this.$st.sendPv('/disallow_stats') + this.$st.sendEv('全局', '允许/禁止统计', '禁止') + } + this.$message.success(this.$t('Saved successfully')) + localStorage.setItem('useStats', value ? '1' : '0') } }, async created () {