123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384 |
- <template>
- <!-- 禁止滚动穿透 -->
- <page-meta :page-style="'overflow:'+(show?'hidden':'visible')"></page-meta>
- <view class="main">
- <view class="one" v-if="user.role!='Patient'">
- <view class="one_1">群组成员({{total||0}})</view>
- <view class="one_2">
- <view class="list" v-for="(item, index) in personList" :key="index" @tap="toChat(item,'1')">
- <view class="url">
- <image class="image"
- :src="item.icon&&item.icon.length>0?item.icon[0].url:config.user_url[0].url" mode="">
- </image>
- </view>
- <view class="name textOne">{{item.name||'暂无姓名'}}</view>
- </view>
- </view>
- <view class="one_3" v-if="total>20">
- <view class="more" @tap="toMore">查看更多群成员 <text class="iconfont icon-dayuhao"></text></view>
- </view>
- </view>
- <view class="two">
- <view class="two_1">医生信息</view>
- <view class="two_2">
- <image class="image"
- :src="doctorInfo.icon&&doctorInfo.icon.length>0?doctorInfo.icon[0].url:config.user_url[0].url"
- mode="">
- </image>
- <view class="name textOver">姓名:{{doctorInfo.name||'暂无'}}</view>
- <view class="other">
- <view class="other_1 textOne">
- <text>手机号:</text>{{doctorInfo.mobile||'暂无'}}
- </view>
- <view class="other_1 textOne">
- <text>医院名称:</text>{{doctorInfo.hos_name||'暂无'}}
- </view>
- <view class="other_1 textOne">
- <text>科室名称:</text>{{doctorInfo.dept_name||'暂无'}}
- </view>
- <view class="other_1 textOne">
- <text>职称:</text>{{doctorInfo.post||'暂无'}}
- </view>
- <view class="other_1 textOne">
- <text>职务:</text>{{doctorInfo.title||'暂无'}}
- </view>
- <view class="other_1 textOne">
- <text>简介:</text>{{doctorInfo.content||'暂无'}}
- </view>
- </view>
- <view class="bottom" v-if="user.role=='Patient'">
- <button class="button" size="mini" type="primary" @tap="toChat(doctorInfo,'0')">发起聊天</button>
- </view>
- </view>
- </view>
- <view class="thr">
- <view class="thr_1">群简介</view>
- <view class="thr_2">{{info.content||'暂无'}}</view>
- </view>
- <!-- 查看更多成员 -->
- <uni-popup ref="popup" background-color="#fff" type="bottom" :is-mask-click="false" @change="change">
- <view class="popup">
- <view class="close">
- <text>群成员</text>
- <text @click="toClose" class="iconfont icon-shanchu"></text>
- </view>
- <view class="info_1">
- <scroll-view scroll-y="true" class="scroll-view">
- <view class="list-scroll-view">
- <view class="list" v-for="(item, index) in list" :key="index" @tap="toChat(item,'1')">
- <view class="url">
- <image class="image"
- :src="item.icon&&item.icon.length>0?item.icon[0].url:config.user_url[0].url"
- mode="">
- </image>
- </view>
- <view class="name textOne">{{item.name||'暂无姓名'}}</view>
- </view>
- </view>
- </scroll-view>
- </view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- id: '',
- user: {},
- config: {},
- info: {},
- // 部分群成员
- personList: [],
- // 全部群成员
- list: [],
- doctorInfo: {},
- total: 0,
- skip: 0,
- limit: 20,
- // 禁止滚动穿透
- show: false
- }
- },
- onLoad: async function(e) {
- const that = this;
- that.$set(that, `id`, e && e.id || '');
- uni.setNavigationBarTitle({
- title: e && e.title || '群组'
- });
- await that.searchToken();
- await that.searchConfig();
- await that.search();
- },
- methods: {
- // 禁止滚动穿透
- change(e) {
- const that = this;
- that.show = e.show
- },
- // 用户信息
- searchToken() {
- const that = this;
- try {
- const res = uni.getStorageSync('token');
- if (res) {
- const user = that.$jwt(res);
- that.$set(that, `user`, user);
- }
- } catch (e) {}
- },
- searchConfig() {
- const that = this;
- try {
- const res = uni.getStorageSync('config');
- if (res) that.$set(that, `config`, res);
- } catch (e) {}
- },
- async search() {
- const that = this;
- if (that.id) {
- const res = await that.$api(`/group/${that.id}`, 'GET', {})
- if (res.errcode == '0') {
- that.$set(that, `info`, res.data)
- that.$set(that, `total`, res.data.patients.length)
- that.$set(that, `doctorInfo`, res.data.doctor)
- } else {
- uni.showToast({
- title: res.errmsg,
- icon: 'none'
- });
- }
- // 群成员
- let info = {
- skip: that.skip,
- limit: that.limit,
- groupId: that.id
- }
- const arr = await that.$api(`/group/getPaitentList`, 'GET', {
- ...info
- })
- if (arr.errcode == '0') {
- that.$set(that, `personList`, arr.data)
- } else {
- uni.showToast({
- title: arr.errmsg,
- icon: 'none'
- });
- }
- }
- },
- // 好友聊天
- toChat(item, type) {
- const that = this;
- if (type == '0') {
- uni.navigateTo({
- url: `/pagesHome/friend/index?doctorId=${item.id||item._id}&groupId=${that.id}&patientId=${that.user._id}&title=${item.name}`
- })
- } else {
- uni.navigateTo({
- url: `/pagesHome/friend/index?patientId=${item.id||item._id}&doctorId=${that.user._id}&groupId=${that.id}&title=${item.name}`
- })
- }
- },
- // 查看更多成员
- async toMore() {
- const that = this;
- // 群成员
- const res = await that.$api(`/group/getPaitentList`, 'GET', {
- groupId: that.id
- })
- if (res.errcode == '0') that.$set(that, `list`, res.data);
- that.$refs.popup.open()
- },
- // 关闭弹框
- toClose() {
- const that = this;
- that.$refs.popup.close();
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .main {
- padding: 2vw;
- background-color: var(--f9Color);
- .one {
- background-color: var(--mainColor);
- .one_1 {
- text-align: center;
- padding: 2vw 0;
- font-size: var(--font16Size);
- font-weight: bold;
- }
- .one_2 {
- display: flex;
- flex-wrap: wrap;
- .list {
- display: flex;
- flex-direction: column;
- align-items: center;
- width: 15vw;
- margin: 2vw;
- .image {
- width: 15vw;
- height: 15vw;
- border-radius: 2vw;
- }
- .name {
- margin: 1vw 0 0 0;
- font-size: var(--font12Size);
- color: var(--f85Color);
- }
- }
- }
- .one_3 {
- .more {
- text-align: center;
- padding: 4vw;
- font-size: var(--font14Size);
- color: var(--f69Color);
- }
- }
- }
- .two {
- padding: 2vw;
- margin: 2vw 0;
- background-color: var(--mainColor);
- .two_1 {
- text-align: center;
- font-size: var(--font16Size);
- font-weight: bold;
- }
- .two_2 {
- padding: 2vw 0;
- .image {
- width: 20vw;
- height: 20vw;
- border-radius: 2vw;
- }
- .name {
- font-size: var(--font14Size);
- font-weight: bold;
- }
- .other {
- font-size: var(--font14Size);
- color: var(--f69Color);
- .other_1 {
- margin: 1vw 0 0 0;
- }
- }
- .bottom {
- text-align: center;
- .button {
- background-color: var(--f3CColor);
- color: var(--mainColor);
- font-size: var(--font14Size);
- }
- }
- }
- }
- .thr {
- padding: 2vw;
- margin: 2vw 0;
- background-color: var(--mainColor);
- .thr_1 {
- text-align: center;
- font-size: var(--font16Size);
- font-weight: bold;
- }
- .thr_2 {
- padding: 2vw 0;
- font-size: var(--font14Size);
- color: var(--f69Color);
- }
- }
- .uni-popup {
- z-index: 9999 !important;
- }
- .popup {
- display: flex;
- flex-direction: column;
- width: 100vw;
- height: 60vh;
- background-color: var(--f9Color);
- .close {
- display: flex;
- justify-content: space-between;
- padding: 2vw;
- text:first-child {
- font-size: var(--font16Size);
- font-weight: bold;
- }
- }
- .info_1 {
- position: relative;
- display: flex;
- flex-direction: column;
- height: 54vh;
- padding: 2vw;
- .list {
- display: flex;
- flex-direction: column;
- align-items: center;
- width: 15vw;
- margin: 2vw;
- .image {
- width: 15vw;
- height: 15vw;
- border-radius: 2vw;
- }
- .name {
- margin: 1vw 0 0 0;
- font-size: var(--font12Size);
- color: var(--f85Color);
- }
- }
- }
- }
- .scroll-view {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- .list-scroll-view {
- display: flex;
- flex-wrap: wrap;
- padding: 2vw;
- }
- }
- }
- </style>
|