Forráskód Böngészése

1.屏蔽充值功能添加邀请页面目录入口
2.添加语音切换页面及入口测试

306132416@qq.com 6 éve%!(EXTRA string=óta)
szülő
commit
707172df91

+ 7 - 0
pages.json

@@ -42,7 +42,14 @@
 		    "style" : {
 				"navigationBarTitleText": "套餐"
 			}
+		},
+		{
+		    "path" : "pages/share/sharePage",
+		    "style": {
+		    		"navigationBarTitleText": "邀好友 赚查询次数"
+		    		}
 		}
+		
     ],
 	"globalStyle": {
 		"navigationBarTextStyle": "black",

+ 247 - 9
pages/index/index.vue

@@ -39,30 +39,71 @@
 
 		</scroll-view>
 		<view class="send-box" :style="{ 'padding-bottom' : isShowKeyBoard + 'px'}">
-			<input type="text" class="enter-box" v-model="inputInfo" :adjust-position="true"  @focus="isNeedAuth()"
+			<image :src="[!isVoiceType ? '/static/icon/voice-icon.png' : '/static/icon/keyBoard-icon.png']"  @click.stop='tabVoice()'></image>
+		    
+			<view class="voice-mode" v-if='isVoiceType' @touchstart="voiceBegin" @touchmove.stop.prevent="voiceIng" @touchend="voiceEnd" @touchcancel="voiceCancel">{{voiceTis}}</view>
+			
+			<input type="text"  v-if="!isVoiceType" class="enter-box" v-model="inputInfo" :adjust-position="true"  @focus="isNeedAuth()"
 		    :style="{'width':inputWidth}" confirm-hold='true' confirm-type='send' @confirm="sendInputInfo" />
+			
 			<!-- @input='isInputing' -->
 			<!-- <button type="primary" class="submit-message" @click="sendInputInfo()" v-if='isShowSend'>发送</button> -->
 			<image src="/static/setIcon.png"  @click.stop='openModal()' v-if='isShowSetCenter'></image>
 		</view>
+		
+		<!-- 录音UI效果 -->
+		<view class="record" :class="recording?'':'hidden'">
+			<view class="ing" :class="willStop?'hidden':''"><image src="../../static/icon/send-icon.png" style="width: 64rpx;height:  64rpx;"></image></view>
+			<view class="cancel" :class="willStop?'':'hidden'"><image src="../../static/icon/cancel-icon.png" style="width:  64rpx;height:  64rpx;"></image></view>
+			<view class="tis" :class="willStop?'change':''">{{recordTis}}</view>
+		</view>
+		
 		 <!-- <drag-button :isDock="true" :existTabBar="true"  @btnClick="goUserSelf" /> -->
 		<uni-popup ref="popup" type="bottom">
 		   <view class="uni-share">
 		 		<view class="uni-share-content">
-		 			<view  class="uni-share-content-box" @click.stop='goUserSelf' >
+		 			
+					<view  class="uni-share-content-box" @click.stop='goUserSelf' >
 		 				<view class="uni-share-content-image">
 		 					<image src="/static/icon/userSetIcon.png" class="image" />
 		 				</view>
 		 			<view class="uni-share-content-text">个人中心</view>
 		 	      </view>
 				  
-				  <view  class="uni-share-content-box" @click.stop='goRecharge'  v-if="!isIos">
+			      <view  class="uni-share-content-box" @click.stop='goSharePage' >
+			      		<view class="uni-share-content-image">
+			      		 	<image src="/static/icon/share-icon.png" class="image" />
+			      		 </view>
+			      		<view class="uni-share-content-text">邀好友奖查询次数</view>
+			      </view>
+			      
+				<!--  <view  class="uni-share-content-box" @click.stop='tabVoice' >
+				  		<view class="uni-share-content-image">
+				  		 	<image src="/static/icon/userSetIcon.png" class="image" />
+				  		 </view>
+				  		 <view class="uni-share-content-text">语音输入</view>
+				  </view> -->
+				  
+				  
+				<view  class="uni-share-content-box" @click.stop='clearChat' >
+						<view class="uni-share-content-image">
+						 	<image src="/static/icon/clean-icon.png" class="image" />
+						 </view>
+						<view class="uni-share-content-text">清空</view>
+				</view>
+				  
+			
+			
+			
+			<!-- 	  <view  class="uni-share-content-box" @click.stop='goRecharge'  v-if="!isIos">
 				  			<view class="uni-share-content-image">
 				  				 <image src="/static/icon/recharge.png" class="image" />
 				  			</view>
 				  		<view class="uni-share-content-text">去充值</view>
-				  </view>
-		 		 </view>
+				  </view> -->
+		 		
+				
+			 </view>
 				
 				 <view class="uni-share-btn" @click="cancelModal()">取消</view>
 		 	  </view>
@@ -74,6 +115,8 @@
 	import uniPopup from "@/components/uni-popup/uni-popup.vue"
 	var md5 = require("../../common/md5.js");
 	var page = 1;
+	const recorderManager = uni.getRecorderManager();
+	const innerAudioContext = uni.createInnerAudioContext();
 	export default {
 		data() {
 			return {
@@ -81,7 +124,7 @@
 				isShowSetModal:false,
 				isShowSetCenter:true,
 				isShowRecharge:false,
-				inputWidth:'80%',
+				inputWidth:'70%',
 				title: 'RABOT',
 				nowTime: '',
 				nowHeight: '622px',
@@ -105,7 +148,25 @@
 				isAuth:true,
 				iv:'',
 				session_key:'',
-				encryptedData:''
+				encryptedData:'',
+				
+				//录音相关参数
+				isVoiceType:false,
+				RECORDER:uni.getRecorderManager(),
+				isVoice:false,
+				voiceTis:'按住 说话',
+				recordTis:"手指上滑 取消发送",
+				recording:false,
+				willStop:false,
+				initPoint:{identifier:0,Y:0},
+				recordTimer:null,
+				recordLength:0,
+				
+				//播放语音相关参数
+				AUDIO:uni.createInnerAudioContext(),
+				playMsgid:null,
+				VoiceTimer:null,
+				voicePath: ''
 			}
 		},
 		components: {
@@ -124,6 +185,10 @@
 		onLoad() {
 			this.userLogin();
 			this.getEquipmentHeight();
+			
+			this.AUDIO.onEnded((res)=>{
+				this.playMsgid=null;
+			});
 		},
 		onShow() {
 			// this.getNowTime();
@@ -415,6 +480,20 @@
 			getInputBlur(){
 				//this.isShowKeyBoard = 0
 			},
+			goSharePage(){
+				uni.navigateTo({
+					url: '../share/sharePage',
+					success: res => {},
+					fail: () => {},
+					complete: () => {}
+				});
+			},
+			tabVoice(){
+				this.isVoiceType = !this.isVoiceType;
+			},
+			clearChat(){
+				
+			},
 			openModal(){
 			        // 需要在 popup 组件,指定 ref 为 popup
 					if(!this.isAuth){
@@ -431,9 +510,87 @@
 			cancelModal(){
 				          // 需要在 popup 组件,指定 ref 为 popup
 				     this.$refs.popup.close();
-			  }
+			  },
+			  // 录音开始
+			  voiceBegin(e){
+			  	console.log(e)
+			  	if(e.touches.length>1){
+			  		return ;
+			  	}
+			  	this.initPoint.Y = e.touches[0].clientY;
+			  	this.initPoint.identifier = e.touches[0].identifier;
+			    this.recordBegin(e)
+			  	this.RECORDER.start({format:"mp3"});//录音开始,
+			
+			  },
+			  //录音开始UI效果
+			  recordBegin(e){
+			  	this.recording = true;
+			  	this.voiceTis='松开 结束';
+			  	this.recordLength = 0;
+			  	this.recordTimer = setInterval(()=>{
+			  		this.recordLength++;
+			  	},1000)
+			  },
+			  // 录音被打断
+			  voiceCancel(){
+			  	this.recording = false;
+			  	this.voiceTis='按住 说话';
+			  	this.recordTis = '手指上滑 取消发送'
+			  	this.willStop = true;//不发送录音
+			  	this.RECORDER.stop();//录音结束
+				this.recordEnd()
+			  },
+			  // 录音中(判断是否触发上滑取消发送)
+			  voiceIng(e){
+			  	if(!this.recording){
+			  		return;
+			  	}
+			  	let touche = e.touches[0];
+			  	//上滑一个导航栏的高度触发上滑取消发送
+			  	if(this.initPoint.Y - touche.clientY>=uni.upx2px(100)){
+			  		this.willStop = true;
+			  		this.recordTis = '松开手指 取消发送'
+			  	}else{
+			  		this.willStop = false;
+			  		this.recordTis = '手指上滑 取消发送'
+			  	}
+			  },
+			  // 结束录音
+			  voiceEnd(e){
+			  	if(!this.recording){
+			  		return;
+			  	}
+			  	this.recording = false;
+			  	this.voiceTis='按住 说话';
+			  	this.recordTis = '手指上滑 取消发送'
+			  	this.RECORDER.stop();//录音结束
+				console.log(e)
+				this.recordEnd(e);
+			  },
+			  //录音结束(回调文件)
+			  recordEnd(e){
+			  	clearInterval(this.recordTimer);
+			  	if(!this.willStop){
+			  		console.log("e: " + JSON.stringify(e));
+			  		let msg = {
+			  			length:0,
+			  			url:e.tempFilePath
+			  		}
+			  		let min = parseInt(this.recordLength/60);
+			  		let sec = this.recordLength%60;
+			  		min = min<10?'0'+min:min;
+			  		sec = sec<10?'0'+sec:sec;
+			  		msg.length = min+':'+sec;
+			  		console.log(msg)	
+			  		//this.sendMsg(msg,'voice');
+			  	}else{
+			  		console.log('取消发送录音');
+			  	}
+			  	this.willStop = false;
+			  },
 			},
-			
+		
 			onShareAppMessage(){
 				
 			}
@@ -668,4 +825,85 @@
 	.auth button:after{
 		border: 0px;
 	}
+	
+	.voice-mode {
+		width: 70%;
+		height: 70rpx;
+		background: #fff;
+		border-radius: 1%;
+		text-align: left;
+		margin: 8px;
+		margin-bottom: 10px;
+		padding-left:8px;
+		text-align: center;
+		line-height: 70rpx;
+	}
+	
+	
+.icon {
+		font-family:"HMfont-home" !important;
+		font-size:56upx;
+		font-style:normal;
+		color: #333;
+	}
+
+.hidden{
+	display: none !important;
+}
+.record{
+	width: 40vw;
+	height: 40vw;
+	position: fixed;
+	top: 55%;
+	left: 30%;
+	background-color: rgba(0,0,0,.6);
+	border-radius: 20upx;	
+}
+.ing{
+		width: 100%;
+		height: 30vw;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		// 模拟录音音效动画	
+	}
+	@keyframes volatility {
+			0% {background-position: 0% 130%;}
+			20% {background-position: 0% 150%;}
+			30% {background-position: 0% 155%;}
+			40% {background-position: 0% 150%;}
+			50% {background-position: 0% 145%;}
+			70% {background-position: 0% 150%;}
+			80% {background-position: 0% 155%;}
+			90% {background-position: 0% 140%;}
+			100% {background-position: 0% 135%;}
+		}
+.cancel{
+		width: 100%;
+		height: 30vw;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+	}
+	.icon{
+		background-image:linear-gradient(to bottom,#f09b37,#fff 50%); 
+		background-size:100% 200%;
+		animation: volatility 1.5s ease-in-out -1.5s infinite alternate;
+		-webkit-background-clip:text; 
+		-webkit-text-fill-color:transparent; 
+		font-size: 150upx;
+		color: #f09b37;
+	}
+	.tis{
+		width: 100%;
+		height: 10vw;
+		display: flex;
+		justify-content: center;
+		font-size: 28upx;
+		color: #fff;
+		
+	}
+	.change{
+		color: #f09b37;
+	}
 </style>

+ 25 - 4
pages/selfInfo/selfInfo.vue

@@ -20,7 +20,7 @@
 			</view>
 		</view>
 		
-		<view class="self-pay-box" v-if='!isIos'>
+		<!-- <view class="self-pay-box" v-if='!isIos'> 
 			<view class="search-content">
 				<view class="search-content-value" style="color:#000;font-size: 38upx;margin-left: -11%;">查询套餐</view>
 				<view class="search-content-text">限时优惠进行中</view>
@@ -29,10 +29,10 @@
 				<image src="../../static/payIcon.png" mode=""></image>
 				<button type="primary">去购买</button>
 			</view>
-		</view>
+		</view> -->
 		
-		<view class="self-setting-box" @click.stop="goRechargePage()">
-			<view class="setting-content-box" style="border-bottom: 1upx solid #d9d9d9" v-if='!isIos'>
+		<view class="self-setting-box">
+			<!-- <view class="setting-content-box" style="border-bottom: 1upx solid #d9d9d9" v-if='!isIos' @click.stop="goRechargePage()"> 
 				<view class="setting-content-text">
 					<image src="../../static/icon/moneyIcon.png" mode=""></image>
 				    <text>充值记录</text>
@@ -40,8 +40,21 @@
 				<view style="margin-right: 2%;margin-top: 2%;">
 					<image src="../../static/icon/arrowIcon.png" mode="" style="width: 32upx;height:32upx;"></image>
 				</view>
+			 </view> -->
+			
+			<view class="setting-content-box" @click.stop="inviteFriend()">
+				<view class="setting-content-text">
+					<image src="../../static/icon/askIcon.png" mode="" class="askIcon"></image>
+				    <text>邀好友</text>
+				</view>
+				<view style="margin-right: 2%;margin-top:2%;display: flex;">
+					<text style="font-size: 25upx;color:#999999;padding-right: 20rpx;">邀1人得10次查询机会</text>
+					<image src="../../static/icon/arrowIcon.png" mode="" style="width: 32upx;height:32upx;"></image>
+				</view>
 			</view>
 			
+			
+			
 			<view class="setting-content-box" @click.stop="goMyAskPage()">
 				<view class="setting-content-text">
 					<image src="../../static/icon/askIcon.png" mode="" class="askIcon"></image>
@@ -140,6 +153,14 @@
 					delta:0
 				})
 			},
+			inviteFriend(){
+				uni.navigateTo({
+					url: '../share/sharePage',
+					success: res => {},
+					fail: () => {},
+					complete: () => {}
+				});
+			},
 			goRechargePage(){
 				uni.navigateTo({
 					url: './rechargeRecord/rechargeRecord',

+ 32 - 0
pages/share/sharePage.vue

@@ -0,0 +1,32 @@
+<template>
+	
+	<div class='share-bg-box'>
+		 <image src="../../static/share-bg.png"></image>
+	</div>
+	
+</template>
+
+<script>
+</script>
+
+	
+<style>
+	
+	page {
+		height: 100%;
+		background-image: url("data:image/jpg;base64,/9j/4AAQSkZJRgABAQEA....");
+	}
+	
+	
+	.share-bg-box {
+		width: 100%;
+		height: 100%;
+		/* background-image: '../../static/share-bg.png'; */
+	}
+	.share-bg-box image {
+		width: 100%;
+		height: 100%;
+		z-index: -99;
+	}
+	
+</style>

BIN
static/icon/cancel-icon.png


BIN
static/icon/clean-icon.png


BIN
static/icon/keyBoard-icon.png


BIN
static/icon/send-icon.png


BIN
static/icon/share-icon.png


BIN
static/icon/voice-icon.png


BIN
static/share-bg.png


+ 4 - 1
uni.scss

@@ -73,4 +73,7 @@ $uni-font-size-title:40upx;
 $uni-color-subtitle: #555555; // 二级标题颜色
 $uni-font-size-subtitle:36upx;
 $uni-color-paragraph: #3F536E; // 文章段落颜色
-$uni-font-size-paragraph:30upx;
+$uni-font-size-paragraph:30upx;
+
+
+