dever 4 years ago
parent
commit
3b2803f3f9

+ 2 - 3
lib/dever/components/comment.vue

@@ -1,4 +1,4 @@
-<template name="comment">
+<template name="dever-comment">
 	<view>
 		<view class="msgs-tabs">
 		  <view class="tit">{{item.name}}</view>
@@ -14,7 +14,7 @@
 		</view>
 		<y-Fab :bottom="20" :right="140" @click="showModal" bgColor="#0fa5e5" text="发布"></y-Fab>
 		<view v-if="show">
-			<publish :title="title" :is_upload="false" @hideModal="hideModal" @getRefresh="getRefresh" :type="type" :type_id="type_id" :api="api"></publish>
+			<dever-publish :title="title" :is_upload="false" @hideModal="hideModal" @getRefresh="getRefresh" :type="type" :type_id="type_id" :api="api"></dever-publish>
 		</view>
 	</view>
 </template>
@@ -23,7 +23,6 @@
 import publish from '@/lib/dever/components/publish.vue';
 import deverContent from '@/lib/dever/components/content.vue';
 export default {
-	name: "comment",
 	props: {
 		type : {
 			type : String,

+ 0 - 1
lib/dever/components/content.vue

@@ -17,7 +17,6 @@
 <script>
 import jyfParser from "@/lib/jyf-parser/jyf-parser";
 export default {
-	name: "dever-content",
 	props: {
 		skeleton : {
 			type    : Boolean,

+ 1 - 2
lib/dever/components/drawerPage.vue

@@ -1,4 +1,4 @@
-<template name="drawerPage">
+<template name="dever-drawer-page">
 	<view class="DrawerPage" :class="show">
 		<slot name="links"></slot>
 	</view>
@@ -6,7 +6,6 @@
 
 <script>
 export default {
-	name: "drawerPage",
 	props: {
 		show : '',
 	},

+ 1 - 2
lib/dever/components/drawerWindow.vue

@@ -1,4 +1,4 @@
-<template name="drawerWindow">
+<template name="dever-drawer-window">
 	<view :style="{background:background,zIndex:zIndex, top:top+'px'}">
 		<view :class="['DrawerClose_' + direction, show ? 'show' : '']" @tap="hideModal">
 			<text :class="'cuIcon-pull'+direction"></text>
@@ -13,7 +13,6 @@
 
 <script>
 export default {
-	name: "drawerWindow",
 	props: {
 		show : {
 			type : Boolean,

File diff suppressed because it is too large
+ 0 - 0
lib/dever/components/jweixin.js


+ 264 - 0
lib/dever/components/popup.vue

@@ -0,0 +1,264 @@
+<!-- 底部弹窗(分享) -->
+
+<template name="dever-popup">
+	<view v-if="showPopup" class="uni-popup" @touchmove.stop.prevent="clear">
+		<dever-transition :mode-class="['fade']" :styles="maskClass" :duration="duration" :show="showTrans" @click="onTap" />
+		<dever-transition :mode-class="ani" :styles="transClass" :duration="duration" :show="showTrans" @click="onTap">
+			<view class="uni-popup__wrapper-box" @click.stop="clear">
+				<slot />
+			</view>
+		</dever-transition>
+	</view>
+</template>
+
+<script>
+	import deverTransition from '@/lib/dever/components/transition.vue'
+
+	/**
+	 * PopUp 弹出层
+	 * @description 弹出层组件,为了解决遮罩弹层的问题
+	 * @tutorial https://ext.dcloud.net.cn/plugin?id=329
+	 * @property {String} type = [top|center|bottom] 弹出方式
+	 * 	@value top 顶部弹出
+	 * 	@value center 中间弹出
+	 * 	@value bottom 底部弹出
+	 * @property {Boolean} animation = [ture|false] 是否开启动画
+	 * @property {Boolean} maskClick = [ture|false] 蒙版点击是否关闭弹窗
+	 * @event {Function} change 打开关闭弹窗触发,e={show: false}
+	 */
+
+	export default {
+		components: {
+			deverTransition
+		},
+		props: {
+			// 开启动画
+			animation: {
+				type: Boolean,
+				default: true
+			},
+			// 弹出层类型,可选值,top: 顶部弹出层;bottom:底部弹出层;center:全屏弹出层
+			type: {
+				type: String,
+				default: 'center'
+			},
+			// maskClick
+			maskClick: {
+				type: Boolean,
+				default: true
+			}
+		},
+		data() {
+			return {
+				duration: 300,
+				ani: [],
+				showPopup: false,
+				showTrans: false,
+				maskClass: {
+					'position': 'fixed',
+					'bottom': 0,
+					'top': 0,
+					'left': 0,
+					'right': 0,
+					'backgroundColor': 'rgba(0, 0, 0, 0.4)'
+				},
+				transClass: {
+					'position': 'fixed',
+					'left': 0,
+					'right': 0,
+				}
+			}
+		},
+		watch: {
+			type: {
+				handler: function(newVal) {
+					switch (this.type) {
+						case 'top':
+							this.ani = ['slide-top']
+							this.transClass = {
+								'position': 'fixed',
+								'left': 0,
+								'right': 0,
+							}
+							break
+						case 'bottom':
+							this.ani = ['slide-bottom']
+							this.transClass = {
+								'position': 'fixed',
+								'left': 0,
+								'right': 0,
+								'bottom': 0
+							}
+							break
+						case 'center':
+							this.ani = ['zoom-out', 'fade']
+							this.transClass = {
+								'position': 'fixed',
+								/* #ifndef APP-NVUE */
+								'display': 'flex',
+								'flexDirection': 'column',
+								/* #endif */
+								'bottom': 0,
+								'left': 0,
+								'right': 0,
+								'top': 0,
+								'justifyContent': 'center',
+								'alignItems': 'center'
+							}
+
+							break
+					}
+				},
+				immediate: true
+			}
+		},
+		created() {
+			if (this.animation) {
+				this.duration = 300
+			} else {
+				this.duration = 0
+			}
+		},
+		methods: {
+			clear(e) {
+				// TODO nvue 取消冒泡
+				e.stopPropagation()
+			},
+			open() {
+				this.showPopup = true
+				this.$nextTick(() => {
+					clearTimeout(this.timer)
+					this.timer = setTimeout(() => {
+						this.showTrans = true
+					}, 50);
+				})
+				this.$emit('change', {
+					show: true
+				})
+			},
+			close(type) {
+				this.showTrans = false
+				this.$nextTick(() => {
+					clearTimeout(this.timer)
+					this.timer = setTimeout(() => {
+						this.$emit('change', {
+							show: false
+						})
+						this.showPopup = false
+					}, 300)
+				})
+			},
+			onTap() {
+				if (!this.maskClick) return
+				this.close()
+			}
+		}
+	}
+</script>
+<style lang="scss" scoped>
+	.uni-popup {
+		position: fixed;
+		/* #ifdef H5 */
+		top: var(--window-top);
+		/* #endif */
+		/* #ifndef H5 */
+		top: 0;
+		/* #endif */
+		bottom: 0;
+		left: 0;
+		right: 0;
+		/* #ifndef APP-NVUE */
+		z-index: 100;
+		/* #endif */
+	}
+
+	.uni-popup__mask {
+		position: absolute;
+		top: 0;
+		bottom: 0;
+		left: 0;
+		right: 0;
+		background-color: $uni-bg-color-mask;
+		opacity: 0;
+	}
+
+	.mask-ani {
+		transition-property: opacity;
+		transition-duration: 0.2s;
+	}
+
+	.uni-top-mask {
+		opacity: 1;
+	}
+
+	.uni-bottom-mask {
+		opacity: 1;
+	}
+
+	.uni-center-mask {
+		opacity: 1;
+	}
+
+	.uni-popup__wrapper {
+		/* #ifndef APP-NVUE */
+		display: block;
+		/* #endif */
+		position: absolute;
+	}
+
+	.top {
+		top: 0;
+		left: 0;
+		right: 0;
+		transform: translateY(-500px);
+	}
+
+	.bottom {
+		bottom: 0;
+		left: 0;
+		right: 0;
+		transform: translateY(500px);
+	}
+
+	.center {
+		/* #ifndef APP-NVUE */
+		display: flex;
+		flex-direction: column;
+		/* #endif */
+		bottom: 0;
+		left: 0;
+		right: 0;
+		top: 0;
+		justify-content: center;
+		align-items: center;
+		transform: scale(1.2);
+		opacity: 0;
+	}
+
+	.uni-popup__wrapper-box {
+		/* #ifndef APP-NVUE */
+		display: block;
+		/* #endif */
+		position: relative;
+	}
+
+	.content-ani {
+		// transition: transform 0.3s;
+		transition-property: transform, opacity;
+		transition-duration: 0.2s;
+	}
+
+
+	.uni-top-content {
+		transform: translateY(0);
+	}
+
+	.uni-bottom-content {
+		transform: translateY(0);
+	}
+
+	.uni-center-content {
+		transform: scale(1);
+		opacity: 1;
+	}
+</style>

+ 1 - 2
lib/dever/components/position.vue

@@ -1,4 +1,4 @@
-<template name="position">
+<template name="dever-position">
 	<view>
 		<block v-for="(v, k) in item" :key="k">
 			<view :class="['position-tag', position[v.text-1]]" v-if="v.name" @click="view(v.goods_id)">
@@ -13,7 +13,6 @@
 
 <script>
 export default {
-	name: "position",
 	props: {
 		button : {
 			type : String,

+ 1 - 2
lib/dever/components/publish.vue

@@ -1,4 +1,4 @@
-<template name="publish">
+<template name="dever-publish">
 	<view class="cu-modal show">
 		<view class="cu-dialog">
 			<view class="cu-bar bg-white justify-end">
@@ -43,7 +43,6 @@
 
 <script>
 	export default {
-		name : 'publish',
 		props: {
 			title : '',
 			cate_id : null,

+ 1 - 1
lib/dever/components/seat.vue

@@ -1,4 +1,4 @@
-<template name="seat">
+<template name="dever-seat">
 	<view class="w-100 grace-body">
 		<view class="bg-f1">
 			<movable-area :style="'height:'+(seatRow*40+350)+'rpx;width: 100vw;tops:'+(rpxNum*132)+'px'" class="pt-f left-0">

+ 187 - 0
lib/dever/components/share.vue

@@ -0,0 +1,187 @@
+<template name="dever-share">
+	<view>
+		<dever-popup ref="popup" type="bottom">
+			<view class="sharebtn">
+				<view class="uni-share">
+					<view class="uni-share-content">
+						<view v-for="(v, k) in button" :key="k" class="uni-share-content-box" :style="v.type == 'copy' ? 'margin-right:0rpx;' : mr" @click='share(v.type)'>
+							<view class="uni-share-content-image">
+								<image :src="v.icon" class="content-image" />
+							</view>
+							<text class="uni-share-content-text">{{ v.text }}</text>
+						</view>
+					</view>
+				</view>
+			</view>
+		</dever-popup>
+	</view>
+</template>
+
+<script>
+	import deverPopup from "@/lib/dever/components/popup.vue"; 
+	import copyText from "@/lib/clipboard.thorui.js";
+	import wx from "@/lib/dever/components/jweixin.js"; 
+	export default {
+		data() {
+			return {
+				button: [{
+						text: '微信',
+						icon: '/static/dever/weixin.png',
+						type: 'weixin'
+					},
+					{
+						text: '朋友圈',
+						icon: '/static/dever/pengyouquan.png',
+						type: 'weixin_group'
+					},
+					{
+						text: 'QQ',
+						icon: '/static/dever/qq.png',
+						type: 'qq'
+					}
+				],
+			}
+		},
+		props: {
+			id : 0,
+			data : {},
+		},
+		created : function() {
+			this.mr = 'margin-right:60rpx';
+			if (this.data && this.data.poster) {
+				this.mr = 'margin-right:40rpx';
+				this.button.push({
+					text: '海报',
+					icon: '/static/dever/poster.png', 
+					type: 'poster'
+				});
+			}
+			
+			this.button.push({
+				text: '复制',
+				icon: '/static/dever/copy.png',
+				type: 'copy'
+			});
+		},
+		methods: {
+			open : function() {
+				this.$refs.popup.open();
+			},
+			
+			init : function() {
+				this.Dever.shareInit(this.data);
+			},
+			
+			share : function(type) {
+				eval("this."+type+"()");
+			},
+			
+			copy : function() {
+				var self = this;
+				var value = this.data.title;
+				if (this.data.content) {
+					value += "\r\n" + this.data.content;
+				}
+				if (this.data.link) {
+					value += "\r\n" + this.data.link;
+				}
+				copyText.getClipboardData(value, function(res) {
+					if (res) {
+						self.Dever.alert('复制成功');
+					} else {
+						self.Dever.alert('复制失败');
+					}
+				});
+			},
+			
+			weixin : function() {
+				this.Dever.share('weixin', 'WXSceneSession', 0, this.data);
+			},
+			
+			weixin_group : function() {
+				this.Dever.share('weixin', 'WXSenceTimeline', 0, this.data);
+			},
+			
+			qq : function() {
+				this.Dever.share('qq', '', 1, this.data);
+			},
+			
+			poster : function() {
+				if (this.data.poster) {
+					// 弹出海报
+				} else {
+					this.Dever.alert('没有海报素材');
+				}
+			}
+		},
+		components:{
+			deverPopup
+		}
+	}
+</script>
+
+<style lang="scss">
+	/* 底部分享 */
+	.sharebtn {
+		.uni-share {
+			width: 690rpx;
+			margin: 30rpx;
+			border-radius: 30rpx;
+			/* #ifndef APP-NVUE */
+			display: flex;
+			flex-direction: column;
+			/* #endif */
+			background-color: #fff;
+			.uni-share-content {
+				/* #ifndef APP-NVUE */
+				display: flex;
+				/* #endif */
+				flex-direction: row;
+				flex-wrap: nowrap;
+				justify-content: center;
+				overflow-x: scroll;
+				padding: 15px 50rpx;
+				.uni-share-content-box {
+					/* #ifndef APP-NVUE */
+					display: flex;
+					/* #endif */
+					flex-direction: column;
+					align-items: center;
+					// width: 25%;
+					// justify-content: space-between;
+					&:nth-last-child(1) {
+						margin-right: 0;
+					}
+					.uni-share-content-image {
+						/* #ifndef APP-NVUE */
+						display: flex;
+						/* #endif */
+						flex-direction: row;
+						justify-content: center;
+						align-items: center;
+						width: 90rpx;
+						height: 90rpx;
+						overflow: hidden;
+						border-radius: 10rpx;
+						.content-image {
+							width: 90rpx;
+							height: 90rpx;
+						}
+					}
+					&:nth-last-child(1){
+						.uni-share-content-image .content-image {
+							width: 50rpx!important;
+							height: 50rpx!important;
+						}
+					}
+					.uni-share-content-text {
+						font-size: 26rpx;
+						color: #333;
+						padding-top: 5px;
+						padding-bottom: 10px;
+					}
+				}
+			}
+		}
+	}
+</style>

+ 0 - 1
lib/dever/components/speaker.vue

@@ -16,7 +16,6 @@
 </template>
 <script>
 export default {
-	name: "dever-speaker",
 	props: {
 		msgs : {
 		  type  : Array,

+ 280 - 0
lib/dever/components/transition.vue

@@ -0,0 +1,280 @@
+<!-- 底部弹窗需要组件(分享) -->
+
+<template name="dever-transition">
+	<view v-if="isShow" ref="ani" class="uni-transition" :class="[ani.in]" :style="'transform:' +transform+';'+stylesObject"
+	 @click="change">
+		 <slot></slot>
+	</view>
+</template>
+
+<script>
+	// #ifdef APP-NVUE
+	const animation = uni.requireNativePlugin('animation');
+	// #endif
+	/**
+	 * Transition 过渡动画
+	 * @description 简单过渡动画组件
+	 * @tutorial https://ext.dcloud.net.cn/plugin?id=985
+	 * @property {Boolean} show = [false|true] 控制组件显示或隐藏
+     * @property {Array} modeClass = [fade|slide-top|slide-right|slide-bottom|slide-left|zoom-in|zoom-out] 过渡动画类型
+     *  @value fade 渐隐渐出过渡
+     *  @value slide-top 由上至下过渡
+     *  @value slide-right 由右至左过渡
+     *  @value slide-bottom 由下至上过渡
+     *  @value slide-left 由左至右过渡
+     *  @value zoom-in 由小到大过渡
+     *  @value zoom-out 由大到小过渡
+	 * @property {Number} duration 过渡动画持续时间
+	 * @property {Object} styles 组件样式,同 css 样式,注意带’-‘连接符的属性需要使用小驼峰写法如:`backgroundColor:red`
+	 */
+	export default {
+		props: {
+			show: {
+				type: Boolean,
+				default: false
+			},
+			modeClass: {
+				type: Array,
+				default () {
+					return []
+				}
+			},
+			duration: {
+				type: Number,
+				default: 300
+			},
+			styles: {
+				type: Object,
+				default () {
+					return {}
+				}
+			}
+		},
+		data() {
+			return {
+				isShow: false,
+				transform: '',
+				ani: { in: '',
+					active: ''
+				}
+			};
+		},
+		watch: {
+			show: {
+				handler(newVal) {
+					if (newVal) {
+						this.open()
+					} else {
+						this.close()
+					}
+				},
+				immediate: true
+			}
+		},
+		computed: {
+			stylesObject() {
+				let styles = {
+					...this.styles,
+					'transition-duration': this.duration / 1000 + 's'
+				}
+				let transfrom = ''
+				for (let i in styles) {
+					let line = this.toLine(i)
+					transfrom += line + ':' + styles[i] + ';'
+				}
+				return transfrom
+			}
+		},
+		created() {
+			// this.timer = null
+			// this.nextTick = (time = 50) => new Promise(resolve => {
+			// 	clearTimeout(this.timer)
+			// 	this.timer = setTimeout(resolve, time)
+			// 	return this.timer
+			// });
+		},
+		methods: {
+			change() {
+				this.$emit('click', {
+					detail: this.isShow
+				})
+			},
+			open() {
+				clearTimeout(this.timer)
+				this.isShow = true
+				this.transform = ''
+				this.ani.in = ''
+				for (let i in this.getTranfrom(false)) {
+					if (i === 'opacity') {
+						this.ani.in = 'fade-in'
+					} else {
+						this.transform += `${this.getTranfrom(false)[i]} `
+					}
+				}
+				this.$nextTick(() => {
+					setTimeout(() => {
+						this._animation(true)
+					}, 50)
+				})
+
+			},
+			close(type) {
+				clearTimeout(this.timer)
+				this._animation(false)
+			},
+			_animation(type) {
+				let styles = this.getTranfrom(type)
+				// #ifdef APP-NVUE
+				if(!this.$refs['ani']) return
+				animation.transition(this.$refs['ani'].ref, {
+					styles,
+					duration: this.duration, //ms
+					timingFunction: 'ease',
+					needLayout: false,
+					delay: 0 //ms
+				}, () => {
+					if (!type) {
+						this.isShow = false
+					}
+					this.$emit('change', {
+						detail: this.isShow
+					})
+				})
+				// #endif
+				// #ifndef APP-NVUE
+				this.transform = ''
+				for (let i in styles) {
+					if (i === 'opacity') {
+						this.ani.in = `fade-${type?'out':'in'}`
+					} else {
+						this.transform += `${styles[i]} `
+					}
+				}
+				this.timer = setTimeout(() => {
+					if (!type) {
+						this.isShow = false
+					}
+					this.$emit('change', {
+						detail: this.isShow
+					})
+
+				}, this.duration)
+				// #endif
+
+			},
+			getTranfrom(type) {
+				let styles = {
+					transform: ''
+				}
+				this.modeClass.forEach((mode) => {
+					switch (mode) {
+						case 'fade':
+							styles.opacity = type ? 1 : 0
+							break;
+						case 'slide-top':
+							styles.transform += `translateY(${type?'0':'-100%'}) `
+							break;
+						case 'slide-right':
+							styles.transform += `translateX(${type?'0':'100%'}) `
+							break;
+						case 'slide-bottom':
+							styles.transform += `translateY(${type?'0':'100%'}) `
+							break;
+						case 'slide-left':
+							styles.transform += `translateX(${type?'0':'-100%'}) `
+							break;
+						case 'zoom-in':
+							styles.transform += `scale(${type?1:0.8}) `
+							break;
+						case 'zoom-out':
+							styles.transform += `scale(${type?1:1.2}) `
+							break;
+					}
+				})
+				return styles
+			},
+			_modeClassArr(type) {
+				let mode = this.modeClass
+				if (typeof(mode) !== "string") {
+					let modestr = ''
+					mode.forEach((item) => {
+						modestr += (item + '-' + type + ',')
+					})
+					return modestr.substr(0, modestr.length - 1)
+				} else {
+					return mode + '-' + type
+				}
+			},
+			// getEl(el) {
+			// 	console.log(el || el.ref || null);
+			// 	return el || el.ref || null
+			// },
+			toLine(name) {
+				return name.replace(/([A-Z])/g, "-$1").toLowerCase();
+			}
+		}
+	}
+</script>
+
+<style>
+	.uni-transition {
+		transition-timing-function: ease;
+		transition-duration: 0.3s;
+		transition-property: transform, opacity;
+	}
+
+	.fade-in {
+		opacity: 0;
+	}
+
+	.fade-active {
+		opacity: 1;
+	}
+
+	.slide-top-in {
+		/* transition-property: transform, opacity; */
+		transform: translateY(-100%);
+	}
+
+	.slide-top-active {
+		transform: translateY(0);
+		/* opacity: 1; */
+	}
+
+	.slide-right-in {
+		transform: translateX(100%);
+	}
+
+	.slide-right-active {
+		transform: translateX(0);
+	}
+
+	.slide-bottom-in {
+		transform: translateY(100%);
+	}
+
+	.slide-bottom-active {
+		transform: translateY(0);
+	}
+
+	.slide-left-in {
+		transform: translateX(-100%);
+	}
+
+	.slide-left-active {
+		transform: translateX(0);
+		opacity: 1;
+	}
+
+	.zoom-in-in {
+		transform: scale(0.8);
+	}
+
+	.zoom-out-active {
+		transform: scale(1);
+	}
+
+	.zoom-out-in {
+		transform: scale(1.2);
+	}
+</style>

+ 1 - 2
lib/dever/components/video.nvue

@@ -31,7 +31,7 @@
 			<cover-image
 			class="ico-video-play" v-if="!playButton"></cover-image>
 			
-			<position :item="position_item" :down="src" :button="position_save" v-if="position_item"></position>
+			<dever-position :item="position_item" :down="src" :button="position_save" v-if="position_item"></dever-position>
 			
 			<cover-view class="cover-view-right" v-if="showInfo">
 				<cover-image :src="pic"
@@ -64,7 +64,6 @@
 <script>
 import position from "@/lib/dever/components/position.vue";
 export default {
-	name: "dever-video",
 	props: {
 		src : {
 			type    : String,

BIN
lib/dever/images/live_weixin.png


+ 202 - 2
lib/dever/index.js

@@ -554,6 +554,144 @@ var upload = {
 			}
 		});
 	}
+}
+
+var share = 
+{
+    wechat : false,
+    url : '',
+    project : '',
+    uid : '-1',
+    param : {
+        title : '',
+        pic : '',
+        content : '',
+        link : '',
+    },
+    init : function(uid, project, url, param, button)
+    {
+        var self = this;
+        self.wechat = dever.is_weixin();
+        self.project = project;
+        self.url = url;
+        self.uid = uid;
+        self.param = param;
+		self.param.timelineCallback = function() {};
+		self.param.sendMessageCallback = function() {};
+		self.param.shareQQCallback = function() {};
+
+        if (self.wechat) {
+            self.wechatInit();
+        }
+        self.reflux();
+    }
+
+    ,wechatInit: function()
+    {
+        var self = this;
+        var url = this.url + 'init?callback=?';
+        var param = this.param;
+        var project = this.project;
+		var options = {};
+		options.project = project;
+		options.url = location.href.split('#')[0];
+		options.noloading = 1;
+		http.request('post', url, options, function(result) {
+			var data = result.data;
+			wx.config({
+			    //debug:true,
+			    appId: data.appId,
+			    timestamp: data.timestamp,
+			    nonceStr: data.nonceStr,
+			    signature: data.signature,
+			    jsApiList: [
+			        'onMenuShareTimeline',
+			        'onMenuShareAppMessage',
+			        'onMenuShareQQ'
+			    ]
+			});
+			
+			wx.ready(function() {
+			    wx.onMenuShareAppMessage({
+			        title: param.title,
+			        desc: param.content,
+			        link: param.link,
+			        imgUrl: param.pic,
+			        success: function(res) {
+			            param.sendMessageCallback('success', res)
+			            self.shareLog(1, 1);
+			        },
+			        cancel: function(res) {
+			            param.sendMessageCallback('cancel', res)
+			            self.shareLog(1, 2);
+			        },
+			        fail: function(res) {
+			            param.sendMessageCallback('fail', res)
+			            self.shareLog(1, 3);
+			        }
+			    });
+			    wx.onMenuShareTimeline({
+			        title: param.title,
+			        link: param.url,
+			        imgUrl: param.img,
+			        success: function(res) {
+			            param.timelineCallback('success', res)
+			            self.shareLog(2, 1);
+			        },
+			        cancel: function(res) {
+			            param.timelineCallback('cancel', res)
+			            self.shareLog(2, 2);
+			        },
+			        fail: function(res) {
+			            param.timelineCallback('fail', res)
+			            self.shareLog(2, 3);
+			        }
+			    });
+			    wx.onMenuShareQQ({
+			        title: param.title,
+			        link: param.url,
+			        imgUrl: param.img,
+			        success: function(res) {
+			            param.shareQQCallback('success', res)
+			            self.shareLog(3, 1);
+			        },
+			        cancel: function(res) {
+			            param.shareQQCallback('cancel', res)
+			            self.shareLog(3, 2);
+			        },
+			        fail: function(res) {
+			            param.shareQQCallback('fail', res)
+			            self.shareLog(3, 3);
+			        }
+			    });
+			});
+		});
+    }
+
+    ,reflux: function() {
+        var refer = document.referrer,
+            url = encodeURIComponent(document.location.href),
+            param = location.search.substr(1),
+            ua = encodeURIComponent(navigator.userAgent),
+            project = this.project,
+            uid = this.uid,
+            wechat = this.wechat;
+
+        if (param.indexOf("tsina-") > -1 || param.indexOf("timeline") > -1 || param.indexOf("singlemessage") > -1 || param.indexOf("groupmessage") > -1) {
+            var url = this.url + 'reflux?callback=?' + '&project='+project+'&url=' + url + '&ua=' + ua + '&param=' + encodeURIComponent(param) + '&uid=' + uid + '&type=' + wechat;
+			http.request('post', url, {noloading:1});
+        }
+    }
+
+    ,shareLog: function(actType, actResult) {
+        var project = this.project;
+        var uid = this.uid;
+        var wechat = this.wechat;
+        var ua = encodeURIComponent(navigator.userAgent);
+        var url = encodeURIComponent(document.location.href);
+		var url = this.url + 'collect?callback=?' + '&project='+project+'&url=' + url + '&actType=' + actType + '&actResult=' + actResult + '&ua=' + ua + '&uid=' + uid + '&type=' + wechat
+		http.request('post', url, {noloading:1});
+    }
 }
 
 var dever = {
@@ -1108,10 +1246,14 @@ var dever = {
 	},
 	
 	//微信提醒
-	wxTip : function() {
+	wxTip : function(type) {
 		var wx = this.is_weixin();
 		if (wx) {
-			var tip = '<div id="weixin-tip" style="position: fixed; left:0; top:0; background: rgba(0,0,0,0.8); filter:alpha(opacity=80); width: 100%; height:100%; z-index: 100;"  onclick="document.getElementById(\'weixin-tip\').remove()"><p style="text-align: center; margin-top: 10%; padding:0 5%;"><img src="static/dever/live_weixin.png" alt="微信打开" style="max-width: 100%; height: auto;"/></p></div>';
+			var img = 'live_weixin';
+			if (type) {
+				img = 'weixin-guide';
+			}
+			var tip = '<div id="weixin-tip" style="position: fixed; left:0; top:0; background: rgba(0,0,0,0.8); filter:alpha(opacity=80); width: 100%; height:100%; z-index: 100;"  onclick="document.getElementById(\'weixin-tip\').remove()"><p style="text-align: center; margin-top: 10%; padding:0 5%;"><img src="static/dever/'+img+'.png" alt="微信打开" style="max-width: 100%; height: auto;"/></p></div>';
 			this.html(tip);
 			return true;
 		}
@@ -1468,6 +1610,64 @@ var dever = {
 	
 	sleep : function(time) {
 		return new Promise((resolve) => setTimeout(resolve, time));
+	},
+	
+	//分享功能初始化
+	shareInit : function(data) {
+		
+	},
+	
+	//通用的分享功能
+	share : function(provider, scene, type, data, success, error) {
+		if (this.source == 'h5') {
+			var weixin = this.wxTip(1);
+			if (!weixin) {
+				this.alert('请点击复制按钮');
+			}
+		} else {
+			var config = {
+				provider: provider,
+				type: type,
+				scene: scene,
+				href: data.link,
+				title: data.title,
+				summary: data.content,
+				imageUrl: data.pic,
+				success: function(res) {
+					if (success) {
+						success(res);
+					} else {
+						console.log("success:" + JSON.stringify(res));
+					}
+				},
+				fail: function(err) {
+					if (error) {
+						success(err);
+					} else {
+						console.log("fail:" + JSON.stringify(err));
+					}
+				}
+			};
+			if (data.media) {
+				config.mediaUrl = media;
+			}
+			if (this.source == 'applet') {
+				if (!data.path) {
+					console.log('data.path未定义!');
+					return;
+				}
+				if (!data.applet_id) {
+					console.log('data.applet_id未定义!');
+					return;
+				}
+				config.miniProgram = {};
+				config.miniProgram.id = data.applet_id;
+				config.miniProgram.path = data.path;
+				config.miniProgram.type = 0;
+				config.miniProgram.webUrl = data.link;
+			}
+			uni.share(config);
+		}
 	}
 }
 

BIN
lib/dever/static/share/background.png


BIN
lib/dever/static/share/copy.png


BIN
lib/dever/static/share/pengyouquan.png


BIN
lib/dever/static/share/poster.png


BIN
lib/dever/static/share/qq.png


BIN
lib/dever/static/share/weibo.png


BIN
lib/dever/static/share/weixin-guide.png


BIN
lib/dever/static/share/weixin.png


+ 16 - 8
pages/dream/buy.vue

@@ -35,10 +35,10 @@
 			<view class="grace-news-list">
 				<view class="grace-news-item" style="padding: 12rpx 8rpx;border: 1px dashed cornflowerblue;">
 					<view class="grace-news-body">
-						<text class="grace-news-title">{{fetch.info.share_title}}</text>
-						<text class="grace-news-desc">{{fetch.info.share_content}}</text>
+						<text class="grace-news-title">{{fetch.share.title}}</text>
+						<text class="grace-news-desc">{{fetch.share.content}}</text>
 					</view>
-					<image :src="fetch.info.share_pic" class="image grace-news-img grace-news-img-r"></image>
+					<image :src="fetch.share.pic" class="image grace-news-img grace-news-img-r"></image>
 				</view>
 				<view class="grace-news-info">
 					<view style="width:500rpx;margin-top:20rpx;justify-content: center;" class="grace-nowrap">
@@ -50,16 +50,16 @@
 			</view>
 			<!--
 			<view class="share_left">
-				<text class="p">{{fetch.info.share_title}}</text>
-				<text class="p">{{fetch.info.share_content}}</text>
+				<text class="p">{{fetch.share.title}}</text>
+				<text class="p">{{fetch.share.content}}</text>
 			</view>
 			<view class="share_right">
-				<image :src="fetch.info.share_pic" class="image"></image>
+				<image :src="fetch.share.pic" class="image"></image>
 			</view>
 			-->
 			<view class="grace-form-item grace-border-b">
 				<view class="grace-form-body" style="margin-left:0rpx">
-					<input type="text" class="grace-form-input" name="name1" placeholder="在这里输入一句话,你的好友能够看到哦~" />
+					<input type="text" class="grace-form-input" style="text-align:left" name="desc" @blur="saveTicket" @confirm="saveTicket" v-model="fetch.ticket.desc" placeholder="在这里输入一句话,你的好友能够看到哦~" />
 				</view>
 			</view>
 			<view class="btn-wrapper">
@@ -109,7 +109,8 @@ export default {
 	methods:{
 		getData : function() {
 			var self = this;
-			this.Dever.get(this, 'app/collection/?l=api.getBuy', {id:this.id}, function(t) {
+			var url = this.Dever.host + '/pages/dream/index';
+			this.Dever.get(this, 'app/collection/?l=api.getBuy', {id:this.id, code:this.code, url:url}, function(t) {
 				self.show = true;
 			});
 		},
@@ -150,6 +151,13 @@ export default {
 		hideBuy : function() {
 			this.show = false;
 			this.$emit('hideBuy');
+		},
+		saveTicket : function() {
+			var data = {};
+			data.ticket_id = this.fetch.ticket.id;
+			data.desc = this.fetch.ticket.desc;
+			data.noloading = 1;
+			this.Dever.post('app/user/?l=api.ticketSave', data);
 		}
 	},
 	components:{

+ 1 - 1
pages/dream/func/community.vue

@@ -16,7 +16,7 @@
 		</view>
 		
 		<view v-if="show">
-			<publish :title="title" :is_upload="true" @hideModal="hideModal" @getRefresh="getRefresh" :cate_id="cate_id" :type="type" :type_id="type_id"></publish>
+			<dever-publish :title="title" :is_upload="true" @hideModal="hideModal" @getRefresh="getRefresh" :cate_id="cate_id" :type="type" :type_id="type_id"></dever-publish>
 		</view>
 	</view>
 </template>

+ 7 - 13
pages/dream/func/share.vue

@@ -77,7 +77,7 @@
 			<view slot="btns" class="grace-space-between">
 				<text class="grace-dialog-buttons" @tap="closeText">关闭</text>
 				<text class="grace-dialog-buttons grace-blue" @tap="textLinkCopy">复制+链接</text>
-				<text class="grace-dialog-buttons grace-blue" @tap="textCopy">复制</text>
+				<text class="grace-dialog-buttons grace-blue" @tap="textCopy(false)">复制</text>
 			</view>
 		</graceDialog>
 		
@@ -183,9 +183,12 @@ export default {
 			
 			this.text_index = index;
 		},
-		textCopy : function() {
+		textCopy : function(link) {
 			var self = this;
 			var value = this.fetch.text[this.text_index].content;
+			if (link) {
+				value += "\r\n" + link;
+			}
 			copyText.getClipboardData(value, function(res) {
 				if (res) {
 					self.Dever.alert('复制成功');
@@ -194,17 +197,8 @@ export default {
 				}
 			});
 		},
-		textLinkCopy : function() {
-			var self = this;
-			var value = this.fetch.text[this.text_index].content;
-			value += "\r\n" + this.fetch.info.url;
-			copyText.getClipboardData(value, function(res) {
-				if (res) {
-					self.Dever.alert('复制成功');
-				} else {
-					self.Dever.alert('复制失败');
-				}
-			});
+		textLinkCopy : function() {
+			this.textCopy(this.fetch.info.url);
 		},
 		// 轮播图变化
 		onSwiperChange(e) {

+ 13 - 10
pages/dream/index.vue

@@ -41,7 +41,9 @@
 			
 			<view v-if="infoState">
 				<info :id="id" :bgcolor="fetch.button.bgcolor" :color="fetch.button.color" @hideInfo="hideInfo"></info>
-			</view>
+			</view>
+			
+			<dever-share ref="share" :id="id" :data="fetch.share"></dever-share>
 			
 			<view class="mask buy-layer" v-if="inviteState && fetch.info.user">
 			  <view class="buytip-layer layer " catchtap="handleStop">
@@ -68,7 +70,8 @@
 <script>
 import buy from "@/pages/dream/buy.vue";
 import ranking from "@/pages/dream/ranking.vue";
-import info from "@/pages/dream/info.vue";
+import info from "@/pages/dream/info.vue";
+import deverShare from '@/lib/dever/components/share.vue';
 export default{
 	data() {
 		return {
@@ -91,6 +94,7 @@ export default{
 	},
 	onLoad(option) {
 		this.id = option.id;
+		this.code = option.code;
 		this.Dever.login = 'user/login?id=' + this.id;
 		this.Dever.checkLogin();
 		this.getData();
@@ -103,8 +107,9 @@ export default{
 		change : function(e) {
 			this.swiper.index = e.detail.current;
 		},
-		getData : function() {
-			this.Dever.get(this, 'app/collection/?l=api.getInfo', {id:this.id}, function(t) {
+		getData : function() {
+			var url = this.Dever.host + '/pages/dream/index';
+			this.Dever.get(this, 'app/collection/?l=api.getInfo', {id:this.id,code:this.code,url:url}, function(t) {
 				uni.setNavigationBarTitle({
 					title:t.info.name
 				});
@@ -128,6 +133,8 @@ export default{
 			this.inviteState = false;
 		},
 		showBuy : function() {
+			this.$refs.share.open();
+			return;
 			this.buyState = true;
 		},
 		hideBuy : function() {
@@ -144,14 +151,10 @@ export default{
 		},
 		hideInfo : function() {
 			this.infoState = false;
-		},
-		share : function() {
-			//从后端获取分享链接需要的加密参数
-			
-		}
+		},
 	},
 	components:{
-		buy,ranking,info
+		buy,ranking,info,deverShare
 	}
 }
 </script>

+ 4 - 4
pages/dream/view.vue

@@ -3,7 +3,7 @@
 		<view class="container" slot="gBody">
 			<ourLoading isFullScreen :active="pageLoading" :text="pageLoadingText" />
 			<view v-if="fetch.items.length > 0">
-				<drawerPage :show="drawer.show ? 'left' : ''">
+				<dever-drawer-page :show="drawer.show ? 'left' : ''">
 					<view class="container_main" slot="links" @click="closeDrawer()">
 						<block v-if="show">
 							<swiper class="swiper" @change="change" :circular="swiper.circular" :current="fetch.index">
@@ -18,10 +18,10 @@
 							<dream ref="dream" @showDrawer="showDrawer" :index="fetch.index" :item="fetch.items[fetch.index]" :control="control" :bottom="bottom" class="item"></dream>
 						</block>
 					</view>
-				</drawerPage>
+				</dever-drawer-page>
 				
 				
-				<drawerWindow v-for="(v, k) in drawer.item" :key="k" :type="k" :show="v.show" :zIndex="v.index" padding="v.padding" :top="v.top" :direction="v.direction" :width="v.width" v-on:closeDrawer="closeDrawer(k)" v-on:bottomFunc="bottomFunc">
+				<dever-drawer-window v-for="(v, k) in drawer.item" :key="k" :type="k" :show="v.show" :zIndex="v.index" padding="v.padding" :top="v.top" :direction="v.direction" :width="v.width" v-on:closeDrawer="closeDrawer(k)" v-on:bottomFunc="bottomFunc">
 					<view slot="links">
 						<block v-if="k == 'cate'">
 							<cate ref="cate" @goIndex="goIndex" :index="fetch.index" :content_id="content_id" :width="v.width" :param="v.param" :page_id="fetch.page_id"  @getCate="getCate"></cate>
@@ -47,7 +47,7 @@
 							<share ref="share" @goIndex="goIndex" :index="fetch.index" :content_id="content_id" :width="v.width" :param="v.param" :type="type"></share>
 						</block>
 					</view>
-				</drawerWindow>
+				</dever-drawer-window>
 				
 				<y-Fab v-if="!drawer.show && fetch.user.avatar && show" :bottom="20" :right="20" :btnList="drawer.button" @click="clickDrawerButton" :text="`P`+(swiper.index+1)" :icon_o="fetch.user.avatar"></y-Fab>
 				<y-Fab v-if="!show" :bottom="20" :right="20" @click="goHome" :text="`首页`"></y-Fab>

+ 2 - 2
pages/dream/view/audioComment.vue

@@ -13,10 +13,10 @@
 			</dever-audio>
 		</view>
 		<block v-if="item.type == 2">
-			<comment ref="comment" :item="item" :type="`content/video_comment`" :type_id="item.id"></comment>
+			<dever-comment ref="comment" :item="item" :type="`content/video_comment`" :type_id="item.id"></dever-comment>
 		</block>
 		<block v-if="item.type == 1">
-			<seat ref="seat" :item="item" :type="`content/video_comment`" :type_id="item.id" @start="start" @stop="stop"></seat>
+			<dever-seat ref="seat" :item="item" :type="`content/video_comment`" :type_id="item.id" @start="start" @stop="stop"></dever-seat>
 		</block>
 	</view>
 </template>

+ 2 - 2
pages/dream/view/liveComment.vue

@@ -13,10 +13,10 @@
 			</dever-video>
 		</view>
 		<block v-if="item.type == 2">
-			<comment ref="comment" :item="item" :type="`content/video_comment`" :type_id="item.id"></comment>
+			<dever-comment ref="comment" :item="item" :type="`content/video_comment`" :type_id="item.id"></dever-comment>
 		</block>
 		<block v-if="item.type == 1">
-			<seat ref="seat" :item="item" :type="`content/video_comment`" :type_id="item.id" @start="start" @stop="stop"></seat>
+			<dever-seat ref="seat" :item="item" :type="`content/video_comment`" :type_id="item.id" @start="start" @stop="stop"></dever-seat>
 		</block>
 	</view>
 </template>

+ 1 - 1
pages/dream/view/pic.vue

@@ -1,7 +1,7 @@
 <template name="pic">
 	<view class="cover cover-height">
 		<image @click="Dever.viewPic([item.pic], item.pic)" :src="item.pic" mode="widthFix" :class="['default', 'slide-image', 'slide-image-'+item.type]"  style="height:auto"></image>
-		<position :item="item.text" :down="item.pic" :button="item.is_button"></position>
+		<dever-position :item="item.text" :down="item.pic" :button="item.is_button"></dever-position>
 	</view>
 </template>
 

+ 1 - 1
pages/dream/view/product.vue

@@ -95,7 +95,7 @@
 				<y-Fab :bottom="20" :right="20" v-if="!attrIsShow" @click="back" text="返回"></y-Fab>
 			</block>
 			<view v-if="showComment">
-				<publish :title="title" :is_upload="true" @hideModal="hideModal" @getRefresh="getRefresh" :type="key" :type_id="item.goods.id" :api="api"></publish>
+				<dever-publish :title="title" :is_upload="true" @hideModal="hideModal" @getRefresh="getRefresh" :type="key" :type_id="item.goods.id" :api="api"></dever-publish>
 			</view>
 		</view>
 		<!-- 底部 -->

+ 2 - 2
pages/dream/view/vodComment.vue

@@ -14,10 +14,10 @@
 			</dever-video>
 		</view>
 		<block v-if="item.type == 2">
-			<comment ref="comment" :item="item" :type="`content/video_comment`" :type_id="item.id"></comment>
+			<dever-comment ref="comment" :item="item" :type="`content/video_comment`" :type_id="item.id"></dever-comment>
 		</block>
 		<block v-if="item.type == 1">
-			<seat ref="seat" :item="item" :type="`content/video_comment`" :type_id="item.id" @start="start" @stop="stop"></seat>
+			<dever-seat ref="seat" :item="item" :type="`content/video_comment`" :type_id="item.id" @start="start" @stop="stop"></dever-seat>
 		</block>
 	</view>
 </template>

Some files were not shown because too many files changed in this diff