瀏覽代碼

1.修改首页布局
2.添加历史接口

306132416@qq.com 6 年之前
父節點
當前提交
2d619b7c3f
共有 2 個文件被更改,包括 82 次插入14 次删除
  1. 80 13
      pages/index/index.vue
  2. 2 1
      pages/selfInfo/selfInfo.vue

+ 80 - 13
pages/index/index.vue

@@ -18,18 +18,19 @@
 				</view>
 				
 				<view  v-for="chat in talkList" :key="chat.talkType">
-					<view  class="talk-box" v-show="chat.talkType === 0">
+					<view  class="talk-box talk-box-end" v-show="chat.content">
+						<view class="talk-content">{{chat.content}}</view>
 						<view  class="talk-head-box">
-							<image :src="chat.headUrl" mode="" class="talk-head"></image>
+							<image :src='userHeadUrl' mode="" class="talk-head"></image>
 						</view>
-						<view class="talk-content">{{chat.content}}</view>
 					</view>
-					<view  class="talk-box talk-box-end" v-show="chat.talkType === 1">
-						<view class="talk-content">{{chat.content}}</view>
+					<view  class="talk-box">
 						<view  class="talk-head-box">
-							<image :src="chat.headUrl" mode="" class="talk-head"></image>
+							<image :src='rabotHeadImg' mode="" class="talk-head"></image>
 						</view>
+						<view class="talk-content">{{chat.reply}}</view>
 					</view>
+				
 				</view>
 				
 			</view>
@@ -50,17 +51,60 @@
 				nowTime:'',
 				nowHeight:'622px',
 				inputInfo:'',
-				userHeadUrl:getApp().globalData.user_headUrl || '../../static/logo.png',
+				rabotHeadImg:"../../static/logo.png",
+				userHeadUrl:getApp().globalData.user_headUrl || '../../static/alienware.png',
 				talkList:[
 					{
-						talkType:1 ,// 代表用户
-						headUrl:'../../static/alienware.png',
-						content:'0000152',
+						"id": "1", 
+						"content": "", 
+						"reply": "欢迎您使用阿拉灯神丁,您有10次免费查询机会,输入股票代码(例如:000001)试试吧!", 
+						"uid": "1", 
+						"type": "0", 
+						"addtime": "1575961303",
 					},
 					{
-						talkType:0 ,// 代表机器人
-						headUrl:'../../static/logo.png',
-						content:'参与投股100人,62人建议买入,30人建议卖出,8人建议持有不操作',
+						"id": "2", 
+						"reply": "参与投股100人,62人建议买入,30人建议卖出,8人建议持有不操作",
+						"uid": "1", 
+						"type": "0", 
+						"addtime": "1575961303",
+						 headUrl:'../../static/logo.png',
+						 content:'000001',
+					},
+					{
+						"id": "3", 
+						"reply": "停市啦!",
+						"uid": "1", 
+						"type": "0", 
+						"addtime": "1575961303",
+						 headUrl:'../../static/logo.png',
+						 content:'000003',
+					},
+					{
+						"id": "3", 
+						"reply": "停市啦!",
+						"uid": "1", 
+						"type": "0", 
+						"addtime": "1575961303",
+						 headUrl:'../../static/logo.png',
+						 content:'000003',
+					},
+					{
+						"id": "3", 
+						"reply": "停市啦!",
+						"uid": "1", 
+						"type": "0", 
+						"addtime": "1575961303",
+						 headUrl:'../../static/logo.png',
+						 content:'000003',
+					},{
+						"id": "3", 
+						"reply": "停市啦!",
+						"uid": "1", 
+						"type": "0", 
+						"addtime": "1575961303",
+						 headUrl:'../../static/logo.png',
+						 content:'000003',
 					},
 				],
 				config:{
@@ -86,6 +130,7 @@
 		},
 		onLoad() {
 		  this.getEquipmentHeight();
+		  this.getHistory();
 		},
 		onShow() {
 			this.getNowTime();
@@ -106,6 +151,28 @@
 				this.nowHeight = height  + 'px';
 				getApp().globalData.glbalHeight = this.nowHeight;
 			},
+			getHistory(){
+				let that = this;
+				uni.request({
+					url:getApp().globalData.shareUrl, //需要设置为全局
+					method: 'POST',
+					header: {
+						'content-type': 'application/x-www-form-urlencoded'
+					},
+					data: {
+						method: 'question_list',
+						timestamp: getApp().globalData.globalTimestamp, //Date.now()
+						uid:getApp().globalData.user_id,
+						sign: md5('question_list' + getApp().globalData.globalTimestamp),
+						page:1,
+						pageSize:10,
+					},
+					success: res => {
+						 that.talkList = (res.data.msg).reverse();
+						 that.userHeadUrl = getApp().globalData.user_headUrl 
+					} 
+				});
+			},
 			customConduct(){
 					uni.navigateTo({
 						url:'../selfInfo/selfInfo'

+ 2 - 1
pages/selfInfo/selfInfo.vue

@@ -96,7 +96,8 @@
 						headimg:info.avatarUrl
 					},
 					success: res => {
-					     console.log(res.data.msg)
+						 getApp().globalData.user_name = res.data.msg.name;
+						 getApp().globalData.user_headUrl = res.data.msg.headimg;
 					} 
 				});
 			},