默认关闭教程

This commit is contained in:
marvzhang
2020-03-01 10:24:31 +08:00
parent fa273a988e
commit a7bcda95f2
13 changed files with 45 additions and 16 deletions

View File

@@ -38,6 +38,7 @@ other:
version: 0.4.7
setting:
allowRegister: "N"
enableTutorial: "N"
notification:
mail:
server: ''

View File

@@ -7,7 +7,8 @@ import (
)
type SettingBody struct {
AllowRegister string `json:"allow_register"`
AllowRegister string `json:"allow_register"`
EnableTutorial string `json:"enable_tutorial"`
}
func GetVersion(c *gin.Context) {
@@ -21,9 +22,10 @@ func GetVersion(c *gin.Context) {
}
func GetSetting(c *gin.Context) {
allowRegister := viper.GetString("setting.allowRegister")
body := SettingBody{AllowRegister: allowRegister}
body := SettingBody{
AllowRegister: viper.GetString("setting.allowRegister"),
EnableTutorial: viper.GetString("setting.enableTutorial"),
}
c.JSON(http.StatusOK, Response{
Status: "ok",

View File

@@ -24,6 +24,7 @@ services:
# CRAWLAB_TASK_WORKERS: 4 # number of task executors 任务执行器个数并行执行任务数
# CRAWLAB_SERVER_LANG_NODE: "Y" # whether to pre-install Node.js 预安装 Node.js 语言环境
# CRAWLAB_SETTING_ALLOWREGISTER: "N" # whether to allow user registration 是否允许用户注册
# CRAWLAB_SETTING_ENABLETUTORIAL: "N" # whether to enable tutorial 是否启用教程
# CRAWLAB_NOTIFICATION_MAIL_SERVER: smtp.exmaple.com # STMP server address STMP 服务器地址
# CRAWLAB_NOTIFICATION_MAIL_PORT: 465 # STMP server port STMP 服务器端口
# CRAWLAB_NOTIFICATION_MAIL_SENDEREMAIL: admin@exmaple.com # sender email 发送者邮箱

View File

@@ -448,6 +448,7 @@ export default {
'Key': '设置',
'Allow Sending Statistics': '允许发送统计信息',
'General': '通用',
'Enable Tutorial': '启用教程',
// 其他
tagsView: {

View File

@@ -16,6 +16,12 @@ const actions = {
async getSetting ({ commit }) {
const res = await request.get('/setting')
commit('SET_SETTING', res.data.data)
// set default enable_tutorial
const enableTutorial = res.data.data.enable_tutorial
if (localStorage.getItem('enableTutorial') === undefined) {
localStorage.setItem('enableTutorial', enableTutorial ? '1' : '0')
}
}
}

View File

@@ -18,6 +18,10 @@ export default {
}
return !!data[tourName]
},
startTour: (vm, tourName) => {
if (localStorage.getItem('enableTutorial') === '0') return
vm.$tours[tourName].start()
},
finishTour: (tourName) => {
let data
try {

View File

@@ -124,7 +124,7 @@ export default {
},
mounted () {
if (!this.$utils.tour.isFinishedTour('node-detail')) {
this.$tours['node-detail'].start()
this.$utils.tour.startTour(this, 'node-detail')
this.$st.sendEv('教程', '开始', 'node-detail')
}
}

View File

@@ -467,7 +467,7 @@ export default {
if (!this.$utils.tour.isFinishedTour('schedule-list-add')) {
setTimeout(() => {
this.$tours['schedule-list-add'].start()
this.$utils.tour.startTour(this, 'schedule-list-add')
this.$st.sendEv('教程', '开始', 'schedule-list-add')
}, 500)
}
@@ -617,7 +617,7 @@ export default {
mounted () {
if (!this.isDisabledSpiderSchedule) {
if (!this.$utils.tour.isFinishedTour('schedule-list')) {
this.$tours['schedule-list'].start()
this.$utils.tour.startTour(this, 'schedule-list')
this.$st.sendEv('教程', '开始', 'schedule-list')
}
}

View File

@@ -9,7 +9,7 @@
/>
<!--./tour-->
<!-- 新增全局变量 -->
<!--新增全局变量-->
<el-dialog :title="$t('Add Global Variable')"
:visible.sync="addDialogVisible">
<el-form label-width="80px" ref="globalVariableForm">
@@ -30,6 +30,7 @@
</el-form-item>
</el-form>
</el-dialog>
<!--./新增全局变量-->
<el-tabs v-model="activeName" @tab-click="tabActiveHandle" type="border-card">
<el-tab-pane :label="$t('General')" name="general">
@@ -49,6 +50,14 @@
inactive-color="#909399"
/>
</el-form-item>
<el-form-item :label="$t('Enable Tutorial')">
<el-switch
v-model="isEnableTutorial"
@change="onEnableTutorialChange"
active-color="#67C23A"
inactive-color="#909399"
/>
</el-form-item>
<el-form-item>
<div style="text-align: right">
<el-button type="success" size="small" @click="saveUserInfo">
@@ -213,7 +222,8 @@ export default {
this.$utils.tour.nextStep('setting', currentStep)
}
},
isAllowSendingStatistics: localStorage.getItem('useStats') === '1'
isAllowSendingStatistics: localStorage.getItem('useStats') === '1',
isEnableTutorial: localStorage.getItem('enableTutorial') === '1'
}
},
computed: {
@@ -291,6 +301,10 @@ export default {
}
this.$message.success(this.$t('Saved successfully'))
localStorage.setItem('useStats', value ? '1' : '0')
},
onEnableTutorialChange (value) {
this.$message.success(this.$t('Saved successfully'))
localStorage.setItem('enableTutorial', value ? '1' : '0')
}
},
async created () {
@@ -300,7 +314,7 @@ export default {
},
mounted () {
if (!this.$utils.tour.isFinishedTour('setting')) {
this.$tours['setting'].start()
this.$utils.tour.startTour(this, 'setting')
this.$st.sendEv('教程', '开始', 'setting')
}
}

View File

@@ -208,7 +208,7 @@ export default {
if (!this.$utils.tour.isFinishedTour('spider-detail-config')) {
setTimeout(() => {
this.$tours['spider-detail-config'].start()
this.$utils.tour.startTour(this, 'spider-detail-config')
this.$st.sendEv('教程', '开始', 'spider-detail-config')
}, 100)
}
@@ -260,7 +260,7 @@ export default {
},
mounted () {
if (!this.$utils.tour.isFinishedTour('spider-detail')) {
this.$tours['spider-detail'].start()
this.$utils.tour.startTour(this, 'spider-detail')
this.$st.sendEv('教程', '开始', 'spider-detail')
}
}

View File

@@ -887,7 +887,7 @@ export default {
setTimeout(() => {
if (!this.$utils.tour.isFinishedTour('spider-list-add')) {
this.$tours['spider-list-add'].start()
this.$utils.tour.startTour(this, 'spider-list-add')
this.$st.sendEv('教程', '开始', 'spider-list-add')
}
}, 300)
@@ -1241,7 +1241,7 @@ export default {
})
if (!this.$utils.tour.isFinishedTour('spider-list')) {
this.$tours['spider-list'].start()
this.$utils.tour.startTour(this, 'spider-list')
this.$st.sendEv('教程', '开始', 'spider-list')
}
},

View File

@@ -202,7 +202,7 @@ export default {
},
mounted () {
if (!this.$utils.tour.isFinishedTour('task-detail')) {
this.$tours['task-detail'].start()
this.$utils.tour.startTour(this, 'task-detail')
this.$st.sendEv('教程', '开始', 'task-detail')
}
},

View File

@@ -412,7 +412,7 @@ export default {
}, 5000)
if (!this.$utils.tour.isFinishedTour('task-list')) {
this.$tours['task-list'].start()
this.$utils.tour.startTour(this, 'task-list')
this.$st.sendEv('教程', '开始', 'task-list')
}
},