hwq 3 år sedan
förälder
incheckning
d4fb5e5299

+ 4 - 1
App.vue

@@ -24,7 +24,7 @@ export default {
 		// 加载缓存中的用户信息
 		let userInfo = uni.getStorageSync('userInfo') || '';
 		// 判断是否拥有用户信息
-		if (userInfo.uid) {
+		if (userInfo.id) {
 			//更新登陆状态
 			uni.getStorage({
 				key: 'userInfo',
@@ -246,6 +246,9 @@ button[type='default'] {
 .font-color-red {
 	color: $color-red;
 }
+.font-color-green {
+	color: $color-green;
+}
 // 边框颜色
 .border-color-yellow {
 	border: 1rpx solid $color-yellow;

+ 15 - 0
api/login.js

@@ -102,4 +102,19 @@ export function resetpwd(data) {
 		method: 'post',
 		data
 	})
+}
+
+export function getUser(data) {
+	return request({
+		url: '/api/user/userinfo',
+		method: 'get',
+		data
+	})
+}
+export function loginout(data) {
+	return request({
+		url: '/api/Login/loginout',
+		method: 'get',
+		data
+	})
 }

+ 1 - 98
api/wallet.js

@@ -1,103 +1,5 @@
 import request from '@/utils/request'
 
-// 获取用户消费记录
-export function spreadCommission(data, state) {
-	return request({
-		url: '/api/spread/commission/' + state,
-		method: 'get',
-		data
-	});
-}
-
-// 获取账户余额
-export function userBalance(data) {
-	return request({
-		url: '/api/user/balance',
-		method: 'get',
-		data
-	});
-}
-
-// 提现
-export function extractCash(data) {
-	return request({
-		url: '/api/extract/cash',
-		method: 'post',
-		data
-	});
-}
-
-// 提现信息
-export function extractBank(data) {
-	return request({
-		url: '/api/extract/bank',
-		method: 'get',
-		data
-	});
-}
-// #ifdef H5
-// 公众号充值
-export function rechargeWechat(data) {
-	return request({
-		url: '/api/recharge/wechat',
-		method: 'post',
-		data
-	});
-}
-// #endif
-// #ifdef MP
-// 小程序充值
-export function rechargeRoutine(data) {
-	return request({
-		url: '/api/recharge/routine',
-		method: 'post',
-		data
-	});
-}
-// #endif
-// 获取提现支付宝账号
-export function aliInfo(data) {
-	return request({
-		url: '/api/ali/info',
-		method: 'get',
-		data
-	});
-}
-//获取默认银行卡账号
-export function bankInfo(data) {
-	return request({
-		url: '/api/bank/info',
-		method: 'get',
-		data
-	});
-}
-// 保存提现支付宝账号
-export function setAliInfo(data) {
-	return request({
-		url: '/api/ali/edit',
-		method: 'post',
-		data
-	});
-}
-//保存默认银行卡账号
-export function setBankInfo(data) {
-	return request({
-		url: '/api/bank/edit',
-		method: 'post',
-		data
-	});
-}
-
-
-// 账户余额
-export function balance(data) {
-	return request({
-		url: '/api/user/balance',
-		method: 'get',
-		data
-	});
-}
-
 // 资金列表
 export function usercoin(data) {
 	return request({
@@ -125,6 +27,7 @@ export function czcoin(data) {
 	});
 }
 
+// 充币详情
 export function czpage(data) {
 	return request({
 		url: '/api/user/czpage',

+ 17 - 2
pages.json

@@ -3,7 +3,8 @@
 			"path": "pages/index/index",
 			"style": {
 				"enablePullDownRefresh": true,
-				"navigationBarTitleText": "首页"
+				"navigationBarTitleText": "首页",
+				"navigationStyle": "custom"
 			}
 		},
 		{
@@ -21,7 +22,15 @@
 		{
 			"path": "pages/transaction/cbdetail",
 			"style": {
-				"navigationBarTitleText": "充幣詳情"
+				"navigationBarTitleText": "充幣詳情",
+				"navigationStyle": "custom"
+			}
+		},
+		{
+			"path": "pages/transaction/czlist",
+			"style": {
+				"navigationBarTitleText": "充幣記錄",
+				"navigationStyle": "custom"
 			}
 		},
 		{
@@ -76,6 +85,12 @@
 			"style": {
 				"navigationBarTitleText": "資產"
 			}
+		},
+		{
+			"path": "pages/user/menu",
+			"style": {
+				"navigationBarTitleText": ""
+			}
 		}
 	],
 	"globalStyle": {

+ 460 - 4
pages/heyue/heyue.vue

@@ -1,6 +1,219 @@
 <template>
 	<view class="content">
-
+		<view class="usdtTitle flex">
+			<view class="left flex">
+				<image class="img margin-r-10" src="../../static/icon/hy02.png" mode="widthFix"></image>
+				<view class="margin-r-10">
+					BTC/USDT
+				</view>
+				<view class="font-color-green">
+					10086
+				</view>
+			</view>
+			<view class="right">
+				<image class="img" src="../../static/icon/hy01.png" mode="widthFix"></image>
+			</view>
+		</view>
+		<view class="box  flex padding-t-20 padding-b-30">
+			<view class="item">
+				<view class="itemTitle margin-b-20">
+					交易方向
+				</view>
+				<view class="buttomBox flex">
+					<view @click="typeIndex=1" class="buttom " :class="{action:typeIndex==1}">
+						上涨
+					</view>
+					<view @click="typeIndex=2" class="buttom " :class="{action:typeIndex==2,'bg-danger':typeIndex==2}">
+						下跌
+					</view>
+				</view>
+				<view class="tabType flex ">
+					<view class="tab" @click="jyType=1" :class="{action:jyType==1}">
+						限价委托
+					</view>
+					<view class="tab" @click="jyType=2" :class="{action:jyType==2}">
+						市价委托
+					</view>
+				</view>
+				<view class="inputBox margin-b-20" v-if="jyType==1">
+					<input v-model="xzMoney" class="input" placeholder="请输入价格" type="number">
+				</view>
+				<view class="itemTitle  margin-b-20">
+					交易个数
+				</view>
+				<view class="inputBox flex margin-b-20">
+					<input v-model="payNum" class="input" placeholder="请输入交易数量" type="number">
+					<view class="rightInputBox flex">
+						<image @click="payNum>0?payNum--:false" class="img" src="../../static/icon/hy04.png"
+							mode="scaleToFill"></image>
+						<view class="jg">
+						</view>
+						<image @click="payNum++" class="img" src="../../static/icon/hy03.png" mode="scaleToFill">
+						</image>
+					</view>
+				</view>
+				<view class="itemTitle margin-b-20">
+					杠杆倍数
+				</view>
+				<view class="itemLeftList flex margin-b-20">
+					<view class="ll" @click="changeGG(ind,ls)" :class="{action:ind==ggIndex}"
+						v-for="(ls,ind) in ggList">
+						{{ls.num}}
+					</view>
+				</view>
+				<view class="inputBox flex margin-b-20">
+					<input v-model="ggBs" class="input" placeholder="请输入杠杆倍数" type="number">
+				</view>
+				<view class="flex margin-b-20">
+					<view class="itemTitle">
+						止损价
+					</view>
+					<view class="inputBox flex">
+						<input v-model="zsMoney" placeholder="请输入止损价格" class="input" type="number">
+					</view>
+				</view>
+				<view class="flex margin-b-20">
+					<view class="itemTitle">
+						止盈价
+					</view>
+					<view class="inputBox flex">
+						<input v-model="zyMoney" placeholder="请输入止盈价格" class="input" type="number">
+					</view>
+				</view>
+				<view class="flex margin-b-20">
+					<view class="itemTitle">
+						保证金
+					</view>
+					<view class="itemTitle">
+						0
+					</view>
+				</view>
+				<view class="flex margin-b-20">
+					<view class="itemTitle">
+						可用合约余额
+					</view>
+					<view class="itemTitle">
+						0
+					</view>
+				</view>
+				<view class="flex margin-b-20">
+					<view class="itemTitle">
+						手续费
+					</view>
+					<view class="itemTitle">
+						0
+					</view>
+				</view>
+				<view class="buttomSubmit" :class="{'bg-success':typeIndex==1,'bg-danger':typeIndex==2}">
+					{{typeIndex==1?'做多':'做空'}}
+				</view>
+			</view>
+			<view class="item padding-l-20">
+				<view class="itemName flex">
+					<view class="itemMinName">
+						价格
+					</view>
+					<view class="itemMinName">
+						数量
+					</view>
+				</view>
+				<view class="itemList">
+					<view class="list flex font-color-green">
+						<view class="li top">
+							166666
+						</view>
+						<view class="li top">
+							0000.00
+						</view>
+					</view>
+					<view class="llMax font-color-green">
+						10086
+					</view>
+					<view class="list flex font-color-red">
+						<view class="li bottom">
+							166666
+						</view>
+						<view class="li bottom">
+							0000.00
+						</view>
+					</view>
+				</view>
+			</view>
+		</view>
+		<view class="box margin-t-30 padding-t-30 padding-b-30">
+			<view class="flex listTitleBox">
+				<view class="leftBottom flex">
+					<view @click="ddTypeChage(1)" class="titleType margin-r-30" :class="{action:ddType==1}">
+						限价委托
+					</view>
+					<view @click="ddTypeChage(2)" class="titleType" :class="{action:ddType==2}">
+						持仓
+					</view>
+				</view>
+				<view class="rightBottom flex">
+					<image class="img" src="../../static/icon/hy02.png" mode="widthFix"></image>
+					<view class="more">
+						全部订单
+					</view>
+				</view>
+			</view>
+			<view class="usdtList padding-t-30 padding-b-30">
+				<view class="flex">
+					<view class="name">
+						<text class="font-color-green">
+							做多
+						</text>
+						<text>
+							BTC/USDT
+						</text>
+						<text class="font-color-green">
+							0.00
+						</text>
+					</view>
+					<view class="usdtListButtom">
+						一键平仓
+					</view>
+				</view>
+				<view class="tip ">
+					开仓时间:2022-11-23 19:10:11
+				</view>
+				<view class="flex">
+					<view class="tipList">
+						<view class="nameTip">
+							开仓单价
+						</view>
+						<view class="text">
+							1600000
+						</view>
+					</view>
+					<view class="tipList">
+						<view class="nameTip">
+							保证金
+						</view>
+						<view class="text">
+							1600000
+						</view>
+					</view>
+					<view class="tipList">
+						<view class="nameTip">
+							交易个数
+						</view>
+						<view class="text">
+							1600000
+						</view>
+					</view>
+					<view class="tipList">
+						<view class="nameTip">
+							杠杆倍数
+						</view>
+						<view class="text">
+							1600000
+						</view>
+					</view>
+				</view>
+			</view>
+			
+		</view>
 	</view>
 </template>
 
@@ -8,7 +221,35 @@
 	export default {
 		data() {
 			return {
-
+				// 当前选中的杠杆倍数
+				ggIndex: 0,
+				ggList: [{
+					num: 5
+				}, {
+					num: 10
+				}, {
+					num: 20
+				}, {
+					num: 50
+				}, {
+					num: 100
+				}],
+				//当前选中的交易类别
+				typeIndex: 1,
+				// 交易类型
+				jyType: 1,
+				//交易数量
+				payNum: 0,
+				// 杠杆倍数
+				ggBs: 0,
+				// 限价委托价格
+				xzMoney: 0,
+				// 止损价格
+				zsMoney: 0,
+				// 止盈价格
+				zyMoney: 0,
+				// 当前查看列表类型
+				ddType: 1
 			}
 		},
 		onLoad() {
@@ -24,10 +265,225 @@
 
 		},
 		methods: {
-
+			// 修改杠杆倍数
+			changeGG(ind, item) {
+				this.ggBs = item.num
+				this.ggIndex = ind
+			},
+			// 查看列表切换类型
+			ddTypeChage(ind) {
+				this.ddType = ind
+			}
 		}
 	}
 </script>
 
 <style lang="scss">
-</style>
+	.usdtTitle,
+	.box {
+		padding: 0 20rpx;
+		width: 750rpx;
+		background-color: #FFFFFF;
+
+	}
+
+	.usdtTitle {
+		border-bottom: 1px solid $border-color-light;
+		line-height: 1;
+
+		.left {
+			font-size: 32rpx;
+			font-weight: bold;
+
+			.img {
+				width: 36rpx;
+			}
+
+		}
+
+		.right {
+			.img {
+				width: 48rpx;
+			}
+		}
+	}
+
+	.box {
+		line-height: 1;
+		align-items: flex-start;
+
+		.itemTitle {
+			font-weight: bold;
+			font-size: $font-sm;
+		}
+
+		.item {
+			flex-grow: 1;
+			flex-shrink: 0;
+		}
+
+		.buttomBox {
+			font-size: $font-sm;
+
+			.buttom {
+				width: 200rpx;
+				padding: 20rpx 0;
+				text-align: center;
+				border-radius: 10rpx;
+				background-color: #F5F5F5;
+
+				&.action {
+					color: #FFFFFF;
+					background-color: $color-green;
+				}
+			}
+		}
+
+		.tabType {
+			justify-content: space-around;
+
+			.tab {
+				padding-top: 30rpx;
+				padding-bottom: 20rpx;
+				color: #545D6F;
+				font-size: $font-sm;
+				font-weight: bold;
+
+				&.action {
+					color: $uni-color-warning;
+				}
+			}
+		}
+
+		.inputBox {
+			height: 60rpx;
+			border-radius: 10rpx;
+			padding: 0 20rpx;
+			display: flex;
+			align-items: center;
+			border: 1px solid $border-color-light;
+
+			.input {
+				font-size: $font-sm;
+				flex-grow: 1;
+			}
+
+			.rightInputBox {
+				.jg {
+					border: 1px solid $border-color-light;
+					height: 50rpx;
+					margin: 0 30rpx;
+				}
+
+				.img {
+					width: 28rpx;
+					height: 28rpx;
+				}
+			}
+		}
+
+		.itemLeftList {
+			justify-content: space-around;
+
+			.ll {
+				border: 1px solid $border-color-light;
+				width: 74rpx;
+				height: 54rpx;
+				line-height: 54rpx;
+				text-align: center;
+				font-size: $font-sm;
+				font-weight: bold;
+
+				&.action {
+					background-color: #F5F5F5;
+				}
+			}
+		}
+
+		.buttomSubmit {
+			color: #FFFFFF;
+			height: 64rpx;
+			line-height: 64rpx;
+			text-align: center;
+			font-size: $font-sm;
+			border-radius: 10rpx;
+		}
+
+		.itemName {
+			padding-bottom: 20rpx;
+
+			.itemMinName {
+				font-size: 22rpx;
+				color: #5D6677;
+			}
+
+		}
+
+		.itemList {
+			.list {
+				font-size: 20rpx;
+				padding: 10rpx 0;
+			}
+
+			.llMax {
+				padding: 30rpx 0;
+				font-weight: bold;
+				font-size: $font-lg;
+			}
+		}
+
+		.listTitleBox {
+			border-bottom: 1px solid $border-color-light;
+			align-items: flex-start;
+			.leftBottom {
+				flex-shrink: 0;
+				font-size: $font-lg;
+				font-weight: bold;
+
+				.action {
+					border-bottom: 2px solid $uni-color-warning;
+				}
+
+				.titleType {
+					padding-bottom: 20rpx;
+				}
+			}
+
+			.rightBottom {
+				font-size: $font-base;
+				color: #707A8A;
+				flex-shrink: 0;
+
+				.img {
+					width: 36rpx;
+				}
+			}
+		}
+		.usdtList{
+			color: #707A8A;
+			border-bottom: 1px solid $border-color-light;
+			.name{
+				font-size: $font-lg;
+				font-weight: bold;
+			}
+			.usdtListButtom{
+				font-size: $font-base;
+				background-color:#F5F5F5 ;
+				color: $uni-color-warning;
+				border-radius: 10rpx;
+				padding: 10rpx 20rpx;
+			}
+			.tip{
+				padding-top: 10rpx;
+				padding-bottom: 30rpx;
+				font-size: $font-base;
+			}
+			.tipList{
+				font-size: $font-sm;
+				.nameTip{
+					padding-bottom: 20rpx;
+				}
+			}
+		}
+	}
+</style>

+ 98 - 65
pages/index/index.vue

@@ -1,5 +1,9 @@
 <template>
 	<view class="container">
+		<view class="flex" style="justify-content: space-between;padding: 20rpx 30rpx;">
+			<image src="../../static/icon/user.png" mode="" style="width: 53rpx;height: 53rpx;" @click="navto('/pages/user/menu')"></image>
+			<!-- <image src="../../static/icon/tz.png" mode="" style="width: 53rpx;height: 53rpx;"></image> -->
+		</view>
 		<!-- 轮播图 start -->
 		<swiper class="top-swiper" autoplay="true" duration="400" interval="5000" @change="swiperChange">
 			<swiper-item v-for="(item, index) in 2" :key="index" class="carousel-item" @click="bannerNavToUrl(item)">
@@ -36,34 +40,43 @@
 					<view class="btm-item-name">
 						BTC/USDT
 					</view>
-					<view class="btm-item-val">
-						15716.53
-					</view>
-					<view class="btm-item-bl">
-						-2.44%
-					</view>
+					<template v-if="listOBj['BTC-USDT']">
+						<view class="btm-item-val" :style="{'color': listOBj['BTC-USDT'].dcf > 0 ? '#5ec886': '#DD3745'}">
+							{{listOBj['BTC-USDT'].last|| '--,--'}}
+						</view>
+						<view class="btm-item-bl" :style="{'color': listOBj['BTC-USDT'].dcf > 0 ? '#5ec886': '#DD3745'}">
+							{{listOBj['BTC-USDT'].dcf || '--,--'}}%
+						</view>
+					</template>
+					
 				</view>
 				<view class="btm-item">
 					<view class="btm-item-name">
-						BTC/USDT
-					</view>
-					<view class="btm-item-val">
-						15716.53
-					</view>
-					<view class="btm-item-bl">
-						-2.44%
+						BCH/USDT
 					</view>
+					<template v-if="listOBj['BCH-USDT']">
+						<view class="btm-item-val" :style="{'color': listOBj['BCH-USDT'].dcf > 0 ? '#5ec886': '#DD3745'}" >
+							{{listOBj['BCH-USDT'].last || '--,--'}}
+						</view>
+						<view class="btm-item-bl" :style="{'color': listOBj['BCH-USDT'].dcf > 0 ? '#5ec886': '#DD3745'}">
+							{{listOBj['BCH-USDT'].dcf || '--,--'}}%
+						</view>
+					</template>
+					
 				</view>
 				<view class="btm-item">
 					<view class="btm-item-name">
 						ETH/USDT
 					</view>
-					<view class="btm-item-val">
-						15716.53
-					</view>
-					<view class="btm-item-bl">
-						-2.44%
-					</view>
+					<template v-if="listOBj['ETH-USDT']">
+						<view class="btm-item-val" :style="{'color': listOBj['ETH-USDT'].dcf > 0 ? '#5ec886': '#DD3745'}">
+							{{listOBj['ETH-USDT'].last || '--,--'}}
+						</view>
+						<view class="btm-item-bl" :style="{'color': listOBj['ETH-USDT'].dcf > 0 ? '#5ec886': '#DD3745'}">
+							{{listOBj['ETH-USDT'].dcf || '--,--'}}%
+						</view>
+					</template>
+					
 				</view>
 			</view>
 		</view>
@@ -75,20 +88,23 @@
 				<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 class="list-main flex" v-for="(item,index ) in listOBj">
+				<view class="main-left">{{index}}</view>
+				<view class="main-center" :class="{ down: item.dcf > 0, ping: item.dcf == 0 }">
+					{{ item.last == 0 ? '--.--' : item.last }}</view>
+				<view class="main-right">
+					<view class="btn" :class="{ down: item.dcf > 0, ping: item.dcf == 0 }">{{ item.dcf }}%</view>
 				</view>
-			</scroll-view> -->
+			</view>
 		</view>
 	</view>
 </template>
 
 <script>
+	import {
+		mapState,
+		mapMutations
+	} from 'vuex';
 	import {
 		scoketNew,
 		scoketOpen
@@ -99,35 +115,19 @@
 	export default {
 		data() {
 			return {
-				maxheight: '',
+
 				scoket: '',
 				instId: 'IOTA-USDT', //请求的产品id
-				spList:[],//需要查询的列表
-				listOBj:{}//保存实际列表对象
+				spList: [], //需要查询的列表
+				listOBj: {} //保存实际列表对象
 			};
 		},
 		computed: {
-
+			...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
 		},
 		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()
@@ -140,18 +140,31 @@
 
 		},
 		methods: {
-			swiperChange(){
-				
+			navto(url) {
+				console.log(url);
+				if (!this.hasLogin) {
+					// 保存地址
+					saveUrl();
+					// 登录拦截
+					interceptor();
+				} else {
+					uni.navigateTo({
+						url
+					});
+				}
+			},
+			swiperChange() {
+
 			},
 			// 开始请求长连接
-			onScoket(){
+			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{
+					const requestList = that.spList.map((e) => {
+						return {
 							"channel": "tickers",
-							"instId": e.coinname.toUpperCase()+"-USDT"
+							"instId": e.coinname.toUpperCase() + "-USDT"
 						}
 					})
 					that.scoket.scoketSend({
@@ -160,27 +173,33 @@
 					}).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,'报错');
+					that.scoket.scoketMessage((res) => {
+						try {
+							if (res.data) {
+								// res.res.data[0].name = res.arg.instId
+								that.listOBj[res.arg.instId] = res.data[0];
+								that.listOBj[res.arg.instId].dcf = ((res.data[0].last*1 -  res.data[0].sodUtc0*1)/(res.data[0].sodUtc0*1) * 100 ).toFixed(2)
+								that.listOBj = Object.assign( {},that.listOBj);
+							}
+							console.log(that.listOBj, 'that.listOBj++++++')
+						} catch (e) {
+
+							console.log(res, res.data, '报错');
 						}
 					})
 				})
 			},
-			closeScoket(){
-				that.scoket.scoketClose();
+			closeScoket() {
+				this.scoket.scoketClose();
 			},
 			// 获取查询列表
-			geLevertade(){
+			geLevertade() {
 				const that = this;
-				geLevertade().then((e)=>{
+				geLevertade().then((e) => {
 					that.spList = e.list;
 					// 开启长连接
 					that.onScoket()
-					
+
 				})
 			},
 			// 轮播图跳转
@@ -274,32 +293,39 @@
 			}
 		}
 	}
+
 	.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%;
@@ -308,6 +334,7 @@
 				font-weight: 500;
 				color: #525c6e;
 			}
+
 			.main-center {
 				text-align: center;
 				width: 33%;
@@ -315,18 +342,22 @@
 				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;
@@ -338,9 +369,11 @@
 					font-family: PingFang SC;
 					font-weight: 500;
 					color: #ffffff;
+
 					&.down {
 						background: #5ec886;
 					}
+
 					&.ping {
 						background: #f6f6f6;
 					}

+ 21 - 1
pages/public/login.vue

@@ -25,9 +25,11 @@
 </template>
 
 <script>
+	import { mapMutations,mapState } from 'vuex';
 	import {
 		loginWx,
-		gologin
+		gologin,
+		getUser
 	} from '@/api/login.js';
 	export default {
 		data() {
@@ -40,6 +42,7 @@
 			
 		},
 		methods: {
+			...mapMutations('user',['login','setUserInfo']),
 			zc() {
 				uni.navigateTo({
 					url: '/pages/public/register',
@@ -65,6 +68,23 @@
 				}).then(res => {
 					console.log(res)
 					obj.loadingType = 'no'
+					uni.showToast({
+						title: '登錄成功',
+						duration: 2000,
+						position: 'top'
+					});
+					getUser().then(re => {
+						obj.login()
+						obj.setUserInfo(re.data)
+						setTimeout(()=> {
+							uni.switchTab({
+								url:'/pages/index/index'
+							})
+						},1500)
+					})
+					
+					
+					
 				}).catch(err => {
 					console.log(err)
 					obj.loadingType = 'no'

+ 1 - 0
pages/transaction/cbdetail.vue

@@ -5,6 +5,7 @@
 			<image class="top-icon1" src="../../static/img/cb2.png" mode=""></image>
 			<image class="top-icon2" src="../../static/img/cb1.png" mode=""></image>
 		</view>
+		<view class="title">充幣</view>
 	</view>
 </template>
 

+ 33 - 0
pages/transaction/czlist.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>

+ 97 - 32
pages/transaction/transaction.vue

@@ -10,19 +10,28 @@
 				<view class="title-right">24h漲跌</view>
 			</view>
 			<scroll-view class="swiper-box" scroll-y="true" :style="{ height: maxheight }">
-				<view class="list-main flex" v-for="(item, index) in list">
-					<view class="main-left">{{ item.jyd }}</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 class="list-main flex" v-for="(item,index ) in listOBj">
+					<view class="main-left">{{index}}</view>
+					<view class="main-center" :class="{ down: item.dcf > 0, ping: item.dcf == 0 }">
+						{{ item.last == 0 ? '--.--' : item.last }}</view>
+					<view class="main-right">
+						<view class="btn" :class="{ down: item.dcf > 0, ping: item.dcf == 0 }">{{ item.dcf }}%</view>
+					</view>
 				</view>
 			</scroll-view>
 		</view>
 	</view>
 </template>
 
-<script>
+<script>
+	import { mapMutations,mapState } from 'vuex';
+	import {
+		scoketNew,
+		scoketOpen
+	} from '@/utils/socket.js';
+	import {
+		geLevertade
+	} from '@/api/index.js';
 export default {
 	onReady(res) {
 		var _this = this;
@@ -39,40 +48,96 @@ export default {
 				console.log('打印页面的剩余高度', res);
 			}
 		});
+	},
+	computed: {
+		...mapState('user',['hasLogin'])
 	},
 	data() {
 		return {
-			typelist: [{ name: 'USDT市场' }, { name: 'LP市场' }, { name: 'BNB市场' }, { name: 'TP市场' }],
+			typelist: [{ name: 'USDT市场' }],
 			tabCurrentIndex: 0,
-			maxheight: '',
-			list: [
-				{ jyd: 'BTC/USDT', price: '0.8431', zd: 1.2 },
-				{ jyd: 'ETH/USDT', price: '0.8431', zd: -1.2 },
-				{ jyd: 'EOS/USDT', price: '0.8431', zd: 1.2 },
-				{ jyd: 'DOGE/USDT', price: '0.8431', zd: 1.2 },
-				{ jyd: 'BCH/USDT', price: '0.8431', zd: 1.2 },
-				{ jyd: 'BTC/USDT', price: '0', zd: 0 },
-				{ jyd: 'BTC/USDT', price: '0.8431', zd: 1.2 },
-				{ jyd: 'BTC/USDT', price: '0.8431', zd: 1.2 },
-				{ jyd: 'BTC/USDT', price: '0.8431', zd: -1.2 },
-				{ jyd: 'BTC/USDT', price: '0.8431', zd: 1.2 },
-				{ jyd: 'BTC/USDT', price: '0.8431', zd: 1.2 },
-				{ jyd: 'BTC/USDT', price: '0.8431', zd: 1.2 },
-				{ jyd: 'BTC/USDT', price: '0.8431', zd: -1.2 },
-				{ jyd: 'BTC/USDT', price: '0.8431', zd: 1.2 },
-				{ jyd: 'BTC/USDT', price: '0.8431', zd: 1.2 },
-				{ jyd: 'BTC/USDT', price: '0.8431', zd: -1.2 },
-				{ jyd: 'BTC/USDT', price: '0.8431', zd: -1.2 },
-				{ jyd: 'BTC/USDT', price: '0.8431', zd: 1.2 }
-			]
+			maxheight: '',
+			scoket: '',
+			instId: 'IOTA-USDT', //请求的产品id
+			spList: [], //需要查询的列表
+			listOBj: {} //保存实际列表对象
 		};
 	},
-	onLoad() {},
-	onShow() {},
+	onLoad() {
+		
+	},
+	onShow() {
+		if(this.hasLogin) {
+			this.geLevertade()
+		}else {
+			uni.showModal({
+				title: '提示',
+				content: '您未登錄,是否馬上登錄?',
+				complete(res) {
+					console.log(res)
+					if(res.confirm) {
+						uni.navigateTo({
+							url:'/pages/public/login'
+						})
+					}
+				}
+			})
+		}
+		
+	},
+	onHide() {
+		this.closeScoket()
+	},
 	methods: {
 		tabClick(opt) {
 			this.tabCurrentIndex = opt;
-		}
+		},
+		// 开始请求长连接
+		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 {
+						if (res.data) {
+							// res.res.data[0].name = res.arg.instId
+							that.listOBj[res.arg.instId] = res.data[0];
+							that.listOBj[res.arg.instId].dcf = ((res.data[0].last*1 -  res.data[0].sodUtc0*1)/(res.data[0].sodUtc0*1) * 100 ).toFixed(2)
+							that.listOBj = Object.assign( {},that.listOBj);
+						}
+						console.log(that.listOBj, 'that.listOBj++++++')
+					} catch (e) {
+		
+						console.log(res, res.data, '报错');
+					}
+				})
+			})
+		},
+		closeScoket() {
+			this.scoket.scoketClose();
+		},
+		// 获取查询列表
+		geLevertade() {
+			const that = this;
+			geLevertade().then((e) => {
+				that.spList = e.list;
+				// 开启长连接
+				that.onScoket()
+		
+			})
+		},
 	}
 };
 </script>

+ 197 - 0
pages/user/menu.vue

@@ -0,0 +1,197 @@
+<template>
+	<view class="content">
+		<view class="" style="height: 40rpx;">
+
+		</view>
+		<view class="user-wrap flex">
+			<view class="user-name">
+				{{userInfo.username}}
+			</view>
+			<view class="user-invit">
+				邀請碼:{{userInfo.invit}}
+			</view>
+		</view>
+		<!-- <view class="user-list flex">
+			<image src="../../static/icon/mu1.png" mode="" class="left-img"></image>
+			<view class="">
+				語言
+			</view>
+			<image src="../../static/icon/back.png" mode="" class="right-img"></image>
+		</view> -->
+		<view class="user-list flex">
+			<image src="../../static/icon/mu2.png" mode="" class="left-img"></image>
+			<view class="">
+				幫助中心
+			</view>
+			<image src="../../static/icon/back.png" mode="" class="right-img"></image>
+		</view>
+		<view class="user-list flex">
+			<image src="../../static/icon/mu3.png" mode="" class="left-img"></image>
+			<view class="">
+				通知
+			</view>
+			<image src="../../static/icon/back.png" mode="" class="right-img"></image>
+		</view>
+		<view class="user-list flex">
+			<image src="../../static/icon/mu4.png" mode="" class="left-img"></image>
+			<view class="">
+				修改密碼
+			</view>
+			<image src="../../static/icon/back.png" mode="" class="right-img"></image>
+		</view>
+		<view class="user-list flex">
+			<image src="../../static/icon/mu5.png" mode="" class="left-img"></image>
+			<view class="">
+				提幣地址
+			</view>
+			<image src="../../static/icon/back.png" mode="" class="right-img"></image>
+		</view>
+		<view class="user-list flex">
+			<image src="../../static/icon/mu6.png" mode="" class="left-img"></image>
+			<view class="">
+				實名認證
+			</view>
+			<image src="../../static/icon/back.png" mode="" class="right-img"></image>
+		</view>
+		<view class="loginout" @click="cancel()">
+			退出
+		</view>
+	</view>
+</template>
+
+<script>
+	import {
+		mapMutations,
+		mapState
+	} from 'vuex';
+	import {
+		getUser,
+		loginout
+	} from '@/api/login.js'
+
+	export default {
+		data() {
+			return {
+
+			}
+		},
+		computed: {
+			...mapState('user', ['userInfo'])
+		},
+		onLoad() {
+
+		},
+		onShow() {
+			this.getUser()
+		},
+		onReachBottom() {
+
+		},
+		onReady() {
+
+		},
+		methods: {
+			...mapMutations('user', ['login', 'setUserInfo', 'logout']),
+			getUser() {
+				let obj = this
+				getUser().then(res => {
+					console.log(res)
+					obj.setUserInfo(res.data)
+				})
+			},
+			cancel() {
+				// this.$refs.popup.open();
+				let obj = this;
+				uni.showModal({
+					content: '确定要退出登录么',
+					success: e => {
+						if (e.confirm) {
+							loginout().then(res => {
+								obj.logout();
+								uni.switchTab({
+									url: '/pages/index/index'
+								})
+							})
+
+
+						}
+					}
+				});
+			},
+		}
+	}
+</script>
+
+<style lang="scss">
+	page {
+		background-color: #fff;
+		height: 100%;
+	}
+
+	.user-wrap {
+		width: 674rpx;
+		height: 147rpx;
+		margin: auto;
+		background: #F9F9F9;
+		border-radius: 10rpx;
+		flex-direction: column;
+		padding-left: 27rpx;
+		justify-content: center;
+		align-items: start;
+		text-align: left;
+
+		.user-name {
+			font-size: 34rpx;
+			font-weight: 500;
+			color: #636572;
+		}
+
+		.user-invit {
+			padding: 20rpx 0;
+			font-size: 22rpx;
+			font-weight: 500;
+			color: #636572;
+		}
+	}
+
+	.user-list {
+		width: 691rpx;
+		height: 104rpx;
+		background: #FFFFFF;
+		// box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06)
+		border-radius: 28rpx;
+		margin: 20rpx auto;
+		// padding: 0 25rpx;
+
+		.left-img {
+			width: 50rpx;
+			height: 50rpx;
+		}
+
+		view {
+			padding-left: 20rpx;
+			flex-grow: 1;
+			font-size: 29rpx;
+			font-weight: bold;
+			color: #5D5D5D;
+		}
+
+		.right-img {
+			width: 50rpx;
+			height: 50rpx;
+		}
+	}
+
+	.loginout {
+		width: 675rpx;
+		height: 70rpx;
+		line-height: 70rpx;
+		text-align: center;
+		font-size: 26rpx;
+		color: #000;
+		background-color: #f4d03c;
+		margin: 50rpx auto;
+		border-radius: 20rpx;
+		font-weight: bold;
+	}
+</style>

+ 1 - 1
static/css/cmy.css

@@ -470,7 +470,7 @@
 }
 
 .bg-success {
-	background-color: #009688 !important;
+	background-color: #5DC887 !important;
 }
 
 .bg-info {

BIN
static/icon/back.png


BIN
static/icon/hy01.png


BIN
static/icon/hy02.png


BIN
static/icon/hy03.png


BIN
static/icon/hy04.png


BIN
static/icon/mu1.png


BIN
static/icon/mu2.png


BIN
static/icon/mu3.png


BIN
static/icon/mu4.png


BIN
static/icon/mu5.png


BIN
static/icon/mu6.png


BIN
static/icon/tz.png


BIN
static/icon/user.png


+ 2 - 2
uni.scss

@@ -30,14 +30,14 @@ $uni-border-color:#ebeef5;
 /*颜色*/
 $color-yellow: #fd5b23;
 $color-gray: #999999;
-$color-green: #5dbc7c;
+$color-green: #5DC887;
 $color-red: #dd524d;
 /* 图片加载中颜色 */
 $image-bg-color: #eee;
 /* 行为相关颜色 */
 $uni-color-primary: #5dbc7c;
 $uni-color-success: #4cd964;
-$uni-color-warning: #f0ad4e;
+$uni-color-warning: #F4D03C;
 $uni-color-error: #dd524d;
 // 提交框阴影
 $box-shadow: 0rpx 0rpx 10rpx 10rpx #f3f3f3;