Commit 4b6e77fa05fc23461d02d1c13a7f3a534f6fbdb7

Authored by 夏洋涛
1 parent 12bbfccb
Exists in master

feat:标题栏api

Showing 1 changed file with 274 additions and 271 deletions   Show diff stats
src/router/index.js
@@ -44,283 +44,283 @@ import switchUser from '@/views/answerRank/switchUser.vue' //切换 @@ -44,283 +44,283 @@ import switchUser from '@/views/answerRank/switchUser.vue' //切换
44 44
45 Vue.use(VueRouter) 45 Vue.use(VueRouter)
46 const [routerPush, routerReplace] = [VueRouter.prototype.push, VueRouter.prototype.replace]; 46 const [routerPush, routerReplace] = [VueRouter.prototype.push, VueRouter.prototype.replace];
47 -VueRouter.prototype.push = function push(to) { 47 +VueRouter.prototype.push = function push (to) {
48 return routerPush.call(this, to).catch(err => err) 48 return routerPush.call(this, to).catch(err => err)
49 } 49 }
50 -VueRouter.prototype.replace = function replace(location) { 50 +VueRouter.prototype.replace = function replace (location) {
51 return routerReplace.call(this, location).catch(error => error); 51 return routerReplace.call(this, location).catch(error => error);
52 }; 52 };
53 const routes = [{ 53 const routes = [{
54 - path: '/',  
55 - name: 'ServiceKQ',  
56 - component: ServiceKQ,  
57 - meta: {  
58 - title: '红色网上游'  
59 - }  
60 - }, {  
61 - path: '/home',  
62 - name: 'Home',  
63 - component: Home,  
64 - meta: {  
65 - title: '红色网上游'  
66 - }  
67 - },  
68 - {  
69 - path: '/home_user_info',  
70 - name: 'HomeUserInfo',  
71 - component: HomeUserInfo,  
72 - meta: {  
73 - title: '红色网上游'  
74 - }  
75 - },  
76 - {  
77 - path: '/abroad_detail',  
78 - name: 'ServiceAbroadDetail',  
79 - component: ServiceAbroadDetail,  
80 - meta: {  
81 - title: '红色网上游'  
82 - }  
83 - }, 54 + path: '/',
  55 + name: 'ServiceKQ',
  56 + component: ServiceKQ,
  57 + meta: {
  58 + title: '红色网上游'
  59 + }
  60 +}, {
  61 + path: '/home',
  62 + name: 'Home',
  63 + component: Home,
  64 + meta: {
  65 + title: '红色网上游'
  66 + }
  67 +},
  68 +{
  69 + path: '/home_user_info',
  70 + name: 'HomeUserInfo',
  71 + component: HomeUserInfo,
  72 + meta: {
  73 + title: '红色网上游'
  74 + }
  75 +},
  76 +{
  77 + path: '/abroad_detail',
  78 + name: 'ServiceAbroadDetail',
  79 + component: ServiceAbroadDetail,
  80 + meta: {
  81 + title: '红色网上游'
  82 + }
  83 +},
84 84
85 85
86 - {  
87 - path: '/service_orderXST',  
88 - name: 'ServiceOrderXST',  
89 - component: ServiceOrderXST,  
90 - meta: {  
91 - title: '我的评价'  
92 - }  
93 - },  
94 - {  
95 - path: '/evaluateCourse',  
96 - name: 'evaluateCourse',  
97 - component: evaluateCourse,  
98 - meta: {  
99 - title: '评价'  
100 - }  
101 - },  
102 - {  
103 - path: '/evaluateBase',  
104 - name: 'evaluateBase',  
105 - component: evaluateBase,  
106 - meta: {  
107 - title: '基地评价'  
108 - }  
109 - },  
110 - {  
111 - path: '/evaluateDetail',  
112 - name: 'evaluateDetail',  
113 - component: evaluateDetail,  
114 - meta: {  
115 - title: '评价详情'  
116 - }  
117 - },  
118 - {  
119 - path: '/service_abroad_evaluate',  
120 - name: 'ServiceAbroadEvaluate',  
121 - component: ServiceAbroadEvaluate,  
122 - meta: {  
123 - title: '评价'  
124 - }  
125 - },  
126 - {  
127 - path: '/YanxueCode',  
128 - name: 'YanxueCode',  
129 - component: YanxueCode,  
130 - meta: {  
131 - title: '研学码'  
132 - }  
133 - },  
134 - {  
135 - path: '/YanxueInfo',  
136 - name: 'YanxueInfo',  
137 - component: YanxueInfo,  
138 - meta: {  
139 - title: '研学码信息'  
140 - }  
141 - },  
142 - {  
143 - path: '/chooseSchool',  
144 - name: 'chooseSchool',  
145 - component: chooseSchool,  
146 - meta: {  
147 - title: '选择学校'  
148 - }  
149 - },  
150 - {  
151 - path: '/select_contact',  
152 - name: 'SelectContact',  
153 - component: SelectContact,  
154 - meta: {  
155 - title: '选择出行人'  
156 - }  
157 - },  
158 - {  
159 - path: '/edit_contact',  
160 - name: 'EditContact',  
161 - component: EditContact,  
162 - meta: {  
163 - title: '修改出行人'  
164 - }  
165 - },  
166 - {  
167 - path: '/MyClassList',  
168 - name: 'MyClassList',  
169 - component: MyClassList,  
170 - meta: {  
171 - title: '基地签到'  
172 - }  
173 - },  
174 - {  
175 - path: '/StudentDetail',  
176 - name: 'StudentDetail',  
177 - component: StudentDetail,  
178 - meta: {  
179 - title: '学生信息'  
180 - }  
181 - },  
182 - {  
183 - path: '/payneed',  
184 - name: 'payneed',  
185 - component: payneed,  
186 - meta: {  
187 - title: '购买须知'  
188 - }  
189 - },  
190 - {  
191 - path: '/protocol',  
192 - name: 'protocol',  
193 - component: protocol,  
194 - meta: {  
195 - title: '用户协议'  
196 - }  
197 - },  
198 - {  
199 - path: '/schoolFollow',  
200 - name: 'schoolFollow',  
201 - component: schoolFollow,  
202 - meta: {  
203 - title: '关注学校'  
204 - }  
205 - },  
206 - {  
207 - path: '/schoolAttestation',  
208 - name: 'schoolAttestation',  
209 - component: schoolAttestation,  
210 - meta: {  
211 - title: '已认证学校'  
212 - }  
213 - },  
214 - {  
215 - path: '/classAttestation',  
216 - name: 'classAttestation',  
217 - component: classAttestation,  
218 - meta: {  
219 - title: '集团认领'  
220 - }  
221 - },  
222 - {  
223 - path: '/YanxuePage',  
224 - name: 'YanxuePage',  
225 - component: YanxuePage,  
226 - meta: {  
227 - title: '每日一习'  
228 - }  
229 - },  
230 - {  
231 - path: '/achievements',  
232 - name: 'achievements',  
233 - component: achievements,  
234 - meta: {  
235 - title: '研学成果'  
236 - }  
237 - },  
238 - {  
239 - path: '/achievementsOne',  
240 - name: 'achievementsOne',  
241 - component: achievementsOne,  
242 - meta: {  
243 - title: '研学成果'  
244 - }  
245 - },  
246 - {  
247 - path: '/chooseSchoolOne',  
248 - name: 'chooseSchoolOne',  
249 - component: chooseSchoolOne,  
250 - meta: {  
251 - title: '选择学校'  
252 - }  
253 - },  
254 - {  
255 - path: '/pageDetails',  
256 - name: 'pageDetails',  
257 - component: pageDetails,  
258 - meta: {  
259 - title: '研学成果'  
260 - }  
261 - },  
262 - {  
263 - path: '/rank',  
264 - name: 'rank',  
265 - component: rank,  
266 - meta: {  
267 - title: '排行榜'  
268 - }  
269 - },  
270 - {  
271 - path: '/ans_rank',  
272 - name: 'ans_rank',  
273 - component: ans_rank,  
274 - meta: {  
275 - title: '排行榜'  
276 - }  
277 - },  
278 - {  
279 - path: '/brush_questions',  
280 - name: 'brush_questions',  
281 - component: brush_questions,  
282 - meta: {  
283 - title: '刷题记录'  
284 - }  
285 - },  
286 - {  
287 - path: '/category',  
288 - name: 'category',  
289 - component: category,  
290 - meta: {  
291 - title: '题库'  
292 - }  
293 - },  
294 - {  
295 - path: '/stars',  
296 - name: 'stars',  
297 - component: stars,  
298 - meta: {  
299 - title: '五星少年'  
300 - }  
301 - },  
302 - {  
303 - path: '/ans_question',  
304 - name: 'ans_question',  
305 - component: ans_question,  
306 - meta: {  
307 - title: '答题'  
308 - }  
309 - },  
310 - {  
311 - path: '/switchUser',  
312 - name: 'switchUser',  
313 - component: switchUser,  
314 - meta: {  
315 - title: '切换用户'  
316 - }  
317 - },  
318 - {  
319 - path: '/YanxueDetail',  
320 - name: 'YanxueDetail',  
321 - component: YanxueDetail,  
322 - meta: {}  
323 - }, 86 +{
  87 + path: '/service_orderXST',
  88 + name: 'ServiceOrderXST',
  89 + component: ServiceOrderXST,
  90 + meta: {
  91 + title: '我的评价'
  92 + }
  93 +},
  94 +{
  95 + path: '/evaluateCourse',
  96 + name: 'evaluateCourse',
  97 + component: evaluateCourse,
  98 + meta: {
  99 + title: '评价'
  100 + }
  101 +},
  102 +{
  103 + path: '/evaluateBase',
  104 + name: 'evaluateBase',
  105 + component: evaluateBase,
  106 + meta: {
  107 + title: '基地评价'
  108 + }
  109 +},
  110 +{
  111 + path: '/evaluateDetail',
  112 + name: 'evaluateDetail',
  113 + component: evaluateDetail,
  114 + meta: {
  115 + title: '评价详情'
  116 + }
  117 +},
  118 +{
  119 + path: '/service_abroad_evaluate',
  120 + name: 'ServiceAbroadEvaluate',
  121 + component: ServiceAbroadEvaluate,
  122 + meta: {
  123 + title: '评价'
  124 + }
  125 +},
  126 +{
  127 + path: '/YanxueCode',
  128 + name: 'YanxueCode',
  129 + component: YanxueCode,
  130 + meta: {
  131 + title: '研学码'
  132 + }
  133 +},
  134 +{
  135 + path: '/YanxueInfo',
  136 + name: 'YanxueInfo',
  137 + component: YanxueInfo,
  138 + meta: {
  139 + title: '研学码信息'
  140 + }
  141 +},
  142 +{
  143 + path: '/chooseSchool',
  144 + name: 'chooseSchool',
  145 + component: chooseSchool,
  146 + meta: {
  147 + title: '选择学校'
  148 + }
  149 +},
  150 +{
  151 + path: '/select_contact',
  152 + name: 'SelectContact',
  153 + component: SelectContact,
  154 + meta: {
  155 + title: '选择出行人'
  156 + }
  157 +},
  158 +{
  159 + path: '/edit_contact',
  160 + name: 'EditContact',
  161 + component: EditContact,
  162 + meta: {
  163 + title: '修改出行人'
  164 + }
  165 +},
  166 +{
  167 + path: '/MyClassList',
  168 + name: 'MyClassList',
  169 + component: MyClassList,
  170 + meta: {
  171 + title: '基地签到'
  172 + }
  173 +},
  174 +{
  175 + path: '/StudentDetail',
  176 + name: 'StudentDetail',
  177 + component: StudentDetail,
  178 + meta: {
  179 + title: '学生信息'
  180 + }
  181 +},
  182 +{
  183 + path: '/payneed',
  184 + name: 'payneed',
  185 + component: payneed,
  186 + meta: {
  187 + title: '购买须知'
  188 + }
  189 +},
  190 +{
  191 + path: '/protocol',
  192 + name: 'protocol',
  193 + component: protocol,
  194 + meta: {
  195 + title: '用户协议'
  196 + }
  197 +},
  198 +{
  199 + path: '/schoolFollow',
  200 + name: 'schoolFollow',
  201 + component: schoolFollow,
  202 + meta: {
  203 + title: '关注学校'
  204 + }
  205 +},
  206 +{
  207 + path: '/schoolAttestation',
  208 + name: 'schoolAttestation',
  209 + component: schoolAttestation,
  210 + meta: {
  211 + title: '已认证学校'
  212 + }
  213 +},
  214 +{
  215 + path: '/classAttestation',
  216 + name: 'classAttestation',
  217 + component: classAttestation,
  218 + meta: {
  219 + title: '集团认领'
  220 + }
  221 +},
  222 +{
  223 + path: '/YanxuePage',
  224 + name: 'YanxuePage',
  225 + component: YanxuePage,
  226 + meta: {
  227 + title: '每日一习'
  228 + }
  229 +},
  230 +{
  231 + path: '/achievements',
  232 + name: 'achievements',
  233 + component: achievements,
  234 + meta: {
  235 + title: '研学成果'
  236 + }
  237 +},
  238 +{
  239 + path: '/achievementsOne',
  240 + name: 'achievementsOne',
  241 + component: achievementsOne,
  242 + meta: {
  243 + title: '研学成果'
  244 + }
  245 +},
  246 +{
  247 + path: '/chooseSchoolOne',
  248 + name: 'chooseSchoolOne',
  249 + component: chooseSchoolOne,
  250 + meta: {
  251 + title: '选择学校'
  252 + }
  253 +},
  254 +{
  255 + path: '/pageDetails',
  256 + name: 'pageDetails',
  257 + component: pageDetails,
  258 + meta: {
  259 + title: '研学成果'
  260 + }
  261 +},
  262 +{
  263 + path: '/rank',
  264 + name: 'rank',
  265 + component: rank,
  266 + meta: {
  267 + title: '排行榜'
  268 + }
  269 +},
  270 +{
  271 + path: '/ans_rank',
  272 + name: 'ans_rank',
  273 + component: ans_rank,
  274 + meta: {
  275 + title: '排行榜'
  276 + }
  277 +},
  278 +{
  279 + path: '/brush_questions',
  280 + name: 'brush_questions',
  281 + component: brush_questions,
  282 + meta: {
  283 + title: '刷题记录'
  284 + }
  285 +},
  286 +{
  287 + path: '/category',
  288 + name: 'category',
  289 + component: category,
  290 + meta: {
  291 + title: '题库'
  292 + }
  293 +},
  294 +{
  295 + path: '/stars',
  296 + name: 'stars',
  297 + component: stars,
  298 + meta: {
  299 + title: '五星少年'
  300 + }
  301 +},
  302 +{
  303 + path: '/ans_question',
  304 + name: 'ans_question',
  305 + component: ans_question,
  306 + meta: {
  307 + title: '答题'
  308 + }
  309 +},
  310 +{
  311 + path: '/switchUser',
  312 + name: 'switchUser',
  313 + component: switchUser,
  314 + meta: {
  315 + title: '切换用户'
  316 + }
  317 +},
  318 +{
  319 + path: '/YanxueDetail',
  320 + name: 'YanxueDetail',
  321 + component: YanxueDetail,
  322 + meta: {}
  323 +},
324 324
325 ] 325 ]
326 const router = new VueRouter({ 326 const router = new VueRouter({
@@ -332,7 +332,10 @@ const router = new VueRouter({ @@ -332,7 +332,10 @@ const router = new VueRouter({
332 router.beforeEach((to, from, next) => { 332 router.beforeEach((to, from, next) => {
333 /* 路由发生变化修改页面title */ 333 /* 路由发生变化修改页面title */
334 if (to.meta.title) { 334 if (to.meta.title) {
335 - document.title = to.meta.title 335 + // document.title = to.meta.title
  336 + ZWJSBridge.setTitle({
  337 + "title": to.meta.title
  338 + })
336 } 339 }
337 next() 340 next()
338 }) 341 })