index.vue 5.9 KB

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