| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 | 
							- <script>
 
- 	const config = require('./static/config.js');
 
- 	export default {
 
- 		onLaunch: function() {
 
- 			let href = location.href;
 
- 			let code  = this.getQueryString('code');
 
- 			if(!code){
 
- 				let url =  href.split('#')[0];
 
- 				url = encodeURIComponent(url);
 
- 				url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+config.appid+"&redirect_uri="+url+"&response_type=code&scope=snsapi_userinfo&state=123&connect_redirect=1#wechat_redirect"
 
- 				window.location.href = url;
 
- 			}
 
- 			this.globalData.BASE_URL = config.BASE_URL;
 
- 		},
 
- 		onShow: function() {
 
- 			let shareToken  = this.getQueryString('shareToken');
 
- 			let projectId  = this.getQueryString('projectId');
 
- 			this.globalData.projectId = projectId||'';
 
- 			this.globalData.shareToken = shareToken||'';
 
- 			this.regist();
 
- 			document.body.style.setProperty("background-color",this.globalData.color4);
 
- 		},
 
- 		onHide: function() {
 
- 		},
 
- 		methods: {
 
- 			getThemeInfo() {
 
- 			
 
- 			},
 
- 			getQueryString(name){
 
- 				var reg = new RegExp("(^|\\?|&)"+ name +"=([^&]*)(\\s|&|$)", "i");
 
- 				return reg.test(location.href) ? unescape(RegExp.$2.replace(/\+/g, " ")) : ""
 
- 			},
 
- 			async regist() {
 
- 				let code  = this.getQueryString('code');
 
- 				let ret = await this.$myRequest({
 
- 					url: "/regist",
 
- 					data: {
 
- 						"code": code,
 
- 						"shareToken":this.globalData.shareToken||"",
 
- 						"projectId":this.globalData.projectId||"",
 
- 					}
 
- 				});
 
- 				if (ret.data.success) {
 
- 					let userId = ret.data.single.userId;
 
- 					this.globalData.userId = userId;
 
- 					if (ret.data.single.authed == 1) {
 
- 						let token = ret.data.single.token;
 
- 						this.globalData.token = token
 
- 					}
 
- 					uni.$emit('request')
 
- 				}
 
- 			},
 
- 		},
 
- 		globalData: {
 
- 			token: "",
 
- 			userId:"",
 
- 			projectId:"",
 
- 			shareToken:"",
 
- 			color1: "#F07423",
 
- 			color2: "#FD8F3C",
 
- 			color3: "#FFC444",
 
- 			color4: "#F5F5F7",
 
- 			color5: "#F7A98E",
 
- 			color6: "#FFF4EB",
 
- 			color7:"#F8BA91",
 
- 			color8:"#FFF4EB",
 
- 			color9:"#8B654D",
 
- 			color10:"#FCF6F1",
 
- 			BASE_URL:"https://dm-api.elab-plus.cn",//默认环境
 
- 		}
 
- 	}
 
- </script>
 
- <style>
 
- 	
 
- </style>
 
 
  |