ソースを参照

前端小程序sdy

zhongtianhaoyuan 3 年 前
コミット
dda0ec008e

+ 26 - 15
components/swiperup.vue

@@ -1,15 +1,17 @@
 <template>
-	<view class="wrap">
+	<view class="wrap" @click="clickInfoList()">
 		 <swiper
 	  id="_swiper_up"
 	  :indicator-dots="indicatorDots"
 	  :autoplay="autoplay" :interval="interval" :duration="duration" vertical="true" circular="true">
 	  <block v-for="(item,index) in list" :key="index">
-	    <swiper-item>
+	    <swiper-item >
 			<view class="itme_text">
 				<view>
-					<image class='gb' src='https://taohaoliang.oss-cn-beijing.aliyuncs.com/tmp/gb.png'></image>
-					<image class='horn' src='https://taohaoliang.oss-cn-beijing.aliyuncs.com/tmp/horn.png'></image>{{item.port}}{{item.goodsName}}&nbsp;&nbsp;({{item.newOld}})&nbsp;&nbsp;{{item.price}}元/吨
+					<image class='gb' src='https://taohaoliang.oss-cn-beijing.aliyuncs.com/tmp/new.png'></image>
+					最新价格:<{{item.goodsName}}> 
+					<text style="margin-right: 10px;margin-left: 10px;" :class="item.newPrice > item.openPrice ? 'text-red':'text-green'">{{item.newPrice}}</text>
+					元/吨
 				</view>
 			</view>
 	    </swiper-item>
@@ -61,21 +63,27 @@
 			console.log(this.list)
 		},
 		methods: {
+			clickInfoList(){
+				uni.navigateTo({
+					url: `/pageB/info/info_list`
+				})
+			},
 			eventClick() {
 				this.$emit('eventClick');
 			}
+			
 		},
 	}
 </script>
 
 <style scoped>
 	.wrap{
-		height: 64rpx;
+		height: 74rpx;
 		margin-bottom: 20rpx;
 		background: #fff;
-		line-height: 64rpx;
+		line-height: 74rpx;
 		position: relative;
-		width:84%;
+		width:90%;
 		margin:0 auto;
 		margin-top:12px;
 		box-shadow: 2px 2px 4px rgba(0,0,0,0.07);
@@ -85,29 +93,31 @@
 		position: absolute;
 		background: #fff;
 		display: block;
-		width: 35px;
-		height: 35px;
+		width: 37px;
+		height: 37px;
 		left: -15px;
 		z-index: 1;
-		-webkit-border-radius: 50%;
-		border-radius: 50%;
+		-webkit-border-radius: 30%;
+		border-radius: 30%;
 	}
 	.wrap::after{
 		content: "";
 		position: absolute;
 		background: #fff;
 		display: block;
-		width: 35px;
-		height: 35px;
+		width: 37px;
+		height: 37px;
 		right: -15px;
 		z-index: 1;
-		-webkit-border-radius: 50%;
-		border-radius: 50%;
+		-webkit-border-radius: 30%;
+		border-radius: 30%;
 	}
 	.gb{
 		width:27px;
 		height:21px;
 		vertical-align: middle;
+		margin-right: 10px;
+		
 	}
 	.horn{
 		width:14px;height:14px;
@@ -130,5 +140,6 @@
 	.itme_text {
 	  font-size: 26rpx;
 	  z-index: 999;
+	  color: #000000;
 	}
 </style>

+ 5 - 5
main.js

@@ -182,17 +182,17 @@ const doRequest = (method, url, data,header)=> {
 	// let baseUrl = config.def().baseUrl
 	let baseUrl = config.def().baseUrlNew
         // 如果data为空
-        if (!data) var data = []
-        var arr = []
-        arr.push(data)
+        // if (!data) var data = []
+        // var arr = []
+        // arr.push(data)
         // 接口需要验证的可以将json转成数组添加值再调用
         // 不需要的可以直接data:data
         return new Promise((resolve, reject) => {
             uni.request({
                 method: method,
                 url: baseUrl +url,
-                data: arr[0],
-                // data:data
+                // data: arr[0],
+                data:data,
                 header: {
                     'content-type': contentheader //'application/x-www-form-urlencoded; charset=UTF-8',
                 },

+ 66 - 144
pageA/product/trade.vue

@@ -4,88 +4,53 @@
 		<view class="detail-desc">
 			<view class="c-list">
 				<view class="c-row">
-					<text class="tit">水分(%){{'<='}} </text>
+					<text class="tit">卖方</text>
 					<view class="con-list">
-						<text>{{goods.waterContent}}</text>
+						<view v-if='goods.customerTypeFlag==1' class="title">{{goods.customerName}}</view>
+						<view v-if='goods.customerTypeFlag==2' class="title">{{goods.compName}}</view>
 					</view>
 				</view>
-				</view>
-		<view v-if="companyId!=2" class="cu-form-group">
-			<view class="title">卖方</view>
-			<view class="title">{{seller}}</view>
-		</view>
-		<view v-if="companyId!=2" class="cu-form-group">
-			<view class="title">卖方电话</view>
-			<view class="title">{{sellerPhone}}</view>
-		</view>
-		</view>
-		<view class="cu-form-group">
-			<text class="tit">我的信息</text>
-			<view v-if='bankNameList.length>0'>
-				<picker @change="bankNameChange" :value="bankNameIndex" :range="bankNameList">
-					<view class="picker">
-						{{bankNameIndex>-1?bankNameList[bankNameIndex]:'点击选择名头'}}
+				<view class="c-row">
+					<text class="tit">买方</text>
+					<view class="con-list">
+						<view class="title">{{seller}}</view>
 					</view>
-				</picker>
-			</view>
-				
-			<button class='cu-btn bg-green shadow' @click="changeZhihang">添加名头</button>
-		</view>
-		<view  v-if="companyId!=2" class="cu-form-group margin-top">
-			<view class="title">价格类型</view>
-			<picker @change="PriceTypeChange" :value="priceTypeIndex" :range="priceType">
-				<view class="picker">
-					{{priceTypeIndex>-1?priceType[priceTypeIndex]:'请选择'}}
 				</view>
-			</picker>
+			</view>
 		</view>
-		<view v-if='companyId!=2' class="cu-form-group">
-			<view class="title">交接区域</view>
-			<picker mode="region" @change="RegionChange" :value="region">
-				<view class="picker" v-if="region.length>0">
-					{{region[0]}}{{region[1]}}{{region[2]}}
+		<view class="detail-desc">
+			<view class="c-list">
+				<view class="c-row">
+					<text class="tit">卖方</text>
+					<view class="con-list">
+						<view v-if='goods.customerTypeFlag==1' class="title">{{goods.customerName}}</view>
+						<view v-if='goods.customerTypeFlag==2' class="title">{{goods.compName}}</view>
+					</view>
 				</view>
-				<view class="picker" v-else>
-					请选择
+				<view class="c-row">
+					<text class="tit">买方</text>
+					<view class="con-list">
+						<view class="title">{{seller}}</view>
+					</view>
 				</view>
-			</picker>
-		</view>
-		<view v-if='companyId!=2' class="cu-form-group">
-			<view class="title">详细交收地址</view>
-			<input placeholder="请填写" name="input" @input="addressInput"></input>
-		</view>
-		<view v-if='companyId==2' class="cu-form-group">
-			<view class="title">库点地址</view>
-			<view class="title">{{province+city+area+storeName}}</view>
-		</view>
-		<view class="cu-form-group">
-			<view class="title">最小成交量(吨)</view>
-			<view class="title">{{minSale}}</view>
-		</view>
-		<view v-if='companyId!=2' class="cu-form-group">
-			<view v-if='isFutures==1' class="title">库容</view>
-			<view v-if='isFutures==0' class="title">库存量</view>
-			<view class="title">{{exsitCount}}</view>
+			</view>
 		</view>
-		<view v-if="companyId==2" class="cu-form-group">
-			<view  class="title">发票类型</view>
-			<picker @change="InvoiceTypeChange1" :value="invoiceTypeIndex1" :range="invoiceType1">
-				<view class="picker">
-					{{invoiceTypeIndex1>-1?invoiceType1[invoiceTypeIndex1]:'请选择'}}
+		<view class="detail-desc">
+			<view class="c-list">
+				<view class="c-row">
+					<text class="tit">卖方</text>
+					<view class="con-list">
+						<view v-if='goods.customerTypeFlag==1' class="title">{{goods.customerName}}</view>
+						<view v-if='goods.customerTypeFlag==2' class="title">{{goods.compName}}</view>
+					</view>
 				</view>
-			</picker>
-		</view>
-		<view v-else class="cu-form-group">
-			<view  class="title">发票类型</view>
-			<picker @change="InvoiceTypeChange" :value="invoiceTypeIndex" :range="invoiceType">
-				<view class="picker">
-					{{invoiceTypeIndex>-1?invoiceType[invoiceTypeIndex]:'请选择'}}
+				<view class="c-row">
+					<text class="tit">买方</text>
+					<view class="con-list">
+						<view class="title">{{seller}}</view>
+					</view>
 				</view>
-			</picker>
-		</view>
-		<view class="cu-form-group">
-			<view class="title">购买数量(吨)</view>
-			<input placeholder="请填写" name="input" @input="countInput"></input>
+			</view>
 		</view>
 		<!-- <view v-if='isFutures==0' class="cu-form-group margin-top margin-bottom">
 			<view class="title">质量验收方式</view>
@@ -95,56 +60,6 @@
 				</view>
 			</picker>
 		</view> -->
-		<view v-if="companyId!=2" class="cu-form-group">
-			<view class="title">包装方式</view>
-			<input placeholder="请填写 例:袋装XX斤/散装" name="input" @input='packingInput'></input>
-		</view>
-		<view  v-else class="cu-form-group margin-top">
-			<view class="title">包装方式</view>
-			<picker @change="packingChange" :value="packingIndex" :range="packingType">
-				<view class="picker">
-					{{packingIndex>-1?packingType[packingIndex]:'请选择'}}
-				</view>
-			</picker>
-		</view>
-		<view class="cu-form-group">
-			<view v-if='companyId != 2' class="title">协议单价(元/吨)</view>
-			<view v-else class="title" style='color:red'>点价(元/吨)</view>
-			<input placeholder="请填写" name="input" @input="unitPriceInput"></input>
-		</view>
-		<view v-if="companyId==2" class="cu-form-group">
-			<view class="title">基差(元/吨)</view>
-			<view class="title">{{basis}}</view>
-		</view>
-		<view v-if="companyId==2" class="cu-form-group">
-			<view class="title">发票费用(元/吨)</view>
-			<view class="title">{{invoiceMoney}}</view>
-		</view>
-<!-- 		<view v-if="companyId==2&&unloadingFee" class="cu-form-group">
-			<view class="title">卸车费(元/吨)</view>
-			<view class="title">{{unloadingFee}}</view>
-		</view> -->
-		<view v-if="companyId==2" class="cu-form-group">
-			<view class="title">包装费</view>
-			<view class="title">25KG(含25)以内40元/吨,50KG(含50)以内20元/吨</view>
-		</view>
-		
-		<view v-if="companyId==2" class="cu-form-group">
-			<view class="title">结算价格(自动计算)</view>
-			<view class="title">{{(Number(unitPrice) + Number(basis) + Number(invoiceMoney) +  Number(packingMoney))*count}}元</view>
-		</view>
-		<view v-else class="cu-form-group">
-			<view class="title">总金额(自动计算)</view>
-			<view class="title">{{unitPrice*count}}元</view>
-		</view>
-		<view v-if="companyId==2" class="cu-form-group align-start">
-			<!-- <view class="title">结算价格=点价+基差+发票+包装费</view> -->
-			<view class="title">最终以纸质合同为准</view>
-		</view>
-		<view class="cu-form-group align-start">
-			<view class="title">备注</view>
-			<textarea maxlength="-1" :disabled="modalName!=null" @input="textareaInput" placeholder="请填写包装规格、质量、包装物要求。例:50kg袋装、大粒、彩包"></textarea>
-		</view>
 		<view class="padding flex flex-direction">
 			<button class="cu-btn bg-red margin-tb-sm lg" @click="commit">提交</button>
 		</view>
@@ -174,6 +89,7 @@
 						packingMoney:0,
 						type:0,
 					},
+					goods:{},
 					invoiceTypeIndex:0,
 					invoiceTypeIndex1:0,
 					acceptTypeIndex:0,
@@ -239,31 +155,37 @@
 				this.unloadingFee = options.unloadingFee
 			},
 			onShow() {
-				var that=this
-				this.$api.request('company', 'getCompany', failres => {
-					that.$api.msg(failres.errmsg)
-					uni.hideLoading()
-				}).then(res => {
-					if(res.data.code=='SUCCESS'){
-						var data=[]
-						this.Company=res.data.data
-						if(res.data.data){
-							for(let i=0;i<res.data.data.length;i++){
-								data.push(res.data.data[i].companyName+' '+res.data.data[i].companyPhone)
-							}
-						}
-						if(this.Company){
-							this.buyer =this.Company[0].companyName
-							this.buyerPhone=this.Company[0].companyPhone
-							this.tradeCompanyId=this.Company[0].id
-						}
-						that.bankNameList=data
-						uni.hideLoading()
-					}else{
-						that.$api.msg(res.data.code)
-						uni.hideLoading()
+				this.$api.doRequest('get', '/identityAuthenticationInfo/getInfo',{commonId:111111}).then(res => {
+					if(res.data.code==200){
+						this.goods=res.data.data
 					}
+					uni.hideLoading()
 				})
+				// var that=this
+				// this.$api.request('company', 'getCompany', failres => {
+				// 	that.$api.msg(failres.errmsg)
+				// 	uni.hideLoading()
+				// }).then(res => {
+				// 	if(res.data.code=='SUCCESS'){
+				// 		var data=[]
+				// 		this.Company=res.data.data
+				// 		if(res.data.data){
+				// 			for(let i=0;i<res.data.data.length;i++){
+				// 				data.push(res.data.data[i].companyName+' '+res.data.data[i].companyPhone)
+				// 			}
+				// 		}
+				// 		if(this.Company){
+				// 			this.buyer =this.Company[0].companyName
+				// 			this.buyerPhone=this.Company[0].companyPhone
+				// 			this.tradeCompanyId=this.Company[0].id
+				// 		}
+				// 		that.bankNameList=data
+				// 		uni.hideLoading()
+				// 	}else{
+				// 		that.$api.msg(res.data.code)
+				// 		uni.hideLoading()
+				// 	}
+				// })
 				// uni.getLocation({
 				//     type: 'wgs84',
 				// 	geocode:true,

ファイルの差分が大きいため隠しています
+ 259 - 0
pageB/info/info_list.vue


+ 21 - 45
pageD/identity/companyIdentity.vue

@@ -70,14 +70,13 @@
 			<view class="c-row b-b">
 				<text class="tit">手机号</text>
 				<view class="con-list">
-					<input placeholder="请填写手机号" name="input" v-model="identityAuthenticationInfo.customerPhone"></input>
+					<input placeholder="请填写手机号" @input='phoneinput' v-model="identityAuthenticationInfo.customerPhone"></input>
 				</view>
 			</view>
 			<view style='width:100%;border-bottom:1px solid #E8E9ED;position:relative;padding:10px;' class="flex">
 				<button :class='codestatus&&!sendDisabled?"active":""' @click='getcode'
 					class='getcode'>{{sendText}}</button>
 				<view style='width:70%;position:relative;margin-left: 200px;'>
-
 					<input v-model='verifyCode' placeholder="请输入验证码" type="text">
 				</view>
 			</view>
@@ -145,7 +144,7 @@
 			<view class="c-row b-b">
 				<text class="tit">手机号</text>
 				<view class="con-list">
-					<input placeholder="请填写手机号" name="input" v-model="identityAuthenticationInfo.customerPhone"></input>
+					<input placeholder="请填写手机号" @input='phoneinput' v-model="identityAuthenticationInfo.customerPhone"></input>
 				</view>
 			</view>
 			<view style='width:100%;border-bottom:1px solid #E8E9ED;position:relative;padding:10px;' class="flex">
@@ -175,7 +174,6 @@
 		name: "buy",
 		data() {
 			return {
-				radios: 2,
 				inputContent: null,
 				customerPhone: '',
 				consentStatus: true,
@@ -186,12 +184,18 @@
 				sendText: '获取验证码',
 				platform: '',
 				sendDisabled: false,
+
 				identityAuthenticationInfo: {
 					customerPhone: '',
 			
 				},
 				tempFilePaths: [],
-				businessLicenseAddressUrl:""
+				businessLicenseAddressUrl:"",
+
+				userInfo:{
+					phone: ''
+				},
+				identityAuthenticationInfo: {},
 			};
 
 		},
@@ -204,8 +208,8 @@
 					this.consentStatus = false
 					this.consentStatus1 = true
 				}
-
 			},
+
 			license() {
 				wx.chooseImage({
 					success: function(res) {
@@ -227,9 +231,9 @@
 
 			getcode() {
 				var that = this
-				if (/^0?1[3|4|5|6|7|8][0-9]\d{8}$/.test(this.customerPhone)) {
+				if (/^0?1[3|4|5|6|7|8][0-9]\d{8}$/.test(this.identityAuthenticationInfo.customerPhone)) {
 					this.$api.doRequest('get', '/commonUser/sendVerifyCode', {
-							phone: this.customerPhone
+							phone: this.identityAuthenticationInfo.customerPhone
 						}).then(res => {
 							if (res.data.code == 200) {
 								that.sendDisabled = true
@@ -265,25 +269,20 @@
 						duration: 2000
 					})
 				}
-
+			},
+			phoneinput(e){
+				if(e.detail.value.length==11){
+					this.codestatus=true
+				}
 			},
 			verifyCodeInput(e) {
 				this.verifyCode = e.detail.value
 			},
-			phoneinput(e) {
-				if (e.detail.value.length == 11) {
-					this.codestatus = true
-				}
-			},
 			cancel() {
 				this.inputShow = false
 				this.inputStatus = 'none'
 				this.isPhone = false
 			},
-			radioschenge(index) {
-				console.log(index)
-				this.radios = index
-			},
 			commit() {
 				this.identityAuthenticationInfo.businessLicenseAddressUrl = 111
 				console.log(this.businessLicenseAddressUrl,"好了")
@@ -310,7 +309,6 @@
 	.center {
 		padding: 10px 20px;
 	}
-
 	.c-row {
 		display: -webkit-box;
 		display: -webkit-flex;
@@ -321,17 +319,6 @@
 		padding: 20rpx 30rpx;
 		position: relative;
 	}
-
-	.verificationCode {
-		margin-top: 20px;
-		background: #F5F6F9;
-		color: #AFB3BF;
-	}
-
-	.verificationCode:after {
-		border: none;
-	}
-
 	.con-list {
 		-webkit-box-flex: 1;
 		-webkit-flex: 1;
@@ -349,34 +336,23 @@
 		padding-right: 20rpx;
 		font-size: 14px;
 	}
-
-	.verificationCode.active {
-		background: #22C572;
-		color: #fff;
-	}
-
 	.getcode {
 		font-size: 14px;
 		position: absolute;
-		/* 	right:0; */
 		top: 50%;
 		transform: translateY(-50%);
 		color: #AFB3BF;
 		background: #F5F6F9;
 		height: 30px;
 		line-height: 30px;
-
 	}
-
-	.getcode:after {
+	.getcode.active {
 		border: none;
 	}
-
-	.uni-navigator {
-		display: inline-block;
-		color: #22C572;
+	.uni-navigator{
+		display:inline-block;
+		color:#22C572;
 	}
-
 	.getcode.active {
 		background: #22C572;
 		color: #fff;

+ 15 - 2
pages.json

@@ -5,8 +5,8 @@
 		"lazyCodeLoading": "requiredComponents",
 		"tabBar": {
 			"custom":false,
-			"color": "#7A7E83",
-			"selectedColor": "#3cc51f",
+			"color": "#656765",
+			"selectedColor": "#22C572",
 			"borderStyle": "black",
 			"backgroundColor": "#ffffff",
 			"list": [
@@ -23,6 +23,12 @@
 					"selectedIconPath":"static/img/jiaoyi_check.png",
 					"text": "交易"
 				},
+				{
+					"pagePath": "pages/home/home",
+					"iconPath":"static/img/liangxin.png",
+					"selectedIconPath":"static/img/liangxin_check.png",
+					"text": "粮信"
+				},
 				{
 					"pagePath": "pages/tran/tran",
 					"iconPath":"static/img/wuliu.png",
@@ -621,6 +627,13 @@
 						"enablePullDownRefresh": true
 					}
 				},
+				{
+				    "path" : "info/info_list",
+				    "style" : {
+						"navigationBarTitleText": "期货信息",
+						"enablePullDownRefresh": false
+					}
+				},
 				{
 				    "path" : "contract/contract_detail",
 				    "style" : {

+ 47 - 6
pages/sale/information.vue

@@ -22,7 +22,7 @@
 				<text class="num">{{swiperLength}}</text>
 			</view> -->
 		</view> 
-		<swiper-up :list="portInfo"></swiper-up>
+		<swiper-up :list="infoList" ></swiper-up>
 		<scroll-view style='margin-top:12px;padding:0 20px;' scroll-x class="nav">
 			<view class="flex text-center">
 				<view style='position:relative;' class="cu-item flex-sub" :class="item.value==TabCur?'text-white':''" v-for="item in categoryList"@tap="tabSelect" :data-id="item.value">
@@ -130,7 +130,6 @@
 			<view v-show="isLoadMore">
 			    <uni-load-more :status="loadStatus" ></uni-load-more>
 			</view>
-			
 		</view>
 	</view>
 </template>
@@ -178,7 +177,8 @@
 				loadStatus:'loading',  //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
 				TabCur: 0,
 				category:0,
-				current: 0
+				current: 0,
+				infoList1:[]
 			};
 		},
 		onReady() {
@@ -188,11 +188,45 @@
 			this.pages = 1
 			this.isLoadMore = false
 			this.loadStatus = 'more'
-			const that = this
 			this.loadData()
 		},
 		onLoad(options) {
-			
+			var that = this
+			var infoList = [];
+			uni.request({
+			    url: "https://hq.sinajs.cn/list=C0,C2109,C2111,C2201,C2203,C2205,C2207,A0,A2109,A2111,A2201,A2203,A2205,A2207",
+			    // url: "https://hq.sinajs.cn/list=C2109",
+			    header: {
+			        'content-type': 'application/x-www-form-urlencoded'
+			    },
+			    success: function(result) {
+			        // resolve调用后,即可传递到调用方使用then或者async+await同步方式进行处理逻辑
+					var tmp = result.data.split('"')
+					for(var i = 1; i<tmp.length;i=i+2){
+						var list = tmp[i].split(",")
+						var data = {
+							goodsName:list[0],
+							newPrice:list[6],
+							openPrice:list[2]
+						}
+						if(data.goodsName){
+							infoList.push(data)
+						}
+					}
+					let name = 'infoList';
+					let value = infoList;
+					that.$store.commit('$uStore', {
+						name,
+						value
+					});
+					// console.log("infoList",infoList)
+			    },
+			    fail: function(e) {
+			        console.log('error in...')
+			        // reject调用后,即可传递到调用方使用catch或者async+await同步方式进行处理逻辑
+			        reject(e)
+			    },
+			})
 		},
 		onPageScroll(e) {
 			this.scrollTop = e.scrollTop;
@@ -214,6 +248,7 @@
 			...mapState(['hasLogin', 'userInfo'])
 		},
 		methods: {
+			
 			DotStyle(e) {
 				this.dotStyle = e.detail.value
 			},
@@ -343,7 +378,7 @@
 					//价格简报
 					if (data.portInfo) {
 						that.portInfo = data.portInfo
-						console.log(that.portInfo)
+						console.log("portInfo",that.portInfo)
 					}
 					//分类5Buttom
 					if (data.advertisement.t4) {
@@ -491,6 +526,9 @@
 </script>
 
 <style lang="scss" scoped>
+	.container{
+		margin: 10rpx 10rpx 10rpx 10rpx;
+	}
 	.cu-tag.badge {
 	    right: 26rpx;
 	}
@@ -634,6 +672,9 @@
 		background: #fff;
 		margin-bottom: 10px;
 	}
+	.swiper-item{
+		border-radius: 5%;
+	}
 	.guess-section {
 		margin-bottom: 120rpx;
 		margin-top:20rpx;

BIN
static/img/jiaoyi.png


BIN
static/img/jiaoyi_check.png


BIN
static/img/liangxin.png


BIN
static/img/liangxin_check.png


BIN
static/img/wode.png


BIN
static/img/wode_check.png


BIN
static/img/wuliu.png


BIN
static/img/wuliu_check.png


BIN
static/img/zixun.png


BIN
static/img/zixun_check.png


+ 3 - 1
store/index.js

@@ -11,7 +11,7 @@ try {
 }
 
 // 需要永久存储,且下次APP启动需要取出的,在state中的变量名
-let saveStateKeys = ['firendItem','userData','pushRes','myTip','taskTip','contractTip','liangxinTip','packet','linkItem','memberItem','memberItemIndex','chatItem','clientId'];
+let saveStateKeys = ['firendItem','userData','pushRes','myTip','taskTip','contractTip','liangxinTip','packet','linkItem','memberItem','memberItemIndex','chatItem','clientId','infoList'];
 
 // 保存变量到本地存储中
 const saveLifeData = function(key, value) {
@@ -53,6 +53,8 @@ const store = new Vuex.Store({
 		hasLogin: false,
 		// 如果上面从本地获取的lifeData对象下有对应的属性,就赋值给state中对应的变量
 		pushRes:lifeData.pushRes?lifeData.pushRes: {},
+		//期货数据获取
+		infoList:lifeData.infoList?lifeData.infoList: [],
 		//我的气泡提示
 		myTip:lifeData.myTip?lifeData.myTip: 0,
 		//我的气泡提示

+ 43 - 0
websocket_sdk.js

@@ -35,6 +35,7 @@ export default class Websocket {
             //发送心跳
             _this.sendHeartbeatData(options);
 			_this.getTips()
+			_this.getInfo()
         }, this._timeout);
     }
     // 监听websocket连接关闭
@@ -296,4 +297,46 @@ export default class Websocket {
 			})
 		})
 	}
+	getInfo(){
+		return new Promise(resolve => {
+			var hour = new Date().getHours();
+			if((hour >= 9 && hour < 12) ||(hour >= 13 && hour < 15)){
+				var infoList = [];
+				uni.request({
+				    url: "https://hq.sinajs.cn/list=C0,C2109,C2111,C2201,C2203,C2205,C2207,A0,A2109,A2111,A2201,A2203,A2205,A2207",
+				    // url: "https://hq.sinajs.cn/list=C2109",
+				    header: {
+				        'content-type': 'application/x-www-form-urlencoded'
+				    },
+				    success: function(result) {
+				        // resolve调用后,即可传递到调用方使用then或者async+await同步方式进行处理逻辑
+						var tmp = result.data.split('"')
+						for(var i = 1; i<tmp.length;i=i+2){
+							var list = tmp[i].split(",")
+							var data = {
+								goodsName:list[0],
+								newPrice:list[6],
+								openPrice:list[2]
+							}
+							if(data.goodsName){
+								infoList.push(data)
+							}
+						}
+						let name = 'infoList';
+						let value = infoList;
+						store.commit('$uStore', {
+							name,
+							value
+						});
+						// console.log("infoList",infoList)
+				    },
+				    fail: function(e) {
+				        console.log('error in...')
+				        // reject调用后,即可传递到调用方使用catch或者async+await同步方式进行处理逻辑
+				        reject(e)
+				    },
+				})
+			}
+		})
+	}
 }

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません