index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <view class="page_container">
  3. <custom-nav-bar title="会议详情">
  4. <view class="right_content" slot="more">
  5. <image src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/meeting_details_share.png" @click="shareMeeting" />
  6. <image class="more_icon" src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/common_more.png" @click="showMoreAction = true" v-if="isHost" />
  7. </view>
  8. </custom-nav-bar>
  9. <view class="meeting_info">
  10. <view class="meeting_title">
  11. {{ meetingData.info.creatorDefinedMeeting.title }}
  12. </view>
  13. <view class="time_line">
  14. <view class="time_point">
  15. <view class="title">
  16. {{ startTime }}
  17. </view>
  18. <view class="sub_title">
  19. {{ startDate }}
  20. </view>
  21. </view>
  22. <view class="duration">
  23. <view class="state_icon" :style="{
  24. 'background-color':
  25. beginState !== '已开始' ? '#0089FF' : '#FFB300'
  26. }">
  27. {{ beginState }}
  28. </view>
  29. <view class="duration_details">
  30. {{ duration }}
  31. </view>
  32. </view>
  33. <view class="time_point">
  34. <view class="title">
  35. {{ endTime }}
  36. </view>
  37. <view class="sub_title">
  38. {{ endDate }}
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="meeting_more">
  44. <view class="more_item">
  45. <text>会议号:{{ meetingData.info.systemGenerated.meetingID, }}</text>
  46. <image src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/meeting_copy.png" @click="copyMeetingID" />
  47. </view>
  48. <view class="more_item">
  49. <text>发起人:{{ meetingData.info.systemGenerated.creatorNickname }}</text>
  50. </view>
  51. </view>
  52. <view class="action_row">
  53. <u-button type="primary" text="进入会议" @click="tryJoinMeeting"></u-button>
  54. </view>
  55. <u-action-sheet safeAreaInsetBottom :actions="moreList" cancelText="取消" closeOnClickOverlay
  56. :closeOnClickAction="true" :show="showMoreAction" @select="clickMoreAction" @close="showMoreAction = false" />
  57. </view>
  58. </template>
  59. <script>
  60. import CustomNavBar from "../../../components/CustomNavBar/index.vue";
  61. import dayjs from "dayjs";
  62. import { ContactChooseTypes } from "../../../constant";
  63. import { toastWithCallback } from "../../../util/common";
  64. import { meetingModule, meetingErrorHandle } from "../../../util/imCommon";
  65. import { mapGetters } from "vuex";
  66. import config from "../../../common/config";
  67. import { joinMeeting, endMeeting } from '../../../api/meeting'
  68. const secondsToTime = {
  69. 1800: "30分钟",
  70. 3600: "1小时",
  71. 5400: "1.5小时",
  72. 7200: "2小时",
  73. };
  74. export default {
  75. components: {
  76. CustomNavBar,
  77. },
  78. data() {
  79. return {
  80. showMoreAction: false,
  81. meetingData: {},
  82. moreList: [
  83. {
  84. name: "修改会议信息",
  85. idx: 0,
  86. },
  87. {
  88. name: "取消会议",
  89. idx: 1,
  90. },
  91. ],
  92. };
  93. },
  94. computed: {
  95. ...mapGetters(["storeSelfInfo"]),
  96. startTime() {
  97. return dayjs(this.meetingData.info?.creatorDefinedMeeting?.scheduledTime * 1000).format("HH:mm");
  98. },
  99. startDate() {
  100. return dayjs(this.meetingData.info?.creatorDefinedMeeting?.scheduledTime * 1000).format("YYYY年M月D日");
  101. },
  102. endTime() {
  103. return dayjs((this.meetingData.info?.creatorDefinedMeeting?.scheduledTime + this.meetingData.info?.creatorDefinedMeeting?.meetingDuration) * 1000).format("HH:mm");
  104. },
  105. endDate() {
  106. return dayjs((this.meetingData.info?.creatorDefinedMeeting?.scheduledTime + this.meetingData.info?.creatorDefinedMeeting?.meetingDuration) * 1000).format("YYYY年M月D日");
  107. },
  108. duration() {
  109. return secondsToTime[
  110. this.meetingData.info?.creatorDefinedMeeting?.meetingDuration
  111. ];
  112. },
  113. beginState() {
  114. const nowDate = (Date.now() / 1000).toFixed();
  115. if (this.meetingData.info?.creatorDefinedMeeting?.scheduledTime > nowDate) {
  116. return "未开始";
  117. }
  118. if ((this.meetingData.info?.creatorDefinedMeeting?.scheduledTime + this.meetingData.info?.creatorDefinedMeeting?.meetingDuration) > nowDate) {
  119. return "已开始";
  120. }
  121. return "已结束";
  122. },
  123. isHost() {
  124. return (
  125. this.meetingData.info?.systemGenerated?.creatorUserID === this.$store.getters.storeSelfInfo.userID
  126. );
  127. },
  128. },
  129. onLoad(options) {
  130. this.meetingData = JSON.parse(options.meetingData);
  131. console.log(this.meetingData);
  132. },
  133. methods: {
  134. clickMoreAction({ idx }) {
  135. if (idx) {
  136. endMeeting({
  137. meetingID: this.meetingData.info?.systemGenerated?.meetingID,
  138. userID: this.storeSelfInfo.userID,
  139. })
  140. .then(() => toastWithCallback("取消成功!", () => uni.navigateBack()))
  141. .catch(() => uni.$u.toast("操作失败!"));
  142. return;
  143. }
  144. uni.$u.route("/pages_im/pages/common/reserveMeeting/index", {
  145. isUpdate: true,
  146. meetingData: JSON.stringify(this.meetingData),
  147. });
  148. this.showMoreAction = false;
  149. },
  150. copyMeetingID() {
  151. uni.setClipboardData({
  152. data: this.meetingData.info?.systemGenerated?.meetingID,
  153. success: () => {
  154. uni.hideToast();
  155. this.$nextTick(() => {
  156. uni.$u.toast("复制成功");
  157. });
  158. },
  159. });
  160. },
  161. tryJoinMeeting() {
  162. const params = {
  163. meetingID: this.meetingData.info?.systemGenerated?.meetingID,
  164. userID: this.storeSelfInfo.userID,
  165. password: "",
  166. };
  167. joinMeeting(params)
  168. .then((data) => {
  169. const meetingData = {
  170. liveURL: data.liveKit?.url,
  171. token: data.liveKit?.token,
  172. roomID: this.meetingData.info?.systemGenerated?.meetingID,
  173. imToken: uni.getStorageSync("IMToken"),
  174. baseURL: config.getApiUrl()
  175. };
  176. meetingModule.startMeeting(meetingData);
  177. })
  178. .catch(meetingErrorHandle);
  179. },
  180. shareMeeting() {
  181. uni.$u.route("/pages_im/pages/common/contactChoose/index", {
  182. type: ContactChooseTypes.InviteMeeting,
  183. forwardMessage: encodeURIComponent(JSON.stringify({
  184. inviterFaceURL: this.$store.getters.storeSelfInfo.faceURL,
  185. id: this.meetingData.info?.systemGenerated?.meetingID,
  186. duration: this.meetingData.info?.creatorDefinedMeeting?.meetingDuration,
  187. inviterNickname: this.$store.getters.storeSelfInfo.nickname,
  188. inviterUserID: this.$store.getters.storeSelfInfo.userID,
  189. subject: this.meetingData.info?.creatorDefinedMeeting?.title,
  190. start: this.meetingData.info?.systemGenerated?.startTime,
  191. })),
  192. });
  193. },
  194. },
  195. };
  196. </script>
  197. <style lang="scss">
  198. .page_container {
  199. background-color: #f6f6f6;
  200. .right_content {
  201. margin-right: 24rpx;
  202. .more_icon {
  203. margin-left: 12rpx;
  204. }
  205. image {
  206. width: 36px;
  207. height: 36px;
  208. }
  209. }
  210. .meeting_info {
  211. padding: 32rpx;
  212. margin: 24rpx 0;
  213. background-color: #fff;
  214. .meeting_title {
  215. font-size: 34rpx;
  216. color: #16191c;
  217. margin-bottom: 24rpx;
  218. }
  219. .time_line {
  220. display: flex;
  221. justify-content: space-between;
  222. .time_point {
  223. display: flex;
  224. flex-direction: column;
  225. align-items: center;
  226. .title {
  227. font-size: 40rpx;
  228. color: #16191c;
  229. margin-bottom: 8rpx;
  230. }
  231. .sub_title {
  232. color: rgba(22, 25, 28, 0.4);
  233. font-size: 28rpx;
  234. }
  235. }
  236. .duration {
  237. display: flex;
  238. flex-direction: column;
  239. align-items: center;
  240. justify-content: flex-end;
  241. .state_icon {
  242. color: #fff;
  243. font-size: 24rpx;
  244. background-color: #0089ff;
  245. padding: 4rpx 20rpx;
  246. border-radius: 24rpx;
  247. margin-bottom: 10rpx;
  248. }
  249. .duration_details {
  250. color: rgba(22, 25, 28, 0.4);
  251. font-size: 28rpx;
  252. }
  253. }
  254. }
  255. }
  256. .meeting_more {
  257. background-color: #fff;
  258. .more_item {
  259. display: flex;
  260. align-items: center;
  261. padding: 24rpx 32rpx;
  262. image {
  263. width: 12px;
  264. height: 13px;
  265. margin-left: 24rpx;
  266. }
  267. }
  268. }
  269. .action_row {
  270. margin-top: 10vh;
  271. padding: 0 24%;
  272. }
  273. }
  274. </style>