CircleDetail.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <view class="circle-overlay" v-if="visible" @tap="$emit('close')">
  3. <view class="circle-modal" @tap.stop>
  4. <view class="circle-modal-header">
  5. <view class="circle-modal-icon-wrap">
  6. <text class="circle-modal-icon">{{ typeIcon(circleType) }}</text>
  7. </view>
  8. <text class="circle-modal-name">{{ circleName }}</text>
  9. <text class="circle-modal-source">{{ sourceLabel(circleSource) }}</text>
  10. </view>
  11. <view class="circle-modal-body">
  12. <view class="circle-modal-section">
  13. <text class="circle-modal-section-title">圈子成员 ({{ memberCount }}人)</text>
  14. <view class="circle-modal-members">
  15. <text class="circle-modal-members-placeholder">成员列表加载中...</text>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="circle-modal-footer">
  20. <button
  21. v-if="!isMember"
  22. class="circle-btn circle-btn-join"
  23. @tap="$emit('join', circleId)">加入圈子</button>
  24. <button
  25. v-else
  26. class="circle-btn circle-btn-leave"
  27. @tap="$emit('leave', circleId)">退出圈子</button>
  28. <button
  29. class="circle-btn circle-btn-close"
  30. @tap="$emit('close')">关闭</button>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. export default {
  37. name: 'CircleDetail',
  38. props: {
  39. visible: {
  40. type: Boolean,
  41. default: false
  42. },
  43. circle: {
  44. type: Object,
  45. default: function() { return {} }
  46. },
  47. isMember: {
  48. type: Boolean,
  49. default: false
  50. }
  51. },
  52. computed: {
  53. circleId: function() {
  54. return this.circle && this.circle.id || null
  55. },
  56. circleName: function() {
  57. return this.circle && this.circle.name || '未知圈子'
  58. },
  59. circleType: function() {
  60. return this.circle && this.circle.type || 'topic'
  61. },
  62. circleSource: function() {
  63. return this.circle && this.circle.matchSource || ''
  64. },
  65. memberCount: function() {
  66. return this.circle && this.circle.memberCount || 0
  67. }
  68. },
  69. methods: {
  70. typeIcon: function(type) {
  71. var map = {
  72. activity: '\u{1F3AF}',
  73. ability: '\u{1F9E0}',
  74. health: '\u{1F4AA}',
  75. product: '\u{1F6CD}',
  76. provider: '\u{1F468}\u200D\u{1F3EB}',
  77. topic: '\u{1F4AC}',
  78. hobby: '\u{1F3A8}'
  79. }
  80. return map[type] || '\u{1F30D}'
  81. },
  82. sourceLabel: function(source) {
  83. var map = {
  84. activity: '源于共同活动',
  85. assessment: '源于共同测评',
  86. health_report: '源于健康状况',
  87. product: '源于共同商品',
  88. teacher: '源于同一规划师',
  89. article: '源于共同阅读',
  90. game: '源于共同游戏'
  91. }
  92. return map[source] || '源于共同兴趣'
  93. }
  94. }
  95. }
  96. </script>
  97. <style scoped>
  98. .circle-overlay {
  99. position: fixed;
  100. top: 0;
  101. left: 0;
  102. right: 0;
  103. bottom: 0;
  104. background: rgba(0,0,0,0.5);
  105. display: flex;
  106. align-items: center;
  107. justify-content: center;
  108. z-index: 1000;
  109. }
  110. .circle-modal {
  111. width: 600rpx;
  112. max-height: 80vh;
  113. background: #fff;
  114. border-radius: 24rpx;
  115. display: flex;
  116. flex-direction: column;
  117. overflow: hidden;
  118. }
  119. .circle-modal-header {
  120. display: flex;
  121. flex-direction: column;
  122. align-items: center;
  123. padding: 40rpx 30rpx 20rpx;
  124. border-bottom: 1rpx solid #f0f0f0;
  125. }
  126. .circle-modal-icon-wrap {
  127. width: 88rpx;
  128. height: 88rpx;
  129. border-radius: 50%;
  130. background: #FFF7ED;
  131. display: flex;
  132. align-items: center;
  133. justify-content: center;
  134. margin-bottom: 16rpx;
  135. }
  136. .circle-modal-icon {
  137. font-size: 44rpx;
  138. }
  139. .circle-modal-name {
  140. font-size: 34rpx;
  141. font-weight: 600;
  142. color: #333;
  143. margin-bottom: 8rpx;
  144. }
  145. .circle-modal-source {
  146. font-size: 24rpx;
  147. color: #999;
  148. }
  149. .circle-modal-body {
  150. flex: 1;
  151. overflow-y: auto;
  152. padding: 20rpx 30rpx;
  153. }
  154. .circle-modal-section {
  155. margin-bottom: 20rpx;
  156. }
  157. .circle-modal-section-title {
  158. font-size: 26rpx;
  159. font-weight: 600;
  160. color: #666;
  161. margin-bottom: 12rpx;
  162. display: block;
  163. }
  164. .circle-modal-members {
  165. min-height: 60rpx;
  166. }
  167. .circle-modal-members-placeholder {
  168. font-size: 24rpx;
  169. color: #ccc;
  170. }
  171. .circle-modal-footer {
  172. padding: 20rpx 30rpx 30rpx;
  173. border-top: 1rpx solid #f0f0f0;
  174. }
  175. .circle-btn {
  176. width: 100%;
  177. height: 80rpx;
  178. border-radius: 40rpx;
  179. font-size: 28rpx;
  180. font-weight: 500;
  181. display: flex;
  182. align-items: center;
  183. justify-content: center;
  184. border: none;
  185. padding: 0;
  186. }
  187. .circle-btn:active {
  188. opacity: 0.8;
  189. }
  190. .circle-btn-join {
  191. background: #F97316;
  192. color: #fff;
  193. }
  194. .circle-btn-leave {
  195. background: #fff;
  196. color: #FF4444;
  197. border: 2rpx solid #FF4444;
  198. }
  199. .circle-btn-close {
  200. background: #f5f5f5;
  201. color: #999;
  202. }
  203. </style>