|
|
@@ -3,20 +3,29 @@
|
|
3
|
3
|
<view class="index-page">
|
|
4
|
4
|
<view v-if="booting" class="index-boot">
|
|
5
|
5
|
<view class="index-boot__spinner" />
|
|
6
|
|
- <text class="index-boot__text">加载中...</text>
|
|
|
6
|
+ <text class="index-boot__text">{{ bootText }}</text>
|
|
7
|
7
|
</view>
|
|
8
|
8
|
|
|
9
|
9
|
<view v-else-if="needRegister" class="index-blank" />
|
|
10
|
10
|
|
|
11
|
11
|
<view v-else-if="ready" class="index-home">
|
|
|
12
|
+ <view v-if="!homeMounted" class="index-boot">
|
|
|
13
|
+ <view class="index-boot__spinner" />
|
|
|
14
|
+ <text class="index-boot__text">正在加载工作台...</text>
|
|
|
15
|
+ </view>
|
|
12
|
16
|
<EnterpriseHome
|
|
13
|
|
- v-if="viewRole === 'enterprise'"
|
|
|
17
|
+ v-else-if="viewRole === 'enterprise'"
|
|
14
|
18
|
ref="enterpriseHome"
|
|
15
|
19
|
:active="true"
|
|
16
|
20
|
/>
|
|
17
|
21
|
<WorkerHome v-else :active="true" />
|
|
18
|
22
|
</view>
|
|
19
|
23
|
|
|
|
24
|
+ <view v-else class="index-boot">
|
|
|
25
|
+ <view class="index-boot__spinner" />
|
|
|
26
|
+ <text class="index-boot__text">页面跳转中...</text>
|
|
|
27
|
+ </view>
|
|
|
28
|
+
|
|
20
|
29
|
<view
|
|
21
|
30
|
class="fe-modal-overlay"
|
|
22
|
31
|
:class="{ 'fe-modal-overlay--active': registerModalVisible }"
|
|
|
@@ -32,15 +41,6 @@
|
|
32
|
41
|
</view>
|
|
33
|
42
|
</view>
|
|
34
|
43
|
</view>
|
|
35
|
|
-
|
|
36
|
|
- <hz-novice-guidance
|
|
37
|
|
- v-if="ready && viewRole === 'enterprise'"
|
|
38
|
|
- ref="noviceGuidance"
|
|
39
|
|
- :base-config="homeGuideBaseConfig"
|
|
40
|
|
- :steps="homeGuideSteps"
|
|
41
|
|
- @finished="onHomeGuideEnded"
|
|
42
|
|
- @skiped="onHomeGuideEnded"
|
|
43
|
|
- />
|
|
44
|
44
|
</view>
|
|
45
|
45
|
</template>
|
|
46
|
46
|
|
|
|
@@ -49,15 +49,15 @@ import EnterpriseHome from '@/packageA/components/home/EnterpriseHome.vue'
|
|
49
|
49
|
import WorkerHome from '@/packageA/components/home/WorkerHome.vue'
|
|
50
|
50
|
import store from '@/common/store.js'
|
|
51
|
51
|
import { getToken } from '@/utils/request.js'
|
|
52
|
|
-import enterpriseHomeGuide from '@/mixins/enterprise-home-guide.js'
|
|
53
|
52
|
|
|
54
|
53
|
export default {
|
|
55
|
54
|
components: { EnterpriseHome, WorkerHome },
|
|
56
|
|
- mixins: [enterpriseHomeGuide],
|
|
57
|
55
|
data() {
|
|
58
|
56
|
return {
|
|
59
|
57
|
booting: true,
|
|
|
58
|
+ bootText: '加载中...',
|
|
60
|
59
|
ready: false,
|
|
|
60
|
+ homeMounted: false,
|
|
61
|
61
|
needRegister: false,
|
|
62
|
62
|
registerModalVisible: false,
|
|
63
|
63
|
viewRole: 'enterprise'
|
|
|
@@ -89,7 +89,17 @@ export default {
|
|
89
|
89
|
},
|
|
90
|
90
|
methods: {
|
|
91
|
91
|
goLogin() {
|
|
92
|
|
- uni.reLaunch({ url: '/packageA/auth/login' })
|
|
|
92
|
+ this.booting = true
|
|
|
93
|
+ this.bootText = '正在前往登录...'
|
|
|
94
|
+ this.ready = false
|
|
|
95
|
+ this.needRegister = false
|
|
|
96
|
+ uni.reLaunch({
|
|
|
97
|
+ url: '/packageA/auth/login',
|
|
|
98
|
+ fail: () => {
|
|
|
99
|
+ this.bootText = '跳转登录失败,请重试'
|
|
|
100
|
+ uni.showToast({ title: '跳转登录失败', icon: 'none' })
|
|
|
101
|
+ }
|
|
|
102
|
+ })
|
|
93
|
103
|
},
|
|
94
|
104
|
goRegister() {
|
|
95
|
105
|
this.registerModalVisible = false
|
|
|
@@ -103,7 +113,9 @@ export default {
|
|
103
|
113
|
},
|
|
104
|
114
|
async bootstrap() {
|
|
105
|
115
|
this.booting = true
|
|
|
116
|
+ this.bootText = '加载中...'
|
|
106
|
117
|
this.ready = false
|
|
|
118
|
+ this.homeMounted = false
|
|
107
|
119
|
this.needRegister = false
|
|
108
|
120
|
this.registerModalVisible = false
|
|
109
|
121
|
|
|
|
@@ -123,16 +135,22 @@ export default {
|
|
123
|
135
|
if (!info || !info.registered) {
|
|
124
|
136
|
this.needRegister = true
|
|
125
|
137
|
this.registerModalVisible = true
|
|
|
138
|
+ this.booting = false
|
|
126
|
139
|
return
|
|
127
|
140
|
}
|
|
128
|
141
|
|
|
129
|
142
|
this.ready = true
|
|
130
|
|
- this.scheduleHomeGuide()
|
|
|
143
|
+ this.booting = false
|
|
|
144
|
+ // 先稳定首页壳子,再挂载超大工作台组件(体验版冷启动更稳)
|
|
|
145
|
+ this.$nextTick(() => {
|
|
|
146
|
+ setTimeout(() => {
|
|
|
147
|
+ if (this.ready) this.homeMounted = true
|
|
|
148
|
+ }, 50)
|
|
|
149
|
+ })
|
|
131
|
150
|
} catch (e) {
|
|
|
151
|
+ console.error('home bootstrap fail', e)
|
|
132
|
152
|
store.logout()
|
|
133
|
153
|
this.goLogin()
|
|
134
|
|
- } finally {
|
|
135
|
|
- this.booting = false
|
|
136
|
154
|
}
|
|
137
|
155
|
}
|
|
138
|
156
|
}
|