organization.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <template>
  2. <view class="container">
  3. <!-- 顶部置顶区域 -->
  4. <view class="top">
  5. <!-- 信息区域 -->
  6. <view class="top_msg">
  7. <view class="msg_name">{{ info.name }}</view>
  8. <view class="msg_time">{{ info.createTime }}</view>
  9. </view>
  10. <!-- 按钮区域 -->
  11. <view v-if="info.isJoin == 1" class="top_btn off">已加入</view>
  12. <view v-if="info.isJoin == 2" class="top_btn" @click="handleJoin_debounce">立即加入</view>
  13. <view v-if="info.isJoin == 3" class="top_btn off">已申请</view>
  14. <!-- 背景图区域 -->
  15. <view class="top_bg">
  16. <img class="bgImg" mode="aspectFill" src="@/static/images/1.png" />
  17. </view>
  18. </view>
  19. <!-- 其他组织区域 -->
  20. <view class="org" v-if="info.otherClub?.length">
  21. <view class="org_text">其他组织</view>
  22. <!-- 组织列表区域 -->
  23. <view class="org_list">
  24. <org-item v-for="(item, index) in info.otherClub" :key="index" :item="item" @click="clickItem(index)">
  25. <template #bg>
  26. <img v-if="index % 4 == 0" class="img_bg" src="@/static/images/3.png" />
  27. <img v-if="index % 4 == 1" class="img_bg" src="@/static/images/4.png" />
  28. <img v-if="index % 4 == 2" class="img_bg" src="@/static/images/5.png" />
  29. <img v-if="index % 4 == 3" class="img_bg" src="@/static/images/6.png" />
  30. </template>
  31. </org-item>
  32. </view>
  33. </view>
  34. <!-- 底部分段器区域 -->
  35. <view class="foot">
  36. <common-controlTag :tagList="tagList" @change="changeIndex"></common-controlTag>
  37. <!-- 本会简介区域 -->
  38. <view v-if="currentIndex == 0" class="desc">
  39. {{ info.description }}
  40. </view>
  41. <!-- 联系我们区域 -->
  42. <view v-if="currentIndex == 1" class="contact">
  43. <!-- <rich-text :nodes="info.contact"></rich-text> -->
  44. <view>联系人:{{ info.contacts }}</view>
  45. <view class="phone">
  46. 电话:
  47. <view class="phone_num" @click="handlePhone(info.phone)">{{ info.phone }}</view>
  48. </view>
  49. <view>邮箱:{{ info.email }}</view>
  50. <view>地址:{{ info.address }}</view>
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. <script setup>
  56. import { onLoad } from '@dcloudio/uni-app'
  57. import { ref } from 'vue'
  58. import { getHomeClubData, getJoinClubApply } from '@/api/index.js'
  59. import debounce from 'lodash/debounce'
  60. // 首页数据
  61. const info = ref({})
  62. // 分段器数组
  63. const tagList = ['本会简介', '联系我们']
  64. // 当前分段器索引
  65. const currentIndex = ref(0)
  66. onLoad(() => {
  67. // 获取首页数据
  68. getData()
  69. })
  70. // 获取首页数据
  71. const getData = async () => {
  72. const res = await getHomeClubData()
  73. // console.log(res)
  74. info.value = res.data
  75. }
  76. const handleJoin = () => {
  77. uni.showModal({
  78. title: '提示',
  79. content: '确定申请加入该组织吗?',
  80. success: (res) => {
  81. if (res.confirm) {
  82. handleJoinReq()
  83. }
  84. }
  85. })
  86. }
  87. // 点击立即加入按钮回调
  88. const handleJoin_debounce = debounce(handleJoin, 200)
  89. // 申请加入组织请求
  90. const handleJoinReq = async () => {
  91. let data = {
  92. id: info.value.id
  93. }
  94. const res = await getJoinClubApply(data)
  95. // console.log(res)
  96. if (res.code == 200) {
  97. uni.showToast({
  98. title: res.message,
  99. icon: 'none'
  100. })
  101. setTimeout(() => {
  102. getData()
  103. }, 1500)
  104. }
  105. }
  106. // 点击拨打电话回调
  107. const handlePhone = (phoneNumber) => {
  108. uni.makePhoneCall({
  109. phoneNumber
  110. })
  111. }
  112. // 点击每一个组织回调
  113. const clickItem = (index) => {
  114. let list = encodeURIComponent(JSON.stringify(info.value.otherClub))
  115. uni.navigateTo({
  116. url: `/pages/org_list/org_list?list=${list}&index=${index}`
  117. })
  118. }
  119. // common-controlTag组件自定义事件
  120. const changeIndex = (e) => {
  121. currentIndex.value = e
  122. }
  123. </script>
  124. <style lang="scss" scoped>
  125. .container {
  126. padding: 30rpx 18rpx;
  127. min-height: 100vh;
  128. .top {
  129. position: relative;
  130. display: flex;
  131. justify-content: space-between;
  132. align-items: center;
  133. padding: 0 28rpx;
  134. height: 223rpx;
  135. border-radius: 26rpx;
  136. box-shadow: 0 0 10rpx #d3d3d3;
  137. background-color: #fff;
  138. .top_msg {
  139. flex: 1;
  140. margin: 0 20rpx;
  141. overflow: hidden;
  142. .msg_name {
  143. font-size: 32rpx;
  144. color: #333333;
  145. overflow: hidden;
  146. white-space: nowrap;
  147. text-overflow: ellipsis;
  148. }
  149. .msg_time {
  150. margin-top: 10rpx;
  151. font-size: 24rpx;
  152. color: #999999;
  153. }
  154. }
  155. .top_btn {
  156. display: flex;
  157. align-items: center;
  158. justify-content: center;
  159. width: 150rpx;
  160. height: 70rpx;
  161. font-size: 28rpx;
  162. color: #fff;
  163. border-radius: 8rpx;
  164. background-color: #007aff;
  165. }
  166. .off {
  167. color: #a6a6a6;
  168. background-color: #e5e5e5;
  169. }
  170. .top_bg {
  171. position: absolute;
  172. left: 0;
  173. right: 0;
  174. bottom: 0;
  175. height: 78rpx;
  176. .bgImg {
  177. width: 100%;
  178. height: 100%;
  179. }
  180. }
  181. }
  182. .org {
  183. margin-top: 30rpx;
  184. .org_text {
  185. position: relative;
  186. padding: 0 10rpx;
  187. font-size: 32rpx;
  188. font-weight: bold;
  189. &::after {
  190. position: absolute;
  191. bottom: 4rpx;
  192. left: 0;
  193. content: '';
  194. width: 148rpx;
  195. height: 9rpx;
  196. background-image: linear-gradient(270deg, rgba(91, 186, 255, 0.5) 0%, rgba(0, 119, 255, 0.5) 100%);
  197. }
  198. }
  199. .org_list {
  200. margin-top: 30rpx;
  201. display: grid;
  202. grid-template-columns: repeat(2, 1fr);
  203. gap: 20rpx;
  204. .img_bg {
  205. position: absolute;
  206. right: 8rpx;
  207. bottom: 8rpx;
  208. width: 139rpx;
  209. height: 130rpx;
  210. }
  211. }
  212. }
  213. .foot {
  214. margin-top: 38rpx;
  215. color: #333333;
  216. font-size: 28rpx;
  217. line-height: 50rpx;
  218. .desc {
  219. margin-top: 15rpx;
  220. }
  221. .contact {
  222. margin-top: 15rpx;
  223. .phone {
  224. display: flex;
  225. .phone_num {
  226. color: #007aff;
  227. }
  228. }
  229. }
  230. }
  231. }
  232. </style>