callend.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <view class="call-end-container">
  3. <view class="call-info-card">
  4. <image class="avatar" :src="contactAvatar" mode="aspectFill"></image>
  5. <view class="call-info">
  6. <text class="title">{{ status }}</text>
  7. <text class="contact-name">{{ contactName }}</text>
  8. <view class="duration-info" v-if="status === '通话已结束' && duration > 0">
  9. <text>通话时长: {{ formatDuration(duration) }}</text>
  10. </view>
  11. </view>
  12. </view>
  13. <button class="return-btn" @click="goToHomePage">返回首页</button>
  14. </view>
  15. </template>
  16. <script>
  17. import { goToMainTab } from '@/utils/navigation'
  18. export default {
  19. data() {
  20. return {
  21. contactName: '家庭设备',
  22. contactAvatar: '/static/logo.png',
  23. duration: 0,
  24. status: '通话已结束'
  25. }
  26. },
  27. onLoad(options) {
  28. if (options) {
  29. this.contactName = decodeURIComponent(options.name || '') || '家庭设备'
  30. this.contactAvatar = decodeURIComponent(options.avatar || '') || '/static/logo.png'
  31. this.duration = parseInt(options.duration || 0, 10)
  32. this.status = decodeURIComponent(options.status || '') || '通话已结束'
  33. }
  34. },
  35. methods: {
  36. formatDuration(seconds) {
  37. if (!seconds || seconds <= 0) return '00:00'
  38. const minutes = Math.floor(seconds / 60)
  39. const remainingSeconds = seconds % 60
  40. return `${String(minutes).padStart(2, '0')}:${String(remainingSeconds).padStart(2, '0')}`
  41. },
  42. goToHomePage() {
  43. goToMainTab('my')
  44. }
  45. }
  46. }
  47. </script>
  48. <style>
  49. .call-end-container {
  50. display: flex;
  51. flex-direction: column;
  52. align-items: center;
  53. justify-content: center;
  54. padding: 40rpx;
  55. min-height: 100vh;
  56. background-color: #f5f5f5;
  57. }
  58. .call-info-card {
  59. width: 90%;
  60. background-color: #fff;
  61. border-radius: 16rpx;
  62. padding: 40rpx;
  63. display: flex;
  64. flex-direction: column;
  65. align-items: center;
  66. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
  67. margin-bottom: 60rpx;
  68. }
  69. .avatar {
  70. width: 160rpx;
  71. height: 160rpx;
  72. border-radius: 50%;
  73. margin-bottom: 30rpx;
  74. border: 4rpx solid #f0f0f0;
  75. }
  76. .call-info {
  77. display: flex;
  78. flex-direction: column;
  79. align-items: center;
  80. width: 100%;
  81. }
  82. .title {
  83. font-size: 36rpx;
  84. font-weight: bold;
  85. color: #333;
  86. margin-bottom: 20rpx;
  87. }
  88. .contact-name {
  89. font-size: 48rpx;
  90. color: #000;
  91. margin-bottom: 30rpx;
  92. font-weight: 500;
  93. }
  94. .duration-info {
  95. display: flex;
  96. align-items: center;
  97. justify-content: center;
  98. font-size: 32rpx;
  99. color: #666;
  100. margin-top: 20rpx;
  101. }
  102. .return-btn {
  103. background-color: #07c160;
  104. color: #fff;
  105. font-size: 36rpx;
  106. padding: 20rpx 0;
  107. width: 90%;
  108. border-radius: 12rpx;
  109. margin-top: 60rpx;
  110. }
  111. @media screen and (orientation: landscape) {
  112. .call-info-card {
  113. flex-direction: row;
  114. align-items: center;
  115. text-align: left;
  116. padding: 30rpx 40rpx;
  117. }
  118. .avatar {
  119. margin-right: 40rpx;
  120. margin-bottom: 0;
  121. }
  122. .call-info {
  123. align-items: flex-start;
  124. }
  125. }
  126. </style>