guhongwei 2 년 전
부모
커밋
f6ad283449
7개의 변경된 파일89개의 추가작업 그리고 13개의 파일을 삭제
  1. 48 0
      common/share.js
  2. 1 0
      config.js
  3. 3 0
      main.js
  4. 13 2
      manifest.json
  5. 1 1
      pages/home/index.vue
  6. 5 7
      pages/my/index.vue
  7. 18 3
      pagesHome/order/detail.vue

+ 48 - 0
common/share.js

@@ -0,0 +1,48 @@
+import config from '../config.js';
+export default {
+	data() {
+		return {
+			share: {
+				title: '天恩活泉',
+				path: `/pages/index/index`,
+				imageUrl: config.shareUrl,
+			}
+		}
+	},
+	onShareAppMessage(res) { //发送给朋友
+		return {
+			title: this.share.title,
+			path: this.share.path,
+			imageUrl: this.share.imageUrl,
+			success(res) {
+				uni.showToast({
+					title: '分享成功'
+				})
+			},
+			fail(res) {
+				uni.showToast({
+					title: '分享失败',
+					icon: 'none'
+				})
+			}
+		}
+	},
+	onShareTimeline(res) { //分享到朋友圈
+		return {
+			title: this.share.title,
+			path: this.share.path,
+			imageUrl: this.share.imageUrl,
+			success(res) {
+				uni.showToast({
+					title: '分享成功'
+				})
+			},
+			fail(res) {
+				uni.showToast({
+					title: '分享失败',
+					icon: 'none'
+				})
+			}
+		}
+	},
+}

+ 1 - 0
config.js

@@ -2,6 +2,7 @@ export default {
   serverUrl: 'https://broadcast.waityou24.cn',
   // serverUrl: 'http://192.168.223.1:12111',
   logoUrl: 'https://broadcast.waityou24.cn/files/point/indexModule/20221010124133.png',
+  shareUrl:'https://broadcast.waityou24.cn/files/point/indexModule/20221011091759.png',
   china: [
     //全国地址
     {

+ 3 - 0
main.js

@@ -11,6 +11,9 @@ Vue.prototype.$apifile = requestFile;
 // 配置文件
 import config from '@/config.js';
 Vue.prototype.$config = config;
+// 全局分享
+import share from "@/common/share.js"
+Vue.mixin(share);
 // 主体组件
 import mobileFrame from '@/components/mobile-frame/index.vue';
 Vue.component('mobile-frame', mobileFrame);

+ 13 - 2
manifest.json

@@ -22,7 +22,8 @@
             "Maps" : {},
             "Geolocation" : {},
             "Messaging" : {},
-            "Payment" : {}
+            "Payment" : {},
+            "Share" : {}
         },
         /* 应用发布信息 */
         "distribute" : {
@@ -78,7 +79,17 @@
                         "appkey_android" : "68af4192b5156af8c0100dd9c10b4365"
                     }
                 },
-                "payment" : {}
+                "payment" : {
+                    "alipay" : {
+                        "__platform__" : [ "ios", "android" ]
+                    }
+                },
+                "share" : {
+                    "weixin" : {
+                        "appid" : "wx928648edf0df1882",
+                        "UniversalLinks" : ""
+                    }
+                }
             },
             "icons" : {
                 "android" : {

+ 1 - 1
pages/home/index.vue

@@ -87,7 +87,7 @@
 				scrollTop: 0,
 				old: {
 					scrollTop: 0
-				}
+				},
 			};
 		},
 		onLoad: function() {

+ 5 - 7
pages/my/index.vue

@@ -2,7 +2,7 @@
 	<mobile-frame :frameStyle="frameStyle" @toPath="toPath">
 		<view class="main">
 			<view class="one">
-				<view class="one_1" v-if="!user._id">
+				<view class="one_1" v-if="user&&user._id==null">
 					<text class="iconfont icon-geren2" @click="toCommon('pages/login/index')"></text>
 					<view class="name">未登录</view>
 				</view>
@@ -45,8 +45,7 @@
 					<view class="title">{{item.title}}</view>
 					<view class="title">
 						<text v-if="user.id&&item.title=='我的积分'">{{user.integral||0}}分</text>
-						<text v-if="item.title=='客服电话'"
-							@tap="makePhone(serviceContactInfo.phone)">{{serviceContactInfo.phone||''}}</text>
+						<text v-if="item.title=='客服电话'" @tap="makePhone(serviceContactInfo.phone)">{{serviceContactInfo.phone||''}}</text>
 						<text class="iconfont icon-jiantouyou"></text>
 					</view>
 				</view>
@@ -139,13 +138,12 @@
 				shop_num: ''
 			};
 		},
-		onShow: async function() {
+		onShow: function() {
 			const that = this;
 			// 查询其他信息
-			await that.searchOther();
+			that.searchOther();
 			// 监听用户登录
-			await that.watchLogin();
-
+			that.watchLogin();
 		},
 		methods: {
 			// 监听用户登录

+ 18 - 3
pagesHome/order/detail.vue

@@ -212,16 +212,19 @@
 				money: 0,
 				// 计数器
 				num: 1,
-				max: 0
+				max: 0,
+				// 分享
+				share: {},
 			};
 		},
 		onLoad: async function(e) {
 			const that = this;
 			that.$set(that, `id`, e.id || '');
 		},
-		onShow: function() {
+		onShow: async function() {
 			const that = this;
-			that.search();
+			await that.search();
+			await that.configShare();
 		},
 		methods: {
 			//店铺,
@@ -468,6 +471,18 @@
 					that.$set(that, `shop_collect`, arr.data)
 				}
 			},
+			// 配置分享内容
+			configShare() {
+				const that = this;
+				let user_id = that.user && that.user._id ? that.user._id : '';
+				let id = that.info && that.info._id ? that.info._id : ''
+				let obj = {
+					title: that.info.name,
+					path: `/pagesHome/order/detail?id=${id}&user_id=${user_id}`,
+					imageUrl: that.info.file[0].url
+				}
+				that.$set(that, `share`, obj)
+			}
 		}
 	}
 </script>