index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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. },
  101. customConduct(){
  102. uni.navigateTo({
  103. url:'../selfInfo/selfInfo'
  104. })
  105. },
  106. sendInputInfo(){
  107. if(!this.inputInfo){
  108. uni.showToast({
  109. title: '请输入股票代码',
  110. icon: 'none'
  111. });
  112. }else {
  113. let obj = {
  114. talkType:1 ,// 代表用户
  115. headUrl:'../../static/alienware.png',
  116. content:this.inputInfo,
  117. }
  118. this.talkList.push(obj);
  119. this.inputInfo = '';
  120. }
  121. }
  122. },
  123. }
  124. </script>
  125. <style>
  126. .content {
  127. text-align: center;
  128. }
  129. .chat-box {
  130. background: #f4f5f7;
  131. padding-top: 3%;
  132. padding-bottom:100upx;
  133. }
  134. .tips-box {
  135. background:#D5D5DA;
  136. font-size: 28upx;
  137. color: #fff;
  138. border-radius: 30upx;
  139. width: 50%;
  140. margin: 0 auto;
  141. height: 50rpx;
  142. line-height: 50rpx
  143. }
  144. .tips-title{
  145. width: 70%;
  146. margin-top: 5%;
  147. font-size: 30rpx;
  148. height: 70rpx;
  149. line-height: 70rpx
  150. }
  151. .send-box {
  152. width: 100%;
  153. height: 90rpx;
  154. position: fixed;
  155. bottom: 0;
  156. background: #F4F0ED;
  157. display: flex;
  158. align-items: center;
  159. }
  160. .talk-box {
  161. display: flex;
  162. justify-content: flex-start;
  163. align-items: center;
  164. margin-top: 3%;
  165. }
  166. .talk-box-end{
  167. justify-content: flex-end;
  168. }
  169. .talk-head-box {
  170. width: 80rpx;
  171. height:80rpx;
  172. border-radius: 30rpx;
  173. margin-left: 2%;
  174. margin-right: 2%;
  175. }
  176. .talk-head {
  177. width: 100%;
  178. height: 100%;
  179. border-radius: 50%;
  180. }
  181. .talk-content {
  182. padding: 2%;
  183. background: #fff;
  184. /* height:50rpx;
  185. line-height: 50rpx; */
  186. font-size: 28rpx;
  187. border-top-right-radius: 20rpx;
  188. border-bottom-left-radius: 20rpx;
  189. border-bottom-right-radius:20rpx;
  190. text-align: left;
  191. max-width: 70%;
  192. }
  193. .enter-box {
  194. width: 78%;
  195. height: 70rpx;
  196. margin-left: 5px;
  197. background: #fff;
  198. border-radius: 1%;
  199. }
  200. .submit-message {
  201. width: 18%;
  202. height: 70rpx;
  203. font-size: 28rpx;
  204. line-height: 70rpx;
  205. color: #fff;
  206. background-color: #0A98D5!important;
  207. }
  208. .logo {
  209. height: 200upx;
  210. width: 200upx;
  211. margin-top: 200upx;
  212. margin-left: auto;
  213. margin-right: auto;
  214. margin-bottom: 50upx;
  215. }
  216. .text-area {
  217. display: flex;
  218. justify-content: center;
  219. }
  220. .title {
  221. font-size: 36upx;
  222. color: #8f8f94;
  223. }
  224. </style>