zhengkaixin 1 rok temu
rodzic
commit
e08666f7a5

+ 2 - 4
pages/packages/choreInformation/jobSearchDetails.vue

@@ -1,9 +1,7 @@
 <template>
 	<view>
-		<u-navbar :back-text="showTitle" v-if="share" back-icon-size="28" :customBack="customBack" back-icon-color="#ffffff"
-			:background="{backgroundColor: '#2795FD',}" :back-text-style="{color: '#ffffff'}"></u-navbar>
-		
-		<u-navbar :back-text="showTitle" v-else back-icon-size="28" back-icon-color="#ffffff"
+		 
+		<u-navbar :back-text="showTitle"  :share="share"  back-icon-size="28" back-icon-color="#ffffff"
 			:background="{backgroundColor: '#2795FD',}" :back-text-style="{color: '#ffffff'}"></u-navbar>
 		<view class="content">
 			<!-- 职位 -->

+ 2 - 4
pages/packages/jobInformation/jobDetails.vue

@@ -1,9 +1,7 @@
 <template>
 	<view>
-		<u-navbar :back-text="showTitle" v-if="share" back-icon-size="28" :customBack="customBack" back-icon-color="#ffffff"
-			:background="{backgroundColor: '#2795FD',}" :back-text-style="{color: '#ffffff'}"></u-navbar>
-		
-		<u-navbar :back-text="showTitle" v-else back-icon-size="28" back-icon-color="#ffffff"
+	 
+		<u-navbar :back-text="showTitle"  :share="share"  back-icon-size="28" back-icon-color="#ffffff"
 			:background="{backgroundColor: '#2795FD',}" :back-text-style="{color: '#ffffff'}"></u-navbar>
 		<view class="content">
 			<view class="title">

+ 26 - 2
pages/packages/news/articleDetail.vue

@@ -1,7 +1,9 @@
 <template>
 	<view>
-		<u-navbar back-text="内容详情" back-icon-size="28" back-icon-color="#ffffff"
+		 <u-navbar   :share="share"    :back-text="newsDetail.title" back-icon-size="28" back-icon-color="#ffffff"
 			:background="{backgroundColor: '#2795FD',}" :back-text-style="{color: '#ffffff'}"></u-navbar>
+		
+		
 		<view class="main">
 			<view class="title">
 				{{newsDetail.title}}
@@ -40,16 +42,38 @@
 		data() {
 			return {
 				id: '',
+				share: 0,
 				newsDetail: {},
 			}
 		},
+		onShareTimeline(){
+			return {
+				title: "荆州经开区共享用工平台",
+			}
+		},
+		onShareAppMessage(res) {
+			if (res.from === 'button') { // 来自页面内分享按钮
+				//.log(res.target)
+			}
+			return {
+				title: this.newsDetail.title,
+				path: '/pages/packages/news/articleDetail?shareMP=1&id=' + this.id
+			}
+		},
 		onLoad(op) {
-			
+			if (op.shareMP) {
+				this.share = op.shareMP
+			}
 			
 			this.id =op.id;
 			this.getNewsDetail();
 		},
 		methods: {
+			customBack(){
+				uni.redirectTo({
+					url:"/pages/main/index/index"
+				})
+			},
 			timestart(){
 					console.log("aaa1")
 			},

+ 20 - 2
pages/packages/shareEmployment/articleDetail.vue

@@ -1,6 +1,6 @@
 <template>
 	<view>
-		<u-navbar back-text="文章详情" back-icon-size="28" back-icon-color="#ffffff"
+		<u-navbar back-text="文章详情" :share="share" back-icon-size="28" back-icon-color="#ffffff"
 			:background="{backgroundColor: '#2795FD',}" :back-text-style="{color: '#ffffff'}"></u-navbar>
 		<view class="main">
 			<!-- 标题 -->
@@ -49,10 +49,28 @@
 				form: {
 					id: ''
 				},
-				photo: ''
+				photo: '',
+				share:0,
+			}
+		},
+		onShareTimeline(){
+			return {
+				title: "荆州经开区共享用工平台",
+			}
+		},
+		onShareAppMessage(res) {
+			if (res.from === 'button') { // 来自页面内分享按钮
+				//.log(res.target)
+			}
+			return {
+				title: this.form.title,
+				path: '/pages/packages/shareEmployment/articleDetail?shareMP=1&id=' + this.form.id
 			}
 		},
 		onLoad(op) {
+			if (op.shareMP) {
+				this.share = op.shareMP
+			}
 			if(op.id) {
 				this.form.id = op.id;
 				this.getShareWorksDetail();

+ 19 - 1
pages/packages/skillTraining/trainingRegistration.vue

@@ -1,6 +1,6 @@
 <template>
 	<view>
-		<u-navbar :back-text="info.title" back-icon-size="28" back-icon-color="#ffffff"
+		<u-navbar :back-text="info.title" :share="share" back-icon-size="28" back-icon-color="#ffffff"
 			:background="{backgroundColor: '#2795FD',}" :back-text-style="{color: '#ffffff'}"></u-navbar>
 		
 		<!-- 内容 -->
@@ -64,9 +64,27 @@
 				info: {
 
 				},
+				share:0,
+			}
+		},
+		onShareTimeline(){
+			return {
+				title: "荆州经开区共享用工平台",
+			}
+		},
+		onShareAppMessage(res) {
+			if (res.from === 'button') { // 来自页面内分享按钮
+				//.log(res.target)
+			}
+			return {
+				title: this.info.title,
+				path: '/pages/packages/skillTraining/trainingRegistration?shareMP=1&id=' + this.id
 			}
 		},
 		onLoad(op) {
+			if (op.shareMP) {
+				this.share = op.shareMP
+			}
 			this.id = op.id
 			this.getInfo()
 		},

+ 17 - 6
uni_modules/uview-ui/components/u-navbar/u-navbar.vue

@@ -71,6 +71,10 @@
 		name: "u-navbar",
 		props: {
 			// 导航栏高度,单位px,非rpx
+			share:{
+				type: [String, Number],
+				default: 0,
+			},
 			height: {
 				type: [String, Number],
 				default: ''
@@ -238,13 +242,20 @@
 			},
 			goBack() {
 				// 如果自定义了点击返回按钮的函数,则执行,否则执行返回逻辑
-				if (typeof this.customBack === 'function') {
-					// 在微信,支付宝等环境(H5正常),会导致父组件定义的customBack()函数体中的this变成子组件的this
-					// 通过bind()方法,绑定父组件的this,让this.customBack()的this为父组件的上下文
-					this.customBack.bind(this.$u.$parent.call(this))();
-				} else {
-					this.navberBack();
+				if(this.share==1){
+					uni.redirectTo({
+						url:"/pages/main/index/index"
+					})
+				}else{
+					if (typeof this.customBack === 'function') {
+						// 在微信,支付宝等环境(H5正常),会导致父组件定义的customBack()函数体中的this变成子组件的this
+						// 通过bind()方法,绑定父组件的this,让this.customBack()的this为父组件的上下文
+						this.customBack.bind(this.$u.$parent.call(this))();
+					} else {
+						this.navberBack();
+					}
 				}
+				
 			}
 		}
 	};