CircleDetail.vue 5.1 KB

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