index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <template>
  2. <view class="content">
  3. <navigation-custom :config="config" :scrollTop="scrollTop" @customConduct="customConduct" :scrollMaxHeight="scrollMaxHeight"/>
  4. <view class='chat-box' :style="{ 'min-height': nowHeight}">
  5. <view class="tips-box">
  6. {{nowTime}}
  7. </view>
  8. <view class="tips-box tips-title" >
  9. 您好,智能投顾很高兴为您服务!
  10. </view>
  11. <view class="talk-box" >
  12. <view class="talk-head-box">
  13. <image src="../../static/logo.png" mode="" class="talk-head"></image>
  14. </view>
  15. <view class="talk-content">您好,智能顾投很高兴为您服务!</view>
  16. </view>
  17. <view v-for="chat in talkList" :key="chat.talkType">
  18. <view class="talk-box" v-show="chat.talkType === 0">
  19. <view class="talk-head-box">
  20. <image :src="chat.headUrl" mode="" class="talk-head"></image>
  21. </view>
  22. <view class="talk-content">{{chat.content}}</view>
  23. </view>
  24. <view class="talk-box talk-box-end" v-show="chat.talkType === 1">
  25. <view class="talk-content">{{chat.content}}</view>
  26. <view class="talk-head-box">
  27. <image :src="chat.headUrl" mode="" class="talk-head"></image>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="send-box">
  33. <input type="number" class="enter-box" v-model="inputInfo">
  34. <button type="primary" class="submit-message" @click="sendInputInfo()">发送</button>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import navigationCustom from "../../components/struggler-navigationCustom/navigation-custom"
  40. export default {
  41. data() {
  42. return {
  43. title: 'RABOT',
  44. nowTime:'',
  45. nowHeight:'622px',
  46. inputInfo:'',
  47. talkList:[
  48. {
  49. talkType:1 ,// 代表用户
  50. headUrl:'../../static/alienware.png',
  51. content:'0000152',
  52. },
  53. {
  54. talkType:0 ,// 代表机器人
  55. headUrl:'../../static/logo.png',
  56. content:'参与投股100人,62人建议买入,30人建议卖出,8人建议持有不操作',
  57. },
  58. ],
  59. config:{
  60. title:"阿拉丁神灯", //title
  61. bgcolor:"#fff", //背景颜色
  62. fontcolor:"black", //文字颜色,默认白色
  63. type:3, //type 1,3胶囊 2,4无胶囊模式
  64. transparent:false, //是否背景透明 默认白色
  65. linear:true, //是为开启下滑渐变
  66. share:true, //是否将主页按钮显示为分享按钮
  67. menuIcon:"../../static/icon/iconfont-user.png", //当type为3或者4的时候左边的icon文件位置,注意位置与当前页面不一样
  68. // menuText:"返回", 当type为3或4的时候icon右边的文字
  69. },
  70. scrollTop:0 ,// 当linear为true的时候需要通过onpagescroll传递参数
  71. scrollMaxHeight:200 //滑动的高度限制,超过这个高度即背景全部显示
  72. }
  73. },
  74. components:{
  75. navigationCustom
  76. },
  77. onPageScroll(e) {
  78. this.scrollTop = e.scrollTop;
  79. },
  80. onLoad() {
  81. this.getEquipmentHeight();
  82. },
  83. onShow() {
  84. this.getNowTime();
  85. },
  86. methods: {
  87. getNowTime(){
  88. let time = new Date();
  89. let y=time.getFullYear();
  90. let m=time.getMonth()+1;
  91. let d=time.getDate();
  92. let h=time.getHours();
  93. let i=time.getMinutes();
  94. i = i > 10 ? i : '0' + i;
  95. this.nowTime = y+"年"+m+"月"+d+"日"+" "+h+":"+i
  96. },
  97. getEquipmentHeight() {
  98. let height = uni.getSystemInfoSync().windowHeight;
  99. this.nowHeight = height + 'px';
  100. getApp().globalData.glbalHeight = this.nowHeight;
  101. },
  102. customConduct(){
  103. uni.navigateTo({
  104. url:'../selfInfo/selfInfo'
  105. })
  106. },
  107. sendInputInfo(){
  108. if(!this.inputInfo){
  109. uni.showToast({
  110. title: '请输入股票代码',
  111. icon: 'none'
  112. });
  113. }else {
  114. let obj = {
  115. talkType:1 ,// 代表用户
  116. headUrl:'../../static/alienware.png',
  117. content:this.inputInfo,
  118. }
  119. this.talkList.push(obj);
  120. this.inputInfo = '';
  121. }
  122. }
  123. },
  124. }
  125. </script>
  126. <style>
  127. .content {
  128. text-align: center;
  129. }
  130. .chat-box {
  131. background: #f4f5f7;
  132. padding-top: 3%;
  133. padding-bottom:100upx;
  134. }
  135. .tips-box {
  136. background:#D5D5DA;
  137. font-size: 28upx;
  138. color: #fff;
  139. border-radius: 30upx;
  140. width: 50%;
  141. margin: 0 auto;
  142. height: 50rpx;
  143. line-height: 50rpx
  144. }
  145. .tips-title{
  146. width: 70%;
  147. margin-top: 5%;
  148. font-size: 30rpx;
  149. height: 70rpx;
  150. line-height: 70rpx
  151. }
  152. .send-box {
  153. width: 100%;
  154. height: 90rpx;
  155. position: fixed;
  156. bottom: 0;
  157. background: #F4F0ED;
  158. display: flex;
  159. align-items: center;
  160. }
  161. .talk-box {
  162. display: flex;
  163. justify-content: flex-start;
  164. align-items: center;
  165. margin-top: 3%;
  166. }
  167. .talk-box-end{
  168. justify-content: flex-end;
  169. }
  170. .talk-head-box {
  171. width: 80rpx;
  172. height:80rpx;
  173. border-radius: 30rpx;
  174. margin-left: 2%;
  175. margin-right: 2%;
  176. }
  177. .talk-head {
  178. width: 100%;
  179. height: 100%;
  180. border-radius: 50%;
  181. }
  182. .talk-content {
  183. padding: 2%;
  184. background: #fff;
  185. /* height:50rpx;
  186. line-height: 50rpx; */
  187. font-size: 28rpx;
  188. border-top-right-radius: 20rpx;
  189. border-bottom-left-radius: 20rpx;
  190. border-bottom-right-radius:20rpx;
  191. text-align: left;
  192. max-width: 70%;
  193. }
  194. .enter-box {
  195. width: 78%;
  196. height: 70rpx;
  197. margin-left: 5px;
  198. background: #fff;
  199. border-radius: 1%;
  200. }
  201. .submit-message {
  202. width: 18%;
  203. height: 70rpx;
  204. font-size: 28rpx;
  205. line-height: 70rpx;
  206. color: #fff;
  207. background-color: #0A98D5!important;
  208. }
  209. .logo {
  210. height: 200upx;
  211. width: 200upx;
  212. margin-top: 200upx;
  213. margin-left: auto;
  214. margin-right: auto;
  215. margin-bottom: 50upx;
  216. }
  217. .text-area {
  218. display: flex;
  219. justify-content: center;
  220. }
  221. .title {
  222. font-size: 36upx;
  223. color: #8f8f94;
  224. }
  225. </style>