Browse Source

Merge branch 'master' of http://git.liuniu946.com/lhl/nzhbsr

hwq 2 years ago
parent
commit
886d197679

+ 9 - 0
api/index.js

@@ -34,3 +34,12 @@ export function loadIndexs(data) {
 	});
 }
 
+// 获取首页信息
+export function geLevertade(data) {
+	return request({
+		url: '/api/Levertade/ctmarket',
+		method: 'get',
+		data
+	});
+}
+

+ 19 - 3
api/login.js

@@ -75,15 +75,31 @@ export function gologin(data) {
 export function getYzm(data) {
 	return request({
 		url: '/api/Login/sendcode',
-		method: 'POST',
+		method: 'get',
 		data
 	})
 }
 export function zc(data) {
 	return request({
 		url: '/api/Login/upregister',
-		method: 'POST',
+		method: 'get',
+		data
+	})
+}
+
+export function getForget(data) {
+	return request({
+		url: '/api/Login/findsendcode',
+		method: 'get',
 		data
 	})
 }
- 
+
+//
+export function resetpwd(data) {
+	return request({
+		url: '/api/Login/resetpwd',
+		method: 'post',
+		data
+	})
+}

+ 41 - 9
pages.json

@@ -12,6 +12,37 @@
 				"navigationBarTitleText": "幣幣交易市場"
 			}
 		},
+		{
+			"path": "pages/transaction/cblist",
+			"style": {
+				"navigationBarTitleText": "充幣列表"
+			}
+		},
+		{
+			"path": "pages/transaction/cbdetail",
+			"style": {
+				"navigationBarTitleText": "充幣詳情"
+			}
+		},
+		{
+			"path": "pages/transaction/tblist",
+			"style": {
+				"navigationBarTitleText": "提幣列表"
+			}
+		},
+		{
+			"path": "pages/transaction/tbdetail",
+			"style": {
+				"navigationBarTitleText": "提幣詳情"
+			}
+		},
+		{
+			"path": "pages/heyue/heyue",
+			"style": {
+				"navigationBarTitleText": "合約交易",
+				"navigationStyle": "custom"
+			}
+		},
 		{
 			"path": "pages/public/register",
 			"style": {
@@ -37,18 +68,13 @@
 		{
 			"path": "pages/public/forget",
 			"style": {
-				"navigationBarTitleText": "忘记密码",
-				"app-plus": {
-					"titleNView": {
-						"type": "transparent"
-					}
-				}
+				"navigationBarTitleText": "重置密碼"
 			}
 		},
 		{
 			"path": "pages/user/user",
 			"style": {
-				"navigationBarTitleText": "我的"
+				"navigationBarTitleText": "資產"
 			}
 		}
 	],
@@ -67,7 +93,7 @@
 				"pagePath": "pages/index/index",
 				"iconPath": "static/tabBar/tab-home.png",
 				"selectedIconPath": "static/tabBar/tab-home-current.png",
-				"text": "首"
+				"text": "首"
 			},
 			{
 				"pagePath": "pages/transaction/transaction",
@@ -75,11 +101,17 @@
 				"selectedIconPath": "static/tabBar/tab-home-current.png",
 				"text": "交易"
 			},
+			{
+				"pagePath": "pages/heyue/heyue",
+				"iconPath": "static/tabBar/tab-home.png",
+				"selectedIconPath": "static/tabBar/tab-home-current.png",
+				"text": "合約"
+			},
 			{
 				"pagePath": "pages/user/user",
 				"iconPath": "static/tabBar/tab-my.png",
 				"selectedIconPath": "static/tabBar/tab-my-current.png",
-				"text": "我的"
+				"text": "資產"
 			}
 		]
 	}

+ 33 - 0
pages/heyue/heyue.vue

@@ -0,0 +1,33 @@
+<template>
+	<view class="content">
+
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+
+			}
+		},
+		onLoad() {
+
+		},
+		onShow() {
+
+		},
+		onReachBottom() {
+
+		},
+		onReady() {
+
+		},
+		methods: {
+
+		}
+	}
+</script>
+
+<style lang="scss">
+</style>

+ 184 - 12
pages/index/index.vue

@@ -12,20 +12,20 @@
 			<view class="gnh-top flex">
 				<view class="top-item flex">
 					<image src="../../static/icon/gn-1.png" mode="" class=""></image>
-					<view class="">认购</view>
+					<view class="">認購</view>
 				</view>
 				<view class="top-item flex">
 					<image src="../../static/icon/gn-2.png" mode="" class=""></image>
-					<view class="">充</view>
+					<view class="">充</view>
 				</view>
 				<view class="top-item flex">
 					<image src="../../static/icon/gn-3.png" mode="" class=""></image>
-					<view class="">提</view>
+					<view class="">提</view>
 				</view>
-				<view class="top-item flex">
+				<!-- <view class="top-item flex">
 					<image src="../../static/icon/gn-4.png" mode="" class=""></image>
-					<view class="">言</view>
-				</view>
+					<view class="">言</view>
+				</view> -->
 				<view class="top-item flex">
 					<image src="../../static/icon/gn-5.png" mode="" class=""></image>
 					<view class="">客服</view>
@@ -68,31 +68,121 @@
 			</view>
 		</view>
 		<!-- 功能盒 end -->
+		<!--  -->
+		<view class="list">
+			<view class="list-title flex">
+				<view class="title-left">交易對</view>
+				<view class="title-center">最新價格</view>
+				<view class="title-right">24h漲跌</view>
+			</view>
+			<!-- <scroll-view class="swiper-box" scroll-y="true" :style="{ height: maxheight }">
+				<view class="list-main flex">
+					<view class="main-left">{{   }}</view>
+					<view class="main-center" :class="{ down: item.zd < 0, ping: item.zd == 0 }">{{ item.price == 0 ? '--.--' : item.price }}</view>
+					<view class="main-right">
+						<view class="btn" :class="{ down: item.zd < 0, ping: item.zd == 0 }">{{ item.zd }}%</view>
+					</view>
+				</view>
+			</scroll-view> -->
+		</view>
 	</view>
 </template>
 
 <script>
+	import {
+		scoketNew,
+		scoketOpen
+	} from '@/utils/socket.js';
+	import {
+		geLevertade
+	} from '@/api/index.js';
 	export default {
 		data() {
 			return {
-
+				maxheight: '',
+				scoket: '',
+				instId: 'IOTA-USDT', //请求的产品id
+				spList:[],//需要查询的列表
+				listOBj:{}//保存实际列表对象
 			};
 		},
 		computed: {
 
 		},
 		onLoad: function(option) {
+			
 
+		},
+		onReady(res) {
+			var _this = this;
+			uni.getSystemInfo({
+				success: resu => {
+					const query = uni.createSelectorQuery();
+					query.select('.swiper-box').boundingClientRect();
+					query.exec(function(res) {
+						_this.maxheight = resu.windowHeight - res[0].top + 'px';
+						console.log('打印页面的剩余高度', _this.maxheight);
+					});
+				},
+				fail: res => {
+					console.log('打印页面的剩余高度', res);
+				}
+			});
 		},
 		onShow: function() {
-
-
+			this.geLevertade()
+		},
+		onHide() {
+			this.closeScoket()
 		},
 		//下拉刷新
 		onPullDownRefresh() {
 
 		},
 		methods: {
+			swiperChange(){
+				
+			},
+			// 开始请求长连接
+			onScoket(){
+				const that = this;
+				that.scoket = scoketNew("wss://wsaws.okx.com:8443/ws/v5/public");
+				that.scoket.scoketOpen().then((res) => {
+					const requestList=that.spList.map((e)=>{
+						return{
+							"channel": "tickers",
+							"instId": e.coinname.toUpperCase()+"-USDT"
+						}
+					})
+					that.scoket.scoketSend({
+						"op": "subscribe",
+						"args": requestList
+					}).then((res) => {
+						console.log(res, '发送成功');
+					})
+					that.scoket.scoketMessage((res)=>{
+						try{
+						that.listOBj[res.arg.instId] = res.data
+						console.log(that.listOBj,'that.listOBj++++++')
+						}catch(e){
+							console.log(res,'报错');
+						}
+					})
+				})
+			},
+			closeScoket(){
+				that.scoket.scoketClose();
+			},
+			// 获取查询列表
+			geLevertade(){
+				const that = this;
+				geLevertade().then((e)=>{
+					that.spList = e.list;
+					// 开启长连接
+					that.onScoket()
+					
+				})
+			},
 			// 轮播图跳转
 			bannerNavToUrl(item) {
 				// #ifdef H5
@@ -117,9 +207,7 @@
 		width: 726rpx;
 		height: 273rpx;
 
-		.carousel-item {
-			
-		}
+		.carousel-item {}
 
 		// margin: 20rpx 0 0;
 		image {
@@ -128,46 +216,56 @@
 			height: 273rpx;
 		}
 	}
+
 	.gnh-wrap {
 		margin: 20rpx 0;
 		width: 750rpx;
 		height: 315rpx;
 		background-color: #fff;
 		border-radius: 50rpx 50rpx 0 0;
+
 		.gnh-top {
 			justify-content: space-around;
 			height: 156rpx;
+
 			.top-item {
 				flex-direction: column;
 				justify-content: center;
 				align-items: center;
+
 				image {
 					width: 66rpx;
 					height: 75rpx;
 				}
+
 				view {
 					font-weight: 500;
 					color: #525C6E;
 				}
 			}
 		}
+
 		.gnh-btm {
 			justify-content: space-around;
+
 			.btm-item {
 				width: 33%;
 				text-align: center;
 				padding-top: 20rpx;
+
 				.btm-item-name {
 					font-size: 24rpx;
 					font-weight: 500;
 					color: #525C6E;
 				}
+
 				.btm-item-val {
 					font-size: 26rpx;
 					font-weight: 500;
 					color: #DD3745;
 					padding: 20rpx 0;
 				}
+
 				.btm-item-bl {
 					font-size: 24rpx;
 					font-weight: 500;
@@ -176,4 +274,78 @@
 			}
 		}
 	}
+	.list {
+		background: #ffffff;
+		border-top-left-radius: 26rpx;
+		border-top-right-radius: 26rpx;
+		padding: 40rpx 15rpx 0;
+		.list-title {
+			font-size: 28rpx;
+			font-family: PingFang SC;
+			font-weight: 500;
+			color: #525c6e;
+			padding-bottom: 32rpx;
+			.title-left {
+				text-align: left;
+				width: 33%;
+			}
+			.title-center {
+				text-align: center;
+				width: 33%;
+			}
+			.title-right {
+				text-align: right;
+				width: 33%;
+			}
+		}
+		.list-main {
+			padding: 12rpx 0;
+			.main-left {
+				text-align: left;
+				width: 33%;
+				font-size: 28rpx;
+				font-family: PingFang SC;
+				font-weight: 500;
+				color: #525c6e;
+			}
+			.main-center {
+				text-align: center;
+				width: 33%;
+				font-size: 28rpx;
+				font-family: PingFang SC;
+				font-weight: 500;
+				color: #e15560;
+				&.down {
+					color: #5ec886;
+				}
+				&.ping {
+					color: #525c6e;
+				}
+			}
+			.main-right {
+				text-align: right;
+				width: 33%;
+				display: flex;
+				justify-content: flex-end;
+				.btn {
+					width: 122rpx;
+					height: 63rpx;
+					background: #e15562;
+					border-radius: 5rpx;
+					text-align: center;
+					line-height: 63rpx;
+					font-size: 24rpx;
+					font-family: PingFang SC;
+					font-weight: 500;
+					color: #ffffff;
+					&.down {
+						background: #5ec886;
+					}
+					&.ping {
+						background: #f6f6f6;
+					}
+				}
+			}
+		}
+	}
 </style>

+ 121 - 109
pages/public/forget.vue

@@ -1,33 +1,38 @@
 <template>
-	<view class="container">
-		<view class="container_text">
-			<image class="banner-img" src="/static/img/img01.png" mode=" scaleToFill"></image>
-		</view>
-		<view class="loginTitle"><text>手机号登录</text></view>
-		<view class="login_text">
-			<view class="login_input flex">
-				<view class="login_img"><image src="/static/icon/img03.png"></image></view>
-				<view class="login_name"><input class="uni-input" v-model="phone" focus placeholder="请输入手机号" /></view>
-			</view>
-			<view class="login_input flex">
-				<view class="login_img"><image src="/static/icon/img06.png"></image></view>
-				<view class="login_name flex">
-					<input class="uni-input width" v-model="code" focus placeholder="请输入验证码" />
-					<view class="code" @click="verification">{{ countDown == 0 ? '验证码' : countDown }}</view>
-				</view>
-			</view>
-			<view>
-				<button type="green" @click="register" class="uni-button uni-button-green">登录</button>
-			</view>
+	<view class="container">
+		<view class="" style="text-align: left;padding-left: 30rpx;font-size: 52rpx;padding-top: 50rpx;">
+			重置密碼
+		</view>
+		<view class="tit" >
+			郵箱
+		</view>
+		<input type="text" class="shuru" placeholder="郵箱" v-model="email">
+		<view class="tit" >
+			新密碼
+		</view>
+		<input type="text" class="shuru" placeholder="新密碼" v-model="lpwd">
+		<view class="tit">
+			郵箱驗證碼
+		</view>
+		<view class="flex" style="width: 673rpx;justify-content: space-between;margin: auto;">
+			<input type="text" class=" yzm" placeholder="驗證碼" v-model="ecode">
+			<view class="code yzmbtn" @click="verification">{{ countDown == 0 ? '验证码' : countDown }}</view>
+		</view>
+		<view class="flex" style="justify-content: space-between;padding: 50rpx 30rpx;align-items: flex-start;">
+			<view class="">
+			</view>
+			<image src="../../static/icon/goto.png" mode="" style="width: 97rpx;height: 97rpx;" @click="resetpwd()"></image>
 		</view>
 	</view>
 </template>
 <script>
 import { mapMutations } from 'vuex';
-import { verify, loginMobile, getUserInfo } from '@/api/login.js';
+import { verify, loginMobile, getUserInfo,getForget ,resetpwd} from '@/api/login.js';
 export default {
 	data() {
-		return {
+		return {
+			ecode: '',
+			email: '',
 			phone: '', //用户
 			code: '', //验证码
 			time: '', //保存倒计时对象
@@ -44,7 +49,32 @@ export default {
 		}
 	},
 	methods: {
-		...mapMutations('user', ['setUserInfo', 'login']),
+		...mapMutations('user', ['setUserInfo', 'login']),
+		resetpwd() {
+			let obj = this
+			if(obj.email == '') {
+				return obj.$api.msg('請輸入郵箱!')
+			}
+			if (!obj.isEmailAvailable(obj.email)) {
+				return obj.$api.msg('請輸入正確的郵箱!')
+			}
+			if(obj.ecode == '') {
+				return obj.$api.msg('請輸入驗證碼!')
+			}
+			if(obj.lpwd == '') {
+				return obj.$api.msg('請輸入新密碼!')
+			}
+			resetpwd({
+				email: obj.email,
+				ecode: obj.ecode,
+				lpwd: obj.lpwd
+			}).then(res => {
+				console.log(res)
+				obj.login()
+			}).catch(err => {
+				
+			})
+		},
 		// 手机登录
 		register() {
 			let obj = this;
@@ -78,17 +108,22 @@ export default {
 			}).catch((e) => {
 				console.log(e);
 			});
+		},
+		isEmailAvailable(obj) {
+			let email = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
+			if (!email.test(obj)) {
+				return false;
+			}
+			return true;
 		},
 		//发送验证码
 		verification() {
-			let obj = this;
-			if (this.phone == '') {
-				this.$api.msg('请输入电话号码');
-				return;
+			let obj = this;
+			if(obj.email == '') {
+				return obj.$api.msg('請輸入郵箱!')
 			}
-			if (this.phone.length < 11) {
-				this.$api.msg('请输入正确的手机号');
-				return;
+			if (!obj.isEmailAvailable(obj.email)) {
+				return obj.$api.msg('請輸入正確的郵箱!')
 			}
 			// 判断是否在倒计时
 			if (obj.countDown > 0) {
@@ -99,9 +134,9 @@ export default {
 					obj.countDown--;
 				}, 1000);
 				//调用验证码接口
-				verify({
-					phone: obj.phone,
-					type: 'login'
+				getForget({
+					email: obj.email,
+					// type: 'login'
 				})
 					.then(({ data }) => {})
 					.catch(err => {
@@ -120,81 +155,58 @@ export default {
 </script>
 
 <style lang="scss">
-page {
-	height: 100%;
-}
-.container {
-	width: 100%;
-	height: 100%;
-	background-size: 100%;
-}
-.container_text {
-	width: 100%;
-	height: 500rpx;
-	top: 0rpx;
-	.banner-img {
-		width: 100%;
-		height: 100%;
+page {
+		height: 100%;
+		background-color: #fff;
+		font-size: 32rpx;
+	}
+
+	.container {
+		width: 100%;
+		height: 100%;
+		background-size: 100%;
+	}
+
+	.shuru {
+		display: block;
+		background-color: #f5f5f5;
+		width: 673rpx;
+		height: 95rpx;
+		margin: auto;
+		padding-left: 30rpx;
+		text-align: 95rpx;
+	}
+
+	.tit {
+		padding: 40rpx 48rpx 20rpx;
+	}
+
+	.gologin {
+		width: 204rpx;
+		height: 98rpx;
+		line-height: 98rpx;
+		background-color: #fcd535;
+		text-align: center;
+		border-radius: 20rpx;
+	}
+
+	.wjmm {
+		color: #fcd535;
+	}
+
+	.yzm {
+		width: 400rpx;
+		height: 95rpx;
+		padding-left: 30rpx;
+		background-color: #f5f5f5;
+	}
+
+	.yzmbtn {
+		width: 234rpx;
+		height: 95rpx;
+		background-color: #f5f5f5;
+		text-align: center;
+		line-height: 95rpx;
+		color: #fcd535;
 	}
-}
-.login_text {
-	margin: auto 30rpx;
-	position: relative;
-	padding: 100rpx 102rpx;
-	background-color: #ffffff;
-	margin-top: -180rpx;
-	border-radius: 20rpx;
-	.login_input {
-		border-bottom: 1px solid #f0f0f0;
-		margin-bottom: 65rpx;
-		.login_img image {
-			height: 35rpx;
-			width: 29rpx;
-			margin-right: 20rpx;
-		}
-		.uni-input {
-			text-align: left;
-			width: 470rpx;
-			font-size: 28rpx !important;
-		}
-		.login_name {
-			color: #333333;
-			.width {
-				width: 325rpx !important;
-			}
-			.code {
-				color: #5dbc7c;
-				font-size: 23rpx;
-				border-left: 1px solid #eeeeee;
-				width: 150rpx;
-				flex-shrink: 0;
-				text-align: center;
-			}
-		}
-	}
-	.uni-button-green {
-		color: #ffffff;
-		background-color: #5dbc7c;
-		margin: 40rpx 10rpx;
-		border-radius: 50rpx;
-	}
-	.uni-button {
-		height: 85rpx;
-		line-height: 85rpx;
-	}
-}
-.loginTitle {
-	position: absolute;
-	top: 250rpx;
-	width: 100%;
-	text-align: center;
-	color: white;
-	font-size: 40rpx;
-}
-
-uni-button {
-	height: 80rpx !important;
-	line-height: 80rpx !important;
-}
-
 </style>

+ 0 - 28
pages/public/login.vue

@@ -21,34 +21,6 @@
 				登錄
 			</view>
 		</view>
-		
-		<!-- <view class="login_text">
-			<view class="login_input flex">
-				<view class="login_img">
-					<image src="/static/icon/img03.png"></image>
-				</view>
-				<view class="login_name"><input class="uni-input" v-model="username" focus placeholder="请输入手机号" />
-				</view>
-			</view>
-			<view class="login_input flex">
-				<view class="login_img">
-					<image src="/static/icon/img04.png"></image>
-				</view>
-				<view class="login_name"><input class="uni-input" type="password" v-model="passward" focus
-						placeholder="请输入密码" /></view>
-			</view>
-			<view><button type="green" class="uni-button uni-button-green" @click="toLogin">登录</button></view>
-			<view><button type="green" class="uni-button uni-button-green uni-button-green-plain" plain="true"
-					hover-class="none" @click="register">注册</button></view>
-			<navigator url="./forget">
-				<view class="forget">忘记密码</view>
-			</navigator>
-			<view class="flex other">
-				<view class="fenge"></view>
-				<view class="qita">其他方式登录</view>
-				<view class="fenge"></view>
-			</view>
-		</view> -->
 	</view>
 </template>
 

+ 6 - 3
pages/public/register.vue

@@ -8,10 +8,10 @@
 		</view>
 		<input type="text" class="shuru" placeholder="請翰入郵箱" v-model="email">
 		<view class="tit">
-			獲取郵箱驗證碼
+			郵箱驗證碼
 		</view>
 		<view class="flex" style="width: 673rpx;justify-content: space-between;margin: auto;">
-			<input type="text" class=" yzm" placeholder="請翰入碼" v-model="code">
+			<input type="text" class=" yzm" placeholder="請翰入驗證碼" v-model="code">
 			<view class="code yzmbtn" @click="verification">{{ countDown == 0 ? '验证码' : countDown }}</view>
 		</view>
 
@@ -156,7 +156,7 @@
 					}, 1000)
 
 				}).catch(err => {
-					obj.loaded = true
+					obj.loaded = false
 				});
 				//调用注册接口,成功跳转登录页
 			},
@@ -170,6 +170,9 @@
 			//发送验证码
 			verification() {
 				let obj = this;
+				if(obj.email == '') {
+					return obj.$api.msg('請輸入郵箱!')
+				}
 				if (!obj.isEmailAvailable(obj.email)) {
 					return obj.$api.msg('請輸入正確的郵箱!')
 				}

+ 33 - 0
pages/transaction/cbdetail.vue

@@ -0,0 +1,33 @@
+<template>
+	<view class="content">
+
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+
+			}
+		},
+		onLoad() {
+
+		},
+		onShow() {
+
+		},
+		onReachBottom() {
+
+		},
+		onReady() {
+
+		},
+		methods: {
+
+		}
+	}
+</script>
+
+<style lang="scss">
+</style>

+ 33 - 0
pages/transaction/cblist.vue

@@ -0,0 +1,33 @@
+<template>
+	<view class="content">
+
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+
+			}
+		},
+		onLoad() {
+
+		},
+		onShow() {
+
+		},
+		onReachBottom() {
+
+		},
+		onReady() {
+
+		},
+		methods: {
+
+		}
+	}
+</script>
+
+<style lang="scss">
+</style>

+ 33 - 0
pages/transaction/tbdetail.vue

@@ -0,0 +1,33 @@
+<template>
+	<view class="content">
+
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+
+			}
+		},
+		onLoad() {
+
+		},
+		onShow() {
+
+		},
+		onReachBottom() {
+
+		},
+		onReady() {
+
+		},
+		methods: {
+
+		}
+	}
+</script>
+
+<style lang="scss">
+</style>

+ 33 - 0
pages/transaction/tblist.vue

@@ -0,0 +1,33 @@
+<template>
+	<view class="content">
+
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+
+			}
+		},
+		onLoad() {
+
+		},
+		onShow() {
+
+		},
+		onReachBottom() {
+
+		},
+		onReady() {
+
+		},
+		methods: {
+
+		}
+	}
+</script>
+
+<style lang="scss">
+</style>

+ 161 - 0
utils/socket.js

@@ -0,0 +1,161 @@
+/**
+ * @param {string} url
+ * @param {Function} success
+ * @param {Function} fail  
+ * @description 创建新的scoket链接
+ */
+
+export function scoketNew(url, success = function() {}, fail = function() {}) {
+	const scoket = uni.connectSocket({
+		url,
+		success,
+		fail
+	});
+	return {
+		scoket,
+		scoketOpen,
+		scoketSend,
+		scoketClose,
+		scoketMessage
+	}
+}
+
+/**
+ * @param {Object} scoket 会话对象
+ */
+export function scoketOpen() {
+	let that = this;
+	return new Promise((resolve, rejact) => {
+		that.scoket.onOpen(res => {
+			resolve(res)
+		})
+	})
+}
+// 发送消息
+/**
+ * @param {Object} data 发送的数据
+ */
+export function scoketSend(data) {
+	let that = this;
+	return new Promise((resolve, rejact) => {
+		that.scoket.send({
+			data: JSON.stringify(data),
+			success: res => {
+				resolve(res)
+			},
+			fail: res => {
+				rejact(res)
+			},
+		});
+	})
+
+}
+/**
+ * @@description  关闭会话链接
+ */
+export function scoketClose() {
+	this.scoket.close({
+		success(res) {
+			console.log('关闭成功', res);
+		},
+		fail(err) {
+			console.log('关闭失败', err);
+		}
+	})
+}
+/**
+ * @@description  监听会话
+ */
+export function scoketMessage(fun) {
+	this.scoket.onMessage(res => {
+		const data = JSON.parse(res.data);
+		if (data.code) {
+			if (+data.code == 60018) {
+				console.log('scoket返回错误',data);
+			}
+		} else {
+			fun(data)
+		}
+	});
+}
+
+
+
+// this.socketTask.onOpen(res => {
+// 	console.log('WebSocket连接正常打开中...!');
+// 	this.socketOpen = true;
+// 	// 注:只有连接正常打开中 ,才能正常收到消息
+// 	this.socketTask.onMessage(res => {
+// 		this.client_id = JSON.parse(res.data).client_id;
+// 		console.log(JSON.parse(res.data));
+// 		if (JSON.parse(res.data).code == 10501) {
+// 			console.log('服务器问题');
+// 			uni.showLoading({
+// 				title: '断线重连'
+// 			});
+// 			// this.closeSocket();
+// 		} else if (JSON.parse(res.data).code == 0) {
+// 			this.$api.msg(JSON.parse(res.data).msg);
+// 		} else {
+// 			console.log('连接成功');
+// 			// ls.content.indexOf('http')
+// 			let newmessage = JSON.parse(res.data);
+// 			let add_time = getTime(newmessage.timestamp)
+
+// 			newmessage = {
+// 				avatar: newmessage.avatar,
+// 				content: newmessage.content,
+// 				nickname: newmessage.nickname,
+// 				order_id: newmessage.order_id,
+// 				type: newmessage.m_type,
+// 				uid: newmessage.uid,
+// 				add_time: add_time
+// 			}
+
+// 			if (newmessage.type == 5) {
+// 				newmessage.content = newmessage.content.split(',');
+// 				newmessage.content[0].split('?')
+// 			}
+
+
+// 			if (newmessage.order_id == this.order_id) {
+// 				// let ques_name = this.que_url
+// 				this.MsgList = this.MsgList.concat(newmessage);
+// 				this.MsgList = this.MsgList.map(e => {
+// 					e.add_time = Date.parse(e.add_time).toString();
+// 					e.add_time = e.add_time.substr(0, 10);
+// 					return e;
+// 				});
+// 				for (let i = 0; i < this.MsgList.length; i++) {
+// 					let length = this.MsgList.length;
+// 					//当前记录时间
+// 					let newTime = this.MsgList[i].add_time;
+// 					//上一条记录时间
+// 					if (i + 1 < length) {
+// 						let lastTime = this.MsgList[i + 1].add_time;
+// 						let time = (this.MsgList[i + 1].add_time) - (this.MsgList[i].add_time);
+// 						if (time > 300) {
+// 							this.MsgList[i].time = true;
+// 						}
+// 					}
+// 				}
+// 				this.MsgList = this.MsgList.map(e => {
+// 					e.add_time = getTime(e.add_time);
+// 					return e;
+// 				});
+// 				console.log(334, this.MsgList)
+// 			}
+// 			this.$nextTick(function() {
+// 				this.scrollToBottom();
+// 			});
+// 		}
+// 	});
+// 	let join = '{"type":"handshake","role":"user","uid":' + this.userInfo.uid + '}';
+// 	console.log(join);
+// 	this.socketTask.send({
+// 		data: join,
+// 		success: res => {
+// 			console.log('消息发送成功');
+// 		}
+// 	});
+// });