浏览代码

初始化

zhengkaixin 2 年之前
父节点
当前提交
d2b34a379c
共有 5 个文件被更改,包括 43 次插入80 次删除
  1. 18 7
      src/components/Common.vue
  2. 9 8
      src/main.js
  3. 5 27
      src/utils/dictionaries.js
  4. 8 34
      src/views-home/Home.vue
  5. 3 4
      vue.config.js

+ 18 - 7
src/components/Common.vue

@@ -5,7 +5,7 @@
 </template>
 
 <script>
-	const projectName = require('$root/config/project');
+	//const projectName = require('$root/config/project');
 	import * as API_WeiXin from '@/apis/weixin'
 	import * as API_User from '@/apis/user'
 	import Loading from '@/components/Loading.vue'
@@ -32,6 +32,10 @@
 				require: false,
 				default: true,
 			},
+			projectCheckLogin: {
+				require: false,
+				default: false,
+			},
 			//用户角色
 			role: {
 				require: false,
@@ -180,18 +184,25 @@
 			//判断权限然后进行跳转
 			projectExchange() {
 				//如果不想跳转,还可以传参exchange,一般用于home注册切换等功能
-				if (this.projectCheck && this.$route.query.exchange != '1' && this.person_popedom && this.person_popedom.sceneId) {
-					let project = Dictionaries.getProject(this.person_popedom.sceneId);
-					if (projectName.name != project && ['devlopment'].indexOf(process.env.VUE_APP_NODE_NAME) == -1) {
-						window.location.href = '../' + project + '/#/master';
-					}
+				// if (this.projectCheck && this.$route.query.exchange != '1' && this.person_popedom && this.person_popedom.sceneId) {
+				// 	let project = Dictionaries.getProject(this.person_popedom.sceneId);
+				// 	if (projectName.name != project && ['devlopment'].indexOf(process.env.VUE_APP_NODE_NAME) == -1) {
+				// 		window.location.href = '../' + project + '/#/master';
+				// 	}
+				// }
+				if (this.projectCheckLogin) {
+					//window.location.href = '../#/master';
+					window.location.href = '#/master';
 				}
 			},
 
 
 			//异步回调父组件的方法
 			asynCallBack(bl) {
-				this.projectExchange();
+				if(bl){
+					this.projectExchange();
+				}
+				//this.projectExchange();
 				this.$emit('asynCallBack',bl);
 			},
 			...mapMutations({

+ 9 - 8
src/main.js

@@ -1,18 +1,18 @@
 import Vue from 'vue'
 import App from './App.vue'
 import router from './router'
-import store from '$project/store'
+import store from '@/store'
 
-import * as API_User from '$project/apis/user'
+import * as API_User from '@/apis/user'
 import {
 	clear,
-} from '$project/utils/storage'
+} from '@/utils/storage'
 
 //引入mui
-import mui from '$project/assets/js/mui.js'
-import '$project/assets/css/mui.min.css'
+import mui from '@/assets/js/mui.js'
+import '@/assets/css/mui.min.css'
 import Vconsole from 'vconsole'
-import '$project/assets/css/icons-extra.css'
+import '@/assets/css/icons-extra.css'
 
 window.mui = mui;
 window.mui.init();
@@ -109,7 +109,8 @@ const checkAuth = (to, from, next) => {
 				next();
 			}
 		} else {
-			window.location.href = '../home/#/user/login';
+			//window.location.href = '../home/#/user/login';
+			window.location.href = '#/user/login';
 		}
 	} else {
 		next();
@@ -147,7 +148,7 @@ const checkFun = (to, from, next) => {
 
 					checkAuth(to, from, next);
 				} else {
-					mui.toast('链接已失效,请登录小鹏管家查看');
+					mui.toast('链接已失效,请重新登录');
 					router.replace({
 						name: 'Master'
 					})

+ 5 - 27
src/utils/dictionaries.js

@@ -1,30 +1,8 @@
-const scene_list = [{
+export function getProject(id) {
+	
+	return {
 		id: '1',
 		title: '工厂园区',
-		project: 'business'
-	},
-	{
-		id: '2',
-		title: '社区住宅',
-		project: 'business'
-	},
-	{
-		id: '3',
-		title: '机构养老',
-		project: 'pension'
-	},
-	{
-		id: '4',
-		title: '居家养老',
-		project: 'pension'
-	},
-];
-
-export function getProject(id) {
-	for (var i = 0; i < scene_list.length; i++) {
-		if (id == scene_list[i]['id']) {
-			return scene_list[i]['project'];
-		}
-	}
-	return scene_list[0]['project'];
+		project: ''
+	};
 }

+ 8 - 34
src/views-home/Home.vue

@@ -24,42 +24,16 @@
 			asynCallBack() {
 				//登录状态判断
 				if (this.person_popedom) {
-					 let project = Dictionaries.getProject(this.person_popedom.sceneId);
-					// setTimeout(function() {
-					// 	window.location.href = '../' + project + '/#/master';
-					// }, 1000);
-				
-					
+				 
+					 this.$router.push({
+						name: 'Master'
+					 })
+				} else {
 					this.$router.push({
-											name: 'UserLogin',
-											query: {
-												project:project
-											}
-					})
-				} else {
-					if (process.env.VUE_APP_NODE_NAME == 'production') {
-						window.location.href="http://xpgj.xiaoxinda.com/xpgj/prod/home/#/select"
-						
- 					}else  if (process.env.VUE_APP_NODE_NAME == 'test') {
-						window.location.href="http://xpgj.xiaoxinda.com/xpgj/test/home/#/select"
+						name: 'UserLogin',
 						
-					}
-					else{
-						 this.$router.push({
-						 						name: 'Select',
-						 					
-						 					})
-					}
-					
-					// this.$router.push({
-					// 						name: 'Select',
-										
-					// 					})
-					// if (process.env.VUE_APP_NODE_NAME == 'production') {
-					// 	window.location.href = 'http://xpgj.xiaoxinda.com/xpgj/prod/home/#/select';
-					// }else{
-					// 	window.location.href = 'http://xpgj.xiaoxinda.com/#/select'; 
-					// }
+					})
+					  
 					
 				}
 			},

+ 3 - 4
vue.config.js

@@ -14,7 +14,7 @@ const productionGzipExtensions = ['js', 'css']
 const conf =  {
 		pages: {
 			index: {
-				entry: 'src/projects/main.js',
+				entry: 'src/main.js',
 				template: 'index/business/index.html',
 				filename: 'index.html',
 				title: '小鹏管家' + title,
@@ -30,10 +30,9 @@ const conf =  {
 			compress: true,
 		},
 		chainWebpack: (config) => {
-			config.entry.app = ['babel-polyfill', '../src/projects/main.js']
+			config.entry.app = ['babel-polyfill', '../src/main.js']
 			config.resolve.alias
-				.set('$project', resolve('../src/projects/'))
-				.set('@', resolve('../src/'))
+				.set('@', resolve('src'))
 			
 
 			config.plugins.delete('preload-index');