Kaynağa Gözat

提交新手指导

Lijy 2 yıl önce
ebeveyn
işleme
97a56210d2

+ 10 - 1
fhKeeper/formulahousekeeper/timesheet/src/App.vue

@@ -22,10 +22,19 @@
 	  	},
 		data(){
 			return{
-				isRouterAlive:true
+				isRouterAlive:true,
+                firstTourFalse: false
 			}
 		},
+        mounted() {
+            this.firstTourFalse = localStorage.getItem('firstTourFalse') | true
+            // 监听页面刷新事件
+			window.addEventListener('unload', this.setItemFirstTourFalse)
+        },
 		methods:{
+            setItemFirstTourFalse() {
+                localStorage.setItem('firstTourFalse', firstTourFalse)
+            },
 			reloads(){
 				this.isRouterAlive = false
 				this.$nextTick(() => {

+ 57 - 85
fhKeeper/formulahousekeeper/timesheet/src/views/Home.vue

@@ -243,7 +243,52 @@
         data() {
             return {
                 tourFlg: false,
-                steps: [],
+                firstTourFalse: localStorage.getItem('firstTourFalse') | true, // 是否需要新手指导
+                steps: [
+                    {
+                        target: '[data-v-step="/timetype"]',
+                        content: `第一步,查看基础设置,按照企业情况进行调整`,
+                        params: {
+                            placement: 'right',
+                            highlight: true 
+                        }
+                    },{
+                        target: '[data-v-step="/list"]',
+                        content: `第二步,创建项目和任务`,
+                        params: {
+                            placement: 'right',
+                            highlight: true 
+                        }
+                    },{
+                        target: '[data-v-step="/daily"]',
+                        content: `第三步,填写每日工时报告`,
+                        params: {
+                            placement: 'right',
+                            highlight: true 
+                        }
+                    },{
+                        target: '[data-v-step="/review"]',
+                        content: `第四步,项目报告审核`,
+                        params: {
+                            placement: 'right',
+                            highlight: true 
+                        }
+                    },{
+                        target: '[data-v-step="/cost"]',
+                        content: `第五步,查看工时成本统计结果`,
+                        params: {
+                            placement: 'right',
+                            highlight: true 
+                        }
+                    },{
+                        target: '[data-v-step="/finance"]',
+                        content: `第六步,导入薪资,校准成本并生成财务报表`,
+                        params: {
+                            placement: 'right',
+                            highlight: true 
+                        }
+                    }
+                ],
                 myOptions:{
                     useKeyboardNavigation: false,    //不使用←、→和ESC键来导航tour
                     startTimeout: 1000,   //1秒后执行
@@ -310,98 +355,22 @@
             };
         },
         created() {
-            var arr = []
-            var routers = JSON.parse(sessionStorage.getItem("user")).moduleList
-            for(var i in routers) {
-                if(routers[i].path == '/timetype') {
-                    let obj = {
-                        target: '[data-v-step="/timetype"]',
-                        content: `查看基础设置,按照企业情况进行调整`,
-                        params: {
-                            placement: 'right',
-                            highlight: true 
-                        }
-                    }
-                    arr.push(obj)
-                }
-                if(routers[i].path == '/list') {
-                    let obj = {
-                        target: '[data-v-step="/list"]',
-                        content: `创建项目和任务`,
-                        params: {
-                            placement: 'right',
-                            highlight: true 
-                        }
-                    }
-                    arr.push(obj)
-                }
-                if(routers[i].path == '/daily') {
-                    let obj = {
-                        target: '[data-v-step="/daily"]',
-                        content: `填写每日工时报告`,
-                        params: {
-                            placement: 'right',
-                            highlight: true 
-                        }
-                    }
-                    arr.push(obj)
-                }
-                if(routers[i].path == '/review') {
-                    let obj = {
-                        target: '[data-v-step="/review"]',
-                        content: `审核人审核日报`,
-                        params: {
-                            placement: 'right',
-                            highlight: true 
-                        }
-                    }
-                    arr.push(obj)
-                }
-                if(routers[i].path == '/cost') {
-                    let obj = {
-                        target: '[data-v-step="/cost"]',
-                        content: `查看工时成本统计结果`,
-                        params: {
-                            placement: 'right',
-                            highlight: true 
-                        }
-                    }
-                    arr.push(obj)
-                }
-                if(routers[i].path == '/finance') {
-                    let obj = {
-                        target: '[data-v-step="/finance"]',
-                        content: `导入薪资,校准成本并生成财务报表`,
-                        params: {
-                            placement: 'right',
-                            highlight: true 
-                        }
-                    }
-                    arr.push(obj)
-                }
-                if(routers[i].path == '/team') {
-                    let obj = {
-                        target: '[data-v-step="/team"]',
-                        content: `编辑员工信息,分配角色`,
-                        params: {
-                            placement: 'right',
-                            highlight: true 
-                        }
-                    }
-                    arr.push(obj)
-                }
-            }
-            this.steps = arr
-            console.log(this.steps, '数据', routers)
+            this.firstTourFalse = localStorage.getItem('firstTourFalse') || true
+            console.log(this.firstTourFalse, '数据书数据')
+            console.log(localStorage.getItem('firstTourFalse'))
         },
         methods: {
             onSkip(currentStep) {
                 console.log('看看')
                 this.vTourFlg = false
+                this.firstTourFalse = false
+                localStorage.setItem('firstTourFalse', false)
             },
             onFinish(currentStep) {
                 console.log('数据')
                 this.vTourFlg = false
+                this.firstTourFalse = false
+                localStorage.setItem('firstTourFalse', false)
             },
 
             // 中英文切换
@@ -777,7 +746,10 @@
             }
 
             // 判断是否为新用户
-            if(this.user.isFirstLogin == 1) {
+            // console.log(this.firstTourFalse, '数据书数据123', 'true' == true)
+            // if(this.firstTourFalse != 'false') {
+                // console.log('数据书数据123数据书数据123', this.firstTourFalse)
+            if(this.user.isFirstLogin == 1 && this.user.roleName == '超级管理员' && this.firstTourFalse != 'false') {
                 var thats = this
                 this.tourFlg = true
                 setTimeout(() => {