Fly 2 anni fa
parent
commit
0f08982dce
42 ha cambiato i file con 874 aggiunte e 7776 eliminazioni
  1. 17 0
      api/index.js
  2. 8 0
      components/empty/empty.vue
  3. 2 1
      manifest.json
  4. 59 10
      pages/content/bind.vue
  5. 71 39
      pages/content/mine.vue
  6. 34 30
      pages/content/money-password.vue
  7. 1 1
      pages/content/safety-set.vue
  8. 2 4
      pages/contract/grants/index.vue
  9. 18 4
      pages/contract/history/at-present.vue
  10. 235 0
      pages/contract/history/history-entrust.vue
  11. 14 4
      pages/contract/history/history.vue
  12. 35 0
      pages/contract/history/index.scss
  13. 24 18
      pages/contract/history/index.vue
  14. 49 0
      pages/contract/history/select-condition.vue
  15. 9 4
      pages/contract/history/turnover.vue
  16. 76 36
      pages/contract/index.vue
  17. 13 8
      pages/contract/modules/drawer.vue
  18. 2 4
      pages/contract/shortcut/index.vue
  19. 11 0
      pages/contract/sustainability/details.vue
  20. 12 12
      pages/contract/sustainability/freight-space.vue
  21. 5 1
      pages/contract/sustainability/index.scss
  22. 1 1
      pages/contract/sustainability/index.vue
  23. 9 10
      pages/index/index.vue
  24. 2 2
      pages/index/modules/usdt.vue
  25. 8 2
      pages/login/email-verify.vue
  26. 26 3
      static/fontsize/fontsize1/demo_index.html
  27. 7 3
      static/fontsize/fontsize1/iconfont.css
  28. 1 1
      static/fontsize/fontsize1/iconfont.js
  29. 7 0
      static/fontsize/fontsize1/iconfont.json
  30. BIN
      static/fontsize/fontsize1/iconfont.ttf
  31. BIN
      static/fontsize/fontsize1/iconfont.woff
  32. BIN
      static/fontsize/fontsize1/iconfont.woff2
  33. BIN
      static/icon.png
  34. 0 1
      store/modules/app.config.js
  35. 33 69
      store/modules/websocket.js
  36. 2 0
      uni.scss
  37. 18 1
      utils/common.js
  38. 2 1
      utils/initialize.js
  39. 0 118
      utils/websock - 副本 (2).js
  40. 0 202
      utils/websock - 副本.js
  41. 0 205
      utils/websock.js
  42. 61 6981
      utils/websocket.js

+ 17 - 0
api/index.js

@@ -160,6 +160,23 @@ export function Api_setWalletOut(data) {
 	return axios.post(`/api/wallet/out` , data)
 }
 
+// 7-2-6 绑定邮箱
+export function Api_setBindEmail(data) {
+	return axios.post(`/api/safe/email` , data)
+}
+
+// 7-2-6 绑定手机
+export function Api_setBindMobile(data) {
+	return axios.post(`/api/safe/mobile` , data)
+}
+
+
+// 设置/修改支付密码
+export function Api_setUpdatePassword(data) {
+	return axios.post(`/api/safe/update_password` , data)
+}
+
+
 
 // // 根据手机号登录
 // export function goAuthLogin_Api(data) {

+ 8 - 0
components/empty/empty.vue

@@ -1,6 +1,7 @@
 <template>
 	<view class="empty-box">
 		<image class="empty-img" src="../../static/images/empty.png" mode="aspectFit"></image>
+		<text class="empty-text">暂无数据</text>
 	</view>
 </template>
 
@@ -19,10 +20,17 @@
 .empty-box{
 	width: 100%;
 	text-align: center;
+	display: flex;
+	flex-direction: column;
 	.empty-img{
 		max-width: 100%;
 		width: 720rpx;
 		height: 351rpx;
 	}
+	.empty-text{
+		padding-top: 50rpx;
+		width: 100%;
+		font-size: 28rpx;
+	}
 }
 </style>

+ 2 - 1
manifest.json

@@ -43,7 +43,8 @@
                     "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
                     "<uses-feature android:name=\"android.hardware.camera\"/>",
                     "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
-                ]
+                ],
+                "abiFilters" : [ "armeabi-v7a", "arm64-v8a" ]
             },
             /* ios打包配置 */
             "ios" : {

+ 59 - 10
pages/content/bind.vue

@@ -21,7 +21,7 @@
 					</template>
 					<template v-else>
 						<text>国家和地区</text>
-						<text class="iconfont">&#xe60e;</text>
+						<text class="iconfont">&#xeb6d;</text>
 					</template>
 				</view>
 				<text class="item-link"></text>
@@ -58,7 +58,9 @@
 <script>
 	import {
 		Api_getEmailCode,
-		Api_getSmsSend
+		Api_getSmsSend,
+		Api_setBindEmail,
+		Api_setBindMobile
 	} from "@/api/index.js";
 	export default {
 		name: 'bind-phone',
@@ -71,9 +73,9 @@
 				errIndex: '',
 				next: false,
 				account: {
-					user_string: '',
+					user_string: '17777777777',
 					area_code: '',
-					code: ''
+					code: '893720'
 				},
 				errText: [
 					'',
@@ -174,16 +176,18 @@
 				if (!errStatus) {
 					return false
 				}
-
 				let obj = {
 					user_string: this.account.user_string
 				};
-				if (this.account.area_code) {
+				if (this.type == 1) {
 					obj.area_code = this.account.area_code
-				}
+				};
 				if (this.Api_) {
 					this.Api_(obj).then(res => {
-
+						uni.showToast({
+							title: '验证码发送成功',
+							icon: 'none'
+						})
 					}).catch(err => {
 
 					})
@@ -199,8 +203,53 @@
 					}, 1000)
 				}
 			},
-			submitBindAccount(){
-				
+			submitBindAccount() {
+				// 
+				let Api_ = '',
+					obj = {},
+					title = ''
+				if (this.type == 1) {
+					// 手机号
+					title = '手机号'
+					Api_ = Api_setBindMobile;
+					obj = {
+						mobile: this.account.user_string,
+						code: this.account.code
+					}
+				}
+
+				if (this.type == 2) {
+					// 邮箱
+					title = '邮箱'
+					Api_ = Api_setBindEmail;
+					obj = {
+						email: this.account.user_string,
+						code: this.account.code
+					}
+				}
+				if (Api_) {
+					uni.showLoading({
+						title: '',
+						mask: true
+					})
+					Api_(obj).then(res => {
+						setTimeout(() => {
+							uni.showToast({
+								title: `绑定${title}成功`,
+								icon: "none"
+							})
+							setTimeout(() => {
+								uni.navigateBack()
+							}, 1000)
+						}, 300)
+					}).catch(err => {
+
+					}).failly(() => {
+						setTimeout(() => {
+							uni.hideLoading()
+						}, 200)
+					})
+				}
 			}
 		}
 	}

+ 71 - 39
pages/content/mine.vue

@@ -1,5 +1,5 @@
 <template>
-	<view class="mine-page" >
+	<view class="mine-page">
 		<!-- 头部 -->
 		<headContent borderBottom>
 			<template #left>
@@ -18,7 +18,8 @@
 		<!-- 个人信息 -->
 		<view class="mine-info" v-if="showMuen">
 			<view class="mine-account">{{ userInfo.account_number }}</view>
-			<view class="mine-UID">UID: {{ userInfo.extension_code }}<image class="copy-UID" src="../../static/logo.png" mode=""></image>
+			<view class="mine-UID">UID: {{ userInfo.id }}<text v-show="userInfo.id" class="mine-copy iconfont"
+					@click.stop="setCopy(userInfo.id)">&#xe65f;</text>
 			</view>
 		</view>
 		<!-- 个人信息 -->
@@ -148,10 +149,13 @@
 				安全退出
 			</view>
 		</view>
- 
-		
+
+
 		<!-- 邀请 -->
-		<sharePage ref="sharePageRef" :tabBar="false"/>
+		<sharePage ref="sharePageRef" :tabBar="false" />
+
+		<!-- 确认退出 -->
+		<confirm-popup ref="confirmPopup" @confirm="confirmOut" content="确认退出此账号"/>
 	</view>
 </template>
 
@@ -161,7 +165,9 @@
 	} from 'vuex'
 	import reverseBack from "@/components/headModules/reverse-back.vue"
 	import pageStyle from "@/components/headModules/style.vue"
-	import { Way_getUserInfo } from "@/utils/common-request.js"
+	import {
+		Way_getUserInfo
+	} from "@/utils/common-request.js"
 	import {
 		refreshAccount
 	} from "@/utils/common.js"
@@ -172,32 +178,32 @@
 		},
 		data() {
 			return {
-				showMuen:false,
-				userInfo:{}
+				showMuen: false,
+				userInfo: {}
 			};
 		},
 		onShow() {
-		 
+
 		},
 		computed: {
 			...mapGetters([
 				'token'
 			]),
 		},
-		watch:{
-			token:{
-				handler(newToken){
+		watch: {
+			token: {
+				handler(newToken) {
 					this.showMuen = newToken ? true : false
-					if(newToken){
+					if (newToken) {
 						this.getUserInfo()
 					}
 				},
-				immediate:true
+				immediate: true
 			}
 		},
-		methods:{
+		methods: {
 			// 获取用户信息
-			getUserInfo(){
+			getUserInfo() {
 				Way_getUserInfo().then(res => {
 					this.userInfo = res
 				}).catch(err => {
@@ -205,61 +211,80 @@
 				})
 			},
 			// 去登陆
-			goLogin(){
+			goLogin() {
 				uni.navigateTo({
 					url: '/pages/login/index'
 				});
 			},
 			// 打开邀请
-			openShare(){
+			openShare() {
 				this.$nextTick(() => {
 					this.$refs.sharePageRef.openShare()
 				})
 			},
 			// 系统设置
-			openSetting(){
+			openSetting() {
 				uni.navigateTo({
-					url:'/pages/content/setting'
+					url: '/pages/content/setting'
 				})
 			},
 			// 安全设置
-			openSafetySet(){
+			openSafetySet() {
 				uni.navigateTo({
-					url:'/pages/content/safety-set'
+					url: '/pages/content/safety-set'
 				})
 			},
 			// 在线客服
-			getService(){
+			getService() {
 				uni.navigateTo({
-					url:'/pages/content/customer-service'
+					url: '/pages/content/customer-service'
 				})
 			},
 			// 关于我们
-			getAboutUs(){
+			getAboutUs() {
 				this.getSinglePage(1)
 			},
 			// 安全退出
-			retreatFromLogin(){
+			retreatFromLogin() {
+				this.$nextTick(() => {
+					this.$refs.confirmPopup.open()
+				});
+			},
+			// 确认 安全退出 
+			confirmOut() {
 				refreshAccount()
 			},
 			// 获取地址列表
-			getAddress(){
+			getAddress() {
 				uni.navigateTo({
-					url:'/pages/content/address'
+					url: '/pages/content/address'
 				})
 			},
 			// getAboutUs
-			openActivityCenter(){
+			openActivityCenter() {
 				this.getSinglePage(2)
 			},
-			
-			getSinglePage(id){
-			
+
+			getSinglePage(id) {
+
 				uni.navigateTo({
 					url: `/pages/content/h5-list?id=${id}`
 				})
+			},
+			setCopy(val) {
+				uni.setClipboardData({
+					data: val,
+					success: function() {
+						uni.showToast({
+							title: '复制成功',
+							icon: 'none'
+						})
+					}
+				});
 			}
-			
+
+
+
 		}
 	}
 </script>
@@ -278,6 +303,7 @@
 		display: flex;
 		flex-direction: column;
 		justify-content: space-between;
+
 		.mine-account {
 			font-size: 34rpx;
 			font-family: PingFang SC, PingFang SC-Bold;
@@ -293,11 +319,17 @@
 			color: #808080;
 			display: flex;
 			align-items: center;
+
 			.copy-UID {
 				width: 22rpx;
 				height: 26rpx;
 				margin-left: 12rpx;
 			}
+
+			.mine-copy {
+				margin-left: 10rpx;
+				font-size: 30rpx;
+			}
 		}
 	}
 
@@ -331,7 +363,7 @@
 				font-size: 32rpx;
 			}
 
-			.muen-text { 
+			.muen-text {
 				font-size: 28rpx;
 				font-family: PingFang SC, PingFang SC-Regular;
 				font-weight: 400;
@@ -361,21 +393,21 @@
 			}
 		}
 	}
-	
-	.mine-btn{
+
+	.mine-btn {
 		width: 690rpx;
 		height: 90rpx;
 		margin: 80rpx auto;
 		background: #05c175;
 		border-radius: 8rpx;
-		
- 
+
+
 		font-size: 30rpx;
 		font-family: PingFang SC, PingFang SC-Regular;
 		font-weight: 400;
 		text-align: center;
 		color: #ffffff;
-		line-height:90rpx;
+		line-height: 90rpx;
 		letter-spacing: 0.64rpx;
 	}
 </style>

+ 34 - 30
pages/content/money-password.vue

@@ -17,7 +17,7 @@
 			<form class="form-content">
 				<view class="form-item ">
 					<view class="form-item-lable">新密码</view>
-					<input class="form-item-input" v-model="formData.newPassword" :maxlength="maxlength"
+					<input class="form-item-input" v-model="formData.password" :maxlength="maxlength"
 						placeholder-class="form-item-place" :type="showNewPsd ? 'text' : 'password'"
 						placeholder="请输入新密码">
 					<view class="form-item-icon" @click.stop="showNewPsd = !showNewPsd">
@@ -28,7 +28,7 @@
 				<view class="err-hint">{{ formError.newPsdErr }}</view>
 				<view class="form-item ">
 					<view class="form-item-lable">确认密码</view>
-					<input class="form-item-input" v-model="formData.confirmPassword" :maxlength="maxlength"
+					<input class="form-item-input" v-model="formData.pare_passwordssword" :maxlength="maxlength"
 						placeholder-class="form-item-place" :type="showConfirmPsd ? 'text' : 'password'"
 						placeholder="请再次输入新密码">
 					<view class="form-item-icon" @click.stop="showConfirmPsd = !showConfirmPsd">
@@ -56,7 +56,7 @@
 		validPassword
 	} from "@/utils/validate.js"
 	import {
-		Api_setPassword
+		Api_setUpdatePassword
 	} from "@/api/index.js"
 	import {
 		Way_getUserInfo
@@ -72,8 +72,8 @@
 				showConfirmPsd: false,
 				formData: {
 
-					newPassword: '',
-					confirmPassword: ''
+					password: '',
+					pare_passwordssword: ''
 				},
 				formError: {
 
@@ -84,11 +84,11 @@
 		},
 		watch: {
 
-			'formData.newPassword'(newPsd, oldPsd) {
-				this.validateField('newPassword')
+			'formData.password'(newPsd, oldPsd) {
+				this.validateField('password')
 			},
-			'formData.confirmPassword'(newPsd, oldPsd) {
-				this.validateField('confirmPassword')
+			'formData.pare_passwordssword'(newPsd, oldPsd) {
+				this.validateField('pare_passwordssword')
 			}
 		},
 		onShow() {
@@ -105,23 +105,23 @@
 				let validateStatus = false
 				switch (key) {
 
-					case 'newPassword':
+					case 'password':
 						if (!this.formData[key].trim()) {
 							this.formError.newPsdErr = '请输入新密码'
 							validateStatus = false;
-						} else if (!validPassword(this.formData[key])) {
-							this.formError.newPsdErr = '密码长度为8-20位字符,必须同时包含大写字母、小写字母和数字';
+						} else if (this.formData[key].length < 6) {
+							this.formError.newPsdErr = `密码长度为6-${this.maxlength}位字符`;
 							validateStatus = false;
 						} else {
 							this.formError.newPsdErr = '';
 							validateStatus = true;
 						};
 						break;
-					case 'confirmPassword':
+					case 'pare_passwordssword':
 						if (!this.formData[key].trim()) {
 							this.formError.confirmPsdErr = '请再次输入新密码';
 							validateStatus = false;
-						} else if (this.formData[key] !== this.formData.newPassword) {
+						} else if (this.formData[key] !== this.formData.password) {
 							this.formError.confirmPsdErr = '确认密码和新密码输入不一致';
 							validateStatus = false;
 						} else {
@@ -139,7 +139,6 @@
 				return new Promise((resolve, reject) => {
 					let validateStatus = true;
 					for (let key in this.formData) {
-						console.log('SubmitPassWord', key)
 						if (validateStatus) {
 							validateStatus = this.validateField(key)
 						} else {
@@ -170,26 +169,31 @@
 
 				this.confirmValidateField().then(res => {
 					uni.showLoading({
-						title: '修改中',
+						title: '',
 						mask: true
 					})
 					const obj = {
-						account: this.account?.account_number,
-						password: this.formData.newPassword,
-						repassword: this.formData.newPassword
+						password: this.formData.password,
+						pare_passwordssword: this.formData.pare_passwordssword
 					}
 
-					// Api_setPassword(obj).then(res => {
-					// 	setTimeout(() => {
-							// uni.navigateBack({
-							// 	delta: 1
-							// })
-					// 	}, 501)
-					// }).catch(err => {}).finally(() => {
-					// 	setTimeout(() => {
-					// 		uni.hideLoading()
-					// 	}, 500)
-					// })
+					Api_setUpdatePassword(obj).then(res => {
+						setTimeout(() => {
+							uni.showToast({
+								title: `设置成功`,
+								icon: "none"
+							})
+							setTimeout(() => {
+								uni.navigateBack({
+									delta:1
+								})
+							}, 1000)
+						}, 300)
+					}).catch(err => {}).finally(() => {
+						setTimeout(() => {
+							uni.hideLoading()
+						}, 200)
+					})
 
 
 				})

+ 1 - 1
pages/content/safety-set.vue

@@ -26,7 +26,7 @@
 				</view>
 			</view>
 			<view class="safety-set-item" @click.stop="bindContactAccount(2)">
-				<text class="safety-set-lable">邮箱 {{ userInfo.email }}</text>
+				<text class="safety-set-lable">邮箱</text>
 				<view class="safety-set-more">
 					<template v-if="userInfo && userInfo.email">
 						<text class="more-lable active-more-lable">已绑定</text>

+ 2 - 4
pages/contract/grants/index.vue

@@ -84,9 +84,7 @@
 	import lever from "../sustainability/lever.vue"
 	import drawer from "./../modules/drawer.vue"
 	import popupHint from "../modules/popup-hint.vue"
-	import {
-		startWebSocket
-	} from "@/utils/websock.js"
+	 
 	import restrictPopup from "./../modules/restrict.vue"
 	export default {
 		name: 'shortcut',
@@ -141,7 +139,7 @@
 			]),
 		},
 		mounted() {
-			// startWebSocket()
+			 
 		},
 		watch: {
 			currencyVal: {

+ 18 - 4
pages/contract/history/at-present.vue

@@ -1,5 +1,11 @@
 <template>
 	<view class="">
+		<view class="lable-select-box">
+			<view class="lable-select">
+				<selectCondition val="全部合约" />
+				<selectCondition val="全部类型" />
+			</view>
+		</view>
 		<view class="lable-title" v-if="list.length > 0">
 			<text class="lable-title-text">委托信息</text>
 			<text class="lable-title-btn" @click.stop="setCloseLeverAll()">全部撤单</text>
@@ -64,8 +70,13 @@
 			<view class="loadmore-box" v-show="loadStatus !== 'nomore' || list.length > 0">
 				<u-loadmore :status="loadStatus" nomoreText="没有更多数据" :fontSize='28' :icon="false" />
 			</view>
-			<empty class="empty-content" v-show="loadStatus === 'nomore' && list.length <= 0" />
+			<view class="empty-content" :style="{'height': scrollHeight ? `${scrollHeight}px` : '' }"
+				v-if="loadStatus === 'nomore' && list.length <= 0">
+				<empty />
+			</view>
 		</u-list>
+
+	
 		<restrictPopup ref="restrictRef" @setSuccess="setSuccess" />
 	</view>
 </template>
@@ -78,6 +89,7 @@
 		Api_getRegister
 	} from "@/api/index.js"
 	import restrictPopup from "./../modules/restrict.vue"
+	import selectCondition from "./select-condition.vue"
 	export default {
 		name: 'login',
 		props: {
@@ -108,13 +120,14 @@
 			};
 		},
 		components: {
-			restrictPopup
+			restrictPopup,
+			selectCondition
 		},
 		watch: {
 			listHeight: {
 				handler(newH) {
 					if (newH) {
-						this.scrollHeight = newH - uni.upx2px(80);
+						this.scrollHeight = newH - uni.upx2px(80) - uni.upx2px(80);
 					}
 				},
 				immediate: true
@@ -205,5 +218,6 @@
 
 <style lang="scss" scoped>
 	@import "~../sustainability/index.scss";
-	
+	@import "~./index.scss";
+
 </style>

+ 235 - 0
pages/contract/history/history-entrust.vue

@@ -0,0 +1,235 @@
+<template>
+	<view class="">
+		<view class="lable-select-box">
+			<view class="lable-select">
+				<selectCondition val="全部合约" />
+				<selectCondition val="全部类型" />
+			</view>
+			<text class="lable-title-icon iconfont">&#xe611;</text>
+		</view>
+		<view class="conceal-box">
+			<view class="conceal-vi"></view>
+			<text class="conceal-text">隐藏已取消订单</text>
+		</view>
+
+		<u-list class="swiper-list" :style="{'height': scrollHeight ? `${scrollHeight}px` : '' }"
+			@scrolltolower="scrolltolower">
+			<template v-for="item in list">
+				<view class="content-box" :rise-fall="stocksColor">
+					<view class="content-top">
+						<view class="top-left">
+							<view class="top-left-title">
+								<text>{{ item.symbol }}</text>
+								<text v-if="item.settled == 0">永续</text>
+								<text v-else-if="item.settled == 9">快捷</text>
+							</view>
+							<view class="top-left-b">
+								<text>{{ item.multiple }}倍杠杆</text>
+								<text class="top-left-b-tag">{{ item.type_name }}</text>
+							</view>
+						</view>
+
+						<view class="top-right  top-right-btns">
+							<text class="top-right-btn" @click.stop="setCloseLeverAll()">撤单</text>
+						</view>
+					</view>
+					<view class="content-info">
+						<view class="info-item">
+							<text class="info-item-lable">委托数量(张)</text>
+							<text class="info-item-val">{{ item.caution_money }}</text>
+						</view>
+						<view class="info-item">
+							<text class="info-item-lable">委托价格(USDT)</text>
+							<text class="info-item-val">{{ item.price }}</text>
+						</view>
+						<view class="info-item">
+							<text class="info-item-lable">委托价(USDT)</text>
+							<text class="info-item-val">{{ item.origin_price }}</text>
+						</view>
+
+
+						<view class="info-item">
+							<text class="info-item-lable">止损价(USDT)</text>
+							<text class="info-item-val"
+								@click.stop="setRestrict(item)">{{ item.stop_loss_price || '--' }}
+								<text class="iconfont">&#xe610;</text></text>
+						</view>
+						<view class="info-item">
+							<text class="info-item-lable">预计价(USDT)</text>
+							<text class="info-item-val"
+								@click.stop="setRestrict(item)">{{ item.target_profit_price || '--' }} <text
+									class="iconfont">&#xe610;</text> </text>
+						</view>
+						<view class="info-item">
+							<text class="info-item-lable">创建时间(USDT)</text>
+							<text class="info-item-val">{{ $getData_(item.create_time , false) }}</text>
+						</view>
+					</view>
+
+				</view>
+				<gap />
+			</template>
+			<view class="loadmore-box" v-show="loadStatus !== 'nomore' || list.length > 0">
+				<u-loadmore :status="loadStatus" nomoreText="没有更多数据" :fontSize='28' :icon="false" />
+			</view>
+			<view class="empty-content" :style="{'height': scrollHeight ? `${scrollHeight}px` : '' }"
+				v-if="loadStatus === 'nomore' && list.length <= 0">
+				<empty />
+			</view>
+		</u-list>
+
+
+		<restrictPopup ref="restrictRef" @setSuccess="setSuccess" />
+	</view>
+</template>
+
+<script>
+	import {
+		mapGetters
+	} from 'vuex'
+	import {
+		Api_getRegister
+	} from "@/api/index.js"
+	import restrictPopup from "./../modules/restrict.vue"
+	import selectCondition from "./select-condition.vue"
+	export default {
+		name: 'login',
+		props: {
+			listHeight: {
+				type: Number,
+				default: 0
+			},
+			legal_id: {
+				type: [Number, String],
+				default: ''
+			},
+			currency_id: {
+				type: [Number, String],
+				default: ''
+			},
+			status: {
+				type: Number,
+				default: ''
+			},
+		},
+		data() {
+			return {
+				scrollHeight: 0,
+				list: [],
+				loadStatus: '', // loading / nomore / loadmore
+				limit: 10,
+				page: 1,
+			};
+		},
+		components: {
+			restrictPopup,
+			selectCondition
+		},
+		watch: {
+			listHeight: {
+				handler(newH) {
+					if (newH) {
+						this.scrollHeight = newH - uni.upx2px(80)  - uni.upx2px(60);
+					}
+				},
+				immediate: true
+			},
+			status: {
+				handler(newSatus, oldStatus) {
+					if (newSatus === 0 && newSatus !== oldStatus) {
+						this.initData()
+					}
+				},
+				immediate: true
+			},
+		},
+		computed: {
+			...mapGetters([
+				"stocksColor",
+			])
+		},
+		mounted() {
+
+		},
+		methods: {
+			// 初始化
+			initData() {
+				this.limit = 10;
+				this.page = 1;
+				this.loadStatus = 'nomore';
+				// this.getRegister()
+			},
+			setSuccess() {
+				this.initData()
+			},
+			// 设置止盈止损
+			setRestrict(item) {
+				this.$nextTick(() => {
+					this.$refs.restrictRef.open(item)
+				})
+			},
+			scrolltolower() {
+				if (this.loadStatus === 'loadmore') {
+					this.page++;
+					this.getRegister()
+				}
+			},
+			getRegister() {
+				if (this.loadStatus === 'loading') {
+					return false
+				};
+				this.loadStatus = 'loading'
+				Api_getRegister({
+					status: this.status,
+					page: this.page,
+					limit: this.limit,
+				}).then(res => {
+					const data = res.message;
+					this.list = this.list.concat(data.data)
+					this.page = data.current_page
+					if (this.list.length >= data.total) {
+						this.loadStatus = 'nomore'
+					} else {
+						this.loadStatus = 'loadmore'
+					}
+				}).catch(err => {
+					if (this.page >= 2) {
+						this.page -= 1;
+						this.loadStatus = 'loadmore'
+					} else {
+						this.loadStatus = 'nomore'
+					}
+				})
+			}
+
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	@import "~../sustainability/index.scss";
+	@import "~./index.scss";
+
+	.conceal-box {
+		width: 100%;
+		height: 60rpx;
+		padding: 0 $pages-padding;
+		display: flex;
+		align-items: center;
+		border-bottom: 1rpx solid $border-color;
+		font-size: 24rpx;
+		color: $SizeColor3;
+
+		.conceal-vi {
+			width: 30rpx;
+			height: 30rpx;
+			border: 1rpx solid $border-color6;
+			margin-right: 20rpx;
+		}
+	}
+
+	// <view class="conceal-box">
+	// 	<view class="conceal-vi"></view>
+	// 	<text class="conceal-text">隐藏已取消订单</text>
+	// </view>
+</style>

+ 14 - 4
pages/contract/history/history.vue

@@ -1,7 +1,11 @@
 <template>
 	<view class="">
-		<view class="lable-title" v-if="list.length > 0">
-			<view class=""></view>
+		<view class="lable-select-box">
+			<view class="lable-select">
+				<!-- val.sync="全部合约" -->
+				<selectCondition val="全部合约"/>
+				<selectCondition val="全部类型"/>
+			</view>
 			<text class="lable-title-icon iconfont">&#xe611;</text>
 		</view>
 		<u-list class="swiper-list" :style="{'height': scrollHeight ? `${scrollHeight}px` : '' }"
@@ -70,7 +74,10 @@
 			<view class="loadmore-box" v-show="loadStatus !== 'nomore' || list.length > 0">
 				<u-loadmore status="loading" nomoreText="没有更多数据" :fontSize='28' :icon="false" />
 			</view>
-			<empty class="empty-content" v-show="loadStatus === 'nomore' && list.length <= 0" />
+			<view class="empty-content" :style="{'height': scrollHeight ? `${scrollHeight}px` : '' }"
+				v-if="loadStatus === 'nomore' && list.length <= 0">
+				<empty />
+			</view>
 		</u-list>
 	</view>
 </template>
@@ -82,8 +89,10 @@
 	import {
 		Api_getRegister
 	} from "@/api/index.js"
+	import selectCondition from "./select-condition.vue"
 	export default {
 		name: 'login',
+		components:{selectCondition},
 		props: {
 			listHeight: {
 				type: Number,
@@ -108,7 +117,7 @@
 			listHeight: {
 				handler(newH) {
 					if (newH) {
-						this.scrollHeight = newH - uni.upx2px(80);
+						this.scrollHeight = newH - uni.upx2px(80) ;
 					}
 				},
 				immediate: true
@@ -174,6 +183,7 @@
 
 <style lang="scss" scoped>
 	@import "~../sustainability/index.scss";
+	@import "~./index.scss";
 	.top-right-float{
 		text{
 			border: none;

+ 35 - 0
pages/contract/history/index.scss

@@ -0,0 +1,35 @@
+.lable-select-box {
+	width: 100%;
+	height: 80rpx;
+	display: flex;
+	justify-content: space-between;
+	align-items: center;
+	border-bottom: 1rpx solid $border-color;
+	padding: 0 $pages-padding;
+ 
+	color: #000;
+	font-weight: bold;
+
+	.lable-select {
+		display: flex;
+		align-items: stretch;
+	}
+
+	.lable-title-btn {
+		color: $Theme-Color;
+	}
+
+	.lable-title-icon {
+		font-size: 34rpx;
+		color: #000;
+		font-weight: normal;
+	}
+}
+
+
+	.empty-content {
+		width: 100%;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+	}

+ 24 - 18
pages/contract/history/index.vue

@@ -21,14 +21,17 @@
 		<view class="">
 			<!-- <u-swiper :list="list1" @change="change" ></u-swiper> -->
 			<swiper class="swiper-content" :current="historyIdex"
-				:style="{'height': swiperHeight ? `${swiperHeight}px` : '' }">
+				:style="{'height': swiperHeight ? `${swiperHeight}px` : '' }" :duration="200">
 				<swiper-item class="swiper-item-box">
-					<at-present :listHeight="swiperHeight" :status="historyLable[historyIdex].status" :legal_id="legal_id" :currency_id="currency_id"/>
-					<!-- <view class="swiper-item" :style="{'height': listHeight[0] ? `${listHeight[0]}px` : '' }">{{ listHeight[0] }}</view> -->
+					<at-present :listHeight="swiperHeight" :status="historyLable[historyIdex].status"
+						:legal_id="legal_id" :currency_id="currency_id" />
+				</swiper-item>
+				<swiper-item class="swiper-item-box">
+					<history-entrust :listHeight="swiperHeight" :status="historyLable[historyIdex].status"
+						:legal_id="legal_id" :currency_id="currency_id" />
 				</swiper-item>
 				<swiper-item>
-					<history :listHeight="swiperHeight" :status="historyLable[historyIdex].status" />
-					<!-- <view class="swiper-item uni-bg-green">B</view> -->
+					<history-freight-space :listHeight="swiperHeight" :status="historyLable[historyIdex].status" />
 				</swiper-item>
 				<swiper-item>
 					<turnover :listHeight="swiperHeight" :status="historyLable[historyIdex].status" />
@@ -44,7 +47,8 @@
 	} from 'vuex'
 	import entrust from "../sustainability/entrust.vue"
 	import atPresent from "./at-present.vue"
-	import history from "./history.vue"
+	import historyEntrust from "./history-entrust.vue"
+	import historyFreightSpace from "./history-freight-space.vue"
 	import turnover from "./turnover.vue"
 	import {
 		Api_getRegister
@@ -53,14 +57,15 @@
 		name: 'contract-history',
 		components: {
 			entrust,
-			history,
+			historyEntrust,
+			historyFreightSpace,
 			turnover,
 			atPresent
 		},
 		data() {
 			return {
-				legal_id:'',
-				currency_id:'',
+				legal_id: '',
+				currency_id: '',
 				swiperHeight: 0,
 
 				historyIdex: 0,
@@ -76,10 +81,10 @@
 						name: '当前委托',
 						status: 0,
 					},
-					// {
-					// 	name:'当前委托',
-					// 	status: 0,
-					// },
+					{
+						name: '历史委托',
+						status: 999,
+					},
 					{
 						name: '历史仓位',
 						status: -1,
@@ -89,7 +94,7 @@
 						status: 3,
 					}
 				],
-				historyData:[
+				historyData: [
 					[],
 					[],
 					[]
@@ -106,12 +111,12 @@
 			PageContentHeight: {
 				handler(newH) {
 					if (newH) {
-						this.swiperHeight = newH - uni.upx2px(96) - 10;
+						this.swiperHeight = newH - uni.upx2px(96);
 					}
 				},
 				immediate: true
 			},
-			
+
 		},
 		onLoad(opt) {
 			this.legal_id = opt?.legal_id;
@@ -122,7 +127,7 @@
 
 		},
 		methods: {
-			
+
 		}
 	}
 </script>
@@ -153,7 +158,8 @@
 				display: flex;
 				align-items: center;
 				font-size: 28rpx;
-				color: rgba(107, 105, 105, 0.9);
+				color: $SizeColor3;
+				font-weight: 700;
 
 				&:nth-child(n + 2) {
 					margin-left: 30rpx;

+ 49 - 0
pages/contract/history/select-condition.vue

@@ -0,0 +1,49 @@
+<template>
+	<view class="box">
+		<text>{{ val }}</text>
+		<text class="iconfont">&#xeb6d;</text>
+	</view>
+</template>
+
+<script>
+	export default {
+		props: {
+			val: {
+				type: String,
+				default: ''
+			}
+		},
+		data() {
+			return {
+
+			};
+		},
+		mounted() {
+
+		}
+	}
+</script>
+
+<style scoped lang="scss">
+	.box {
+		width: 230rpx;
+		height: 58rpx;
+		background-color: $bg_02;
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+		padding: 20rpx;
+		font-size: 24rpx;
+		font-weight: normal;
+		color: $SizeColor2;
+		border-radius: 8rpx;
+
+		.iconfont {
+			font-size: 20rpx;
+		}
+	}
+
+	.box+.box {
+		margin-left: 20rpx;
+	}
+</style>

+ 9 - 4
pages/contract/history/turnover.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="">
-		<view class="lable-title" v-if="list.length > 0">
-			<view class=""></view>
+		<view class="lable-select-box">
+			<view class="lable-select"><selectCondition val="全部合约" /></view>
 			<text class="lable-title-icon iconfont">&#xe611;</text>
 		</view>
 		<u-list class="swiper-list" :style="{'height': scrollHeight ? `${scrollHeight}px` : '' }" @scrolltolower="scrolltolower">
@@ -53,7 +53,10 @@
 			<view class="loadmore-box" v-show="loadStatus !== 'nomore' || list.length > 0">
 				<u-loadmore :status="loadStatus" nomoreText="没有更多数据" :fontSize='28' :icon="false"/>
 			</view>
-			<empty class="empty-content" v-show="loadStatus === 'nomore' && list.length <= 0" />
+			<view class="empty-content" :style="{'height': scrollHeight ? `${scrollHeight}px` : '' }"
+				v-if="loadStatus === 'nomore' && list.length <= 0">
+				<empty />
+			</view>
 		</u-list>
 	</view>
 </template>
@@ -65,8 +68,9 @@
 	import {
 		Api_getRegister
 	} from "@/api/index.js"
+	import selectCondition from "./select-condition.vue"
 	export default {
-		name: 'login',
+		components:{selectCondition},
 		props: {
 			listHeight: {
 				type: Number,
@@ -156,6 +160,7 @@
 
 <style lang="scss" scoped>
 	@import "~../sustainability/index.scss";
+	@import "~./index.scss";
 	.top-left-b-tag{
 		padding-left: 30rpx !important;
 		padding-right: 30rpx !important;

+ 76 - 36
pages/contract/index.vue

@@ -15,22 +15,26 @@
 		<!-- 永续合约 -->
 		<template v-if="contractIndex === 0">
 			<sustainability ref="sustainabilityRef" :currency-info="currencyVal" :leverTransaction="lever_transaction"
-				:pagesInfo="pagesInfo" :rate-profits-total="rate_profits_total" @refreshData="init" @setContract="setContract"/>
+				:pagesInfo="pagesInfo" :rate-profits-total="rate_profits_total" @refreshData="init"
+				@setContract="setContract" @setProfitLoss="setProfitLoss"/>
 		</template>
 		<!-- 永续合约 -->
 		<template v-if="contractIndex === 1">
-			<shortcut :leverTransaction="lever_transaction" :rate-profits-total="rate_profits_total" :pagesInfo="pagesInfo" @refreshData="init" />
+			<shortcut :leverTransaction="lever_transaction" :rate-profits-total="rate_profits_total"
+				:pagesInfo="pagesInfo" @refreshData="init" />
 		</template>
 		<!-- 赠金交易 -->
 		<template v-if="contractIndex === 2">
 			<grants />
 		</template>
 		<notarize />
-		
+
 		<!-- 永续合约设置 -->
-		<contract-set ref="contractSetRef" @confirm="openSet"/>
+		<contract-set ref="contractSetRef" @confirm="openSet" />
 		<!-- 偏好设置 -->
-		<preference ref="preferenceRef"/>
+		<preference ref="preferenceRef" />
+		<!-- 设置盈亏 -->
+		<restrictPopup ref="restrictPopupRef" @setSuccess="setRestrictSuccess"/>
 	</view>
 </template>
 
@@ -50,7 +54,11 @@
 	import {
 		mapGetters
 	} from 'vuex'
-	// import WS from "@/utils/websock.js"
+	import {
+		startSocket,
+		closeSocket
+	} from "@/utils/websocket.js"
+	import restrictPopup from "./modules/restrict.vue"
 	export default {
 		name: 'contract',
 		components: {
@@ -58,7 +66,8 @@
 			sustainability,
 			grants,
 			shortcut,
-			preference
+			preference,
+			restrictPopup
 		},
 		data() {
 			return {
@@ -76,9 +85,9 @@
 			};
 		},
 		onLoad() {
-			
+
 		},
-		
+
 		computed: {
 			...mapGetters([
 				'currencyVal'
@@ -95,39 +104,51 @@
 		},
 		onShow() {
 			const nu = this.$getStorageSync('contractIndex');
-			this.contractIndex = [0,1,2].includes(nu) ? nu : this.contractIndex
+			this.contractIndex = [0, 1, 2].includes(nu) ? nu : this.contractIndex
 			this.$removeStorageSync('contractIndex')
-			
+
 			// this.init()
+			this.setSocket();
 		},
 		onHide() {
 			this.close()
 		},
+		mounted() {
+			// 设置盈亏
+			// setProfitLoss(item) {
+			// 	console.log('setProfitLoss')
+			// 	this.$nextTick(() => {
+			// 		this.$refs.restrictPopupRef.open(item)
+			// 	})
+			// },
+			// this.$on('setProfitLoss', (val) => {
+			// 	console.log('setProfitLoss' , val);
+			// });
+		},
 		methods: {
 			close() {
-				//  关闭 socket 实时更新
-				this.$store.dispatch('websocket/closeSocket')
-				//  关闭 socket 实时更新
-				this.$store.commit('websocket/set_socket_update_status', false)
+				closeSocket()
 				this.$store.dispatch('websocket/getQuotationNew', {
 					suspend: true
 				})
-				
+
 			},
 			init() {
-				this.getLeverDeal();
 				if ([0, 1].includes(this.contractIndex)) {
 					// 永续 / 快捷 需要获取持仓信息
 					this.getRegister()
 				}
 				this.getAccountInfo();
-				this.$store.dispatch('websocket/getQuotationNew')
+				this.$store.dispatch('websocket/getQuotationNew', {
+					noRefresh: true
+				})
 				// 运行 socket 实时更新
-				this.$store.commit('websocket/set_socket_update_status', true)
+				// this.$store.commit('websocket/set_socket_update_status', true)
 				if (this.currencyVal && this.currencyVal?.legal_id) {
+					this.getLeverDeal();
 					this.setSocket();
 				}
-				
+
 			},
 			// 获取持仓信息(当前持仓)
 			getRegister() {
@@ -137,23 +158,28 @@
 					limit: 10000,
 					settled: this.contractIndex === 0 ? 0 : 9
 				}).then(res => {
-					console.log('Api_getRegister = ', res)
 					this.rate_profits_total = res.rate_profits_total
 				}).catch(err => {
 					// this.getRegister()
 				})
 			},
 			setSocket() {
-				this.$store.dispatch("websocket/openSocket", {
-					type: 'market_depth',
-					legal_id: this.currencyVal.legal_id,
-					currency_id: this.currencyVal.currency_id
-				})
-				this.$store.dispatch("websocket/openSocket", {
-					type: 'daymarket',
-					legal_id: this.currencyVal.legal_id,
-					currency_id: this.currencyVal.currency_id
-				})
+				startSocket({
+					type: 'market_depth'
+				});
+				startSocket({
+					type: 'daymarket'
+				});
+				// this.$store.dispatch("websocket/openSocket", {
+				// 	,
+				// 	legal_id: this.currencyVal.legal_id,
+				// 	currency_id: this.currencyVal.currency_id
+				// })
+				// this.$store.dispatch("websocket/openSocket", {
+				// 	type: 'daymarket',
+				// 	legal_id: this.currencyVal.legal_id,
+				// 	currency_id: this.currencyVal.currency_id
+				// })
 			},
 			getLeverDeal() {
 				Api_getLeverDeal({
@@ -174,15 +200,29 @@
 					console.log('获取shibai ')
 				})
 			},
-			setContract(){
+			setContract() {
 				// setContract
 				this.$nextTick(() => {
 					this.$refs.contractSetRef.open()
 				})
 			},
+			// 设置盈亏
+			setProfitLoss(item) {
+				console.log('setProfitLoss')
+				this.$nextTick(() => {
+					this.$refs.restrictPopupRef.open(item)
+				})
+			},
+			// 设置盈亏成功
+			setRestrictSuccess(){
+				this.getRegister();
+				this.getLeverDeal();
+			},
+
 			// 永续合约 设置
-			openSet(type){
-				switch(type){
+			openSet(type) {
+				return false
+				switch (type) {
 					case 1:
 						// 偏好设置
 						this.$nextTick(() => {
@@ -192,10 +232,10 @@
 					case 2:
 						// 合约计算器
 						uni.navigateTo({
-							url:'/pages/contract/calculator'
+							url: '/pages/contract/calculator'
 						})
 						break;
-					// 
+						// 
 				}
 			}
 

+ 13 - 8
pages/contract/modules/drawer.vue

@@ -1,5 +1,5 @@
 <template>
-	<uni-popup ref="popupRef" type="left">
+	<uni-popup ref="popupRef" type="left" @change="changePopup">
 
 		<view class="drawer-box" :rise-fall="stocksColor">
 			<view :style="{'width': '100%', 'height': `${statusBarHeight}px`}"></view>
@@ -74,8 +74,6 @@
 						</u-list>
 					</swiper-item>
 				</swiper>
-				
-
 			</view>
 		</view>
 	</uni-popup>
@@ -121,12 +119,12 @@ import { Api_getQuotationNew } from "@/api/index.js"
 		mounted() {
 			
 			// this.$refs.popupRef.open()
-			 
+			// noRefresh
 		},
 		methods: {
 			setName(item){
-				console.log()
-				if(this.searchName){
+				console.log(1)
+				if(this.searchName && item){
 					if( item.currency_name.indexOf(this.searchName) >= 0 ){
 						return true
 					}
@@ -139,15 +137,22 @@ import { Api_getQuotationNew } from "@/api/index.js"
 				console.log('--22-' , item)
 			},
 			setCurrency(item){
-				console.log('--211-' , item)
-				
 				this.$store.commit('websocket/set_currency_val' , item)
 				this.close()
 			},
+			changePopup(obj){
+				console.log('changePopup = ' , obj)
+				if(obj.show){
+					this.$store.dispatch('websocket/getQuotationNew')
+				}else{
+					this.$store.commit('websocket/set_currencySuspend' , false)
+				}
+			},
 			close() {
 				this.$refs.popupRef.close();
 			},
 			open() {
+				
 				this.$nextTick(() => {
 					this.$refs.popupRef.open();
 				})

+ 2 - 4
pages/contract/shortcut/index.vue

@@ -276,9 +276,7 @@
 	import lever from "../sustainability/lever.vue"
 	import drawer from "./../modules/drawer.vue"
 	import popupHint from "../modules/popup-hint.vue"
-	import {
-		startWebSocket
-	} from "@/utils/websock.js"
+ 
 	import restrictPopup from "./../modules/restrict.vue"
 	export default {
 		name: 'shortcut',
@@ -341,7 +339,7 @@
 			]),
 		},
 		mounted() {
-			// startWebSocket()
+		 
 		},
 		watch: {
 			currencyVal: {

+ 11 - 0
pages/contract/sustainability/details.vue

@@ -131,6 +131,7 @@
 	import {
 		mapGetters
 	} from 'vuex'
+	import { startSocket , closeSocket} from "@/utils/websocket.js"
 	export default {
 		data() {
 			return {
@@ -163,10 +164,20 @@
 				immediate: true
 			}
 		},
+		onShow() {
+			this.setSocket();
+		},
+		onHide() {
+			closeSocket()
+		},
 		mounted() {
 
 		},
 		methods:{
+			setSocket() {
+				startSocket({type: 'market_depth'});
+				startSocket({type: 'daymarket'});
+			},
 			consumeBtn(){
 				const pages = getCurrentPages();
 				console.log('pages = ' , pages)

+ 12 - 12
pages/contract/sustainability/freight-space.vue

@@ -74,12 +74,13 @@
 						<view class="content-btn-item" @click.stop="setCloseLever(item)">
 							平仓
 						</view>
-						<view class="content-btn-item" @click.stop="setInversion(item)">
+						<!-- @click.stop="setInversion(item)" -->
+						<view class="content-btn-item" >
 							反向开仓
 						</view>
-					<!-- 	<view class="content-btn-item">
+						<view class="content-btn-item">
 							加仓
-						</view> -->
+						</view>
 					</view>
 				</view>
 				<gap />
@@ -89,7 +90,6 @@
 			<empty class="empty-content" />
 		</template>
 		
-		<restrictPopup ref="restrictRef" @setSuccess="setSuccess" />
 	</view>
 </template>
 
@@ -101,7 +101,6 @@
 	import {
 		mapGetters
 	} from 'vuex'
-	import restrictPopup from "./../modules/restrict.vue"
 	export default {
 		name: 'freight-space',
 		props: {
@@ -118,10 +117,7 @@
 					return {}
 				}
 			},
-		},
-		components: {
-			restrictPopup
-		},
+		}, 
 		computed: {
 			...mapGetters([
 				"stocksColor"
@@ -193,9 +189,13 @@
 			},
 			// 设置止盈止损
 			setRestrict(item) {
-				this.$nextTick(() => {
-					this.$refs.restrictRef.open(item)
-				})
+				
+				console.log('setRestrict = ' , item )
+				this.$emit('setProfitLoss' , item)
+ 
+				// this.$nextTick(() => {
+				// 	this.$refs.restrictRef.open(item)
+				// })
 			},
 			setSuccess() {
 				this.$emit('closeLeverSuccess')

+ 5 - 1
pages/contract/sustainability/index.scss

@@ -9,7 +9,10 @@
 		font-size: 24rpx;
 		color: #000;
 		font-weight: bold;
-
+		.lable-select{
+			display: flex;
+			align-items: stretch;
+		}
 		.lable-title-btn {
 			color: $Theme-Color;
 		}
@@ -231,4 +234,5 @@
 	
 	.empty-content{
 		padding-top: 100rpx;
+		// margin: auto auto;
 	}

+ 1 - 1
pages/contract/sustainability/index.vue

@@ -177,7 +177,7 @@
 			<swiper-item class="swiper-item-box">
 				<u-list class="swiper-list" :style="{'height': scrollHeight ? `${scrollHeight}px` : '' }">
 					<freightSpace ref="freightSpaceRef" :leverTransaction="leverTransaction"
-						@closeLeverSuccess="closeLeverSuccess" @setDepot="setDepot" :currency="currencyVal" />
+						@closeLeverSuccess="closeLeverSuccess" @setDepot="setDepot" :currency="currencyVal" v-bind="$attrs" v-on="$listeners"/>
 				</u-list>
 			</swiper-item>
 			<swiper-item>

+ 9 - 10
pages/index/index.vue

@@ -57,8 +57,8 @@
 	import {
 		Way_getQuotationNew
 	} from "@/utils/common-request.js"
-	
- 
+
+
 	import {
 		mapGetters
 	} from 'vuex'
@@ -79,7 +79,7 @@
 				title: 'Hello',
 				BannerList: [],
 				Announcement: [],
-		 
+
 				refreshStatus: false,
 			}
 		},
@@ -88,9 +88,9 @@
 				'stocksColor'
 			]),
 		},
-		 
+
 		onLoad() {
-		  
+
 			this.getBanner();
 			this.getAnnouncement();
 		},
@@ -99,14 +99,13 @@
 			// getQuotationNew() {
 			// 	this.$store.dispatch('websocket/getQuotationNew')
 			// },
-			this.$store.dispatch('websocket/getQuotationNew' )
+			this.$store.dispatch('websocket/getQuotationNew')
 			// this.refreshStatus = true;
 			// this.getQuotationNew();
 		},
 		onHide() {
-			this.$store.dispatch('websocket/getQuotationNew', {suspend:true})
-			this.ws && this.ws.closeSocket(1000);
-			// this.refreshStatus = false;
+			this.$store.commit('websocket/set_currencySuspend', false)
+
 		},
 		methods: {
 			openShare() {
@@ -132,7 +131,7 @@
 					this.Announcement = res.list
 				})
 			},
-	
+
 			clearInt() {
 				try {
 					clearInterval(this.timeInterval);

+ 2 - 2
pages/index/modules/usdt.vue

@@ -3,9 +3,9 @@
 		<view :class="['usdt-item' ,$setColor(item.change)]" v-for="(item , index ) in usdtList"
 			:key="`usdt_${index}`" @click.stop="getPicture(item)">
 			<text class="item-title">{{ item.currency_name }}{{ item.legal_name ? `/${item.legal_name}` : '' }}</text>
-			<text class="item-nums color">{{ item.now_price }}</text>
+			<text class="item-nums color">{{ $numIntercepting(item.now_price , 2) }}</text>
 			<text class="item-ratio color">{{ item.change }}%</text>
-			<text class="item-result"><text class="iconfont">≈</text><text class="iconfont2">&#xe615;</text>{{ item.volume }}</text>
+			<text class="item-result"><text class="iconfont">≈</text><text class="iconfont2">&#xe615;</text>{{ $numIntercepting(item.volume , 2) }}</text>
 		</view>
 	</view>
 </template>

+ 8 - 2
pages/login/email-verify.vue

@@ -11,7 +11,7 @@
 			<text class="login-content">验证码已发送至{{account}}</text>
 
 			<view class="code-box">
-				<u-code-input v-model="accountCode" :maxlength="6" :focus="true" :size="70"></u-code-input>
+				<u-code-input v-model="accountCode" :maxlength="6" :focus="true" color="#000000" :fontSize="30" :size="80" :space="30"></u-code-input>
 				<view class=" code-hint" @click.stop="resendCode()">{{ CodeText }} </view>
 			</view>
 
@@ -121,11 +121,17 @@
 			},
 			setPassWord() {
 
+			},
+			slideImgSuccess(){
+				
 			}
 		}
 	}
 </script>
 
 <style lang="scss" scoped>
-	@import "~./common.scss"
+	@import "~./common.scss";
+	::v-deep .u-code-input__item{
+		border-radius: 10rpx;
+	}
 </style>

+ 26 - 3
static/fontsize/fontsize1/demo_index.html

@@ -54,6 +54,12 @@
       <div class="content unicode" style="display: block;">
           <ul class="icon_lists dib-box">
           
+            <li class="dib">
+              <span class="icon iconfont">&#xe6c5;</span>
+                <div class="name">学院-筛选选中</div>
+                <div class="code-name">&amp;#xe6c5;</div>
+              </li>
+          
             <li class="dib">
               <span class="icon iconfont">&#xe629;</span>
                 <div class="name">设置</div>
@@ -558,9 +564,9 @@
 <pre><code class="language-css"
 >@font-face {
   font-family: 'iconfont';
-  src: url('iconfont.woff2?t=1684137225748') format('woff2'),
-       url('iconfont.woff?t=1684137225748') format('woff'),
-       url('iconfont.ttf?t=1684137225748') format('truetype');
+  src: url('iconfont.woff2?t=1684221925959') format('woff2'),
+       url('iconfont.woff?t=1684221925959') format('woff'),
+       url('iconfont.ttf?t=1684221925959') format('truetype');
 }
 </code></pre>
           <h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
@@ -586,6 +592,15 @@
       <div class="content font-class">
         <ul class="icon_lists dib-box">
           
+          <li class="dib">
+            <span class="icon iconfont icon-xueyuan-shaixuanxuanzhong"></span>
+            <div class="name">
+              学院-筛选选中
+            </div>
+            <div class="code-name">.icon-xueyuan-shaixuanxuanzhong
+            </div>
+          </li>
+          
           <li class="dib">
             <span class="icon iconfont icon-shezhi"></span>
             <div class="name">
@@ -1342,6 +1357,14 @@
       <div class="content symbol">
           <ul class="icon_lists dib-box">
           
+            <li class="dib">
+                <svg class="icon svg-icon" aria-hidden="true">
+                  <use xlink:href="#icon-xueyuan-shaixuanxuanzhong"></use>
+                </svg>
+                <div class="name">学院-筛选选中</div>
+                <div class="code-name">#icon-xueyuan-shaixuanxuanzhong</div>
+            </li>
+          
             <li class="dib">
                 <svg class="icon svg-icon" aria-hidden="true">
                   <use xlink:href="#icon-shezhi"></use>

+ 7 - 3
static/fontsize/fontsize1/iconfont.css

@@ -1,8 +1,8 @@
 @font-face {
   font-family: "iconfont"; /* Project id 3999574 */
-  src: url('iconfont.woff2?t=1684137225748') format('woff2'),
-       url('iconfont.woff?t=1684137225748') format('woff'),
-       url('iconfont.ttf?t=1684137225748') format('truetype');
+  src: url('iconfont.woff2?t=1684221925959') format('woff2'),
+       url('iconfont.woff?t=1684221925959') format('woff'),
+       url('iconfont.ttf?t=1684221925959') format('truetype');
 }
 
 .iconfont {
@@ -13,6 +13,10 @@
   -moz-osx-font-smoothing: grayscale;
 }
 
+.icon-xueyuan-shaixuanxuanzhong:before {
+  content: "\e6c5";
+}
+
 .icon-shezhi:before {
   content: "\e629";
 }

File diff suppressed because it is too large
+ 1 - 1
static/fontsize/fontsize1/iconfont.js


+ 7 - 0
static/fontsize/fontsize1/iconfont.json

@@ -5,6 +5,13 @@
   "css_prefix_text": "icon-",
   "description": "",
   "glyphs": [
+    {
+      "icon_id": "8191630",
+      "name": "学院-筛选选中",
+      "font_class": "xueyuan-shaixuanxuanzhong",
+      "unicode": "e6c5",
+      "unicode_decimal": 59077
+    },
     {
       "icon_id": "5401274",
       "name": "设置",

BIN
static/fontsize/fontsize1/iconfont.ttf


BIN
static/fontsize/fontsize1/iconfont.woff


BIN
static/fontsize/fontsize1/iconfont.woff2


BIN
static/icon.png


+ 0 - 1
store/modules/app.config.js

@@ -24,7 +24,6 @@
 		const headH = state.headHeight.split('rpx')[0];
 		const contentHeight = info.windowHeight - state.statusBarHeight - uni.upx2px(headH);
 		state.navBarHeight = uni.upx2px(headH) + state.statusBarHeight;
-		console.log('state.navigationBarHeight = ' , state.navBarHeight)
  		state.PageContentHeight = contentHeight;
 		state.maxPageHeight = info.windowHeight;
  	},

+ 33 - 69
store/modules/websocket.js

@@ -1,8 +1,3 @@
-// import socket from "@/utils/websocket.js"
-let socket_api = 'https://doc.okenx.com:2000'
-// import io from '@/js_sdk/hyoga-uni-socket_io/uni-socket.io.js';
-import io from '@hyoga/uni-socket.io';
-
 let socket = []
 
 import {
@@ -20,18 +15,27 @@ const state = {
 	marketAll: [],
 	currencyVal: {},
 
-	realTimeUpdate: false,
-	suspend: false
+
+	currencySuspend: false
 
 }
 
 const mutations = {
-	set_socket_update_status: (state, status) => {
-		state.realTimeUpdate = status;
+	set_currencySuspend: (state, status) => {
+		state.currencySuspend = status;
 	},
 	set_currency_val: (state, val) => {
 		state.currencyVal = val;
-	}
+	},
+	set_bids: (state, val) => {
+		state.bids = val;
+	},
+	set_asks: (state, val) => {
+		state.asks = val;
+	},
+	set_daymarket: (state, val) => {
+		state.daymarket = val;
+	},
 	// SET_CONTRACT: (state, contract) => {
 	// 	// 合约账户
 	// 	state.contractAccount = contract;
@@ -77,80 +81,38 @@ const actions = {
 		commit,
 		state
 	}, data) {
-		return false
-		 console.log('打开socket' , )
-		const socketUrl = 'https://doc.okenx.com:2000';
-		socket[socket.length - 1] = io(socketUrl, {
-			query: {},
-			transports: ['websocket', 'polling'],
-			timeout: 5000,
-		}); 
-		socket[socket.length - 1].on(data.type, (msg) => {
-			// console.log('socket = ' , socket , msg)
-			// if(!socket){
-			// 	try{
-			// 		socket.disconnect()
-			// 		socket.closeSocket()
-			// 	}catch{}
-			// 		socket = null;
-			// 	return false
-			// }
-			
-			if (state.currencyVal.legal_id == msg.legal_id && state.currencyVal.currency_id == msg
-				.currency_id) {
-
-				if (msg.type == 'market_depth') {
-					var buyIn = msg.bids.slice(0, 7);
-
-					state.bids = nums(buyIn);
-					var out = msg.asks.slice(0, 7);
-					// state.bids = msg.bids
-					state.asks = nums(out);
-				}
-				if (msg.type == 'daymarket') {
-					state.daymarket = msg;
-				} 
-
-			}
-			// // 主动向服务器发送数据
-			// socket.emit('send_data', {
-			//   time: +new Date(),
-			// });
-		});
 
-		 
 	},
 	closeSocket({
 		commit,
 		state
 	}, data) {
-		console.log('关闭socket' , socket)
-		try{
+		console.log('关闭socket', socket)
+		try {
 			socket.disconnect()
 			// socket.forEach(el => {
 			// 	el.disconnect()
 			// });
 			// socket
-					// socket.close()
-		}catch{}
+			// socket.close()
+		} catch {}
 		socket = null;
 	},
-	
-	
-	
+
+
+
 	getQuotationNew({
 		commit,
 		state
 	}, data) {
-		state.suspend = data ? data?.suspend : false
+		commit('set_currencySuspend', true)
 		const rq = () => {
 			Api_getQuotationNew().then(res => {
 				if (res && res.length > 0) {
 
 					let newArr = res.find((item) => item.name == 'USDT').quotation || [];
 					if (!state.currencyVal || !state.currencyVal?.currency_id) {
-						state.currencyVal = newArr[0]
-						console.log('currencyVal = ', state.currencyVal)
+						state.currencyVal = newArr[0];
 					}
 					// 首页推荐
 					if (newArr && newArr.length > 0) {
@@ -165,21 +127,23 @@ const actions = {
 					state.marketAll = newArr
 				}
 			}).catch(err => {
-
+				console.log(11111 , state.currencySuspend , data?.noRefresh)
+				if (state.currencySuspend && data?.noRefresh) {
+					rq()
+				}
 			}).finally(() => {
 				setTimeout(() => {
-					if (!state.suspend) {
+					console.log(22222 , state.currencySuspend , data?.noRefresh)
+					// noRefresh : 是否不刷新,true 不会继续调用
+					if (state.currencySuspend && !data?.noRefresh) {
 						rq()
 					}
-
-				}, 1000)
+				}, 3000)
 
 			})
 		}
-
-		if (!state.suspend) {
-			rq()
-		}
+		
+		rq()
 
 	},
 }

+ 2 - 0
uni.scss

@@ -31,6 +31,7 @@ $headTitleHeight: 100rpx;
 $SizeColor:  rgba(132,132,132,0.9);
 $SizeColor1:  rgba(203,203,203,0.9);
 $SizeColor2:  #a6a5a5;
+$SizeColor3:  #8b8a8a;
 $btnBgColor:#dedcdc;
 
 $mai_01:#06c174;
@@ -41,6 +42,7 @@ $mai_04:#FEEBED;
 
 
 $bg_01: #f1eded;
+$bg_02: #f5f5f5;
 
 /* 颜色变量 */
 

+ 18 - 1
utils/common.js

@@ -177,7 +177,7 @@ export const scanCode = () => {
 			},
 		});
 	})
-	
+
 
 }
 
@@ -186,4 +186,21 @@ export const readArticleInfo = (id) => {
 	uni.navigateTo({
 		url: `/pages/content/article-details?id=${id}`
 	})
+}
+
+
+// 数字截取
+export const numIntercepting = (num = 0, decimals = 0) => {
+	if (num) {
+		try {
+			num = parseInt(num).toFixed(decimals)
+		} catch {}
+	}
+
+	return num
+
+
+
+
+
 }

+ 2 - 1
utils/initialize.js

@@ -1,6 +1,6 @@
 
 import config from "./config.js"
-import { decimalNum , setStorageSync , getStorageSync , removeStorageSync, setColor , getData_ , readArticleInfo } from "./common.js"
+import { decimalNum , setStorageSync , getStorageSync , removeStorageSync, setColor , getData_ , readArticleInfo , numIntercepting } from "./common.js"
  
 
 
@@ -18,6 +18,7 @@ export default {
 		Vue.prototype.$removeStorageSync = removeStorageSync;  
 		Vue.prototype.$getData_ = getData_;  
 		Vue.prototype.$readArticleInfo = readArticleInfo;  // 阅读文章详情
+		Vue.prototype.$numIntercepting = numIntercepting;  // 数字小数剪切
 
 		Vue.prototype.$setColor = setColor;  
 	 

+ 0 - 118
utils/websock - 副本 (2).js

@@ -1,118 +0,0 @@
- 
-
-import config from "./config.js"
-import {
-	axios
-} from '@/utils/request.js'
-let websock = ''; //webSocket使用
-let isConnect = false; //webSocket连接标识 避免重复连接
-let reConnectNum = 1; //断开后重新连接的次数 免得后台挂了,前端一直重连
-const conceal = () => {
-	websockList.value = [];
-};
-
-const websocketonopen = () => {
-	console.log("WebSocket连接成功------------");
-	//连接建立后修改标识
-	isConnect = true;
-};
-const websocketonerror = () => {
-	console.log("WebSocket连接发生错误");
-	//连接断开后修改标识
-	isConnect = false;
-	//连接错误 需要重连
-	reConnect();
-};
-const websocketonmessage = (e) => {
-	if (e != null) {
-		console.log('websocketclose', e)
-		 
-	}
-};
-
-// webSocket连接关闭
-const websocketclose = () => {
-	//   console.log("webSocket连接关闭");
-	isConnect = false;
-	websock = "";
-	reConnect();
-};
-
-// 尝试重新连接
-const reConnect = () => {
-	// if (reConnectNum > 6) {
-	//   //   console.log("重连超过6次不再重连");
-	//   return false;
-	// }
-	// //   console.log("isConnect", isConnect, $store.getters.userId);
-	// //如果已经连上就不再重试了
-	// if (isConnect && !$store.getters.userId) return;
-	// initWebSocket($store.getters.userId);
-	// reConnectNum = reConnectNum + 1;
-};
-const initWebSocket = (userId) => {
-	console.log('getBaseUrl = ', config.getBaseUrl)
-	// console.log("进入initWebSocket");
-	// console.log("系统用户ID:" + userId);
-	// if (userId != null && userId != "") {
-	//   // WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https
-	console.log('a ', )
-	const t = new Date().getTime()
-	//   const env = import.meta.env.VITE_API_BASEURL.split("://");
-	//   // console.info("location.protocol", wsServer);
-
-	//   //线上环境
-	//   //webSocket 前面加一个前缀xxx_websocket_ 区分后面其他项目的webSocket
-	//   // let wsServer = "wss://域名地址或ip加端口/ nginx配置的  xxx_websocket/" + userId;
-
-	// let wsServer = `wss://doc.okenx.com:2000/socket.io/?EIO=3&transport=websocket&sid=edd3f94f1617d941024b1561`;
-	let wsServer = "wss://houan.songlanyun.com/oa/socket/message/1543837863788879871";
-	 
-	 
-	websock = new WebSocket(wsServer);
-	// websock.onopen = websocketonopen;
-	websock.onopen = () => {
-		console.log('链接成功')
-	};
-	websock.onerror = websocketonerror;
-	websock.onmessage = websocketonmessage;
-	websock.onclose = websocketclose;
-	// }
-};
-
-export const startWebSocket = (data) => {
-	initWebSocket();
-	// var socket_api = 'https://doc.okenx.com:2000'
-	// var socket = s(socket_api);
-	// socket.on('market_depth', function(msg) {
-	// 			console.log('msg = ', msg)
-	// 	if (msg.type == 'market_depth') {
-	// 		if (3 == msg.legal_id && 1 == msg.currency_id) {
-	// 			//btc 匹配
-	// 			// var buyIn = JSON.parse(msg.bids);
-	// 			// var out = JSON.parse(msg.asks).reverse();
-	// 			var buyIn = msg.bids;
-	// 			var out = msg.asks;
-	// 		}
-	// 	}
-
-	// })
-
-	// setTimeout(() => {
-	// 	// 关闭
-	// 	console.log('关闭 = ')
-	// 	socket.close()
-	// }, 3000)
-}
-
-
-export const startAjaxSocket = () => {
-	// https://doc.okenx.com
-	// https://doc.okenx.com
-	const t = new Date().getTime()
-	axios.post(`:2000`, {
-		t: t
-	}).then(res => {
-
-	})
-}

+ 0 - 202
utils/websock - 副本.js

@@ -1,202 +0,0 @@
-// @/utils/websocket.js
-// import { isJSON } from "@/utils/utils"
-
-class WebSocketClass {
-	constructor(url) {
-		this.lockReconnect = false; // 是否开始重连
-		this.wsUrl = ""; // ws 地址
-		this.globalCallback = null; // 回调方法
-		this.userClose = false; // 是否主动关闭
-		this.createWebSocket(url);
-		console.log('================================================================== ')
-	}
-
-	createWebSocket(url) {
-			console.log("WebSocket ---  createWebSocket " , );
-		// #ifdef H5
-		if (typeof(WebSocket) === 'undefined') {
-			this.writeToScreen("您的浏览器不支持WebSocket,无法获取数据");
-			return false
-		}
-		// #endif
-
-		// #ifdef APP-PLUS
-		if (typeof(uni.connectSocket) === 'undefined') {
-			this.writeToScreen("您的浏览器不支持WebSocket,无法获取数据");
-			return false
-		}
-		// #endif
-
-		this.wsUrl = url;
-		try {
-			// 创建一个this.ws对象【发送、接收、关闭socket都由这个对象操作】
-
-			// #ifdef H5
-			this.ws = new WebSocket(this.wsUrl);
-			console.log("WebSocket初始化H5 ---------" , );
-			this.initEventHandle();
-			// #endif
-
-			// #ifdef APP-PLUS
-			this.ws = uni.connectSocket({
-				url: this.wsUrl,
-				success: data => {
-			console.log("WebSocket初始化APP ---------" , );
-
-					this.initEventHandle();
-				}
-			});
-			// #endif
-		} catch (e) {
-			this.reconnect(url);
-		}
-	}
-
-	// 初始化
-	initEventHandle() {
-		/**
-		 * 监听WebSocket连接打开成功
-		 */
-
-		// #ifdef H5
-		this.ws.onopen = () => {
-			console.log("WebSocket连接打开H5" , event);
-		};
-		// this.ws.onopen = (event) => {
-		// 	console.log("WebSocket连接打开H5" , event);
-		// 	 // this.globalCallback({text:'WebSocket连接打开H5'})
-		// };
-		// #endif
-
-		// #ifdef APP-PLUS
-		this.ws.onOpen(res => {
-		  console.log('WebSocket连接打开APP' , res); 
-		});
-		// #endif
-
-		// /**
-		//  * 连接关闭后的回调函数
-		//  */
-
-		// #ifdef H5
-		this.ws.onclose = (event) => {
-	console.log('this.userClose = H5' , this.userClose)
-			if (!this.userClose) {
-				// this.reconnect(this.wsUrl); //重连
-			}
-		};
-		// #endif
-
-		// #ifdef APP-PLUS
-		this.ws.onClose(() => {
-	console.log('this.userClose = APP' , this.userClose)
-			if (!this.userClose) {
-				this.reconnect(this.wsUrl); //重连
-			}
-		});
-		// #endif
-
-
-		/**
-		 * 报错时的回调函数
-		 */
-
-		// #ifdef H5
-		this.ws.onerror = (event) => {
-			if (!this.userClose) {
-				console.log('WebSocket 重连 H5' ); 
-				this.reconnect(this.wsUrl); //重连
-			}
-		};
-		// #endif
-
-		// #ifdef APP-PLUS
-		this.ws.onError(() => {
-			if (!this.userClose) {
-				console.log('WebSocket 重连 APP'  ); 
-				this.reconnect(this.wsUrl); //重连
-			}
-		});
-		// #endif
-
-
-		/**
-		 * 收到服务器数据后的回调函数
-		 */
-
-		// #ifdef H5
-		this.ws.onmessage = (event) => {
-			console.log('onmessage = H5', event)
-			// if(isJSON(event.data)) {
-			//   const jsonobject = JSON.parse(event.data)
-
-			//   this.globalCallback(jsonobject)
-			// }else {
-			//   this.globalCallback(event.data)
-			// }
-		};
-		// #endif
-
-		// #ifdef APP-PLUS
-		this.ws.onMessage(event => {
-			console.log('onmessage = APP-PLUS', event)
-			// if(isJSON(event.data)) {
-			//   const jsonobject = JSON.parse(event.data)
-
-			//   this.globalCallback(jsonobject)
-			// }else {
-			//   this.globalCallback(event.data)
-			// }
-		});
-		// #endif
-	}
-
-	// 关闭ws连接回调
-	reconnect(url) {
-		if (this.lockReconnect) return;
-		this.ws.close();
-		this.lockReconnect = true; // 关闭重连,没连接上会一直重连,设置延迟避免请求过多
-		setTimeout(() => {
-			this.createWebSocket(url);
-			this.lockReconnect = false;
-		}, 1000);
-	}
-
-	// 发送信息方法
-	webSocketSendMsg(msg) {
-		this.ws && this.ws.send({
-			data: msg,
-			success() {
-				console.log("消息发送成功");
-			},
-			fail(err) {
-				console.log("关闭失败", err)
-			}
-		});
-	}
-
-	// 获取ws返回的数据方法
-	getWebSocketMsg(callback) {
-		this.globalCallback = callback
-	}
-
-	// 关闭ws方法
-	closeSocket() {
-		if (this.ws) {
-			this.userClose = true;
-			this.ws.close({
-				success(res) {
-					console.log("关闭成功", res)
-				},
-				fail(err) {
-					console.log("关闭失败", err)
-				}
-			});
-		}
-	}
-
-	writeToScreen(massage) {
-		console.log(massage);
-	}
-}
-export default WebSocketClass;

+ 0 - 205
utils/websock.js

@@ -1,205 +0,0 @@
-// @/utils/websocket.js
-// import { isJSON } from "@/utils/utils"
-
-class WebSocketClass {
-	constructor(url) {
-		this.lockReconnect = false; // 是否开始重连
-		this.wsUrl = ""; // ws 地址
-		this.globalCallback = null; // 回调方法
-		this.userClose = false; // 是否主动关闭
-		this.createWebSocket(url);
-		console.log('================================================================== ')
-	}
-
-	createWebSocket(url) {
-			console.log("WebSocket ---  createWebSocket " , );
-		// #ifdef H5
-		if (typeof(WebSocket) === 'undefined') {
-			this.writeToScreen("您的浏览器不支持WebSocket,无法获取数据");
-			return false
-		}
-		// #endif
-
-		// #ifdef APP-PLUS
-		if (typeof(uni.connectSocket) === 'undefined') {
-			this.writeToScreen("您的浏览器不支持WebSocket,无法获取数据");
-			return false
-		}
-		// #endif
-
-		this.wsUrl = url;
-		try {
-			// 创建一个this.ws对象【发送、接收、关闭socket都由这个对象操作】
-
-			// #ifdef H5
-			this.ws = new WebSocket(this.wsUrl);
-			console.log("WebSocket初始化H5 ---------" , );
-			this.initEventHandle();
-			// #endif
-
-			// #ifdef APP-PLUS
-			this.ws = uni.connectSocket({
-				url: this.wsUrl,
-				success: data => {
-			console.log("WebSocket初始化APP ---------" , );
-
-					this.initEventHandle();
-				}
-			});
-			// #endif
-		} catch (e) {
-			this.reconnect(url);
-		}
-	}
-
-	// 初始化
-	initEventHandle() {
-		/**
-		 * 监听WebSocket连接打开成功
-		 */
-
-		// #ifdef H5
-		this.ws.onopen = () => {
-			console.log("WebSocket连接打开H5" , event);
-		};
-		// this.ws.onopen = (event) => {
-		// 	console.log("WebSocket连接打开H5" , event);
-		// 	 // this.globalCallback({text:'WebSocket连接打开H5'})
-		// };
-		// #endif
-
-		// #ifdef APP-PLUS
-		this.ws.onOpen(res => {
-		  console.log('WebSocket连接打开APP' , res); 
-		});
-		// #endif
-
-		// /**
-		//  * 连接关闭后的回调函数
-		//  */
-
-		// #ifdef H5
-		this.ws.onclose = (event) => {
-	console.log('this.userClose = H5' , this.userClose)
-			if (!this.userClose) {
-				this.reconnect(this.wsUrl); //重连
-			}
-		};
-		// #endif
-
-		// #ifdef APP-PLUS
-		this.ws.onClose(() => {
-	console.log('this.userClose = APP' , this.userClose)
-			if (!this.userClose) {
-				this.reconnect(this.wsUrl); //重连
-			}
-		});
-		// #endif
-
-
-		/**
-		 * 报错时的回调函数
-		 */
-
-		// #ifdef H5
-		this.ws.onerror = (event) => {
-			if (!this.userClose) {
-				console.log('WebSocket 重连 H5' ); 
-				this.reconnect(this.wsUrl); //重连
-			}
-		};
-		// #endif
-
-		// #ifdef APP-PLUS
-		this.ws.onError(() => {
-			if (!this.userClose) {
-				console.log('WebSocket 重连 APP'  ); 
-				this.reconnect(this.wsUrl); //重连
-			}
-		});
-		// #endif
-
-
-		/**
-		 * 收到服务器数据后的回调函数
-		 */
-
-		// #ifdef H5
-		this.ws.onmessage = (event) => {
-			console.log('onmessage = H5', event)
-			// if(isJSON(event.data)) {
-			//   const jsonobject = JSON.parse(event.data)
-
-			//   this.globalCallback(jsonobject)
-			// }else {
-			//   this.globalCallback(event.data)
-			// }
-		};
-		// #endif
-
-		// #ifdef APP-PLUS
-		this.ws.onMessage(event => {
-			console.log('onmessage = APP-PLUS', event)
-			// if(isJSON(event.data)) {
-			//   const jsonobject = JSON.parse(event.data)
-
-			//   this.globalCallback(jsonobject)
-			// }else {
-			//   this.globalCallback(event.data)
-			// }
-		});
-		// #endif
-	}
-
-	// 关闭ws连接回调
-	reconnect(url) {
-		if (this.lockReconnect) return;
-		this.ws.close();
-		this.lockReconnect = true; // 关闭重连,没连接上会一直重连,设置延迟避免请求过多
-		setTimeout(() => {
-			this.createWebSocket(url);
-			this.lockReconnect = false;
-		}, 1000);
-	}
-
-	// 发送信息方法
-	webSocketSendMsg(msg) {
-		this.ws && this.ws.send({
-			data: msg,
-			success() {
-				console.log("消息发送成功");
-			},
-			fail(err) {
-				console.log("关闭失败", err)
-			}
-		});
-	}
-
-	// 获取ws返回的数据方法
-	getWebSocketMsg(callback) {
-		this.globalCallback = callback
-	}
-
-	// 关闭ws方法
-	closeSocket(num) {
-		console.log('手动关闭')
-		if (this.ws) {
-			this.userClose = true;
-		console.log('手动关闭' , this.ws)
-		this.ws.close(num)
-			this.ws.close({
-				success(res) {
-					console.log("关闭成功", res)
-				},
-				fail(err) {
-					console.log("关闭失败", err)
-				}
-			});
-		}
-	}
-
-	writeToScreen(massage) {
-		console.log(massage);
-	}
-}
-export default WebSocketClass;

File diff suppressed because it is too large
+ 61 - 6981
utils/websocket.js