message.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <template>
  2. <view class="message-page" :class="screenMode">
  3. <!-- 顶部返回 -->
  4. <!-- <view class="nav-header" v-if="screenMode != 'heng'">
  5. <view class="back-btn" @click="back"><image src="/static/icon/left.png"></image> 返回</view>
  6. </view> -->
  7. <!-- 消息列表 -->
  8. <view class="message-list">
  9. <view class="message-item ">
  10. <image class="avatar" src="/static/logo.png"></image>
  11. <view class="voice-message">
  12. <view class="voice-duration"> <text>你好啊</text></view>
  13. </view>
  14. </view>
  15. <!-- <view class="message-item right">
  16. <image class="avatar" src="/static/logo.png"></image>
  17. <view class="voice-message">
  18. <view class="voice-duration"> <text>注意身体注意身体注意身体注意身体注意身体注意身体注意身体注意身体注意身体注意身体注意身体注意身体注意身体注意身体注意身体注意身体注意身体注意身体注意身体注意身体注意身体注意身体注意身体注意身体注意身体注意身体注意身体注意身体注意身体</text></view>
  19. </view>
  20. </view> -->
  21. <view class="message-item ">
  22. <image class="avatar" src="/static/logo.png"></image>
  23. <view class="voice-message">
  24. <view class="voice-duration"><image src="/static/icon/tingtong.png"></image> <text>通话时长 00:25</text></view>
  25. </view>
  26. </view>
  27. <!-- 通话记录 -->
  28. <view class="message-item right">
  29. <image class="avatar" src="/static/logo.png"></image>
  30. <view class="voice-message">
  31. <view class="voice-duration"><image src="/static/icon/tingtong.png"></image> <text>通话时长 00:25</text></view>
  32. </view>
  33. </view>
  34. <!-- 语音消息 -->
  35. <view class="message-item left">
  36. <image class="avatar" src="/static/logo.png"></image>
  37. <view class="voice-message">
  38. <view class="voice-duration"> <image src="/static/icon/guangbo.png"></image> <text>24"</text></view>
  39. <text class="time">17:25</text>
  40. </view>
  41. </view>
  42. <!-- 语音消息 -->
  43. <view class="message-item right">
  44. <image class="avatar" src="/static/logo.png"></image>
  45. <view class="voice-message">
  46. <view class="voice-duration"><image src="/static/icon/yinbo.png"></image> <text>00:15</text></view>
  47. <text class="time">18:28</text>
  48. </view>
  49. </view>
  50. <!-- 语音消息带录音点 -->
  51. <view class="message-item left">
  52. <image class="avatar" src="/static/logo.png"></image>
  53. <view class="voice-message">
  54. <view class="voice-duration">
  55. <image src="/static/icon/guangbo.png"></image>
  56. <text>16"</text>
  57. <view class="recording-dot"></view>
  58. </view>
  59. <text class="time">17:25</text>
  60. </view>
  61. </view>
  62. </view>
  63. <!-- 底部操作栏 -->
  64. <view class="footer">
  65. <view class="input-box">按住 说话</view>
  66. <view class="emoji-btn"><image src="/static/icon/emjoy.png"></image></view>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. export default {
  72. data() {
  73. return {
  74. screenMode: 'heng',
  75. }
  76. },
  77. onLoad(options) {
  78. uni.getSystemInfo({
  79. success: (res) => {
  80. this.screenMode = res.windowWidth > res.windowHeight ? 'heng' : 'shu'
  81. }
  82. })
  83. // 获取路由参数中的角色信息
  84. const role = options.role
  85. console.log(role)
  86. if (!role) {
  87. uni.showToast({
  88. title: '缺少角色信息',
  89. icon: 'none'
  90. })
  91. return
  92. }
  93. // 这里可以根据角色获取对应的消息列表
  94. // this.getMessageList(role)
  95. },
  96. methods: {
  97. back() {
  98. uni.navigateBack({
  99. delta: 1
  100. })
  101. }
  102. }
  103. }
  104. </script>
  105. <style scoped lang="less">
  106. .heng {
  107. min-height: 100vh;
  108. background: #f5f5f5;
  109. display: flex;
  110. flex-direction: column;
  111. .message-list {
  112. flex: 1;
  113. padding: 5rpx;
  114. background: #fff;
  115. }
  116. .message-item {
  117. display: flex;
  118. align-items: flex-start;
  119. margin: 15rpx 20rpx;
  120. }
  121. .avatar {
  122. width: 30rpx;
  123. height: 30rpx;
  124. border-radius: 2rpx;
  125. flex-shrink: 0;
  126. }
  127. .voice-message {
  128. position: relative;
  129. display: flex;
  130. align-items: flex-end;
  131. }
  132. .voice-duration {
  133. background: #a4b3d4;
  134. padding: 6rpx;
  135. border-radius: 4rpx;
  136. color: #fff;
  137. font-size: 12rpx;
  138. position: relative;
  139. min-width: 50rpx;
  140. margin: 0 10rpx;
  141. display: flex;
  142. align-items: center;
  143. }
  144. .voice-duration image {
  145. width: 18rpx;
  146. height: 18rpx;
  147. }
  148. .voice-duration text {
  149. margin: 0 5rpx;
  150. }
  151. .right {
  152. flex-direction: row-reverse;
  153. }
  154. .right .avatar{
  155. border-radius: 50%;
  156. }
  157. .right .voice-message {
  158. flex-direction: row-reverse;
  159. }
  160. .right .voice-duration {
  161. background: #e9e9e9;
  162. color: #5e5e5e;
  163. }
  164. .time {
  165. font-size: 12rpx;
  166. color: #999;
  167. display: block;
  168. }
  169. .recording-dot {
  170. width: 5rpx;
  171. height: 5rpx;
  172. background: #eb6100;
  173. border-radius: 50%;
  174. position: absolute;
  175. right: 3rpx;
  176. top: 3rpx;
  177. }
  178. .footer {
  179. padding: 10rpx 35rpx;
  180. background: #f5f5f5;
  181. display: flex;
  182. align-items: center;
  183. border-top: 1rpx solid #eee;
  184. font-size: 14rpx;
  185. }
  186. .input-box {
  187. flex: 1;
  188. background: #ffffff;
  189. height: 30rpx;
  190. line-height: 30rpx;
  191. text-align: center;
  192. border-radius: 4rpx;
  193. margin-right: 10rpx;
  194. color: #666;
  195. border: 1rpx solid #eee;
  196. }
  197. .emoji-btn image {
  198. width: 20rpx;
  199. height: 20rpx;
  200. }
  201. }
  202. .shu{
  203. min-height: 100vh;
  204. background: #f5f5f5;
  205. display: flex;
  206. flex-direction: column;
  207. .nav-header {
  208. padding: 20rpx;
  209. background: #fff;
  210. border-bottom: 1rpx solid #eee;
  211. }
  212. .back-btn {
  213. width: 100rpx;
  214. font-size: 28rpx;
  215. text-align: center;
  216. color: #333;
  217. border-radius: 5rpx;
  218. padding: 10rpx 20rpx;
  219. border: 1px solid #eee;
  220. display: flex;
  221. align-items: center;
  222. gap: 10rpx;
  223. }
  224. .back-btn image {
  225. width: 25rpx;
  226. height: 25rpx;
  227. }
  228. .message-list {
  229. flex: 1;
  230. padding: 20rpx;
  231. background: #fff;
  232. }
  233. .message-item {
  234. display: flex;
  235. align-items: flex-start;
  236. margin: 30rpx 0;
  237. }
  238. .avatar {
  239. width: 80rpx;
  240. height: 80rpx;
  241. border-radius: 8rpx;
  242. flex-shrink: 0;
  243. }
  244. .voice-message {
  245. position: relative;
  246. display: flex;
  247. align-items: flex-end;
  248. }
  249. .voice-duration {
  250. background: #a4b3d4;
  251. padding: 20rpx 20rpx;
  252. border-radius: 8rpx;
  253. color: #fff;
  254. font-size: 28rpx;
  255. position: relative;
  256. min-width: 100rpx;
  257. margin: 0 20rpx;
  258. display: flex;
  259. align-items: center;
  260. }
  261. .voice-duration image{
  262. width: 40rpx;
  263. height: 40rpx;
  264. }
  265. .voice-duration text {
  266. margin: 0 10rpx;
  267. }
  268. .right {
  269. flex-direction: row-reverse;
  270. }
  271. .right .avatar{
  272. border-radius: 50%;
  273. }
  274. .right .voice-message {
  275. flex-direction: row-reverse;
  276. }
  277. .right .voice-duration {
  278. background: #e9e9e9;
  279. color: #5e5e5e;
  280. }
  281. .time {
  282. font-size: 24rpx;
  283. color: #999;
  284. display: block;
  285. }
  286. .recording-dot {
  287. width: 16rpx;
  288. height: 16rpx;
  289. background: #eb6100;
  290. border-radius: 50%;
  291. position: absolute;
  292. right: 10rpx;
  293. top: 10rpx;
  294. }
  295. .footer {
  296. padding: 20rpx 40rpx;
  297. background: #f5f5f5;
  298. display: flex;
  299. align-items: center;
  300. border-top: 1rpx solid #eee;
  301. }
  302. .input-box {
  303. flex: 1;
  304. background: #ffffff;
  305. height: 80rpx;
  306. line-height: 80rpx;
  307. text-align: center;
  308. border-radius: 8rpx;
  309. margin-right: 20rpx;
  310. color: #666;
  311. border: 1px solid #eee;
  312. }
  313. .emoji-btn image{
  314. width: 50rpx;
  315. height: 50rpx;
  316. }
  317. }
  318. </style>