index.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  1. <template>
  2. <!-- 禁止滚动穿透 -->
  3. <page-meta :page-style="'overflow:'+(show?'hidden':'visible')"></page-meta>
  4. <view class="main">
  5. <view class="one" v-if="user.role!='Patient'">
  6. <view class="one_1">群组成员({{total||0}})</view>
  7. <view class="one_2">
  8. <view class="list" v-for="(item, index) in personList" :key="index" @tap="toChat(item,'1')">
  9. <view class="url">
  10. <image class="image"
  11. :src="item.icon&&item.icon.length>0?item.icon[0].url:config.user_url[0].url" mode="">
  12. </image>
  13. </view>
  14. <view class="name textOne">{{item.name||'暂无姓名'}}</view>
  15. </view>
  16. </view>
  17. <view class="one_3" v-if="total>20">
  18. <view class="more" @tap="toMore">查看更多群成员 <text class="iconfont icon-dayuhao"></text></view>
  19. </view>
  20. </view>
  21. <view class="two">
  22. <view class="two_1">医生信息</view>
  23. <view class="two_2">
  24. <image class="image"
  25. :src="doctorInfo.icon&&doctorInfo.icon.length>0?doctorInfo.icon[0].url:config.user_url[0].url"
  26. mode="">
  27. </image>
  28. <view class="name textOver">姓名:{{doctorInfo.name||'暂无'}}</view>
  29. <view class="other">
  30. <view class="other_1 textOne">
  31. <text>手机号:</text>{{doctorInfo.mobile||'暂无'}}
  32. </view>
  33. <view class="other_1 textOne">
  34. <text>医院名称:</text>{{doctorInfo.hos_name||'暂无'}}
  35. </view>
  36. <view class="other_1 textOne">
  37. <text>科室名称:</text>{{doctorInfo.dept_name||'暂无'}}
  38. </view>
  39. <view class="other_1 textOne">
  40. <text>职称:</text>{{doctorInfo.post||'暂无'}}
  41. </view>
  42. <view class="other_1 textOne">
  43. <text>职务:</text>{{doctorInfo.title||'暂无'}}
  44. </view>
  45. <view class="other_1 textOne">
  46. <text>简介:</text>{{doctorInfo.content||'暂无'}}
  47. </view>
  48. </view>
  49. <view class="bottom" v-if="user.role=='Patient'">
  50. <button class="button" size="mini" type="primary" @tap="toChat(doctorInfo,'0')">发起聊天</button>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="thr">
  55. <view class="thr_1">群简介</view>
  56. <view class="thr_2">{{info.content||'暂无'}}</view>
  57. </view>
  58. <!-- 查看更多成员 -->
  59. <uni-popup ref="popup" background-color="#fff" type="bottom" :is-mask-click="false" @change="change">
  60. <view class="popup">
  61. <view class="close">
  62. <text>群成员</text>
  63. <text @click="toClose" class="iconfont icon-shanchu"></text>
  64. </view>
  65. <view class="info_1">
  66. <scroll-view scroll-y="true" class="scroll-view">
  67. <view class="list-scroll-view">
  68. <view class="list" v-for="(item, index) in list" :key="index" @tap="toChat(item,'1')">
  69. <view class="url">
  70. <image class="image"
  71. :src="item.icon&&item.icon.length>0?item.icon[0].url:config.user_url[0].url"
  72. mode="">
  73. </image>
  74. </view>
  75. <view class="name textOne">{{item.name||'暂无姓名'}}</view>
  76. </view>
  77. </view>
  78. </scroll-view>
  79. </view>
  80. </view>
  81. </uni-popup>
  82. </view>
  83. </template>
  84. <script>
  85. export default {
  86. data() {
  87. return {
  88. id: '',
  89. user: {},
  90. config: {},
  91. info: {},
  92. // 部分群成员
  93. personList: [],
  94. // 全部群成员
  95. list: [],
  96. doctorInfo: {},
  97. total: 0,
  98. skip: 0,
  99. limit: 20,
  100. // 禁止滚动穿透
  101. show: false
  102. }
  103. },
  104. onLoad: async function(e) {
  105. const that = this;
  106. that.$set(that, `id`, e && e.id || '');
  107. uni.setNavigationBarTitle({
  108. title: e && e.title || '群组'
  109. });
  110. await that.searchToken();
  111. await that.searchConfig();
  112. await that.search();
  113. },
  114. methods: {
  115. // 禁止滚动穿透
  116. change(e) {
  117. const that = this;
  118. that.show = e.show
  119. },
  120. // 用户信息
  121. searchToken() {
  122. const that = this;
  123. try {
  124. const res = uni.getStorageSync('token');
  125. if (res) {
  126. const user = that.$jwt(res);
  127. that.$set(that, `user`, user);
  128. }
  129. } catch (e) {}
  130. },
  131. searchConfig() {
  132. const that = this;
  133. try {
  134. const res = uni.getStorageSync('config');
  135. if (res) that.$set(that, `config`, res);
  136. } catch (e) {}
  137. },
  138. async search() {
  139. const that = this;
  140. if (that.id) {
  141. const res = await that.$api(`/group/${that.id}`, 'GET', {})
  142. if (res.errcode == '0') {
  143. that.$set(that, `info`, res.data)
  144. that.$set(that, `total`, res.data.patients.length)
  145. that.$set(that, `doctorInfo`, res.data.doctor)
  146. } else {
  147. uni.showToast({
  148. title: res.errmsg,
  149. icon: 'none'
  150. });
  151. }
  152. // 群成员
  153. let info = {
  154. skip: that.skip,
  155. limit: that.limit,
  156. groupId: that.id
  157. }
  158. const arr = await that.$api(`/group/getPaitentList`, 'GET', {
  159. ...info
  160. })
  161. if (arr.errcode == '0') {
  162. that.$set(that, `personList`, arr.data)
  163. } else {
  164. uni.showToast({
  165. title: arr.errmsg,
  166. icon: 'none'
  167. });
  168. }
  169. }
  170. },
  171. // 好友聊天
  172. toChat(item, type) {
  173. const that = this;
  174. if (type == '0') {
  175. uni.navigateTo({
  176. url: `/pagesHome/friend/index?doctorId=${item.id||item._id}&groupId=${that.id}&patientId=${that.user._id}&title=${item.name}`
  177. })
  178. } else {
  179. uni.navigateTo({
  180. url: `/pagesHome/friend/index?patientId=${item.id||item._id}&doctorId=${that.user._id}&groupId=${that.id}&title=${item.name}`
  181. })
  182. }
  183. },
  184. // 查看更多成员
  185. async toMore() {
  186. const that = this;
  187. // 群成员
  188. const res = await that.$api(`/group/getPaitentList`, 'GET', {
  189. groupId: that.id
  190. })
  191. if (res.errcode == '0') that.$set(that, `list`, res.data);
  192. that.$refs.popup.open()
  193. },
  194. // 关闭弹框
  195. toClose() {
  196. const that = this;
  197. that.$refs.popup.close();
  198. },
  199. }
  200. }
  201. </script>
  202. <style lang="scss" scoped>
  203. .main {
  204. padding: 2vw;
  205. background-color: var(--f9Color);
  206. .one {
  207. background-color: var(--mainColor);
  208. .one_1 {
  209. text-align: center;
  210. padding: 2vw 0;
  211. font-size: var(--font16Size);
  212. font-weight: bold;
  213. }
  214. .one_2 {
  215. display: flex;
  216. flex-wrap: wrap;
  217. .list {
  218. display: flex;
  219. flex-direction: column;
  220. align-items: center;
  221. width: 15vw;
  222. margin: 2vw;
  223. .image {
  224. width: 15vw;
  225. height: 15vw;
  226. border-radius: 2vw;
  227. }
  228. .name {
  229. margin: 1vw 0 0 0;
  230. font-size: var(--font12Size);
  231. color: var(--f85Color);
  232. }
  233. }
  234. }
  235. .one_3 {
  236. .more {
  237. text-align: center;
  238. padding: 4vw;
  239. font-size: var(--font14Size);
  240. color: var(--f69Color);
  241. }
  242. }
  243. }
  244. .two {
  245. padding: 2vw;
  246. margin: 2vw 0;
  247. background-color: var(--mainColor);
  248. .two_1 {
  249. text-align: center;
  250. font-size: var(--font16Size);
  251. font-weight: bold;
  252. }
  253. .two_2 {
  254. padding: 2vw 0;
  255. .image {
  256. width: 20vw;
  257. height: 20vw;
  258. border-radius: 2vw;
  259. }
  260. .name {
  261. font-size: var(--font14Size);
  262. font-weight: bold;
  263. }
  264. .other {
  265. font-size: var(--font14Size);
  266. color: var(--f69Color);
  267. .other_1 {
  268. margin: 1vw 0 0 0;
  269. }
  270. }
  271. .bottom {
  272. text-align: center;
  273. .button {
  274. background-color: var(--f3CColor);
  275. color: var(--mainColor);
  276. font-size: var(--font14Size);
  277. }
  278. }
  279. }
  280. }
  281. .thr {
  282. padding: 2vw;
  283. margin: 2vw 0;
  284. background-color: var(--mainColor);
  285. .thr_1 {
  286. text-align: center;
  287. font-size: var(--font16Size);
  288. font-weight: bold;
  289. }
  290. .thr_2 {
  291. padding: 2vw 0;
  292. font-size: var(--font14Size);
  293. color: var(--f69Color);
  294. }
  295. }
  296. .uni-popup {
  297. z-index: 9999 !important;
  298. }
  299. .popup {
  300. display: flex;
  301. flex-direction: column;
  302. width: 100vw;
  303. height: 60vh;
  304. background-color: var(--f9Color);
  305. .close {
  306. display: flex;
  307. justify-content: space-between;
  308. padding: 2vw;
  309. text:first-child {
  310. font-size: var(--font16Size);
  311. font-weight: bold;
  312. }
  313. }
  314. .info_1 {
  315. position: relative;
  316. display: flex;
  317. flex-direction: column;
  318. height: 54vh;
  319. padding: 2vw;
  320. .list {
  321. display: flex;
  322. flex-direction: column;
  323. align-items: center;
  324. width: 15vw;
  325. margin: 2vw;
  326. .image {
  327. width: 15vw;
  328. height: 15vw;
  329. border-radius: 2vw;
  330. }
  331. .name {
  332. margin: 1vw 0 0 0;
  333. font-size: var(--font12Size);
  334. color: var(--f85Color);
  335. }
  336. }
  337. }
  338. }
  339. .scroll-view {
  340. position: absolute;
  341. top: 0;
  342. left: 0;
  343. right: 0;
  344. bottom: 0;
  345. .list-scroll-view {
  346. display: flex;
  347. flex-wrap: wrap;
  348. padding: 2vw;
  349. }
  350. }
  351. }
  352. </style>