浏览代码

微信分享

twt 2 年之前
父节点
当前提交
46d9fe450a
共有 4 个文件被更改,包括 117 次插入54 次删除
  1. 4 4
      common/request.js
  2. 1 1
      pages.json
  3. 90 40
      pages/index/index.vue
  4. 22 9
      pages/login/empower.vue

+ 4 - 4
common/request.js

@@ -1,6 +1,6 @@
-const baseURL = 'https://api.dms.66km.com/'
+//const baseURL = 'https://api.dms.66km.com/'
 //const baseURL='http://wx.32che.cn/'
-//const baseURL='http://api.dms.66km.com.cn/'
+const baseURL='http://api.dms.66km.com.cn/'
 
   // baseURL: 'http://192.168.0.140:20187',
 //authorizaURL: 'https://api.dms.66km.com/weixin/authorize',
@@ -10,8 +10,8 @@ const baseURL = 'https://api.dms.66km.com/'
 //const code='B527DBDDC89D4A29902D1C7CE34814FB'
 
 //const webURL='http://192.168.0.215:9588/#/'
-//const webURL='http://dms.32che.cn/#/'
-const webURL='https://minh5.66km.com/#/'
+const webURL='http://dms.32che.cn/#/'
+//const webURL='https://minh5.66km.com/#/'
 
 
 

+ 1 - 1
pages.json

@@ -1,7 +1,6 @@
 {
 	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
 		
-		
 		{
 			"path": "pages/index/index",
 			"style": {
@@ -20,6 +19,7 @@
 				"navigationBarTitleText": "授权登录"
 			}
 		},
+		
 		{
 			"path": "pages/user/scanCode",
 			"style": {

+ 90 - 40
pages/index/index.vue

@@ -22,46 +22,57 @@
 		onLoad(opt) {
 			var that=this;
 			this.wxOpendata=uni.getStorageSync("wxOpendata");
-			this.logindata=uni.getStorageSync("logindata")
-			uni.getLocation({
-			    type: 'gcj02',
-			    success: function (res) {
-			        console.log('当前位置的经度是:' + res.longitude);
-			        console.log('当前位置的纬度:' + res.latitude);
-					if(opt.id){
-						that.url=that.$webURL+'paySuccess?orderId='+opt.id+'&hideHeader=true&codeapp='+that.wxOpendata.code+'&lat='+res.latitude+'&lng='+res.longitude
-					}else{
-						/* if(!that.wxOpendata.shopID||!that.logindata){
-							uni.navigateTo({
-								url:'../login/empower'
-							})
-						} */
-						
-						if(that.wxOpendata.code){
-							//this.url='http://dms.32che.cn/#/carOwner/index?codeapp='+this.wxOpendata.code+ '&shopId='+this.wxOpendata.shopID
-							that.url=that.$webURL+'carOwner/index?codeapp='+that.wxOpendata.code+ '&shopId='+that.wxOpendata.shopID+'&lat='+res.latitude+'&lng='+res.longitude
+			this.logindata=uni.getStorageSync("logindata");
+			if (opt.path) {
+			      //this.url = `${this.url}${options.path}`
+				   //this.url = opt.path
+				    console.log('options', opt)
+					//console.log(opt)
+					var url=opt.path.replace('$', '?')
+				    this.url=url+"&codeapp="+that.wxOpendata.code+'&shareID='+opt.shareID+'&type='+opt.type+'&isDmsOpen='+that.wxOpendata.isDmsOpen+'&isMarketingOpen='+that.wxOpendata.isMarketingOpen
+			        console.log(url)
+			}else{
+				uni.getLocation({
+				    type: 'gcj02',
+				    success: function (res) {
+				        console.log('当前位置的经度是:' + res.longitude);
+				        console.log('当前位置的纬度:' + res.latitude);
+						if(opt.id){
+							that.url=that.$webURL+'paySuccess?orderId='+opt.id+'&hideHeader=true&codeapp='+that.wxOpendata.code+'&lat='+res.latitude+'&lng='+res.longitude+'&isDmsOpen='+that.wxOpendata.isDmsOpen+'&isMarketingOpen='+that.wxOpendata.isMarketingOpen
 						}else{
-							that.url=that.$webURL+'carOwner/index?codeapp=&shopId=&lat='+res.latitude+'&lng='+res.longitude
+							/* if(!that.wxOpendata.shopID||!that.logindata){
+								uni.navigateTo({
+									url:'../login/empower'
+								})
+							} */
+							
+							if(that.wxOpendata.code){
+								//this.url='http://dms.32che.cn/#/carOwner/index?codeapp='+this.wxOpendata.code+ '&shopId='+this.wxOpendata.shopID
+								that.url=that.$webURL+'carOwner/index?codeapp='+that.wxOpendata.code+ '&shopId='+that.wxOpendata.shopID+'&lat='+res.latitude+'&lng='+res.longitude+'&isDmsOpen='+that.wxOpendata.isDmsOpen+'&isMarketingOpen='+that.wxOpendata.isMarketingOpen
+							}else{
+								that.url=that.$webURL+'carOwner/index?codeapp=&shopId=&lat='+res.latitude+'&lng='+res.longitude
+							}
 						}
+				    },
+					fail(err) {
+						console.log(err)
+					    if(opt.id){
+					    	that.url=that.$webURL+'paySuccess?orderId='+opt.id+'&hideHeader=true&codeapp='+that.wxOpendata.code+'&lat=""&lng=""'
+					    }else{
+					    	if(!that.wxOpendata.shopID){
+					    		uni.navigateTo({
+					    			url:'../login/empower'
+					    		})
+					    	}
+					    	if(that.wxOpendata.code){
+					    		//this.url='http://dms.32che.cn/#/carOwner/index?codeapp='+this.wxOpendata.code+ '&shopId='+this.wxOpendata.shopID
+					    		that.url=that.$webURL+'carOwner/index?codeapp='+that.wxOpendata.code+ '&shopId='+that.wxOpendata.shopID+'&lat=""&lng=""'
+					    	}
+					    }
 					}
-			    },
-				fail(err) {
-					console.log(err)
-				    if(opt.id){
-				    	that.url=that.$webURL+'paySuccess?orderId='+opt.id+'&hideHeader=true&codeapp='+that.wxOpendata.code+'&lat=""&lng=""'
-				    }else{
-				    	if(!that.wxOpendata.shopID){
-				    		uni.navigateTo({
-				    			url:'../login/empower'
-				    		})
-				    	}
-				    	if(that.wxOpendata.code){
-				    		//this.url='http://dms.32che.cn/#/carOwner/index?codeapp='+this.wxOpendata.code+ '&shopId='+this.wxOpendata.shopID
-				    		that.url=that.$webURL+'carOwner/index?codeapp='+that.wxOpendata.code+ '&shopId='+that.wxOpendata.shopID+'&lat=""&lng=""'
-				    	}
-				    }
-				}
-			});
+				});
+			}
+			
 			
 			console.log(opt)
 			//opt.id='3A9DBC40-D5D4-43A6-8ACA-5CF909771512'
@@ -77,13 +88,52 @@
 		},
 		
 		
+		    
+		
 		methods: {
 			goUrl(){
 				
 			},
-            message(event){
-                console.log(event);
-            }
+           message(event){
+               console.log(event);
+           	let { data } = event.mp.detail
+           	console.log('message', data)
+           	this.shareData = JSON.parse(data.pop())
+           	console.log(this.shareData)
+           	//this.shareData= event.mp.detail
+           },
+		},
+		onShareAppMessage(){
+			console.log(this.shareData)
+			/* var share={
+				url:this.shareData.path
+			}
+			var obj=JSON.stringify(share) */
+			var newUrl=this.shareData.path.replace('?', '$')
+			console.log(newUrl)
+			/*   
+			    if (this.shareData) {
+			       path = shareData.path
+			    } */
+		 return {
+		       title:this.shareData.title,
+		       path: 'pages/index/index?path='+ encodeURI(newUrl),
+			   //path: 'pages/index/home?path='+ obj+'&id='+this.shareData.id+'&shareID='+this.shareData.shareID,
+		       imageUrl:this.shareData.img,
+			   desc:this.shareData.desc,
+		       success: function (res) {
+		           // 转发成功
+		         wx.showToast({
+		           title: "转发成功",
+		           icon: 'success',
+		           duration: 2000
+		         })
+		       },
+		       fail: function (res) {
+		           // 转发失败
+		       },
+			   }
+		
 		}
 	}
 </script>

+ 22 - 9
pages/login/empower.vue

@@ -27,27 +27,40 @@ export default {
 			wxOpendata:'',
 			isload:false,
 			shopID:'',
+			loginType:'',
 		}
 	},
 	onLoad(opt) {
       this.type=opt.type;
+	  this.loginType=opt.loginType;
 	  this.wxOpendata=uni.getStorageSync("wxOpendata");
+	  if(this.loginType==1){
+		  
+	  }else{
+		 if( this.wxOpendata){
+		 		  /* uni.switchTab({
+		 		  	url:'../index/index'
+		 		  }) */
+		 		  uni.navigateTo({
+		 		  	url:'../index/index'
+		 		  })
+		 }else{
+		 		  this.isload=true;
+		 } 
+	  }
 	  if(opt.shopId){
 		  this.shopID=opt.shopId
 	  }
-	  if( this.wxOpendata){
-		  uni.switchTab({
-		  	url:'../index/index'
-		  })
-	  }else{
-		  this.isload=true;
-	  }
+	  
 	},
 	methods: {
 		goIndex(){
-			uni.switchTab({
+			/* uni.switchTab({
 				url:'../index/index'
-			}) 
+			}) */
+			uni.navigateTo({
+				url:'../index/index'
+			})
 		},
 		 getPhoneNumber: function(e) {
 		                console.log(e);