zhengkaixin 4 роки тому
батько
коміт
97d5128819
6 змінених файлів з 50 додано та 19 видалено
  1. 1 1
      .env.development
  2. 1 1
      .env.production
  3. 1 1
      .env.test
  4. 13 12
      src/components/Common.vue
  5. 24 0
      src/views/Home.vue
  6. 10 4
      vue.config.js

+ 1 - 1
.env.development

@@ -2,7 +2,7 @@ NODE_ENV=devlopment
 VUE_APP_NODE_NAME=devlopment
 OUT_PUT_NAME=dev
 VUE_APP_LOCAL_STORAGE_PREFIX=dev
-VUE_APP_BACKEND_URL=https://qylhhapi.xiaoxinda.com/enterprise-server
+VUE_APP_BACKEND_URL=https://ykt-test.xiaoxinda.com/smart-school-server/
 #appid
 VUE_APP_WXAPPID=wx907e84ad32e6e142
 

+ 1 - 1
.env.production

@@ -2,7 +2,7 @@ NODE_ENV=production
 VUE_APP_NODE_NAME=production
 OUT_PUT_NAME=prod
 VUE_APP_LOCAL_STORAGE_PREFIX=prod
-VUE_APP_BACKEND_URL=https://qylhhapi.xiaoxinda.com/enterprise-server
+VUE_APP_BACKEND_URL=https://ykt-test.xiaoxinda.com/smart-school-server/
 #appid
 VUE_APP_WXAPPID=wx907e84ad32e6e142
 

+ 1 - 1
.env.test

@@ -2,7 +2,7 @@ NODE_ENV=production
 VUE_APP_NODE_NAME=test
 OUT_PUT_NAME=test
 VUE_APP_LOCAL_STORAGE_PREFIX=test
-VUE_APP_BACKEND_URL=https://ykt-test.xiaoxinda.com/enterprise-server
+VUE_APP_BACKEND_URL=https://ykt-test.xiaoxinda.com/smart-school-server/
 #appid
 VUE_APP_WXAPPID=wx907e84ad32e6e142
 

+ 13 - 12
src/components/Common.vue

@@ -51,12 +51,16 @@
 					if (!this.openId) {
 						this.getOpenid();
 					} else {
-						this.getDataByOpenId();
+						//this.getDataByOpenId();
 					}
 				}
 			} else {
 				if (this.checkOpenId) {
-
+					if (process.env.VUE_APP_NODE_NAME != 'devlopment') {
+						mui.alert('请使用微信浏览打开!', '提示', function() {
+							
+						});
+					}
 				}
 			}
 		},
@@ -75,22 +79,19 @@
 							this.set_openid(response.openid);
 
 							//角色判定调用不同的信息获取详情
-							this.getDataByOpenId();
+							//this.getDataByOpenId();
 
 							return Promise.resolve(response.openid);
 						}).catch(error => {
 							//console.log(error);
 							return Promise.reject(error);
 						});
-						step1.then(() => {
-							let redirect = this.$route.query.redirect;
-							if (redirect) {
-								this.$router.push({
-									path: decodeURIComponent(redirect)
-								});
-							} else {
-								window.location.href = document.URL.replace(/\?code=(.*?)&state=STATE/g, '');
-							}
+						step1.then((openid) => {
+							this.set_openid(response.openid);
+							this.$emit('getOpenId',response.openid);
+							//let redirect = this.$route.query.redirect;
+							//window.location.href = document.URL.replace(/\?code=(.*?)&state=STATE/g, '');
+							
 						});
 					} else {
 						//如果存在openid,把链接中code字符去除

+ 24 - 0
src/views/Home.vue

@@ -3,6 +3,30 @@
 </template>
 
 <script>
+	import Common from '@/components/Common.vue'
+	
+	export default {
+		name: '',
+		components: {
+			Common
+		},
+		data() {
+			return {
+				
+			}
+		},
+		created() {
+			
+		},
+		methods: {
+			
+		},mounted() {
+			console.log(111)
+		},
+		destroyed() {
+			
+		},
+	}
 </script>
 
 <style>

+ 10 - 4
vue.config.js

@@ -2,6 +2,7 @@ const path = require('path');
 
 const CompressionWebpackPlugin = require("compression-webpack-plugin")
 const productionGzipExtensions = ['js', 'css']
+let debug =false;
 
 function resolve(dir) {
 	return path.join(__dirname, dir)
@@ -9,11 +10,13 @@ function resolve(dir) {
 
 let title = '';
 if (process.env.VUE_APP_NODE_NAME == 'production') {
-	title = ''
+	title = '';
 } else if (process.env.VUE_APP_NODE_NAME == 'test') {
-	title = '(测试)'
+	title = '(测试)';
+	debug=true;
 } else {
-	title = '(开发)'
+	title = '(开发)';
+	debug=true;
 }
 
 const Timestamp = new Date().getTime();
@@ -39,7 +42,7 @@ module.exports = {
 		compress: true,
 	},
 	//不输出map
-	productionSourceMap: false,
+	productionSourceMap: debug,
 	chainWebpack: (config) => {
 		config.entry.app = ['babel-polyfill', './src/main.js']
 		config.resolve.alias
@@ -51,6 +54,9 @@ module.exports = {
 		config.optimization.minimize(true);
 	},
 	configureWebpack: config => {
+		if (debug) { // 开发环境配置
+		        config.devtool = 'source-map'
+		    }
 		/* //开启gzip压缩,需要配置Nginx服务器gzip选项开启
 		config.plugins.push(
 			new CompressionWebpackPlugin({