qgb-process 0.2.3 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +2 -2
- package/.env.development +70 -70
- package/.env.pre +60 -60
- package/.env.production +48 -48
- package/.env.test +48 -48
- package/.eslintignore +4 -4
- package/.eslintrc.js +302 -302
- package/README.md +66 -66
- package/babel.config.js +5 -5
- package/commitlint.config.js +30 -30
- package/config/dev.env.js +7 -7
- package/config/index.js +82 -82
- package/config/prod.env.js +4 -4
- package/debug.log +4 -4
- package/index.js +6 -6
- package/jsconfig.json +9 -9
- package/lib/qgb-process.common.js +7666 -5069
- package/lib/qgb-process.umd.js +7666 -5069
- package/lib/qgb-process.umd.min.js +108 -108
- package/package.json +148 -148
- package/packages/index.js +26 -26
- package/public/index.html +47 -47
- package/public/js/qykf.js +21 -21
- package/src/App.vue +37 -37
- package/src/api/ApiExAndapp.js +24 -24
- package/src/api/EnterpriseAssociation.js +8 -8
- package/src/api/Notice.js +31 -31
- package/src/api/apiAcceptance/apiAcceptance.js +37 -37
- package/src/api/apiAddress.js +9 -9
- package/src/api/apiApprovalConfig.js +13 -13
- package/src/api/apiApprove.js +18 -18
- package/src/api/apiArrears/apiArrears.js +41 -41
- package/src/api/apiArrears/apiProjectArrears.js +16 -16
- package/src/api/apiArrears/index.js +15 -15
- package/src/api/apiAssets.js +19 -19
- package/src/api/apiAssociate.js +42 -42
- package/src/api/apiAudit/apiAudit.js +32 -32
- package/src/api/apiAuth.js +25 -25
- package/src/api/apiAuthentication.js +35 -35
- package/src/api/apiBankAccount/index.js +12 -12
- package/src/api/apiBudget/apiBudget.js +30 -30
- package/src/api/apiBudget/apiBudgets.js +105 -105
- package/src/api/apiCarRecord.js +48 -48
- package/src/api/apiCart.js +202 -202
- package/src/api/apiChangeTel.js +13 -13
- package/src/api/apiCheckingIn.js +95 -95
- package/src/api/apiCollection/index.js +13 -13
- package/src/api/apiContract/apiContract.js +21 -21
- package/src/api/apiContract/index.js +3 -3
- package/src/api/apiContract/quill-config.js +122 -122
- package/src/api/apiContractManage/apiContractManage.js +57 -57
- package/src/api/apiContractManage/index.js +2 -2
- package/src/api/apiContractManage/quill-config.js +121 -121
- package/src/api/apiCoping.js +22 -22
- package/src/api/apiCost/index.js +31 -31
- package/src/api/apiCreditManagement.js +16 -16
- package/src/api/apiCustomer/apiCustomer.js +12 -12
- package/src/api/apiDivisional.js +9 -9
- package/src/api/apiDivisionalManagementList.js +17 -17
- package/src/api/apiEmployeeRegularization.js +73 -73
- package/src/api/apiEquipmentRental.js +50 -50
- package/src/api/apiFormBuilder/menu.js +65 -65
- package/src/api/apiFormBuilder/reissueRule.js +15 -15
- package/src/api/apiFund/index.js +16 -16
- package/src/api/apiHelp.js +43 -43
- package/src/api/apiHome.js +24 -24
- package/src/api/apiIminfo.js +39 -39
- package/src/api/apiInventory.js +52 -52
- package/src/api/apiInventorySetting.js +9 -9
- package/src/api/apiInvoice.js +29 -29
- package/src/api/apiJobManage.js +15 -15
- package/src/api/apiLease/apiLease.js +12 -12
- package/src/api/apiLogisticsTransportation/apiLogisticsTransportation.js +34 -34
- package/src/api/apiLostPassword.js +9 -9
- package/src/api/apiMachine/api.js +3 -3
- package/src/api/apiMachine/apiCategory.js +18 -18
- package/src/api/apiMachine/apiHire.js +19 -19
- package/src/api/apiMachine/apiLease.js +27 -27
- package/src/api/apiMachine/apiLocation.js +4 -4
- package/src/api/apiMachine/apiRentInfo.js +107 -107
- package/src/api/apiMachine/apiRentPublish.js +14 -14
- package/src/api/apiMachine/apiStore.js +15 -15
- package/src/api/apiMachine/index.js +3 -3
- package/src/api/apiManagementStore/api.js +3 -3
- package/src/api/apiManagementStore/apiManagementStore.js +25 -25
- package/src/api/apiMaterCheckAndAccept/apiMaterCheckAndAccept.js +47 -47
- package/src/api/apiMaterCheckAndAccept/apiMechanicalSourcing.js +16 -16
- package/src/api/apiMaterCheckAndAccept/index.js +3 -3
- package/src/api/apiMaterials/aaaaaaaaaaaaaa.js +9 -9
- package/src/api/apiMaterials/api.js +3 -3
- package/src/api/apiMaterials/apiAddress.js +116 -116
- package/src/api/apiMaterials/apiBalanceData.js +188 -188
- package/src/api/apiMaterials/apiCommercialConcrete.js +36 -36
- package/src/api/apiMaterials/apiCommodity.js +70 -70
- package/src/api/apiMaterials/apiDownload.js +26 -26
- package/src/api/apiMaterials/apiHome.js +44 -44
- package/src/api/apiMaterials/apiItemBrand.js +9 -9
- package/src/api/apiMaterials/apiLogistics.js +72 -72
- package/src/api/apiMaterials/apiLogisticsReceipt.js +94 -94
- package/src/api/apiMaterials/apiMaterials.js +8 -8
- package/src/api/apiMaterials/apiMySalesOrder.js +21 -21
- package/src/api/apiMaterials/apiOfflineOrder.js +18 -18
- package/src/api/apiMaterials/apiOrder.js +183 -183
- package/src/api/apiMaterials/apiReceipt.js +45 -45
- package/src/api/apiMaterials/quill-config.js +122 -122
- package/src/api/apiMemberSelection.js +39 -39
- package/src/api/apiMessage.js +10 -10
- package/src/api/apiMock/mockOrder.js +98 -98
- package/src/api/apiMonthPlan/apiMonthPlan.js +47 -47
- package/src/api/apiMyBidding.js +8 -8
- package/src/api/apiMyMember/apiComInfo.js +17 -17
- package/src/api/apiMyMember/apiInviteJoin.js +24 -24
- package/src/api/apiMyMember/apiMember.js +24 -24
- package/src/api/apiMyMember/apiMemberApply.js +36 -36
- package/src/api/apiMyMember/apiMemberChance.js +40 -40
- package/src/api/apiOffer.js +40 -40
- package/src/api/apiOffice.js +19 -19
- package/src/api/apiPact.js +26 -26
- package/src/api/apiPassword.js +7 -7
- package/src/api/apiPay/apiPay.js +25 -25
- package/src/api/apiPaying.js +21 -21
- package/src/api/apiPayment/apiPayment.js +13 -13
- package/src/api/apiPayment/apiProjectPayment.js +13 -13
- package/src/api/apiPrint.js +23 -0
- package/src/api/apiProcess.js +65 -65
- package/src/api/apiProject/apiBaseList.js +29 -29
- package/src/api/apiProject/apiGoodsOffer.js +11 -11
- package/src/api/apiProject/apiInventory.js +116 -116
- package/src/api/apiProject/apiOfferOrder.js +12 -12
- package/src/api/apiProject/apiOfferQuery.js +18 -18
- package/src/api/apiProject/apiPlan.js +21 -21
- package/src/api/apiProject/apiProject.js +158 -158
- package/src/api/apiProjectProcurement/apiProjectProcurement.js +88 -88
- package/src/api/apiPurchase/apiPurchase.js +67 -67
- package/src/api/apiPurchaseApply.js +15 -15
- package/src/api/apiPurchasePay.js +16 -16
- package/src/api/apiRankManagement.js +24 -24
- package/src/api/apiRecruit.js +37 -37
- package/src/api/apiReimbursement/apiReimbursement.js +15 -15
- package/src/api/apiRisk/index.js +11 -11
- package/src/api/apiRoleManagement.js +15 -15
- package/src/api/apiRules/apiRules.js +11 -11
- package/src/api/apiSchedule/apiSchedule.js +17 -17
- package/src/api/apiSealRecord.js +52 -52
- package/src/api/apiSign.js +8 -8
- package/src/api/apiSolution/apiSolution.js +9 -9
- package/src/api/apiSubcontract.js +35 -35
- package/src/api/apiSystem/index.js +40 -40
- package/src/api/apiTask.js +76 -76
- package/src/api/apiTeam/api.js +3 -3
- package/src/api/apiTeam/apiUtils.js +11 -11
- package/src/api/apiTender.js +127 -127
- package/src/api/apiUser.js +24 -24
- package/src/api/apiUserEnterprise/api.js +3 -3
- package/src/api/apiUserEnterprise/apiUserEn.js +15 -15
- package/src/api/apiVolunteerTeam.js +11 -11
- package/src/api/apiWorkarea.js +33 -33
- package/src/api/apiXzqh.js +8 -8
- package/src/api/common/api.js +3 -3
- package/src/api/common/apiUtils.js +9 -9
- package/src/api/customer.js +21 -21
- package/src/api/evection.js +19 -19
- package/src/api/guide.js +9 -9
- package/src/api/sociaManageApi.js +30 -30
- package/src/assets/Area.json +1773 -1773
- package/src/assets/css/quill.bubble.css +952 -952
- package/src/assets/css/quill.core.css +397 -397
- package/src/assets/css/quill.snow.css +945 -945
- package/src/assets/data.js +284 -284
- package/src/assets/fonts/Read Me.txt +7 -7
- package/src/assets/fonts/demo-files/demo.css +155 -155
- package/src/assets/fonts/demo-files/demo.js +30 -30
- package/src/assets/fonts/demo.html +951 -951
- package/src/assets/fonts/fonts/icomoon.svg +130 -130
- package/src/assets/fonts/style.css +563 -563
- package/src/assets/icons/checkbox.svg +12 -12
- package/src/assets/icons/columns-3.svg +12 -12
- package/src/assets/icons/columns.svg +12 -12
- package/src/assets/icons/custom-table.svg +12 -12
- package/src/assets/icons/date.svg +19 -19
- package/src/assets/icons/daterange.svg +12 -12
- package/src/assets/icons/fuzhi.svg +11 -11
- package/src/assets/icons/fuzhi_03.svg +5 -5
- package/src/assets/icons/gaojizujian.svg +12 -12
- package/src/assets/icons/groupSummary.svg +12 -12
- package/src/assets/icons/groupTitle.svg +12 -12
- package/src/assets/icons/image-uploader.svg +12 -12
- package/src/assets/icons/input-number.svg +12 -12
- package/src/assets/icons/input.svg +12 -12
- package/src/assets/icons/quill-editor.svg +12 -12
- package/src/assets/icons/radio.svg +12 -12
- package/src/assets/icons/select.svg +12 -12
- package/src/assets/icons/switch.svg +12 -12
- package/src/assets/icons/textarea.svg +12 -12
- package/src/assets/icons/upload-file.svg +12 -12
- package/src/assets/marketplace.js +289 -289
- package/src/components/ComAduitNew.vue +477 -477
- package/src/components/CommonAduit.vue +512 -512
- package/src/components/CommonAduitNew.vue +906 -906
- package/src/components/CommonAduitNews.vue +753 -753
- package/src/components/CommonUEditer.vue +63 -63
- package/src/components/PersonCenter/Mess.vue +59 -59
- package/src/components/PersonCenter/Title.vue +80 -80
- package/src/components/SvgIcon.vue +57 -57
- package/src/components/XmCommonAduit.vue +761 -761
- package/src/components/feiyCommon.vue +713 -713
- package/src/components/form/card.js +5 -5
- package/src/components/form/chinese.js +6 -6
- package/src/components/form/chinessstring.js +5 -5
- package/src/components/form/hunhe.js +8 -8
- package/src/components/form/hunhecq.js +8 -8
- package/src/components/form/hunheh.js +8 -8
- package/src/components/form/num.js +12 -12
- package/src/components/form/numstring.js +5 -5
- package/src/components/form/user.js +7 -7
- package/src/components/form/validate.js +42 -42
- package/src/components/form/validcredit.js +5 -5
- package/src/components/fundCommonAduit.vue +661 -661
- package/src/components/public/BaseCustomTable.vue +71 -71
- package/src/components/public/BaseDialog.vue +144 -144
- package/src/components/public/BaseEmptyData.vue +73 -73
- package/src/components/public/BaseFormTitle.vue +39 -39
- package/src/components/public/BasePagination.vue +55 -55
- package/src/components/public/BaseRouter.vue +14 -14
- package/src/components/public/BaseUpload.vue +185 -185
- package/src/components/public/Bottom.vue +62 -62
- package/src/components/public/Footer.vue +412 -412
- package/src/components/public/Header.vue +30 -30
- package/src/components/public/LeftMenu.vue +170 -170
- package/src/components/public/MemberSelection coby.vue +444 -444
- package/src/components/public/MemberSelection.vue +487 -487
- package/src/components/public/NewLeftMenu.vue +418 -418
- package/src/components/public/PicturesPreview.vue +62 -62
- package/src/components/public/Popout.vue +147 -147
- package/src/components/public/TagLine.vue +353 -353
- package/src/components/public/components/BaseImageUploadDrag.vue +320 -320
- package/src/components/public/components/HeadBar.vue +315 -315
- package/src/components/public/components/MenuList.vue +110 -110
- package/src/components/public/components/NewHeadBar.vue +936 -936
- package/src/components/public/components/QuickGoods.vue +273 -273
- package/src/components/public/components/Search.vue +164 -164
- package/src/components/public/components/Userinfo.vue +383 -383
- package/src/components/utils/pdf.js +254 -254
- package/src/components/xmfyCommonAduit.vue +752 -752
- package/src/filters/index.js +619 -619
- package/src/fnc/arr.js +102 -102
- package/src/fnc/quill-config.js +121 -121
- package/src/fnc/unit.js +102 -102
- package/src/fnc/verify.js +187 -187
- package/src/fnc/verifyStatus.js +24 -24
- package/src/formBuilder/apiBusiness.js +67 -67
- package/src/formBuilder/business.js +1039 -1039
- package/src/formBuilder/component/components/data.js +719 -719
- package/src/formBuilder/component/components/purchaseIndex.vue +1109 -1109
- package/src/formBuilder/component/purchase.vue +35 -35
- package/src/formBuilder/components/app-main/components/components/GroupSummary.vue +33 -33
- package/src/formBuilder/components/app-main/components/components/GroupTitle.vue +33 -33
- package/src/formBuilder/components/app-main/components/components/bank.vue +226 -226
- package/src/formBuilder/components/app-main/components/components/bankFormHeard.vue +298 -298
- package/src/formBuilder/components/app-main/components/components/builder.vue +718 -718
- package/src/formBuilder/components/app-main/components/components/columns.vue +393 -393
- package/src/formBuilder/components/app-main/components/components/customTable.vue +1758 -1758
- package/src/formBuilder/components/app-main/components/components/formDep.vue +105 -105
- package/src/formBuilder/components/app-main/components/components/handleCode.vue +39 -39
- package/src/formBuilder/components/app-main/components/components/itemOption.vue +116 -116
- package/src/formBuilder/components/app-main/components/components/linkForm.vue +116 -116
- package/src/formBuilder/components/app-main/components/components/listDesign.vue +772 -772
- package/src/formBuilder/components/app-main/components/components/optionSolt.js +78 -78
- package/src/formBuilder/components/app-main/components/components/person.vue +104 -104
- package/src/formBuilder/components/app-main/components/components/postman.vue +40 -40
- package/src/formBuilder/components/app-main/components/components/previewDialog.vue +391 -391
- package/src/formBuilder/components/app-main/components/components/tableIndex.vue +51 -51
- package/src/formBuilder/components/app-main/components/components/tableList.vue +561 -561
- package/src/formBuilder/components/app-main/components/components/twoColumns.vue +52 -52
- package/src/formBuilder/components/app-main/components/main-center.vue +187 -187
- package/src/formBuilder/components/app-main/components/main-header.vue +351 -351
- package/src/formBuilder/components/app-main/components/main-left.vue +179 -179
- package/src/formBuilder/components/app-main/components/main-right/components/components/calculateDialog.vue +914 -914
- package/src/formBuilder/components/app-main/components/main-right/components/components/curTextArea.vue +338 -338
- package/src/formBuilder/components/app-main/components/main-right/components/components/form-item-rules.vue +190 -190
- package/src/formBuilder/components/app-main/components/main-right/components/components/linkageDialog.vue +25 -25
- package/src/formBuilder/components/app-main/components/main-right/components/components/searchMixin.js +26 -26
- package/src/formBuilder/components/app-main/components/main-right/components/form-config.vue +284 -284
- package/src/formBuilder/components/app-main/components/main-right/components/form-item-attrs.vue +407 -407
- package/src/formBuilder/components/app-main/components/main-right/components/form-item-config.vue +478 -478
- package/src/formBuilder/components/app-main/components/main-right/index.vue +203 -203
- package/src/formBuilder/components/app-main/index.vue +329 -329
- package/src/formBuilder/comps.js +283 -283
- package/src/formBuilder/config/button.js +63 -63
- package/src/formBuilder/config/cascader-panel.js +224 -224
- package/src/formBuilder/config/cascader.js +306 -306
- package/src/formBuilder/config/checkbox.js +67 -67
- package/src/formBuilder/config/color.js +42 -42
- package/src/formBuilder/config/columns.js +30 -30
- package/src/formBuilder/config/custom-table.js +49 -49
- package/src/formBuilder/config/date.js +107 -107
- package/src/formBuilder/config/daterange.js +47 -47
- package/src/formBuilder/config/datetime.js +78 -78
- package/src/formBuilder/config/datetimerange.js +111 -111
- package/src/formBuilder/config/formDep.js +37 -37
- package/src/formBuilder/config/groupSummary.js +23 -23
- package/src/formBuilder/config/groupTitle.js +23 -23
- package/src/formBuilder/config/handleCode.js +23 -23
- package/src/formBuilder/config/image-uploader.js +113 -113
- package/src/formBuilder/config/input.js +162 -162
- package/src/formBuilder/config/json-editor.js +31 -31
- package/src/formBuilder/config/linkForm.js +69 -69
- package/src/formBuilder/config/number.js +49 -49
- package/src/formBuilder/config/password.js +82 -82
- package/src/formBuilder/config/person.js +37 -37
- package/src/formBuilder/config/postman.js +23 -23
- package/src/formBuilder/config/purchase.js +19 -19
- package/src/formBuilder/config/quill-editor.js +66 -66
- package/src/formBuilder/config/radio-button.js +44 -44
- package/src/formBuilder/config/radio.js +69 -69
- package/src/formBuilder/config/rate.js +93 -93
- package/src/formBuilder/config/select.js +105 -105
- package/src/formBuilder/config/slider.js +92 -92
- package/src/formBuilder/config/switch.js +35 -35
- package/src/formBuilder/config/tag.js +79 -79
- package/src/formBuilder/config/text.js +18 -18
- package/src/formBuilder/config/textarea.js +129 -129
- package/src/formBuilder/config/time.js +60 -60
- package/src/formBuilder/config/timerange.js +94 -94
- package/src/formBuilder/config/tree-select.js +100 -100
- package/src/formBuilder/config/upload-file.js +100 -100
- package/src/formBuilder/config/yesno.js +39 -39
- package/src/formBuilder/config.js +16 -16
- package/src/formBuilder/extend/index.js +20 -20
- package/src/formBuilder/index.js +39 -39
- package/src/formBuilder/menuConfig.js +36 -36
- package/src/formBuilder/mixins/index.js +215 -215
- package/src/formBuilder/tool.js +101 -101
- package/src/function/base.js +13 -13
- package/src/function/findCompanyTree.js +94 -94
- package/src/function/formulaAnalysis.js +44 -44
- package/src/function/verify.js +23 -23
- package/src/http/index.js +219 -219
- package/src/http/type.js +82 -82
- package/src/library/AddType/Index.js +17 -17
- package/src/library/AddType/Index.vue +201 -201
- package/src/library/AreaChange/regionCascader/regionCascader.vue +155 -155
- package/src/library/BigImg/BigImage1/Index.js +17 -17
- package/src/library/BigImg/BigImage1/Index.vue +125 -125
- package/src/library/Button/Button1/Index.js +17 -17
- package/src/library/Button/Button1/Index.vue +60 -60
- package/src/library/Button/Button2/Index.js +17 -17
- package/src/library/Button/Button2/Index.vue +52 -52
- package/src/library/Button/Button3/Index.js +17 -17
- package/src/library/Button/Button3/Index.vue +56 -56
- package/src/library/Button/Button4/Index.js +17 -17
- package/src/library/Button/Button4/Index.vue +56 -56
- package/src/library/Button/Button5/Index.js +17 -17
- package/src/library/Button/Button5/Index.vue +55 -55
- package/src/library/Button/Button6/Index.js +17 -17
- package/src/library/Button/Button6/Index.vue +74 -74
- package/src/library/Button/Button7/Index.js +17 -17
- package/src/library/Button/Button7/Index.vue +56 -56
- package/src/library/ConfirmPlaugin/ConfirmPlaugin1/Index.js +17 -17
- package/src/library/ConfirmPlaugin/ConfirmPlaugin1/Index.vue +147 -147
- package/src/library/ConfirmPlaugin/ConfirmPlaugin2/Index.js +17 -17
- package/src/library/ConfirmPlaugin/ConfirmPlaugin2/Index.vue +137 -137
- package/src/library/ConfirmPlaugin/ConfirmPlaugin3/Index.vue +142 -142
- package/src/library/ConfirmPlaugin/ConfirmPlaugin4/Index.vue +141 -141
- package/src/library/ConfirmPlaugin/ConfirmPlaugin5/Index.vue +121 -121
- package/src/library/ConfirmPlaugin/ConfirmPlaugin6/Index.vue +142 -142
- package/src/library/Input/Input1/Index.js +17 -17
- package/src/library/Input/Input1/Index.vue +66 -66
- package/src/library/NoMessage/NoMessage0/Index.js +17 -17
- package/src/library/NoMessage/NoMessage0/Index.vue +60 -60
- package/src/library/NoMessage/NoMessage1/Index.js +17 -17
- package/src/library/NoMessage/NoMessage1/Index.vue +66 -66
- package/src/library/NoMessage/NoMessage2/Index.js +17 -17
- package/src/library/NoMessage/NoMessage2/Index.vue +66 -66
- package/src/library/Tab/Tab1/TabBox1/Index.vue +36 -36
- package/src/library/Tab/Tab1/TabInner1/Index.vue +70 -70
- package/src/library/Tab/Tab2/TabBox2/Index.vue +36 -36
- package/src/library/Tab/Tab2/TabInner2/Index.vue +66 -66
- package/src/library/Table/Table1/Td1/Index.js +17 -17
- package/src/library/Table/Table1/Td1/Index.vue +110 -110
- package/src/library/Table/Table1/Tr1/Index.js +17 -17
- package/src/library/Table/Table1/Tr1/Index.vue +53 -53
- package/src/library/Table/Table2/Td2/Index.js +17 -17
- package/src/library/Table/Table2/Td2/Index.vue +90 -90
- package/src/library/Table/Table2/Tr2/Index.js +17 -17
- package/src/library/Table/Table2/Tr2/Index.vue +66 -66
- package/src/library/Table/Table3/Td3/Index.js +17 -17
- package/src/library/Table/Table3/Td3/Index.vue +109 -109
- package/src/library/Table/Table3/Tr3/Index.js +17 -17
- package/src/library/Table/Table3/Tr3/Index.vue +128 -128
- package/src/library/Table/Table4/Td4/Index.js +17 -17
- package/src/library/Table/Table4/Td4/Index.vue +114 -114
- package/src/library/Table/Table4/Tr4/Index.js +17 -17
- package/src/library/Table/Table4/Tr4/Index.vue +53 -53
- package/src/library/Title/Title1/Index.js +17 -17
- package/src/library/Title/Title1/Index.vue +80 -80
- package/src/library/toast/Index.js +17 -17
- package/src/library/toast/Index.vue +86 -86
- package/src/main.js +161 -161
- package/src/mixins/Export2Excel.js +207 -207
- package/src/mixins/chartOption.js +110 -110
- package/src/mixins/companyMixins.js +84 -84
- package/src/mixins/quillOptions.js +15 -15
- package/src/mixins/validate/deviceManage.js +211 -211
- package/src/mixins/validate/systemConfig.js +117 -117
- package/src/mixins/validate/validate.js +25 -25
- package/src/public/apiUser/apiUser.js +10 -10
- package/src/public/areaFunction.js +26 -26
- package/src/public/link.js +91 -91
- package/src/public/stageData.js +495 -495
- package/src/public/topmenu.js +68 -68
- package/src/router/index.js +225 -225
- package/src/router/setting/BaseRoutes.js +1639 -1639
- package/src/router/setting/MenuDevMock.js +1570 -1570
- package/src/router/setting/modules/login.js +45 -45
- package/src/router/setting/noAuthRouter.js +109 -109
- package/src/router/setting/routes.js +55 -55
- package/src/static/css/flex.css +75 -75
- package/src/static/css/switch.scss +31 -31
- package/src/storage/cookies.js +37 -37
- package/src/storage/localStorage.js +36 -36
- package/src/storage/sessionStorage.js +25 -25
- package/src/store/formBuilder/formAttrDefault.js +28 -28
- package/src/store/formBuilder/index.js +40 -40
- package/src/store/index.js +553 -553
- package/src/styles/color.scss +24 -24
- package/src/styles/offer.scss +39 -39
- package/src/styles/s-reset.scss +52 -52
- package/src/styles/static-style.scss +797 -797
- package/src/styles/talent.scss +26 -26
- package/src/styles/variable.scss +69 -69
- package/src/styles/workflow/workflow.css +1308 -1308
- package/src/utils/TableFormTypeList.js +26 -26
- package/src/utils/allRouter.js +5579 -5579
- package/src/utils/auditUtil.js +535 -535
- package/src/utils/commonComponents.js +34 -34
- package/src/utils/commonFunc.js +213 -213
- package/src/utils/deepCopyArray.js +9 -9
- package/src/utils/dict.js +49 -49
- package/src/utils/directive.js +26 -26
- package/src/utils/emoji.js +16 -16
- package/src/utils/flator.js +18 -18
- package/src/utils/imMeeting.js +1180 -1180
- package/src/utils/index.js +105 -105
- package/src/utils/initRouter.js +94 -94
- package/src/utils/map.js +23 -23
- package/src/utils/passwordStrength.js +177 -177
- package/src/utils/style.js +30 -30
- package/src/utils/validate.js +30 -30
- package/src/views/404.vue +53 -53
- package/src/views/Login/Login.vue +50 -50
- package/src/views/Login/Passfind.vue +347 -347
- package/src/views/Login/Passfindnext.vue +146 -146
- package/src/views/Login/Sign.vue +55 -55
- package/src/views/Login/SignSuccessfully.vue +132 -132
- package/src/views/Login/appDownload.vue +224 -224
- package/src/views/Login/clientDownload.vue +201 -201
- package/src/views/Login/components/Background.vue +153 -153
- package/src/views/Login/components/FormLogin.vue +1001 -1001
- package/src/views/Login/components/FormPassFind.vue +395 -395
- package/src/views/Login/components/FormSign.vue +493 -493
- package/src/views/Login/components/Title.vue +301 -301
- package/src/views/Login/components/agreeMent.vue +111 -111
- package/src/views/Login/components/companysign.vue +1296 -1296
- package/src/views/Login/components/guideLogin.vue +984 -984
- package/src/views/formBuilder/components/addNode.vue +119 -119
- package/src/views/formBuilder/components/approverSelector.vue +493 -493
- package/src/views/formBuilder/components/baseRoute.vue +315 -315
- package/src/views/formBuilder/components/builderHeader.vue +106 -106
- package/src/views/formBuilder/components/conditionConfig.js +588 -588
- package/src/views/formBuilder/components/conditionNode.vue +191 -191
- package/src/views/formBuilder/components/dataDefault.js +147 -147
- package/src/views/formBuilder/components/depFormNode.vue +583 -583
- package/src/views/formBuilder/components/linkForm.vue +566 -566
- package/src/views/formBuilder/components/linkFormList.vue +821 -821
- package/src/views/formBuilder/components/menuConfig.vue +1752 -1752
- package/src/views/formBuilder/components/newNodeForm.vue +426 -426
- package/src/views/formBuilder/components/newsection.vue +424 -424
- package/src/views/formBuilder/components/nodeConditionConfig cody.vue +376 -376
- package/src/views/formBuilder/components/nodeConditionConfig.vue +603 -603
- package/src/views/formBuilder/components/nodeForm.vue +355 -355
- package/src/views/formBuilder/components/nodeMenu.vue +147 -147
- package/src/views/formBuilder/components/personNode.vue +566 -566
- package/src/views/formBuilder/components/planNode.vue +269 -269
- package/src/views/formBuilder/designListPage.vue +457 -457
- package/src/views/formBuilder/formDataDetail.vue +565 -565
- package/src/views/formBuilder/formGeneration.vue +904 -904
- package/src/views/formBuilder/index.vue +242 -242
- package/src/views/formBuilder/process-1.vue +976 -976
- package/src/views/formBuilder/process-2.vue +1323 -1323
- package/src/views/formBuilder/process.vue +662 -431
- package/src/views/formBuilder/processList.vue +877 -877
- package/src/views/formBuilder/service/ProcessBuilder.js +136 -136
- package/src/views/formBuilder/service/RsxzFieldCollection.js +199 -0
- package/src/views/formBuilder/workflow/addNode.vue +95 -95
- package/src/views/formBuilder/workflow/initData.js +205 -205
- package/src/views/formBuilder/workflow/nodeWrap.vue +731 -731
- package/src/views/guide.vue +227 -227
- package/src/views/guideIndex.vue +284 -284
- package/tests/unit/.eslintrc.js +5 -5
- package/tests/unit/example.spec.js +13 -13
- package/vue.config.js +287 -287
package/src/utils/imMeeting.js
CHANGED
|
@@ -1,1180 +1,1180 @@
|
|
|
1
|
-
import SDK from "@/static/nimSDK/NIM_Web_SDK_v7.0.0.js"
|
|
2
|
-
import store from "@/store"
|
|
3
|
-
import "@/static/nimSDK/NIM_Web_WebRTC_v7.0.0.js"
|
|
4
|
-
import { Message } from "element-ui"
|
|
5
|
-
import api from "@/api/apiIminfo"
|
|
6
|
-
import { use } from "chai"
|
|
7
|
-
var that;
|
|
8
|
-
// 是否被叫中
|
|
9
|
-
var beCalling = false;
|
|
10
|
-
// 呼叫类型
|
|
11
|
-
var type = null;
|
|
12
|
-
// 被叫信息
|
|
13
|
-
var beCalledInfo = null;
|
|
14
|
-
// 是否正忙
|
|
15
|
-
var busy = false;
|
|
16
|
-
// 呼叫超时检查定时器
|
|
17
|
-
var callTimer = null;
|
|
18
|
-
// 被呼叫超时检查定时器
|
|
19
|
-
var beCallTimer = null;
|
|
20
|
-
// 通话正式开始时间戳
|
|
21
|
-
var netcallStartTime = 0
|
|
22
|
-
// 音视频id
|
|
23
|
-
var channelId;
|
|
24
|
-
// 接受音视频之后等待状态
|
|
25
|
-
var acceptAndWait = false;
|
|
26
|
-
// 群聊定时器
|
|
27
|
-
var meetingTimer = null;
|
|
28
|
-
// 声音播放
|
|
29
|
-
var playRingInstance = null
|
|
30
|
-
var nameMap = {
|
|
31
|
-
E: require(`@/assets/nim/audio/avchat_ring.mp3`)
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
// var netcall;
|
|
35
|
-
//
|
|
36
|
-
const pushConfig = {
|
|
37
|
-
enable: true,
|
|
38
|
-
needBadge: true,
|
|
39
|
-
needPushNick: true,
|
|
40
|
-
pushContent: "",
|
|
41
|
-
custom: "测试自定义数据",
|
|
42
|
-
pushPayload: "",
|
|
43
|
-
sound: "",
|
|
44
|
-
forceKeepCalling: 0
|
|
45
|
-
};
|
|
46
|
-
// 视频设置
|
|
47
|
-
const sessionConfig = {
|
|
48
|
-
videoQuality: WebRTC.CHAT_VIDEO_QUALITY_HIGH,
|
|
49
|
-
videoFrameRate: WebRTC.CHAT_VIDEO_FRAME_RATE_15,
|
|
50
|
-
videoBitrate: 0,
|
|
51
|
-
recordVideo: false,
|
|
52
|
-
recordAudio: false,
|
|
53
|
-
highAudio: false,
|
|
54
|
-
bypassRtmp: false,
|
|
55
|
-
rtmpUrl: "",
|
|
56
|
-
rtmpRecord: false,
|
|
57
|
-
splitMode: WebRTC.LAYOUT_SPLITLATTICETILE
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
// 初始化
|
|
62
|
-
export function initWebRTC(self) {
|
|
63
|
-
that = self
|
|
64
|
-
var NIM = SDK.NIM;
|
|
65
|
-
NIM.use(window.WebRTC);
|
|
66
|
-
// 初始化webrtc
|
|
67
|
-
window.netcall = window.webrtc = window.WebRTC.getInstance({
|
|
68
|
-
nim: window.nim,
|
|
69
|
-
container: document.getElementById("localContainer") || document.getElementById("remote-" + store.state.user.imAccount),
|
|
70
|
-
remoteContainer: document.getElementById("remoteContainer"),
|
|
71
|
-
debug: false
|
|
72
|
-
})
|
|
73
|
-
// 被叫收到呼叫通知
|
|
74
|
-
window.webrtc.on("beCalling", function(obj) {
|
|
75
|
-
console.log("onBeCalling", obj)
|
|
76
|
-
webrtcOnBeCalling(obj)
|
|
77
|
-
})
|
|
78
|
-
// 被叫接受的通知
|
|
79
|
-
window.webrtc.on("callAccepted", function(obj) {
|
|
80
|
-
console.log("callAccepted", obj)
|
|
81
|
-
onCallAccepted(obj);
|
|
82
|
-
})
|
|
83
|
-
// 被叫拒绝的通知
|
|
84
|
-
window.webrtc.on("callRejected", function(obj) {
|
|
85
|
-
console.log("callRejected", obj);
|
|
86
|
-
// 取消呼叫倒计时
|
|
87
|
-
clearCallTimer();
|
|
88
|
-
// 挂断
|
|
89
|
-
window.netcall.hangup();
|
|
90
|
-
// 做清理工作
|
|
91
|
-
// resetWhenHangup();
|
|
92
|
-
});
|
|
93
|
-
// 其他端已经做了处理
|
|
94
|
-
window.webrtc.on("callerAckSync", function(obj) {
|
|
95
|
-
channelId = ""
|
|
96
|
-
that.showBecalling = false
|
|
97
|
-
that.showSession = false
|
|
98
|
-
clearRingPlay()
|
|
99
|
-
console.log("其他端已经做了处理", obj);
|
|
100
|
-
});
|
|
101
|
-
// 挂断监听
|
|
102
|
-
window.webrtc.on("hangup", function(obj) {
|
|
103
|
-
console.log(obj)
|
|
104
|
-
if (channelId && obj.channelId == channelId) {
|
|
105
|
-
Message("对方已挂断")
|
|
106
|
-
clearRingPlay()
|
|
107
|
-
that.showSession = false
|
|
108
|
-
that.showBecalling = false
|
|
109
|
-
channelId = ""
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
window.webrtc.on("error", function(obj) {
|
|
113
|
-
console.log("sdk反馈错误信息", obj);
|
|
114
|
-
if (obj.code) {
|
|
115
|
-
if (obj.code == 509) {
|
|
116
|
-
console.warn("你被提出房间了");
|
|
117
|
-
} else if (obj.code == 500) {
|
|
118
|
-
console.warn("你的web不支持H264视频编码,无法进行呼叫,请检测浏览器的H264插件是否正常");
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
// 加入房间
|
|
123
|
-
window.webrtc.on("joinChannel", function(obj) {
|
|
124
|
-
console.log("joinChannel", obj)
|
|
125
|
-
onJoinChannel(obj)
|
|
126
|
-
})
|
|
127
|
-
// 离开房间
|
|
128
|
-
window.webrtc.on("leaveChannel", function(obj) {
|
|
129
|
-
console.log("leaveChannel", obj)
|
|
130
|
-
that.meetingCall.joinedMembers = that.meetingCall.joinedMembers.filter(item => (item != obj.account))
|
|
131
|
-
if (that.meetingCall.membersState[obj.account] != undefined) {
|
|
132
|
-
that.meetingCall.membersState[obj.account] = 3
|
|
133
|
-
that.meetingCall.membersState = Object.assign({}, that.meetingCall.membersState)
|
|
134
|
-
}
|
|
135
|
-
window.netcall.stopRemoteStream({ account: obj.account });
|
|
136
|
-
if (obj.account == that.meetingCall.caller) {
|
|
137
|
-
setTimeout(async() => {
|
|
138
|
-
const res = await api.queryMeetingInfo({ meetingNo: that.channelId })
|
|
139
|
-
console.log(res)
|
|
140
|
-
if (res.data.state == "ok" && res.data.data.status == "ended") {
|
|
141
|
-
leaveChannel()
|
|
142
|
-
Message("主持人关闭会议")
|
|
143
|
-
}
|
|
144
|
-
}, 800)
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
// 媒体流通知
|
|
148
|
-
window.webrtc.on("remoteTrack", function(obj) {
|
|
149
|
-
onRemoteTrack(obj)
|
|
150
|
-
});
|
|
151
|
-
window.webrtc.on("control", function(obj) {
|
|
152
|
-
// 如果不是当前通话的指令, 直接丢掉
|
|
153
|
-
if (window.netcall.notCurrentChannelId(obj)) {
|
|
154
|
-
return
|
|
155
|
-
}
|
|
156
|
-
onControl(obj)
|
|
157
|
-
})
|
|
158
|
-
// 信令断开
|
|
159
|
-
window.webrtc.on("signalClosed", function() {
|
|
160
|
-
if (that.meetingCall.channelName) {
|
|
161
|
-
leaveChannel()
|
|
162
|
-
}
|
|
163
|
-
})
|
|
164
|
-
// rtc链接断开
|
|
165
|
-
window.webrtc.on("rtcConnectFailed", function() {
|
|
166
|
-
console.log("rtcConnectFailed");
|
|
167
|
-
if (that.meetingCall.channelName) {
|
|
168
|
-
leaveChannel()
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
// 监听屏幕共享
|
|
172
|
-
window.webrtc.on("streamEnded", function(obj) {
|
|
173
|
-
console.log("媒体流停止了", obj);
|
|
174
|
-
if (obj && obj.type === "screen") {
|
|
175
|
-
// 屏幕共享的媒体流已经停止了,此处做关闭屏幕共享处理
|
|
176
|
-
netcall.stopDevice(WebRTC.DEVICE_TYPE_DESKTOP_CHROME_SCREEN).then(() => {
|
|
177
|
-
console.log("屏幕共享关闭成功")
|
|
178
|
-
})
|
|
179
|
-
}
|
|
180
|
-
})
|
|
181
|
-
}
|
|
182
|
-
// 被叫收到呼叫通知
|
|
183
|
-
function webrtcOnBeCalling(obj) {
|
|
184
|
-
// if (channelId && channelId === obj.channelId) return
|
|
185
|
-
channelId = obj.channelId;
|
|
186
|
-
// 被叫回应主叫自己已经收到了通话请求
|
|
187
|
-
window.netcall.control({
|
|
188
|
-
channelId: channelId,
|
|
189
|
-
command: WebRTC.NETCALL_CONTROL_COMMAND_START_NOTIFY_RECEIVED
|
|
190
|
-
});
|
|
191
|
-
// 只有在没有通话并且没有被叫的时候才记录被叫信息, 否则通知对方忙并拒绝通话
|
|
192
|
-
if (!window.netcall.calling && !beCalling) {
|
|
193
|
-
that.isMeeting = false
|
|
194
|
-
that.showBecalling = true
|
|
195
|
-
that.showSession = false
|
|
196
|
-
type = obj.type;
|
|
197
|
-
beCalling = true;
|
|
198
|
-
beCalledInfo = obj;
|
|
199
|
-
that.meetingCall.caller = obj.account
|
|
200
|
-
playRing("E", 60)
|
|
201
|
-
// 呼叫方没有响应
|
|
202
|
-
beCallTimer = setTimeout(function() {
|
|
203
|
-
if (!beCallTimer) return;
|
|
204
|
-
clearTimeout(beCallTimer)
|
|
205
|
-
clearRingPlay()
|
|
206
|
-
that.showBecalling = false
|
|
207
|
-
that.showSession = false
|
|
208
|
-
beCalling = false
|
|
209
|
-
window.netcall.control({
|
|
210
|
-
channelId: channelId,
|
|
211
|
-
command: WebRTC.NETCALL_CONTROL_COMMAND_BUSY
|
|
212
|
-
});
|
|
213
|
-
window.netcall.hangup()
|
|
214
|
-
}, 60 * 1000)
|
|
215
|
-
} else {
|
|
216
|
-
if (window.netcall.calling) {
|
|
217
|
-
busy = window.netcall.notCurrentChannelId(obj);
|
|
218
|
-
} else if (beCalling) {
|
|
219
|
-
busy = beCalledInfo.channelId !== channelId;
|
|
220
|
-
}
|
|
221
|
-
if (busy) {
|
|
222
|
-
window.netcall.control({
|
|
223
|
-
channelId: channelId,
|
|
224
|
-
command: WebRTC.NETCALL_CONTROL_COMMAND_BUSY
|
|
225
|
-
});
|
|
226
|
-
// 拒绝通话
|
|
227
|
-
window.netcall.response({
|
|
228
|
-
accepted: false,
|
|
229
|
-
beCalledInfo: obj
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
// 被叫接受的通知
|
|
235
|
-
function onCallAccepted(obj) {
|
|
236
|
-
type = obj.type
|
|
237
|
-
busy = true;
|
|
238
|
-
clearCallTimer();
|
|
239
|
-
startLocalDevice()
|
|
240
|
-
}
|
|
241
|
-
// 开启本地音频,视频设备
|
|
242
|
-
function startLocalDevice(close) {
|
|
243
|
-
window.netcall.startRtc().then(function() {
|
|
244
|
-
// 开启本地麦克风
|
|
245
|
-
return window.netcall.startDevice({
|
|
246
|
-
type: WebRTC.DEVICE_TYPE_AUDIO_IN
|
|
247
|
-
}).catch(function(err) {
|
|
248
|
-
console.log("启动麦克风失败")
|
|
249
|
-
that.microphoneAvail = false
|
|
250
|
-
that.microphoneIsClose = true
|
|
251
|
-
console.log(err)
|
|
252
|
-
})
|
|
253
|
-
})
|
|
254
|
-
.then(function() {
|
|
255
|
-
// 设置采集音量
|
|
256
|
-
that.microphoneIsClose = false
|
|
257
|
-
if (close) {
|
|
258
|
-
window.netcall.stopDevice(WebRTC.DEVICE_TYPE_AUDIO_IN).then(function() {
|
|
259
|
-
console.log("关闭麦克风")
|
|
260
|
-
that.microphoneIsClose = true
|
|
261
|
-
that.isMute = true
|
|
262
|
-
})
|
|
263
|
-
}
|
|
264
|
-
window.netcall.setCaptureVolume(255)
|
|
265
|
-
window.netcall.control({
|
|
266
|
-
command: WebRTC.NETCALL_CONTROL_COMMAND_NOTIFY_AUDIO_ON
|
|
267
|
-
})
|
|
268
|
-
// 开启摄像头
|
|
269
|
-
if (type == WebRTC.NETCALL_TYPE_VIDEO) {
|
|
270
|
-
return window.netcall.startDevice({
|
|
271
|
-
type: WebRTC.DEVICE_TYPE_VIDEO,
|
|
272
|
-
width: 640,
|
|
273
|
-
height: 480
|
|
274
|
-
})
|
|
275
|
-
.then(function() {
|
|
276
|
-
that.cameraIsClose = false
|
|
277
|
-
// 预览本地画面
|
|
278
|
-
const node = that.isMeeting ? document.getElementById("remote-" + store.state.user.imAccount) : document.getElementById("localContainer")
|
|
279
|
-
window.netcall.startLocalStream(
|
|
280
|
-
node
|
|
281
|
-
)
|
|
282
|
-
// 设置本地预览画面大小
|
|
283
|
-
window.netcall.setVideoViewSize({
|
|
284
|
-
width: 500,
|
|
285
|
-
height: 500,
|
|
286
|
-
cut: true
|
|
287
|
-
})
|
|
288
|
-
}).catch(function(err) {
|
|
289
|
-
console.log("启动摄像头失败")
|
|
290
|
-
that.cameraAvail = false
|
|
291
|
-
that.cameraIsClose = true
|
|
292
|
-
if (err.code == 65002) {
|
|
293
|
-
console.log("设备不存在/无任何设备")
|
|
294
|
-
}
|
|
295
|
-
console.error(err)
|
|
296
|
-
})
|
|
297
|
-
}
|
|
298
|
-
})
|
|
299
|
-
.then(function() {
|
|
300
|
-
// 设置互动者角色
|
|
301
|
-
window.netcall.changeRoleToPlayer()
|
|
302
|
-
})
|
|
303
|
-
.catch(function(err) {
|
|
304
|
-
console.log("发生错误")
|
|
305
|
-
console.log(err)
|
|
306
|
-
window.netcall.hangup()
|
|
307
|
-
})
|
|
308
|
-
}
|
|
309
|
-
// 加入房间
|
|
310
|
-
function onJoinChannel(obj) {
|
|
311
|
-
// 通知上层有其他用户加入了房间,上层做相应逻辑和UI处理
|
|
312
|
-
// 这里可以播放加入的同学的视频流
|
|
313
|
-
// 以及播放对方声音
|
|
314
|
-
clearRingPlay()
|
|
315
|
-
clearTimeout(meetingTimer)
|
|
316
|
-
that.meetingCall.joinedMembers.indexOf(obj.account) == -1 && that.meetingCall.joinedMembers.push(obj.account)
|
|
317
|
-
that.meetingCall.membersState[obj.account] = 1
|
|
318
|
-
that.meetingCall.membersState = Object.assign({}, that.meetingCall.membersState)
|
|
319
|
-
if (that.meetingCall.members.indexOf(obj.account) == -1) {
|
|
320
|
-
that.meetingCall.members.push(obj.account)
|
|
321
|
-
// that.meetingCall.caller = that.meetingCall.members[0]
|
|
322
|
-
}
|
|
323
|
-
window.netcall
|
|
324
|
-
.startDevice({
|
|
325
|
-
type: WebRTC.DEVICE_TYPE_AUDIO_OUT_CHAT
|
|
326
|
-
})
|
|
327
|
-
.catch(function() {
|
|
328
|
-
console.log("播放对方的声音失败");
|
|
329
|
-
});
|
|
330
|
-
|
|
331
|
-
that.$nextTick(() => {
|
|
332
|
-
// 预览加入的同学的视频流
|
|
333
|
-
window.netcall.startRemoteStream({
|
|
334
|
-
account: obj.account,
|
|
335
|
-
node: document.getElementById("remote-" + obj.account)
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
// 设置对方预览画面大小
|
|
339
|
-
window.netcall.setVideoViewRemoteSize({
|
|
340
|
-
account: obj.account,
|
|
341
|
-
width: 500,
|
|
342
|
-
height: 500,
|
|
343
|
-
cut: true
|
|
344
|
-
});
|
|
345
|
-
})
|
|
346
|
-
}
|
|
347
|
-
// 媒体流通知
|
|
348
|
-
function onRemoteTrack(obj) {
|
|
349
|
-
console.log(obj)
|
|
350
|
-
clearBeCallTimer()
|
|
351
|
-
acceptAndWait = false
|
|
352
|
-
if (obj.track.kind === "audio") {
|
|
353
|
-
// 播放对方声音
|
|
354
|
-
window.netcall
|
|
355
|
-
.startDevice({
|
|
356
|
-
type: WebRTC.DEVICE_TYPE_AUDIO_OUT_CHAT
|
|
357
|
-
})
|
|
358
|
-
.catch(function() {
|
|
359
|
-
console.log("播放对方的声音失败");
|
|
360
|
-
that.voice[obj.account] = false
|
|
361
|
-
});
|
|
362
|
-
that.voice[obj.account] = true
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
// 视频:展示对方的画面
|
|
366
|
-
if (obj.track.kind === "video") {
|
|
367
|
-
// 预览加入的同学的视频流
|
|
368
|
-
window.netcall.startRemoteStream({
|
|
369
|
-
account: obj.account,
|
|
370
|
-
node: document.getElementById("remote-" + obj.account)
|
|
371
|
-
});
|
|
372
|
-
// 设置对方预览画面大小
|
|
373
|
-
window.netcall.setVideoViewRemoteSize({
|
|
374
|
-
account: obj.account,
|
|
375
|
-
width: 500,
|
|
376
|
-
height: 500,
|
|
377
|
-
cut: true
|
|
378
|
-
});
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
// 清除呼叫定时器
|
|
382
|
-
function clearCallTimer() {
|
|
383
|
-
clearRingPlay()
|
|
384
|
-
if (callTimer) {
|
|
385
|
-
clearTimeout(callTimer)
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
// 清除被呼叫定时器
|
|
389
|
-
function clearBeCallTimer() {
|
|
390
|
-
clearRingPlay()
|
|
391
|
-
if (beCallTimer) {
|
|
392
|
-
clearTimeout(beCallTimer)
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
//
|
|
396
|
-
function onControl(obj) {
|
|
397
|
-
console.log(obj)
|
|
398
|
-
switch (obj.type) {
|
|
399
|
-
// 通知对方自己打开了音频
|
|
400
|
-
case WebRTC.NETCALL_CONTROL_COMMAND_NOTIFY_AUDIO_ON:
|
|
401
|
-
// Message("对方打开了麦克风");
|
|
402
|
-
that.voice[obj.account] = true
|
|
403
|
-
break;
|
|
404
|
-
// 通知对方自己关闭了音频
|
|
405
|
-
case WebRTC.NETCALL_CONTROL_COMMAND_NOTIFY_AUDIO_OFF:
|
|
406
|
-
// Message("对方关闭了麦克风");
|
|
407
|
-
that.voice[obj.account] = false
|
|
408
|
-
break;
|
|
409
|
-
// 通知对方自己打开了视频
|
|
410
|
-
case WebRTC.NETCALL_CONTROL_COMMAND_NOTIFY_VIDEO_ON:
|
|
411
|
-
const ele = document.getElementById("remote-" + obj.account) || document.getElementById("remoteContainer")
|
|
412
|
-
const eleChild = ele.getElementsByTagName("div")[0];
|
|
413
|
-
if (eleChild.style.display != "block") {
|
|
414
|
-
// Message("对方打开了摄像头");
|
|
415
|
-
// 预览加入的同学的视频流
|
|
416
|
-
eleChild.style.display = "block"
|
|
417
|
-
window.netcall.startRemoteStream({
|
|
418
|
-
account: obj.account,
|
|
419
|
-
node: document.getElementById("remote-" + obj.account)
|
|
420
|
-
});
|
|
421
|
-
// 设置对方预览画面大小
|
|
422
|
-
window.netcall.setVideoViewRemoteSize({
|
|
423
|
-
account: obj.account,
|
|
424
|
-
width: 500,
|
|
425
|
-
height: 500,
|
|
426
|
-
cut: true
|
|
427
|
-
});
|
|
428
|
-
}
|
|
429
|
-
break;
|
|
430
|
-
// 通知对方自己关闭了视频
|
|
431
|
-
case WebRTC.NETCALL_CONTROL_COMMAND_NOTIFY_VIDEO_OFF:
|
|
432
|
-
const dom = document.getElementById("remote-" + obj.account) || document.getElementById("remoteContainer")
|
|
433
|
-
const child = dom.getElementsByTagName("div")[0];
|
|
434
|
-
if (child.style.display != "none") {
|
|
435
|
-
// Message("对方关闭了摄像头");
|
|
436
|
-
child.style.display = "none"
|
|
437
|
-
}
|
|
438
|
-
break;
|
|
439
|
-
// 拒绝从音频切换到视频
|
|
440
|
-
case WebRTC.NETCALL_CONTROL_COMMAND_SWITCH_AUDIO_TO_VIDEO_REJECT:
|
|
441
|
-
Message("对方拒绝从音频切换到视频通话");
|
|
442
|
-
break;
|
|
443
|
-
// 请求从音频切换到视频
|
|
444
|
-
case WebRTC.NETCALL_CONTROL_COMMAND_SWITCH_AUDIO_TO_VIDEO:
|
|
445
|
-
that.$confirm("对方请求从音频切换到视频通话, 是否同意?", "提示", {
|
|
446
|
-
confirmButtonText: "同意",
|
|
447
|
-
cancelButtonText: "不同意",
|
|
448
|
-
type: "warning"
|
|
449
|
-
}).then(() => {
|
|
450
|
-
that.cameraAvail && deviceVideoIn(that, true)
|
|
451
|
-
window.netcall.control({
|
|
452
|
-
channelId: beCalledInfo.channelId,
|
|
453
|
-
command: WebRTC.NETCALL_CONTROL_COMMAND_SWITCH_AUDIO_TO_VIDEO_AGREE
|
|
454
|
-
});
|
|
455
|
-
const dom2 = document.getElementById("remote-" + obj.account) || document.getElementById("remoteContainer")
|
|
456
|
-
const child2 = dom2.getElementsByTagName("div")[0];
|
|
457
|
-
if (child2) {
|
|
458
|
-
child2.style.display = "block"
|
|
459
|
-
}
|
|
460
|
-
}).catch(() => {
|
|
461
|
-
window.netcall.control({
|
|
462
|
-
channelId: beCalledInfo.channelId,
|
|
463
|
-
command: WebRTC.NETCALL_CONTROL_COMMAND_SWITCH_AUDIO_TO_VIDEO_REJECT
|
|
464
|
-
});
|
|
465
|
-
});
|
|
466
|
-
break;
|
|
467
|
-
// 同意从音频切换到视频
|
|
468
|
-
case WebRTC.NETCALL_CONTROL_COMMAND_SWITCH_AUDIO_TO_VIDEO_AGREE:
|
|
469
|
-
Message("对方同意从音频切换到视频通话");
|
|
470
|
-
break;
|
|
471
|
-
// 从视频切换到音频
|
|
472
|
-
case WebRTC.NETCALL_CONTROL_COMMAND_SWITCH_VIDEO_TO_AUDIO:
|
|
473
|
-
Message("对方从视频切换为音频");
|
|
474
|
-
const dom1 = document.getElementById("remote-" + obj.account) || document.getElementById("remoteContainer")
|
|
475
|
-
const child1 = dom1.getElementsByTagName("div")[0];
|
|
476
|
-
if (child1) {
|
|
477
|
-
child1.style.display = "none"
|
|
478
|
-
deviceVideoIn(that, false)
|
|
479
|
-
}
|
|
480
|
-
break;
|
|
481
|
-
// 占线
|
|
482
|
-
case WebRTC.NETCALL_CONTROL_COMMAND_BUSY:
|
|
483
|
-
busy = false;
|
|
484
|
-
if (!that.isMeeting) {
|
|
485
|
-
Message("对方正忙,取消通话");
|
|
486
|
-
window.netcall.hangup();
|
|
487
|
-
clearCallTimer();
|
|
488
|
-
that.showBecalling = false
|
|
489
|
-
that.showSession = false
|
|
490
|
-
channelId = ""
|
|
491
|
-
busy = false
|
|
492
|
-
} else {
|
|
493
|
-
// Message(obj.account + "对方正忙,取消通话");
|
|
494
|
-
// that.meetingCall.members = that.meetingCall.members.filter(item=>(item != obj.account))
|
|
495
|
-
that.meetingCall.membersState[obj.account] = 2
|
|
496
|
-
that.meetingCall.membersState = Object.assign({}, that.meetingCall.membersState)
|
|
497
|
-
const flg = that.meetingCall.members.filter(v => (!(that.meetingCall.membersState[v] && that.meetingCall.membersState[v] == 2)))
|
|
498
|
-
// if(store.state.user.imAccount == that.meetingCall.caller && flg.length < 2 && that.channelId){
|
|
499
|
-
// leaveChannel()
|
|
500
|
-
// }
|
|
501
|
-
}
|
|
502
|
-
break;
|
|
503
|
-
case WebRTC.NETCALL_CONTROL_COMMAND_SELF_CAMERA_INVALID:
|
|
504
|
-
// Message("对方摄像头不可用");
|
|
505
|
-
break;
|
|
506
|
-
case 30:
|
|
507
|
-
changeCaller()
|
|
508
|
-
break;
|
|
509
|
-
case 31:
|
|
510
|
-
removeOneMember()
|
|
511
|
-
break
|
|
512
|
-
case 32:
|
|
513
|
-
setMemberMute()
|
|
514
|
-
break
|
|
515
|
-
case 33:
|
|
516
|
-
addMemberList()
|
|
517
|
-
break
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
// 新增成员
|
|
521
|
-
async function addMemberList(resute) {
|
|
522
|
-
const res = resute || await api.queryMeetingInfo({ meetingNo: that.channelId })
|
|
523
|
-
if (res.data.state == "ok") {
|
|
524
|
-
const joinedMembers = [];
|
|
525
|
-
const members = []
|
|
526
|
-
const membersState = {}
|
|
527
|
-
const state = { joined: 1, refuse: 2, invited: 4, out: 3 }
|
|
528
|
-
res.data.data.members.forEach(item => {
|
|
529
|
-
if (item.status != "remove") {
|
|
530
|
-
joinedMembers.push(item.imAccount)
|
|
531
|
-
members.push(item.imAccount)
|
|
532
|
-
if (item.outTime) {
|
|
533
|
-
membersState[item.imAccount] = state[out]
|
|
534
|
-
} else {
|
|
535
|
-
membersState[item.imAccount] = state[item.status] ? state[item.status] : ""
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
})
|
|
539
|
-
that.meetingCall.joinedMembers = joinedMembers.map(item => (item))
|
|
540
|
-
that.meetingCall.members = members.map(item => (item))
|
|
541
|
-
that.meetingCall.membersState = Object.assign({}, membersState)
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
// 设置静音
|
|
545
|
-
async function setMemberMute() {
|
|
546
|
-
const res = await api.queryMeetingInfo({ meetingNo: that.channelId })
|
|
547
|
-
if (res.data.state == "ok") {
|
|
548
|
-
if (res.data.data.isSetMusic == "YES") {
|
|
549
|
-
window.netcall.stopDevice(WebRTC.DEVICE_TYPE_AUDIO_IN).then(function() {
|
|
550
|
-
window.netcall.control({
|
|
551
|
-
command: WebRTC.NETCALL_CONTROL_COMMAND_NOTIFY_AUDIO_ON
|
|
552
|
-
})
|
|
553
|
-
})
|
|
554
|
-
that.microphoneIsClose = true
|
|
555
|
-
that.microphoneAvail = res.data.data.isAllowOpen != "YES"
|
|
556
|
-
} else {
|
|
557
|
-
window.netcall.startDevice(WebRTC.DEVICE_TYPE_AUDIO_IN).then(function() {
|
|
558
|
-
window.netcall.control({
|
|
559
|
-
command: WebRTC.NETCALL_CONTROL_COMMAND_NOTIFY_AUDIO_OFF
|
|
560
|
-
})
|
|
561
|
-
})
|
|
562
|
-
that.microphoneIsClose = false
|
|
563
|
-
that.microphoneAvail = true
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
// 移除入会成员
|
|
568
|
-
async function removeOneMember() {
|
|
569
|
-
const res = await api.queryMeetingInfo({ meetingNo: that.channelId })
|
|
570
|
-
if (res.data.state == "ok") {
|
|
571
|
-
const arr = res.data.data.members.filter(item => (item.status == "remove"))
|
|
572
|
-
if (arr.length > 0) {
|
|
573
|
-
arr.forEach(i => {
|
|
574
|
-
if (i.imAccount == store.state.user.imAccount) {
|
|
575
|
-
leaveChannel()
|
|
576
|
-
}
|
|
577
|
-
})
|
|
578
|
-
}
|
|
579
|
-
addMemberList(res)
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
// 改变主持人
|
|
583
|
-
async function changeCaller() {
|
|
584
|
-
const res = await api.queryMeetingInfo({ meetingNo: that.channelId })
|
|
585
|
-
if (res.data.state == "ok") {
|
|
586
|
-
res.data.data.members.forEach(item => {
|
|
587
|
-
if (item.host == "YES") {
|
|
588
|
-
that.meetingCall.caller = item.imAccount
|
|
589
|
-
}
|
|
590
|
-
})
|
|
591
|
-
}
|
|
592
|
-
}
|
|
593
|
-
// 发起音视频呼叫
|
|
594
|
-
export function doCalling(flg, account) {
|
|
595
|
-
if (!account) {
|
|
596
|
-
Message("请选择呼叫人")
|
|
597
|
-
return
|
|
598
|
-
}
|
|
599
|
-
type = flg == 1 ? WebRTC.NETCALL_TYPE_AUDIO : WebRTC.NETCALL_TYPE_VIDEO
|
|
600
|
-
that.isMeeting = false
|
|
601
|
-
window.webrtc.call({
|
|
602
|
-
type: type,
|
|
603
|
-
account: account,
|
|
604
|
-
pushConfig: pushConfig,
|
|
605
|
-
sessionConfig: sessionConfig
|
|
606
|
-
}).then((obj) => {
|
|
607
|
-
// 成功发起呼叫
|
|
608
|
-
console.log("call success", obj);
|
|
609
|
-
beCalling = true
|
|
610
|
-
that.showSession = true
|
|
611
|
-
that.showBecalling = false
|
|
612
|
-
playRing("E", 60)
|
|
613
|
-
callTimer = setTimeout(function() {
|
|
614
|
-
if (!window.webrtc.callAccepted) {
|
|
615
|
-
clearRingPlay()
|
|
616
|
-
Message("无人接听")
|
|
617
|
-
beCalling = false
|
|
618
|
-
that.showSession = false
|
|
619
|
-
that.showBecalling = false
|
|
620
|
-
window.webrtc.hangup()
|
|
621
|
-
}
|
|
622
|
-
}, 1000 * 60);
|
|
623
|
-
}).catch(function(err) {
|
|
624
|
-
// 被叫不在线
|
|
625
|
-
if (err.event.code === 11001) {
|
|
626
|
-
Message("被叫不在线")
|
|
627
|
-
}
|
|
628
|
-
});
|
|
629
|
-
}
|
|
630
|
-
// 接受邀请
|
|
631
|
-
export function acceptCall() {
|
|
632
|
-
// 接听
|
|
633
|
-
clearRingPlay()
|
|
634
|
-
if (!beCalling) return
|
|
635
|
-
beCalling = false
|
|
636
|
-
that.showBecalling = false
|
|
637
|
-
window.netcall.response({
|
|
638
|
-
accepted: true,
|
|
639
|
-
beCalledInfo: beCalledInfo,
|
|
640
|
-
sessionConfig: sessionConfig
|
|
641
|
-
}).then(function(obj) {
|
|
642
|
-
console.log(obj)
|
|
643
|
-
acceptAndWait = true;
|
|
644
|
-
setTimeout(function() {
|
|
645
|
-
console.log(acceptAndWait)
|
|
646
|
-
if (acceptAndWait) {
|
|
647
|
-
window.netcall.hangup()
|
|
648
|
-
acceptAndWait = false;
|
|
649
|
-
that.showSession = false
|
|
650
|
-
}
|
|
651
|
-
}, 45 * 1000)
|
|
652
|
-
that.showSession = true
|
|
653
|
-
// startLocalDevice()
|
|
654
|
-
})
|
|
655
|
-
.catch(function(err) {
|
|
656
|
-
rejectCall();
|
|
657
|
-
console.log("接听失败", err);
|
|
658
|
-
});
|
|
659
|
-
}
|
|
660
|
-
// 拒绝邀请
|
|
661
|
-
export function rejectCall() {
|
|
662
|
-
clearRingPlay()
|
|
663
|
-
if (!beCalling) return
|
|
664
|
-
beCalling = false
|
|
665
|
-
window.netcall.control({
|
|
666
|
-
channelId: beCalledInfo.channelId,
|
|
667
|
-
command: WebRTC.NETCALL_CONTROL_COMMAND_BUSY
|
|
668
|
-
});
|
|
669
|
-
window.netcall.response({
|
|
670
|
-
accepted: false,
|
|
671
|
-
beCalledInfo
|
|
672
|
-
}).then(function(obj) {
|
|
673
|
-
console.log(obj)
|
|
674
|
-
beCalledInfo = null
|
|
675
|
-
beCalling = false
|
|
676
|
-
that.showBecalling = false
|
|
677
|
-
that.showSession = false
|
|
678
|
-
}).catch(function(err) {
|
|
679
|
-
console.log(err)
|
|
680
|
-
beCalledInfo = null
|
|
681
|
-
beCalling = false
|
|
682
|
-
});
|
|
683
|
-
}
|
|
684
|
-
// 挂断
|
|
685
|
-
export function cancelCalling() {
|
|
686
|
-
clearRingPlay()
|
|
687
|
-
window.netcall.hangup()
|
|
688
|
-
busy = false
|
|
689
|
-
beCalledInfo = null
|
|
690
|
-
channelId = ""
|
|
691
|
-
type = ""
|
|
692
|
-
that.showBecalling = false
|
|
693
|
-
that.showSession = false
|
|
694
|
-
}
|
|
695
|
-
// 创建房间
|
|
696
|
-
export function createChannel(members, types, _this, meetNo) {
|
|
697
|
-
type = types == 1 ? WebRTC.NETCALL_TYPE_AUDIO : WebRTC.NETCALL_TYPE_VIDEO
|
|
698
|
-
const random1 = Math.round(Math.random() * 10)
|
|
699
|
-
const random2 = Math.round(Math.random() * 10)
|
|
700
|
-
const time = Date.now() + ""
|
|
701
|
-
const channel = time.substr(1, 9)
|
|
702
|
-
const channelName = meetNo || (random1 + "" + random2 + channel)
|
|
703
|
-
console.log(_this)
|
|
704
|
-
const meetMenber = _this.members.map(item => {
|
|
705
|
-
return { avatar: "", name: item.name, imAccount: item.imAccount, userNo: item.memberNo }
|
|
706
|
-
})
|
|
707
|
-
const info = {
|
|
708
|
-
theme: _this.theme,
|
|
709
|
-
channelName: channelName,
|
|
710
|
-
no: _this.user.no,
|
|
711
|
-
cno: _this.user.cno,
|
|
712
|
-
channelId: "",
|
|
713
|
-
telPhone: _this.user.telPhone,
|
|
714
|
-
members: meetMenber
|
|
715
|
-
}
|
|
716
|
-
window.netcall.createChannel({
|
|
717
|
-
channelName: channelName, // 必填
|
|
718
|
-
custom: "", // 可选
|
|
719
|
-
webrtcEnable: true, // 启动webrtc
|
|
720
|
-
rtmpConf: "" // 如果不需要房间推流,设置'',即可
|
|
721
|
-
}).then(async function(obj) {
|
|
722
|
-
console.log(obj)
|
|
723
|
-
// 预定房间成功后的上层逻辑操作
|
|
724
|
-
// eg: 初始化房间UI显示
|
|
725
|
-
// eg: 加入房间
|
|
726
|
-
that.isMeeting = true
|
|
727
|
-
that.meetingCall.channelName = obj.channelName
|
|
728
|
-
that.meetingCall.joinedMembers = []
|
|
729
|
-
that.meetingCall.membersState = {}
|
|
730
|
-
that.meetingCall.members = members
|
|
731
|
-
that.meetingCall.caller = store.state.user.imAccount
|
|
732
|
-
that.topical = info.theme
|
|
733
|
-
that.joinTime = Date.now()
|
|
734
|
-
|
|
735
|
-
joinChannel("", "", info)
|
|
736
|
-
if (_this) {
|
|
737
|
-
_this.showOperation = false
|
|
738
|
-
_this.members = []
|
|
739
|
-
}
|
|
740
|
-
}).catch(err => {
|
|
741
|
-
console.log(err)
|
|
742
|
-
console.log("createChannelErr", JSON.stringify(err))
|
|
743
|
-
Message("发起会议失败")
|
|
744
|
-
})
|
|
745
|
-
}
|
|
746
|
-
// 加入房间
|
|
747
|
-
export async function joinChannel(id, meetType, info) {
|
|
748
|
-
console.log(id)
|
|
749
|
-
if (meetType) {
|
|
750
|
-
type = meetType
|
|
751
|
-
}
|
|
752
|
-
let res;
|
|
753
|
-
if (that.meetingCall.caller != store.state.user.imAccount) {
|
|
754
|
-
res = await api.queryMeetingInfo({ meetingNo: that.channelId || id })
|
|
755
|
-
let removeMenber = []
|
|
756
|
-
if (res.data.state == "ok") {
|
|
757
|
-
removeMenber = res.data.data.members.filter(i => (i.status == "remove")).map(it => (it.imAccount == store.state.user.imAccount))
|
|
758
|
-
if (removeMenber.length > 0) {
|
|
759
|
-
Message.error("被支持人移除无法进入会议")
|
|
760
|
-
that.isLockMeeting = true
|
|
761
|
-
that.showSession = false
|
|
762
|
-
that.showBecalling = false
|
|
763
|
-
clearRingPlay()
|
|
764
|
-
if (localStorage.getItem("meetNo")) {
|
|
765
|
-
localStorage.removeItem("meetNo")
|
|
766
|
-
that.$router.push({ path: "/index" })
|
|
767
|
-
}
|
|
768
|
-
return false
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
if (res.data.state == "ok" && res.data.data.isLockMeeting == "YES") {
|
|
772
|
-
const caller = res.data.data.members.filter(i => (i.host == "YES"))
|
|
773
|
-
if (caller.length > 0 && caller[0].imAccount != store.state.user.imAccount) {
|
|
774
|
-
Message.error("会议被锁定,无法加入此会议")
|
|
775
|
-
that.isLockMeeting = true
|
|
776
|
-
that.showSession = false
|
|
777
|
-
that.showBecalling = false
|
|
778
|
-
clearRingPlay()
|
|
779
|
-
if (localStorage.getItem("meetNo")) {
|
|
780
|
-
localStorage.removeItem("meetNo")
|
|
781
|
-
that.$router.push({ path: "/index" })
|
|
782
|
-
}
|
|
783
|
-
return false
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
window.netcall.joinChannel({
|
|
788
|
-
channelName: id || that.meetingCall.channelName,
|
|
789
|
-
type: meetType || type || 2,
|
|
790
|
-
custom: "",
|
|
791
|
-
role: 0,
|
|
792
|
-
sessionConfig: sessionConfig
|
|
793
|
-
}).then(function(obj) {
|
|
794
|
-
that.showBecalling = false
|
|
795
|
-
that.showSession = true
|
|
796
|
-
that.isMeeting = true
|
|
797
|
-
clearTimeout(that.meetingBecall)
|
|
798
|
-
if (res && res.data.state == "ok" && res.data.data.isMute == "YES") {
|
|
799
|
-
startLocalDevice(true)
|
|
800
|
-
} else {
|
|
801
|
-
startLocalDevice()
|
|
802
|
-
}
|
|
803
|
-
channelId = obj.channelId
|
|
804
|
-
that.channelId = obj.channelId
|
|
805
|
-
busy = true
|
|
806
|
-
if (that.meetingCall.caller == store.state.user.imAccount) {
|
|
807
|
-
const teamId = store.state.toUser.split("-")[1] || "";
|
|
808
|
-
const nick = store.state.user.realName || store.state.user.accountName
|
|
809
|
-
const message = type == 1 ? "发起了语音聊天" : "发起了视频聊天"
|
|
810
|
-
/** 发送群视频tip */
|
|
811
|
-
if (store.state.toUser.indexOf("team") > -1) {
|
|
812
|
-
sendTeamTip({ teamId: teamId, message: message, nick: nick })
|
|
813
|
-
}
|
|
814
|
-
/** 点对点发起视频通知 */
|
|
815
|
-
sendCustomMessage({ channelName: that.meetingCall.channelName, nick: nick, teamId: teamId, list: that.meetingCall.members, type: type, teamName: "群聊" })
|
|
816
|
-
playRing("E", 60)
|
|
817
|
-
info.channelId = channelId
|
|
818
|
-
startedMeeting(info)
|
|
819
|
-
// 倒计时
|
|
820
|
-
clearTimeout(meetingTimer)
|
|
821
|
-
meetingTimer = setTimeout(function() {
|
|
822
|
-
if (that.meetingCall.joinedMembers.length < 1) {
|
|
823
|
-
Message("会议呼叫无人应答")
|
|
824
|
-
clearRingPlay()
|
|
825
|
-
leaveChannel()
|
|
826
|
-
}
|
|
827
|
-
}, 60 * 1000)
|
|
828
|
-
setTimeout(() => {
|
|
829
|
-
if (that.showSession) {
|
|
830
|
-
setMemberStatue(that)
|
|
831
|
-
}
|
|
832
|
-
}, 60 * 1000)
|
|
833
|
-
} else if (that.meetingCall.members.indexOf(store.state.user.imAccount) == -1) {
|
|
834
|
-
that.meetingCall.channelName = that.meetingCall.channelName || that.channelId || id
|
|
835
|
-
that.meetingCall.members.push(store.state.user.imAccount)
|
|
836
|
-
}
|
|
837
|
-
that.meetingCall.membersState[store.state.user.imAccount] = 1
|
|
838
|
-
// 1:接听 2:已拒绝 3:已离开 4:未接收
|
|
839
|
-
if (res && res.data.state == "ok" && res.data.data.members && res.data.data.members.length > 0) {
|
|
840
|
-
res.data.data.members.forEach(item => {
|
|
841
|
-
if (!that.meetingCall.membersState[item.imAccount]) {
|
|
842
|
-
that.meetingCall.membersState[item.imAccount] = (item.status == "joined" && item.outTime) ? 1 : (item.status == "joined" && !item.outTime) ? 3 : item.status == "refuse" ? 2 : ""
|
|
843
|
-
}
|
|
844
|
-
if (item.host == "YES") {
|
|
845
|
-
that.meetingCall.caller = item.imAccount
|
|
846
|
-
}
|
|
847
|
-
})
|
|
848
|
-
that.meetingCall.members = res.data.data.members.map(item => (item.imAccount))
|
|
849
|
-
if (that.meetingCall.members.indexOf(store.state.user.imAccount) == -1) {
|
|
850
|
-
that.meetingCall.members.push(store.state.user.imAccount)
|
|
851
|
-
}
|
|
852
|
-
that.meetingId = res.data.data.id
|
|
853
|
-
that.topical = res.data.data.topic
|
|
854
|
-
that.joinTime = Date.now()
|
|
855
|
-
}
|
|
856
|
-
that.meetingCall.membersState = Object.assign({}, that.meetingCall.membersState)
|
|
857
|
-
if (that.meetingCall.caller != store.state.user.imAccount) {
|
|
858
|
-
changeMeetState("in")
|
|
859
|
-
}
|
|
860
|
-
store.commit("UPDATAREFRESHLIST")
|
|
861
|
-
if (localStorage.getItem("meetNo")) {
|
|
862
|
-
localStorage.removeItem("meetNo")
|
|
863
|
-
that.$router.push({ path: "/index" })
|
|
864
|
-
}
|
|
865
|
-
}).catch(err => {
|
|
866
|
-
console.log(err)
|
|
867
|
-
localStorage.removeItem("meetNo")
|
|
868
|
-
const msg = err.code == 20111 ? "会议已关闭" : "加入房间失败";
|
|
869
|
-
Message.error(msg)
|
|
870
|
-
that.$router.push({ path: "/index" })
|
|
871
|
-
if (info && typeof (info) == "function") {
|
|
872
|
-
const flg = err.code == 20111
|
|
873
|
-
info(flg)
|
|
874
|
-
}
|
|
875
|
-
that.showSession = false
|
|
876
|
-
that.showBecalling = false
|
|
877
|
-
clearRingPlay()
|
|
878
|
-
})
|
|
879
|
-
}
|
|
880
|
-
// 主动离开房间
|
|
881
|
-
export function leaveChannel(flg) {
|
|
882
|
-
clearRingPlay()
|
|
883
|
-
clearTimeout(meetingTimer)
|
|
884
|
-
clearInterval(that.timer)
|
|
885
|
-
window.netcall.leaveChannel().then(function(obj) {
|
|
886
|
-
// 离开房间后,开发者自己业务的扫尾工作
|
|
887
|
-
console.log(obj)
|
|
888
|
-
// 离开房间接口调用
|
|
889
|
-
changeMeetState("out")
|
|
890
|
-
// 发起人结束会议调用会议结束接口
|
|
891
|
-
if (store.state.user.imAccount == that.meetingCall.caller && flg || that.meetingCall.joinedMembers.length == 0) {
|
|
892
|
-
endMeeting(that.meetingId)
|
|
893
|
-
}
|
|
894
|
-
channelId = ""
|
|
895
|
-
busy = false
|
|
896
|
-
type = ""
|
|
897
|
-
that.meetingCall = {
|
|
898
|
-
members: [],
|
|
899
|
-
channelName: "", // 房间号
|
|
900
|
-
joinedMembers: [], // 已加入
|
|
901
|
-
caller: "", // 发起人\
|
|
902
|
-
membersState: {}
|
|
903
|
-
}
|
|
904
|
-
that.channelId = ""
|
|
905
|
-
that.showBecalling = false
|
|
906
|
-
that.showSession = false
|
|
907
|
-
store.commit("UPDATAREFRESHLIST")
|
|
908
|
-
}).catch(err => {
|
|
909
|
-
console.log(err)
|
|
910
|
-
});
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
/** 对列表用户进行点对点发送自定义系统通知
|
|
914
|
-
* @param {Array} list
|
|
915
|
-
* @param {object} option
|
|
916
|
-
* @param {string} option.teamName 群名称
|
|
917
|
-
* @param {string} option.type 视频还是音频, 如果为空,则取消呼叫!
|
|
918
|
-
* @param {string} option.list 被呼叫uid的列表
|
|
919
|
-
* @param {string} option.teamId 群id
|
|
920
|
-
* @param {string} option.nick 发起人昵称
|
|
921
|
-
* @param {string} option.channelName 房间id
|
|
922
|
-
*/
|
|
923
|
-
export function sendCustomMessage(option) {
|
|
924
|
-
var that = this;
|
|
925
|
-
option.list = option.list || [];
|
|
926
|
-
|
|
927
|
-
option.list.forEach(function(uid) {
|
|
928
|
-
console.log(uid != store.state.user.imAccount)
|
|
929
|
-
if (uid != store.state.user.imAccount) {
|
|
930
|
-
window.nim.sendCustomSysMsg({
|
|
931
|
-
scene: "p2p",
|
|
932
|
-
to: uid,
|
|
933
|
-
enablePushNick: false,
|
|
934
|
-
content: JSON.stringify({
|
|
935
|
-
id: 3,
|
|
936
|
-
members: option.list,
|
|
937
|
-
teamId: option.teamId,
|
|
938
|
-
teamName: option.teamName,
|
|
939
|
-
room: option.channelName,
|
|
940
|
-
type: option.type,
|
|
941
|
-
channelId: channelId
|
|
942
|
-
}),
|
|
943
|
-
isPushable: true,
|
|
944
|
-
sendToOnlineUsersOnly: false,
|
|
945
|
-
apnsText: option.nick + "正在呼叫您",
|
|
946
|
-
done: function(error, msg) {
|
|
947
|
-
console.log(msg);
|
|
948
|
-
}
|
|
949
|
-
});
|
|
950
|
-
}
|
|
951
|
-
});
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
/** 群聊发起音视频tip信息
|
|
955
|
-
* @param {object} option
|
|
956
|
-
* @param {string} option.teamId 群id
|
|
957
|
-
* @param {string} option.nick 发起人昵称
|
|
958
|
-
* @param {string} option.message 发送信息
|
|
959
|
-
*/
|
|
960
|
-
function sendTeamTip(option) {
|
|
961
|
-
window.nim.sendTipMsg({
|
|
962
|
-
isLocal: true,
|
|
963
|
-
scene: "team",
|
|
964
|
-
to: option.teamId,
|
|
965
|
-
tip: option.nick + option.message,
|
|
966
|
-
time: Date.now(),
|
|
967
|
-
isPushable: false,
|
|
968
|
-
isHistoryable: false,
|
|
969
|
-
isRoamingable: false,
|
|
970
|
-
done: function(err, data) {
|
|
971
|
-
if (!err) {
|
|
972
|
-
store.commit("SET_MSGS", data)
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
});
|
|
976
|
-
}
|
|
977
|
-
export function getDevices() {
|
|
978
|
-
window.netcall.getDevicesOfType().then(function(obj) {
|
|
979
|
-
console.log("音频设备列表:", obj)
|
|
980
|
-
})
|
|
981
|
-
}
|
|
982
|
-
|
|
983
|
-
export function rejectMeeting(channelIds) {
|
|
984
|
-
window.netcall.control({
|
|
985
|
-
channelId: channelIds || that.channelId,
|
|
986
|
-
command: WebRTC.NETCALL_CONTROL_COMMAND_BUSY
|
|
987
|
-
});
|
|
988
|
-
changeMeetState("refuse")
|
|
989
|
-
if (!channelIds) {
|
|
990
|
-
that.showBecalling = false
|
|
991
|
-
that.showSession = false
|
|
992
|
-
clearRingPlay()
|
|
993
|
-
}
|
|
994
|
-
}
|
|
995
|
-
// 音频开关
|
|
996
|
-
export function deviceAudioIn(_this, flg) {
|
|
997
|
-
if (flg) {
|
|
998
|
-
window.netcall.startDevice({
|
|
999
|
-
type: WebRTC.DEVICE_TYPE_AUDIO_IN
|
|
1000
|
-
}).then(function() {
|
|
1001
|
-
_this.microphoneIsClose = false
|
|
1002
|
-
window.netcall.setCaptureVolume(255)
|
|
1003
|
-
window.netcall.control({
|
|
1004
|
-
command: WebRTC.NETCALL_CONTROL_COMMAND_NOTIFY_AUDIO_ON
|
|
1005
|
-
})
|
|
1006
|
-
Message.success("麦克风已开启")
|
|
1007
|
-
}).catch(function() {
|
|
1008
|
-
_this.microphoneAvail = false
|
|
1009
|
-
_this.microphoneIsClose = true
|
|
1010
|
-
Message.error("麦克风启动失败")
|
|
1011
|
-
})
|
|
1012
|
-
} else {
|
|
1013
|
-
window.netcall.stopDevice(WebRTC.DEVICE_TYPE_AUDIO_IN).then(function() {
|
|
1014
|
-
Message.warning("麦克风已关闭")
|
|
1015
|
-
window.netcall.control({
|
|
1016
|
-
command: WebRTC.NETCALL_CONTROL_COMMAND_NOTIFY_AUDIO_OFF
|
|
1017
|
-
})
|
|
1018
|
-
_this.microphoneIsClose = true
|
|
1019
|
-
})
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
// 视频开关
|
|
1023
|
-
export function deviceVideoIn(_this, flg) {
|
|
1024
|
-
if (flg) {
|
|
1025
|
-
window.netcall.startDevice({
|
|
1026
|
-
type: WebRTC.DEVICE_TYPE_VIDEO,
|
|
1027
|
-
width: 640,
|
|
1028
|
-
height: 480
|
|
1029
|
-
}).then(function() {
|
|
1030
|
-
_this.cameraIsClose = false
|
|
1031
|
-
// 预览本地画面
|
|
1032
|
-
const node = that.isMeeting ? document.getElementById("remote-" + store.state.user.imAccount) : document.getElementById("localContainer")
|
|
1033
|
-
window.netcall.startLocalStream(
|
|
1034
|
-
node
|
|
1035
|
-
)
|
|
1036
|
-
const eleChild = node.getElementsByTagName("div")[0];
|
|
1037
|
-
eleChild.style.display = "block"
|
|
1038
|
-
// 设置本地预览画面大小
|
|
1039
|
-
window.netcall.setVideoViewSize({
|
|
1040
|
-
width: 500,
|
|
1041
|
-
height: 500,
|
|
1042
|
-
cut: true
|
|
1043
|
-
})
|
|
1044
|
-
Message.success("摄像头已开启")
|
|
1045
|
-
}).catch(function(err) {
|
|
1046
|
-
that.cameraAvail = false
|
|
1047
|
-
that.cameraIsClose = true
|
|
1048
|
-
if (err.code == 65002) {
|
|
1049
|
-
console.log("设备不存在/无任何设备")
|
|
1050
|
-
}
|
|
1051
|
-
Message.error("摄像头启动失败")
|
|
1052
|
-
})
|
|
1053
|
-
} else {
|
|
1054
|
-
window.netcall.stopDevice(WebRTC.DEVICE_TYPE_VIDEO).then(function() {
|
|
1055
|
-
Message.warning("摄像头已关闭")
|
|
1056
|
-
_this.cameraIsClose = true
|
|
1057
|
-
const node = that.isMeeting ? document.getElementById("remote-" + store.state.user.imAccount) : document.getElementById("localContainer")
|
|
1058
|
-
const eleChild = node.getElementsByTagName("div")[0];
|
|
1059
|
-
eleChild.style.display = "none"
|
|
1060
|
-
})
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
// 提示声音播放
|
|
1064
|
-
export function playRing(name, count, done) {
|
|
1065
|
-
done = done || function() { };
|
|
1066
|
-
playRingInstance = playRingInstance || {};
|
|
1067
|
-
var url = nameMap[name];
|
|
1068
|
-
function doPlay(url, playDone) {
|
|
1069
|
-
var audio = document.createElement("audio");
|
|
1070
|
-
audio.autoplay = true;
|
|
1071
|
-
function onEnded() {
|
|
1072
|
-
playRingInstance.cancel = null;
|
|
1073
|
-
audio = null;
|
|
1074
|
-
playDone();
|
|
1075
|
-
}
|
|
1076
|
-
audio.addEventListener("ended", onEnded);
|
|
1077
|
-
audio.src = url;
|
|
1078
|
-
playRingInstance.cancel = function() {
|
|
1079
|
-
audio.removeEventListener("ended", onEnded);
|
|
1080
|
-
audio.pause();
|
|
1081
|
-
audio = null;
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
var wrap = function() {
|
|
1085
|
-
playRingInstance = null
|
|
1086
|
-
done();
|
|
1087
|
-
};
|
|
1088
|
-
for (var i = 0; i < count; i++) {
|
|
1089
|
-
wrap = (function(wrap) {
|
|
1090
|
-
return function() {
|
|
1091
|
-
doPlay(url, wrap);
|
|
1092
|
-
};
|
|
1093
|
-
})(wrap);
|
|
1094
|
-
}
|
|
1095
|
-
wrap();
|
|
1096
|
-
}
|
|
1097
|
-
export function clearRingPlay() {
|
|
1098
|
-
if (playRingInstance) {
|
|
1099
|
-
playRingInstance.cancel && playRingInstance.cancel();
|
|
1100
|
-
playRingInstance = null;
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
|
-
function setMemberStatue(_this) {
|
|
1105
|
-
_this.meetingCall.members.forEach(item => {
|
|
1106
|
-
if (!_this.meetingCall.membersState[item]) {
|
|
1107
|
-
_this.meetingCall.membersState[item] = 4
|
|
1108
|
-
}
|
|
1109
|
-
})
|
|
1110
|
-
_this.meetingCall.membersState = Object.assign({}, _this.meetingCall.membersState)
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
export function startShare() {
|
|
1114
|
-
window.netcall.startDevice({
|
|
1115
|
-
type: WebRTC.DEVICE_TYPE_DESKTOP_CHROME_SCREEN
|
|
1116
|
-
}).then(res => {
|
|
1117
|
-
console.log(res)
|
|
1118
|
-
const node = document.getElementById("remote-" + store.state.user.imAccount)
|
|
1119
|
-
window.netcall.startLocalStream(node)
|
|
1120
|
-
}).catch(function(err) {
|
|
1121
|
-
Message.error("屏幕共享失败,共享功能只支持在谷歌浏览器上使用")
|
|
1122
|
-
console.log("启动屏幕共享失败", err)
|
|
1123
|
-
})
|
|
1124
|
-
}
|
|
1125
|
-
// 关闭对应人员视频
|
|
1126
|
-
export function stopRemoteStream(account) {
|
|
1127
|
-
window.netcall.stopRemoteStream({
|
|
1128
|
-
account: account
|
|
1129
|
-
});
|
|
1130
|
-
}
|
|
1131
|
-
// 开启对应人员视频
|
|
1132
|
-
export function startRemoteStream(account) {
|
|
1133
|
-
window.netcall.startRemoteStream({
|
|
1134
|
-
account: account,
|
|
1135
|
-
node: document.getElementById("remote-" + account)
|
|
1136
|
-
})
|
|
1137
|
-
}
|
|
1138
|
-
|
|
1139
|
-
// 关闭对应人员音频
|
|
1140
|
-
export function stopAudio(account) {
|
|
1141
|
-
window.netcall.setAudioBlack(account)
|
|
1142
|
-
}
|
|
1143
|
-
// 开启对应人员音频
|
|
1144
|
-
export function startAudio(account) {
|
|
1145
|
-
window.netcall.setAudioStart(account)
|
|
1146
|
-
}
|
|
1147
|
-
|
|
1148
|
-
// 发起会议接口调用
|
|
1149
|
-
export async function startedMeeting(info) {
|
|
1150
|
-
const param = {
|
|
1151
|
-
"topic": info.theme,
|
|
1152
|
-
"meetingNo": info.channelName,
|
|
1153
|
-
"creator": info.no,
|
|
1154
|
-
"companyNo": info.cno,
|
|
1155
|
-
"chatId": info.channelId,
|
|
1156
|
-
"telPhone": info.telPhone,
|
|
1157
|
-
"personalFlag": "YES",
|
|
1158
|
-
"members": info.members
|
|
1159
|
-
}
|
|
1160
|
-
const res = await api.startedMeeting(param)
|
|
1161
|
-
if (res.data.state == "ok") {
|
|
1162
|
-
that.meetingId = res.data.data
|
|
1163
|
-
}
|
|
1164
|
-
}
|
|
1165
|
-
// 结束会议接口调用
|
|
1166
|
-
export async function endMeeting(id) {
|
|
1167
|
-
const res = await api.endedMeeting({ id })
|
|
1168
|
-
if (res.data.state == "ok") {
|
|
1169
|
-
that.meetingId = ""
|
|
1170
|
-
store.commit("UPDATAREFRESHLIST")
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
export async function changeMeetState(type) {
|
|
1174
|
-
// 进入 in 、离开 out 、拒绝 refuse
|
|
1175
|
-
const res = await api.changeState({ meetingNo: that.meetingCall.channelName, imAccount: [that.user.imAccount], type: type })
|
|
1176
|
-
if (res.data.state == "ok") {}
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1
|
+
import SDK from "@/static/nimSDK/NIM_Web_SDK_v7.0.0.js"
|
|
2
|
+
import store from "@/store"
|
|
3
|
+
import "@/static/nimSDK/NIM_Web_WebRTC_v7.0.0.js"
|
|
4
|
+
import { Message } from "element-ui"
|
|
5
|
+
import api from "@/api/apiIminfo"
|
|
6
|
+
import { use } from "chai"
|
|
7
|
+
var that;
|
|
8
|
+
// 是否被叫中
|
|
9
|
+
var beCalling = false;
|
|
10
|
+
// 呼叫类型
|
|
11
|
+
var type = null;
|
|
12
|
+
// 被叫信息
|
|
13
|
+
var beCalledInfo = null;
|
|
14
|
+
// 是否正忙
|
|
15
|
+
var busy = false;
|
|
16
|
+
// 呼叫超时检查定时器
|
|
17
|
+
var callTimer = null;
|
|
18
|
+
// 被呼叫超时检查定时器
|
|
19
|
+
var beCallTimer = null;
|
|
20
|
+
// 通话正式开始时间戳
|
|
21
|
+
var netcallStartTime = 0
|
|
22
|
+
// 音视频id
|
|
23
|
+
var channelId;
|
|
24
|
+
// 接受音视频之后等待状态
|
|
25
|
+
var acceptAndWait = false;
|
|
26
|
+
// 群聊定时器
|
|
27
|
+
var meetingTimer = null;
|
|
28
|
+
// 声音播放
|
|
29
|
+
var playRingInstance = null
|
|
30
|
+
var nameMap = {
|
|
31
|
+
E: require(`@/assets/nim/audio/avchat_ring.mp3`)
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// var netcall;
|
|
35
|
+
//
|
|
36
|
+
const pushConfig = {
|
|
37
|
+
enable: true,
|
|
38
|
+
needBadge: true,
|
|
39
|
+
needPushNick: true,
|
|
40
|
+
pushContent: "",
|
|
41
|
+
custom: "测试自定义数据",
|
|
42
|
+
pushPayload: "",
|
|
43
|
+
sound: "",
|
|
44
|
+
forceKeepCalling: 0
|
|
45
|
+
};
|
|
46
|
+
// 视频设置
|
|
47
|
+
const sessionConfig = {
|
|
48
|
+
videoQuality: WebRTC.CHAT_VIDEO_QUALITY_HIGH,
|
|
49
|
+
videoFrameRate: WebRTC.CHAT_VIDEO_FRAME_RATE_15,
|
|
50
|
+
videoBitrate: 0,
|
|
51
|
+
recordVideo: false,
|
|
52
|
+
recordAudio: false,
|
|
53
|
+
highAudio: false,
|
|
54
|
+
bypassRtmp: false,
|
|
55
|
+
rtmpUrl: "",
|
|
56
|
+
rtmpRecord: false,
|
|
57
|
+
splitMode: WebRTC.LAYOUT_SPLITLATTICETILE
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
// 初始化
|
|
62
|
+
export function initWebRTC(self) {
|
|
63
|
+
that = self
|
|
64
|
+
var NIM = SDK.NIM;
|
|
65
|
+
NIM.use(window.WebRTC);
|
|
66
|
+
// 初始化webrtc
|
|
67
|
+
window.netcall = window.webrtc = window.WebRTC.getInstance({
|
|
68
|
+
nim: window.nim,
|
|
69
|
+
container: document.getElementById("localContainer") || document.getElementById("remote-" + store.state.user.imAccount),
|
|
70
|
+
remoteContainer: document.getElementById("remoteContainer"),
|
|
71
|
+
debug: false
|
|
72
|
+
})
|
|
73
|
+
// 被叫收到呼叫通知
|
|
74
|
+
window.webrtc.on("beCalling", function(obj) {
|
|
75
|
+
console.log("onBeCalling", obj)
|
|
76
|
+
webrtcOnBeCalling(obj)
|
|
77
|
+
})
|
|
78
|
+
// 被叫接受的通知
|
|
79
|
+
window.webrtc.on("callAccepted", function(obj) {
|
|
80
|
+
console.log("callAccepted", obj)
|
|
81
|
+
onCallAccepted(obj);
|
|
82
|
+
})
|
|
83
|
+
// 被叫拒绝的通知
|
|
84
|
+
window.webrtc.on("callRejected", function(obj) {
|
|
85
|
+
console.log("callRejected", obj);
|
|
86
|
+
// 取消呼叫倒计时
|
|
87
|
+
clearCallTimer();
|
|
88
|
+
// 挂断
|
|
89
|
+
window.netcall.hangup();
|
|
90
|
+
// 做清理工作
|
|
91
|
+
// resetWhenHangup();
|
|
92
|
+
});
|
|
93
|
+
// 其他端已经做了处理
|
|
94
|
+
window.webrtc.on("callerAckSync", function(obj) {
|
|
95
|
+
channelId = ""
|
|
96
|
+
that.showBecalling = false
|
|
97
|
+
that.showSession = false
|
|
98
|
+
clearRingPlay()
|
|
99
|
+
console.log("其他端已经做了处理", obj);
|
|
100
|
+
});
|
|
101
|
+
// 挂断监听
|
|
102
|
+
window.webrtc.on("hangup", function(obj) {
|
|
103
|
+
console.log(obj)
|
|
104
|
+
if (channelId && obj.channelId == channelId) {
|
|
105
|
+
Message("对方已挂断")
|
|
106
|
+
clearRingPlay()
|
|
107
|
+
that.showSession = false
|
|
108
|
+
that.showBecalling = false
|
|
109
|
+
channelId = ""
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
window.webrtc.on("error", function(obj) {
|
|
113
|
+
console.log("sdk反馈错误信息", obj);
|
|
114
|
+
if (obj.code) {
|
|
115
|
+
if (obj.code == 509) {
|
|
116
|
+
console.warn("你被提出房间了");
|
|
117
|
+
} else if (obj.code == 500) {
|
|
118
|
+
console.warn("你的web不支持H264视频编码,无法进行呼叫,请检测浏览器的H264插件是否正常");
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
// 加入房间
|
|
123
|
+
window.webrtc.on("joinChannel", function(obj) {
|
|
124
|
+
console.log("joinChannel", obj)
|
|
125
|
+
onJoinChannel(obj)
|
|
126
|
+
})
|
|
127
|
+
// 离开房间
|
|
128
|
+
window.webrtc.on("leaveChannel", function(obj) {
|
|
129
|
+
console.log("leaveChannel", obj)
|
|
130
|
+
that.meetingCall.joinedMembers = that.meetingCall.joinedMembers.filter(item => (item != obj.account))
|
|
131
|
+
if (that.meetingCall.membersState[obj.account] != undefined) {
|
|
132
|
+
that.meetingCall.membersState[obj.account] = 3
|
|
133
|
+
that.meetingCall.membersState = Object.assign({}, that.meetingCall.membersState)
|
|
134
|
+
}
|
|
135
|
+
window.netcall.stopRemoteStream({ account: obj.account });
|
|
136
|
+
if (obj.account == that.meetingCall.caller) {
|
|
137
|
+
setTimeout(async() => {
|
|
138
|
+
const res = await api.queryMeetingInfo({ meetingNo: that.channelId })
|
|
139
|
+
console.log(res)
|
|
140
|
+
if (res.data.state == "ok" && res.data.data.status == "ended") {
|
|
141
|
+
leaveChannel()
|
|
142
|
+
Message("主持人关闭会议")
|
|
143
|
+
}
|
|
144
|
+
}, 800)
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
// 媒体流通知
|
|
148
|
+
window.webrtc.on("remoteTrack", function(obj) {
|
|
149
|
+
onRemoteTrack(obj)
|
|
150
|
+
});
|
|
151
|
+
window.webrtc.on("control", function(obj) {
|
|
152
|
+
// 如果不是当前通话的指令, 直接丢掉
|
|
153
|
+
if (window.netcall.notCurrentChannelId(obj)) {
|
|
154
|
+
return
|
|
155
|
+
}
|
|
156
|
+
onControl(obj)
|
|
157
|
+
})
|
|
158
|
+
// 信令断开
|
|
159
|
+
window.webrtc.on("signalClosed", function() {
|
|
160
|
+
if (that.meetingCall.channelName) {
|
|
161
|
+
leaveChannel()
|
|
162
|
+
}
|
|
163
|
+
})
|
|
164
|
+
// rtc链接断开
|
|
165
|
+
window.webrtc.on("rtcConnectFailed", function() {
|
|
166
|
+
console.log("rtcConnectFailed");
|
|
167
|
+
if (that.meetingCall.channelName) {
|
|
168
|
+
leaveChannel()
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
// 监听屏幕共享
|
|
172
|
+
window.webrtc.on("streamEnded", function(obj) {
|
|
173
|
+
console.log("媒体流停止了", obj);
|
|
174
|
+
if (obj && obj.type === "screen") {
|
|
175
|
+
// 屏幕共享的媒体流已经停止了,此处做关闭屏幕共享处理
|
|
176
|
+
netcall.stopDevice(WebRTC.DEVICE_TYPE_DESKTOP_CHROME_SCREEN).then(() => {
|
|
177
|
+
console.log("屏幕共享关闭成功")
|
|
178
|
+
})
|
|
179
|
+
}
|
|
180
|
+
})
|
|
181
|
+
}
|
|
182
|
+
// 被叫收到呼叫通知
|
|
183
|
+
function webrtcOnBeCalling(obj) {
|
|
184
|
+
// if (channelId && channelId === obj.channelId) return
|
|
185
|
+
channelId = obj.channelId;
|
|
186
|
+
// 被叫回应主叫自己已经收到了通话请求
|
|
187
|
+
window.netcall.control({
|
|
188
|
+
channelId: channelId,
|
|
189
|
+
command: WebRTC.NETCALL_CONTROL_COMMAND_START_NOTIFY_RECEIVED
|
|
190
|
+
});
|
|
191
|
+
// 只有在没有通话并且没有被叫的时候才记录被叫信息, 否则通知对方忙并拒绝通话
|
|
192
|
+
if (!window.netcall.calling && !beCalling) {
|
|
193
|
+
that.isMeeting = false
|
|
194
|
+
that.showBecalling = true
|
|
195
|
+
that.showSession = false
|
|
196
|
+
type = obj.type;
|
|
197
|
+
beCalling = true;
|
|
198
|
+
beCalledInfo = obj;
|
|
199
|
+
that.meetingCall.caller = obj.account
|
|
200
|
+
playRing("E", 60)
|
|
201
|
+
// 呼叫方没有响应
|
|
202
|
+
beCallTimer = setTimeout(function() {
|
|
203
|
+
if (!beCallTimer) return;
|
|
204
|
+
clearTimeout(beCallTimer)
|
|
205
|
+
clearRingPlay()
|
|
206
|
+
that.showBecalling = false
|
|
207
|
+
that.showSession = false
|
|
208
|
+
beCalling = false
|
|
209
|
+
window.netcall.control({
|
|
210
|
+
channelId: channelId,
|
|
211
|
+
command: WebRTC.NETCALL_CONTROL_COMMAND_BUSY
|
|
212
|
+
});
|
|
213
|
+
window.netcall.hangup()
|
|
214
|
+
}, 60 * 1000)
|
|
215
|
+
} else {
|
|
216
|
+
if (window.netcall.calling) {
|
|
217
|
+
busy = window.netcall.notCurrentChannelId(obj);
|
|
218
|
+
} else if (beCalling) {
|
|
219
|
+
busy = beCalledInfo.channelId !== channelId;
|
|
220
|
+
}
|
|
221
|
+
if (busy) {
|
|
222
|
+
window.netcall.control({
|
|
223
|
+
channelId: channelId,
|
|
224
|
+
command: WebRTC.NETCALL_CONTROL_COMMAND_BUSY
|
|
225
|
+
});
|
|
226
|
+
// 拒绝通话
|
|
227
|
+
window.netcall.response({
|
|
228
|
+
accepted: false,
|
|
229
|
+
beCalledInfo: obj
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
// 被叫接受的通知
|
|
235
|
+
function onCallAccepted(obj) {
|
|
236
|
+
type = obj.type
|
|
237
|
+
busy = true;
|
|
238
|
+
clearCallTimer();
|
|
239
|
+
startLocalDevice()
|
|
240
|
+
}
|
|
241
|
+
// 开启本地音频,视频设备
|
|
242
|
+
function startLocalDevice(close) {
|
|
243
|
+
window.netcall.startRtc().then(function() {
|
|
244
|
+
// 开启本地麦克风
|
|
245
|
+
return window.netcall.startDevice({
|
|
246
|
+
type: WebRTC.DEVICE_TYPE_AUDIO_IN
|
|
247
|
+
}).catch(function(err) {
|
|
248
|
+
console.log("启动麦克风失败")
|
|
249
|
+
that.microphoneAvail = false
|
|
250
|
+
that.microphoneIsClose = true
|
|
251
|
+
console.log(err)
|
|
252
|
+
})
|
|
253
|
+
})
|
|
254
|
+
.then(function() {
|
|
255
|
+
// 设置采集音量
|
|
256
|
+
that.microphoneIsClose = false
|
|
257
|
+
if (close) {
|
|
258
|
+
window.netcall.stopDevice(WebRTC.DEVICE_TYPE_AUDIO_IN).then(function() {
|
|
259
|
+
console.log("关闭麦克风")
|
|
260
|
+
that.microphoneIsClose = true
|
|
261
|
+
that.isMute = true
|
|
262
|
+
})
|
|
263
|
+
}
|
|
264
|
+
window.netcall.setCaptureVolume(255)
|
|
265
|
+
window.netcall.control({
|
|
266
|
+
command: WebRTC.NETCALL_CONTROL_COMMAND_NOTIFY_AUDIO_ON
|
|
267
|
+
})
|
|
268
|
+
// 开启摄像头
|
|
269
|
+
if (type == WebRTC.NETCALL_TYPE_VIDEO) {
|
|
270
|
+
return window.netcall.startDevice({
|
|
271
|
+
type: WebRTC.DEVICE_TYPE_VIDEO,
|
|
272
|
+
width: 640,
|
|
273
|
+
height: 480
|
|
274
|
+
})
|
|
275
|
+
.then(function() {
|
|
276
|
+
that.cameraIsClose = false
|
|
277
|
+
// 预览本地画面
|
|
278
|
+
const node = that.isMeeting ? document.getElementById("remote-" + store.state.user.imAccount) : document.getElementById("localContainer")
|
|
279
|
+
window.netcall.startLocalStream(
|
|
280
|
+
node
|
|
281
|
+
)
|
|
282
|
+
// 设置本地预览画面大小
|
|
283
|
+
window.netcall.setVideoViewSize({
|
|
284
|
+
width: 500,
|
|
285
|
+
height: 500,
|
|
286
|
+
cut: true
|
|
287
|
+
})
|
|
288
|
+
}).catch(function(err) {
|
|
289
|
+
console.log("启动摄像头失败")
|
|
290
|
+
that.cameraAvail = false
|
|
291
|
+
that.cameraIsClose = true
|
|
292
|
+
if (err.code == 65002) {
|
|
293
|
+
console.log("设备不存在/无任何设备")
|
|
294
|
+
}
|
|
295
|
+
console.error(err)
|
|
296
|
+
})
|
|
297
|
+
}
|
|
298
|
+
})
|
|
299
|
+
.then(function() {
|
|
300
|
+
// 设置互动者角色
|
|
301
|
+
window.netcall.changeRoleToPlayer()
|
|
302
|
+
})
|
|
303
|
+
.catch(function(err) {
|
|
304
|
+
console.log("发生错误")
|
|
305
|
+
console.log(err)
|
|
306
|
+
window.netcall.hangup()
|
|
307
|
+
})
|
|
308
|
+
}
|
|
309
|
+
// 加入房间
|
|
310
|
+
function onJoinChannel(obj) {
|
|
311
|
+
// 通知上层有其他用户加入了房间,上层做相应逻辑和UI处理
|
|
312
|
+
// 这里可以播放加入的同学的视频流
|
|
313
|
+
// 以及播放对方声音
|
|
314
|
+
clearRingPlay()
|
|
315
|
+
clearTimeout(meetingTimer)
|
|
316
|
+
that.meetingCall.joinedMembers.indexOf(obj.account) == -1 && that.meetingCall.joinedMembers.push(obj.account)
|
|
317
|
+
that.meetingCall.membersState[obj.account] = 1
|
|
318
|
+
that.meetingCall.membersState = Object.assign({}, that.meetingCall.membersState)
|
|
319
|
+
if (that.meetingCall.members.indexOf(obj.account) == -1) {
|
|
320
|
+
that.meetingCall.members.push(obj.account)
|
|
321
|
+
// that.meetingCall.caller = that.meetingCall.members[0]
|
|
322
|
+
}
|
|
323
|
+
window.netcall
|
|
324
|
+
.startDevice({
|
|
325
|
+
type: WebRTC.DEVICE_TYPE_AUDIO_OUT_CHAT
|
|
326
|
+
})
|
|
327
|
+
.catch(function() {
|
|
328
|
+
console.log("播放对方的声音失败");
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
that.$nextTick(() => {
|
|
332
|
+
// 预览加入的同学的视频流
|
|
333
|
+
window.netcall.startRemoteStream({
|
|
334
|
+
account: obj.account,
|
|
335
|
+
node: document.getElementById("remote-" + obj.account)
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
// 设置对方预览画面大小
|
|
339
|
+
window.netcall.setVideoViewRemoteSize({
|
|
340
|
+
account: obj.account,
|
|
341
|
+
width: 500,
|
|
342
|
+
height: 500,
|
|
343
|
+
cut: true
|
|
344
|
+
});
|
|
345
|
+
})
|
|
346
|
+
}
|
|
347
|
+
// 媒体流通知
|
|
348
|
+
function onRemoteTrack(obj) {
|
|
349
|
+
console.log(obj)
|
|
350
|
+
clearBeCallTimer()
|
|
351
|
+
acceptAndWait = false
|
|
352
|
+
if (obj.track.kind === "audio") {
|
|
353
|
+
// 播放对方声音
|
|
354
|
+
window.netcall
|
|
355
|
+
.startDevice({
|
|
356
|
+
type: WebRTC.DEVICE_TYPE_AUDIO_OUT_CHAT
|
|
357
|
+
})
|
|
358
|
+
.catch(function() {
|
|
359
|
+
console.log("播放对方的声音失败");
|
|
360
|
+
that.voice[obj.account] = false
|
|
361
|
+
});
|
|
362
|
+
that.voice[obj.account] = true
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// 视频:展示对方的画面
|
|
366
|
+
if (obj.track.kind === "video") {
|
|
367
|
+
// 预览加入的同学的视频流
|
|
368
|
+
window.netcall.startRemoteStream({
|
|
369
|
+
account: obj.account,
|
|
370
|
+
node: document.getElementById("remote-" + obj.account)
|
|
371
|
+
});
|
|
372
|
+
// 设置对方预览画面大小
|
|
373
|
+
window.netcall.setVideoViewRemoteSize({
|
|
374
|
+
account: obj.account,
|
|
375
|
+
width: 500,
|
|
376
|
+
height: 500,
|
|
377
|
+
cut: true
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
// 清除呼叫定时器
|
|
382
|
+
function clearCallTimer() {
|
|
383
|
+
clearRingPlay()
|
|
384
|
+
if (callTimer) {
|
|
385
|
+
clearTimeout(callTimer)
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
// 清除被呼叫定时器
|
|
389
|
+
function clearBeCallTimer() {
|
|
390
|
+
clearRingPlay()
|
|
391
|
+
if (beCallTimer) {
|
|
392
|
+
clearTimeout(beCallTimer)
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
//
|
|
396
|
+
function onControl(obj) {
|
|
397
|
+
console.log(obj)
|
|
398
|
+
switch (obj.type) {
|
|
399
|
+
// 通知对方自己打开了音频
|
|
400
|
+
case WebRTC.NETCALL_CONTROL_COMMAND_NOTIFY_AUDIO_ON:
|
|
401
|
+
// Message("对方打开了麦克风");
|
|
402
|
+
that.voice[obj.account] = true
|
|
403
|
+
break;
|
|
404
|
+
// 通知对方自己关闭了音频
|
|
405
|
+
case WebRTC.NETCALL_CONTROL_COMMAND_NOTIFY_AUDIO_OFF:
|
|
406
|
+
// Message("对方关闭了麦克风");
|
|
407
|
+
that.voice[obj.account] = false
|
|
408
|
+
break;
|
|
409
|
+
// 通知对方自己打开了视频
|
|
410
|
+
case WebRTC.NETCALL_CONTROL_COMMAND_NOTIFY_VIDEO_ON:
|
|
411
|
+
const ele = document.getElementById("remote-" + obj.account) || document.getElementById("remoteContainer")
|
|
412
|
+
const eleChild = ele.getElementsByTagName("div")[0];
|
|
413
|
+
if (eleChild.style.display != "block") {
|
|
414
|
+
// Message("对方打开了摄像头");
|
|
415
|
+
// 预览加入的同学的视频流
|
|
416
|
+
eleChild.style.display = "block"
|
|
417
|
+
window.netcall.startRemoteStream({
|
|
418
|
+
account: obj.account,
|
|
419
|
+
node: document.getElementById("remote-" + obj.account)
|
|
420
|
+
});
|
|
421
|
+
// 设置对方预览画面大小
|
|
422
|
+
window.netcall.setVideoViewRemoteSize({
|
|
423
|
+
account: obj.account,
|
|
424
|
+
width: 500,
|
|
425
|
+
height: 500,
|
|
426
|
+
cut: true
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
break;
|
|
430
|
+
// 通知对方自己关闭了视频
|
|
431
|
+
case WebRTC.NETCALL_CONTROL_COMMAND_NOTIFY_VIDEO_OFF:
|
|
432
|
+
const dom = document.getElementById("remote-" + obj.account) || document.getElementById("remoteContainer")
|
|
433
|
+
const child = dom.getElementsByTagName("div")[0];
|
|
434
|
+
if (child.style.display != "none") {
|
|
435
|
+
// Message("对方关闭了摄像头");
|
|
436
|
+
child.style.display = "none"
|
|
437
|
+
}
|
|
438
|
+
break;
|
|
439
|
+
// 拒绝从音频切换到视频
|
|
440
|
+
case WebRTC.NETCALL_CONTROL_COMMAND_SWITCH_AUDIO_TO_VIDEO_REJECT:
|
|
441
|
+
Message("对方拒绝从音频切换到视频通话");
|
|
442
|
+
break;
|
|
443
|
+
// 请求从音频切换到视频
|
|
444
|
+
case WebRTC.NETCALL_CONTROL_COMMAND_SWITCH_AUDIO_TO_VIDEO:
|
|
445
|
+
that.$confirm("对方请求从音频切换到视频通话, 是否同意?", "提示", {
|
|
446
|
+
confirmButtonText: "同意",
|
|
447
|
+
cancelButtonText: "不同意",
|
|
448
|
+
type: "warning"
|
|
449
|
+
}).then(() => {
|
|
450
|
+
that.cameraAvail && deviceVideoIn(that, true)
|
|
451
|
+
window.netcall.control({
|
|
452
|
+
channelId: beCalledInfo.channelId,
|
|
453
|
+
command: WebRTC.NETCALL_CONTROL_COMMAND_SWITCH_AUDIO_TO_VIDEO_AGREE
|
|
454
|
+
});
|
|
455
|
+
const dom2 = document.getElementById("remote-" + obj.account) || document.getElementById("remoteContainer")
|
|
456
|
+
const child2 = dom2.getElementsByTagName("div")[0];
|
|
457
|
+
if (child2) {
|
|
458
|
+
child2.style.display = "block"
|
|
459
|
+
}
|
|
460
|
+
}).catch(() => {
|
|
461
|
+
window.netcall.control({
|
|
462
|
+
channelId: beCalledInfo.channelId,
|
|
463
|
+
command: WebRTC.NETCALL_CONTROL_COMMAND_SWITCH_AUDIO_TO_VIDEO_REJECT
|
|
464
|
+
});
|
|
465
|
+
});
|
|
466
|
+
break;
|
|
467
|
+
// 同意从音频切换到视频
|
|
468
|
+
case WebRTC.NETCALL_CONTROL_COMMAND_SWITCH_AUDIO_TO_VIDEO_AGREE:
|
|
469
|
+
Message("对方同意从音频切换到视频通话");
|
|
470
|
+
break;
|
|
471
|
+
// 从视频切换到音频
|
|
472
|
+
case WebRTC.NETCALL_CONTROL_COMMAND_SWITCH_VIDEO_TO_AUDIO:
|
|
473
|
+
Message("对方从视频切换为音频");
|
|
474
|
+
const dom1 = document.getElementById("remote-" + obj.account) || document.getElementById("remoteContainer")
|
|
475
|
+
const child1 = dom1.getElementsByTagName("div")[0];
|
|
476
|
+
if (child1) {
|
|
477
|
+
child1.style.display = "none"
|
|
478
|
+
deviceVideoIn(that, false)
|
|
479
|
+
}
|
|
480
|
+
break;
|
|
481
|
+
// 占线
|
|
482
|
+
case WebRTC.NETCALL_CONTROL_COMMAND_BUSY:
|
|
483
|
+
busy = false;
|
|
484
|
+
if (!that.isMeeting) {
|
|
485
|
+
Message("对方正忙,取消通话");
|
|
486
|
+
window.netcall.hangup();
|
|
487
|
+
clearCallTimer();
|
|
488
|
+
that.showBecalling = false
|
|
489
|
+
that.showSession = false
|
|
490
|
+
channelId = ""
|
|
491
|
+
busy = false
|
|
492
|
+
} else {
|
|
493
|
+
// Message(obj.account + "对方正忙,取消通话");
|
|
494
|
+
// that.meetingCall.members = that.meetingCall.members.filter(item=>(item != obj.account))
|
|
495
|
+
that.meetingCall.membersState[obj.account] = 2
|
|
496
|
+
that.meetingCall.membersState = Object.assign({}, that.meetingCall.membersState)
|
|
497
|
+
const flg = that.meetingCall.members.filter(v => (!(that.meetingCall.membersState[v] && that.meetingCall.membersState[v] == 2)))
|
|
498
|
+
// if(store.state.user.imAccount == that.meetingCall.caller && flg.length < 2 && that.channelId){
|
|
499
|
+
// leaveChannel()
|
|
500
|
+
// }
|
|
501
|
+
}
|
|
502
|
+
break;
|
|
503
|
+
case WebRTC.NETCALL_CONTROL_COMMAND_SELF_CAMERA_INVALID:
|
|
504
|
+
// Message("对方摄像头不可用");
|
|
505
|
+
break;
|
|
506
|
+
case 30:
|
|
507
|
+
changeCaller()
|
|
508
|
+
break;
|
|
509
|
+
case 31:
|
|
510
|
+
removeOneMember()
|
|
511
|
+
break
|
|
512
|
+
case 32:
|
|
513
|
+
setMemberMute()
|
|
514
|
+
break
|
|
515
|
+
case 33:
|
|
516
|
+
addMemberList()
|
|
517
|
+
break
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
// 新增成员
|
|
521
|
+
async function addMemberList(resute) {
|
|
522
|
+
const res = resute || await api.queryMeetingInfo({ meetingNo: that.channelId })
|
|
523
|
+
if (res.data.state == "ok") {
|
|
524
|
+
const joinedMembers = [];
|
|
525
|
+
const members = []
|
|
526
|
+
const membersState = {}
|
|
527
|
+
const state = { joined: 1, refuse: 2, invited: 4, out: 3 }
|
|
528
|
+
res.data.data.members.forEach(item => {
|
|
529
|
+
if (item.status != "remove") {
|
|
530
|
+
joinedMembers.push(item.imAccount)
|
|
531
|
+
members.push(item.imAccount)
|
|
532
|
+
if (item.outTime) {
|
|
533
|
+
membersState[item.imAccount] = state[out]
|
|
534
|
+
} else {
|
|
535
|
+
membersState[item.imAccount] = state[item.status] ? state[item.status] : ""
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
})
|
|
539
|
+
that.meetingCall.joinedMembers = joinedMembers.map(item => (item))
|
|
540
|
+
that.meetingCall.members = members.map(item => (item))
|
|
541
|
+
that.meetingCall.membersState = Object.assign({}, membersState)
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
// 设置静音
|
|
545
|
+
async function setMemberMute() {
|
|
546
|
+
const res = await api.queryMeetingInfo({ meetingNo: that.channelId })
|
|
547
|
+
if (res.data.state == "ok") {
|
|
548
|
+
if (res.data.data.isSetMusic == "YES") {
|
|
549
|
+
window.netcall.stopDevice(WebRTC.DEVICE_TYPE_AUDIO_IN).then(function() {
|
|
550
|
+
window.netcall.control({
|
|
551
|
+
command: WebRTC.NETCALL_CONTROL_COMMAND_NOTIFY_AUDIO_ON
|
|
552
|
+
})
|
|
553
|
+
})
|
|
554
|
+
that.microphoneIsClose = true
|
|
555
|
+
that.microphoneAvail = res.data.data.isAllowOpen != "YES"
|
|
556
|
+
} else {
|
|
557
|
+
window.netcall.startDevice(WebRTC.DEVICE_TYPE_AUDIO_IN).then(function() {
|
|
558
|
+
window.netcall.control({
|
|
559
|
+
command: WebRTC.NETCALL_CONTROL_COMMAND_NOTIFY_AUDIO_OFF
|
|
560
|
+
})
|
|
561
|
+
})
|
|
562
|
+
that.microphoneIsClose = false
|
|
563
|
+
that.microphoneAvail = true
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
// 移除入会成员
|
|
568
|
+
async function removeOneMember() {
|
|
569
|
+
const res = await api.queryMeetingInfo({ meetingNo: that.channelId })
|
|
570
|
+
if (res.data.state == "ok") {
|
|
571
|
+
const arr = res.data.data.members.filter(item => (item.status == "remove"))
|
|
572
|
+
if (arr.length > 0) {
|
|
573
|
+
arr.forEach(i => {
|
|
574
|
+
if (i.imAccount == store.state.user.imAccount) {
|
|
575
|
+
leaveChannel()
|
|
576
|
+
}
|
|
577
|
+
})
|
|
578
|
+
}
|
|
579
|
+
addMemberList(res)
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
// 改变主持人
|
|
583
|
+
async function changeCaller() {
|
|
584
|
+
const res = await api.queryMeetingInfo({ meetingNo: that.channelId })
|
|
585
|
+
if (res.data.state == "ok") {
|
|
586
|
+
res.data.data.members.forEach(item => {
|
|
587
|
+
if (item.host == "YES") {
|
|
588
|
+
that.meetingCall.caller = item.imAccount
|
|
589
|
+
}
|
|
590
|
+
})
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
// 发起音视频呼叫
|
|
594
|
+
export function doCalling(flg, account) {
|
|
595
|
+
if (!account) {
|
|
596
|
+
Message("请选择呼叫人")
|
|
597
|
+
return
|
|
598
|
+
}
|
|
599
|
+
type = flg == 1 ? WebRTC.NETCALL_TYPE_AUDIO : WebRTC.NETCALL_TYPE_VIDEO
|
|
600
|
+
that.isMeeting = false
|
|
601
|
+
window.webrtc.call({
|
|
602
|
+
type: type,
|
|
603
|
+
account: account,
|
|
604
|
+
pushConfig: pushConfig,
|
|
605
|
+
sessionConfig: sessionConfig
|
|
606
|
+
}).then((obj) => {
|
|
607
|
+
// 成功发起呼叫
|
|
608
|
+
console.log("call success", obj);
|
|
609
|
+
beCalling = true
|
|
610
|
+
that.showSession = true
|
|
611
|
+
that.showBecalling = false
|
|
612
|
+
playRing("E", 60)
|
|
613
|
+
callTimer = setTimeout(function() {
|
|
614
|
+
if (!window.webrtc.callAccepted) {
|
|
615
|
+
clearRingPlay()
|
|
616
|
+
Message("无人接听")
|
|
617
|
+
beCalling = false
|
|
618
|
+
that.showSession = false
|
|
619
|
+
that.showBecalling = false
|
|
620
|
+
window.webrtc.hangup()
|
|
621
|
+
}
|
|
622
|
+
}, 1000 * 60);
|
|
623
|
+
}).catch(function(err) {
|
|
624
|
+
// 被叫不在线
|
|
625
|
+
if (err.event.code === 11001) {
|
|
626
|
+
Message("被叫不在线")
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
// 接受邀请
|
|
631
|
+
export function acceptCall() {
|
|
632
|
+
// 接听
|
|
633
|
+
clearRingPlay()
|
|
634
|
+
if (!beCalling) return
|
|
635
|
+
beCalling = false
|
|
636
|
+
that.showBecalling = false
|
|
637
|
+
window.netcall.response({
|
|
638
|
+
accepted: true,
|
|
639
|
+
beCalledInfo: beCalledInfo,
|
|
640
|
+
sessionConfig: sessionConfig
|
|
641
|
+
}).then(function(obj) {
|
|
642
|
+
console.log(obj)
|
|
643
|
+
acceptAndWait = true;
|
|
644
|
+
setTimeout(function() {
|
|
645
|
+
console.log(acceptAndWait)
|
|
646
|
+
if (acceptAndWait) {
|
|
647
|
+
window.netcall.hangup()
|
|
648
|
+
acceptAndWait = false;
|
|
649
|
+
that.showSession = false
|
|
650
|
+
}
|
|
651
|
+
}, 45 * 1000)
|
|
652
|
+
that.showSession = true
|
|
653
|
+
// startLocalDevice()
|
|
654
|
+
})
|
|
655
|
+
.catch(function(err) {
|
|
656
|
+
rejectCall();
|
|
657
|
+
console.log("接听失败", err);
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
// 拒绝邀请
|
|
661
|
+
export function rejectCall() {
|
|
662
|
+
clearRingPlay()
|
|
663
|
+
if (!beCalling) return
|
|
664
|
+
beCalling = false
|
|
665
|
+
window.netcall.control({
|
|
666
|
+
channelId: beCalledInfo.channelId,
|
|
667
|
+
command: WebRTC.NETCALL_CONTROL_COMMAND_BUSY
|
|
668
|
+
});
|
|
669
|
+
window.netcall.response({
|
|
670
|
+
accepted: false,
|
|
671
|
+
beCalledInfo
|
|
672
|
+
}).then(function(obj) {
|
|
673
|
+
console.log(obj)
|
|
674
|
+
beCalledInfo = null
|
|
675
|
+
beCalling = false
|
|
676
|
+
that.showBecalling = false
|
|
677
|
+
that.showSession = false
|
|
678
|
+
}).catch(function(err) {
|
|
679
|
+
console.log(err)
|
|
680
|
+
beCalledInfo = null
|
|
681
|
+
beCalling = false
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
// 挂断
|
|
685
|
+
export function cancelCalling() {
|
|
686
|
+
clearRingPlay()
|
|
687
|
+
window.netcall.hangup()
|
|
688
|
+
busy = false
|
|
689
|
+
beCalledInfo = null
|
|
690
|
+
channelId = ""
|
|
691
|
+
type = ""
|
|
692
|
+
that.showBecalling = false
|
|
693
|
+
that.showSession = false
|
|
694
|
+
}
|
|
695
|
+
// 创建房间
|
|
696
|
+
export function createChannel(members, types, _this, meetNo) {
|
|
697
|
+
type = types == 1 ? WebRTC.NETCALL_TYPE_AUDIO : WebRTC.NETCALL_TYPE_VIDEO
|
|
698
|
+
const random1 = Math.round(Math.random() * 10)
|
|
699
|
+
const random2 = Math.round(Math.random() * 10)
|
|
700
|
+
const time = Date.now() + ""
|
|
701
|
+
const channel = time.substr(1, 9)
|
|
702
|
+
const channelName = meetNo || (random1 + "" + random2 + channel)
|
|
703
|
+
console.log(_this)
|
|
704
|
+
const meetMenber = _this.members.map(item => {
|
|
705
|
+
return { avatar: "", name: item.name, imAccount: item.imAccount, userNo: item.memberNo }
|
|
706
|
+
})
|
|
707
|
+
const info = {
|
|
708
|
+
theme: _this.theme,
|
|
709
|
+
channelName: channelName,
|
|
710
|
+
no: _this.user.no,
|
|
711
|
+
cno: _this.user.cno,
|
|
712
|
+
channelId: "",
|
|
713
|
+
telPhone: _this.user.telPhone,
|
|
714
|
+
members: meetMenber
|
|
715
|
+
}
|
|
716
|
+
window.netcall.createChannel({
|
|
717
|
+
channelName: channelName, // 必填
|
|
718
|
+
custom: "", // 可选
|
|
719
|
+
webrtcEnable: true, // 启动webrtc
|
|
720
|
+
rtmpConf: "" // 如果不需要房间推流,设置'',即可
|
|
721
|
+
}).then(async function(obj) {
|
|
722
|
+
console.log(obj)
|
|
723
|
+
// 预定房间成功后的上层逻辑操作
|
|
724
|
+
// eg: 初始化房间UI显示
|
|
725
|
+
// eg: 加入房间
|
|
726
|
+
that.isMeeting = true
|
|
727
|
+
that.meetingCall.channelName = obj.channelName
|
|
728
|
+
that.meetingCall.joinedMembers = []
|
|
729
|
+
that.meetingCall.membersState = {}
|
|
730
|
+
that.meetingCall.members = members
|
|
731
|
+
that.meetingCall.caller = store.state.user.imAccount
|
|
732
|
+
that.topical = info.theme
|
|
733
|
+
that.joinTime = Date.now()
|
|
734
|
+
|
|
735
|
+
joinChannel("", "", info)
|
|
736
|
+
if (_this) {
|
|
737
|
+
_this.showOperation = false
|
|
738
|
+
_this.members = []
|
|
739
|
+
}
|
|
740
|
+
}).catch(err => {
|
|
741
|
+
console.log(err)
|
|
742
|
+
console.log("createChannelErr", JSON.stringify(err))
|
|
743
|
+
Message("发起会议失败")
|
|
744
|
+
})
|
|
745
|
+
}
|
|
746
|
+
// 加入房间
|
|
747
|
+
export async function joinChannel(id, meetType, info) {
|
|
748
|
+
console.log(id)
|
|
749
|
+
if (meetType) {
|
|
750
|
+
type = meetType
|
|
751
|
+
}
|
|
752
|
+
let res;
|
|
753
|
+
if (that.meetingCall.caller != store.state.user.imAccount) {
|
|
754
|
+
res = await api.queryMeetingInfo({ meetingNo: that.channelId || id })
|
|
755
|
+
let removeMenber = []
|
|
756
|
+
if (res.data.state == "ok") {
|
|
757
|
+
removeMenber = res.data.data.members.filter(i => (i.status == "remove")).map(it => (it.imAccount == store.state.user.imAccount))
|
|
758
|
+
if (removeMenber.length > 0) {
|
|
759
|
+
Message.error("被支持人移除无法进入会议")
|
|
760
|
+
that.isLockMeeting = true
|
|
761
|
+
that.showSession = false
|
|
762
|
+
that.showBecalling = false
|
|
763
|
+
clearRingPlay()
|
|
764
|
+
if (localStorage.getItem("meetNo")) {
|
|
765
|
+
localStorage.removeItem("meetNo")
|
|
766
|
+
that.$router.push({ path: "/index" })
|
|
767
|
+
}
|
|
768
|
+
return false
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
if (res.data.state == "ok" && res.data.data.isLockMeeting == "YES") {
|
|
772
|
+
const caller = res.data.data.members.filter(i => (i.host == "YES"))
|
|
773
|
+
if (caller.length > 0 && caller[0].imAccount != store.state.user.imAccount) {
|
|
774
|
+
Message.error("会议被锁定,无法加入此会议")
|
|
775
|
+
that.isLockMeeting = true
|
|
776
|
+
that.showSession = false
|
|
777
|
+
that.showBecalling = false
|
|
778
|
+
clearRingPlay()
|
|
779
|
+
if (localStorage.getItem("meetNo")) {
|
|
780
|
+
localStorage.removeItem("meetNo")
|
|
781
|
+
that.$router.push({ path: "/index" })
|
|
782
|
+
}
|
|
783
|
+
return false
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
window.netcall.joinChannel({
|
|
788
|
+
channelName: id || that.meetingCall.channelName,
|
|
789
|
+
type: meetType || type || 2,
|
|
790
|
+
custom: "",
|
|
791
|
+
role: 0,
|
|
792
|
+
sessionConfig: sessionConfig
|
|
793
|
+
}).then(function(obj) {
|
|
794
|
+
that.showBecalling = false
|
|
795
|
+
that.showSession = true
|
|
796
|
+
that.isMeeting = true
|
|
797
|
+
clearTimeout(that.meetingBecall)
|
|
798
|
+
if (res && res.data.state == "ok" && res.data.data.isMute == "YES") {
|
|
799
|
+
startLocalDevice(true)
|
|
800
|
+
} else {
|
|
801
|
+
startLocalDevice()
|
|
802
|
+
}
|
|
803
|
+
channelId = obj.channelId
|
|
804
|
+
that.channelId = obj.channelId
|
|
805
|
+
busy = true
|
|
806
|
+
if (that.meetingCall.caller == store.state.user.imAccount) {
|
|
807
|
+
const teamId = store.state.toUser.split("-")[1] || "";
|
|
808
|
+
const nick = store.state.user.realName || store.state.user.accountName
|
|
809
|
+
const message = type == 1 ? "发起了语音聊天" : "发起了视频聊天"
|
|
810
|
+
/** 发送群视频tip */
|
|
811
|
+
if (store.state.toUser.indexOf("team") > -1) {
|
|
812
|
+
sendTeamTip({ teamId: teamId, message: message, nick: nick })
|
|
813
|
+
}
|
|
814
|
+
/** 点对点发起视频通知 */
|
|
815
|
+
sendCustomMessage({ channelName: that.meetingCall.channelName, nick: nick, teamId: teamId, list: that.meetingCall.members, type: type, teamName: "群聊" })
|
|
816
|
+
playRing("E", 60)
|
|
817
|
+
info.channelId = channelId
|
|
818
|
+
startedMeeting(info)
|
|
819
|
+
// 倒计时
|
|
820
|
+
clearTimeout(meetingTimer)
|
|
821
|
+
meetingTimer = setTimeout(function() {
|
|
822
|
+
if (that.meetingCall.joinedMembers.length < 1) {
|
|
823
|
+
Message("会议呼叫无人应答")
|
|
824
|
+
clearRingPlay()
|
|
825
|
+
leaveChannel()
|
|
826
|
+
}
|
|
827
|
+
}, 60 * 1000)
|
|
828
|
+
setTimeout(() => {
|
|
829
|
+
if (that.showSession) {
|
|
830
|
+
setMemberStatue(that)
|
|
831
|
+
}
|
|
832
|
+
}, 60 * 1000)
|
|
833
|
+
} else if (that.meetingCall.members.indexOf(store.state.user.imAccount) == -1) {
|
|
834
|
+
that.meetingCall.channelName = that.meetingCall.channelName || that.channelId || id
|
|
835
|
+
that.meetingCall.members.push(store.state.user.imAccount)
|
|
836
|
+
}
|
|
837
|
+
that.meetingCall.membersState[store.state.user.imAccount] = 1
|
|
838
|
+
// 1:接听 2:已拒绝 3:已离开 4:未接收
|
|
839
|
+
if (res && res.data.state == "ok" && res.data.data.members && res.data.data.members.length > 0) {
|
|
840
|
+
res.data.data.members.forEach(item => {
|
|
841
|
+
if (!that.meetingCall.membersState[item.imAccount]) {
|
|
842
|
+
that.meetingCall.membersState[item.imAccount] = (item.status == "joined" && item.outTime) ? 1 : (item.status == "joined" && !item.outTime) ? 3 : item.status == "refuse" ? 2 : ""
|
|
843
|
+
}
|
|
844
|
+
if (item.host == "YES") {
|
|
845
|
+
that.meetingCall.caller = item.imAccount
|
|
846
|
+
}
|
|
847
|
+
})
|
|
848
|
+
that.meetingCall.members = res.data.data.members.map(item => (item.imAccount))
|
|
849
|
+
if (that.meetingCall.members.indexOf(store.state.user.imAccount) == -1) {
|
|
850
|
+
that.meetingCall.members.push(store.state.user.imAccount)
|
|
851
|
+
}
|
|
852
|
+
that.meetingId = res.data.data.id
|
|
853
|
+
that.topical = res.data.data.topic
|
|
854
|
+
that.joinTime = Date.now()
|
|
855
|
+
}
|
|
856
|
+
that.meetingCall.membersState = Object.assign({}, that.meetingCall.membersState)
|
|
857
|
+
if (that.meetingCall.caller != store.state.user.imAccount) {
|
|
858
|
+
changeMeetState("in")
|
|
859
|
+
}
|
|
860
|
+
store.commit("UPDATAREFRESHLIST")
|
|
861
|
+
if (localStorage.getItem("meetNo")) {
|
|
862
|
+
localStorage.removeItem("meetNo")
|
|
863
|
+
that.$router.push({ path: "/index" })
|
|
864
|
+
}
|
|
865
|
+
}).catch(err => {
|
|
866
|
+
console.log(err)
|
|
867
|
+
localStorage.removeItem("meetNo")
|
|
868
|
+
const msg = err.code == 20111 ? "会议已关闭" : "加入房间失败";
|
|
869
|
+
Message.error(msg)
|
|
870
|
+
that.$router.push({ path: "/index" })
|
|
871
|
+
if (info && typeof (info) == "function") {
|
|
872
|
+
const flg = err.code == 20111
|
|
873
|
+
info(flg)
|
|
874
|
+
}
|
|
875
|
+
that.showSession = false
|
|
876
|
+
that.showBecalling = false
|
|
877
|
+
clearRingPlay()
|
|
878
|
+
})
|
|
879
|
+
}
|
|
880
|
+
// 主动离开房间
|
|
881
|
+
export function leaveChannel(flg) {
|
|
882
|
+
clearRingPlay()
|
|
883
|
+
clearTimeout(meetingTimer)
|
|
884
|
+
clearInterval(that.timer)
|
|
885
|
+
window.netcall.leaveChannel().then(function(obj) {
|
|
886
|
+
// 离开房间后,开发者自己业务的扫尾工作
|
|
887
|
+
console.log(obj)
|
|
888
|
+
// 离开房间接口调用
|
|
889
|
+
changeMeetState("out")
|
|
890
|
+
// 发起人结束会议调用会议结束接口
|
|
891
|
+
if (store.state.user.imAccount == that.meetingCall.caller && flg || that.meetingCall.joinedMembers.length == 0) {
|
|
892
|
+
endMeeting(that.meetingId)
|
|
893
|
+
}
|
|
894
|
+
channelId = ""
|
|
895
|
+
busy = false
|
|
896
|
+
type = ""
|
|
897
|
+
that.meetingCall = {
|
|
898
|
+
members: [],
|
|
899
|
+
channelName: "", // 房间号
|
|
900
|
+
joinedMembers: [], // 已加入
|
|
901
|
+
caller: "", // 发起人\
|
|
902
|
+
membersState: {}
|
|
903
|
+
}
|
|
904
|
+
that.channelId = ""
|
|
905
|
+
that.showBecalling = false
|
|
906
|
+
that.showSession = false
|
|
907
|
+
store.commit("UPDATAREFRESHLIST")
|
|
908
|
+
}).catch(err => {
|
|
909
|
+
console.log(err)
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
/** 对列表用户进行点对点发送自定义系统通知
|
|
914
|
+
* @param {Array} list
|
|
915
|
+
* @param {object} option
|
|
916
|
+
* @param {string} option.teamName 群名称
|
|
917
|
+
* @param {string} option.type 视频还是音频, 如果为空,则取消呼叫!
|
|
918
|
+
* @param {string} option.list 被呼叫uid的列表
|
|
919
|
+
* @param {string} option.teamId 群id
|
|
920
|
+
* @param {string} option.nick 发起人昵称
|
|
921
|
+
* @param {string} option.channelName 房间id
|
|
922
|
+
*/
|
|
923
|
+
export function sendCustomMessage(option) {
|
|
924
|
+
var that = this;
|
|
925
|
+
option.list = option.list || [];
|
|
926
|
+
|
|
927
|
+
option.list.forEach(function(uid) {
|
|
928
|
+
console.log(uid != store.state.user.imAccount)
|
|
929
|
+
if (uid != store.state.user.imAccount) {
|
|
930
|
+
window.nim.sendCustomSysMsg({
|
|
931
|
+
scene: "p2p",
|
|
932
|
+
to: uid,
|
|
933
|
+
enablePushNick: false,
|
|
934
|
+
content: JSON.stringify({
|
|
935
|
+
id: 3,
|
|
936
|
+
members: option.list,
|
|
937
|
+
teamId: option.teamId,
|
|
938
|
+
teamName: option.teamName,
|
|
939
|
+
room: option.channelName,
|
|
940
|
+
type: option.type,
|
|
941
|
+
channelId: channelId
|
|
942
|
+
}),
|
|
943
|
+
isPushable: true,
|
|
944
|
+
sendToOnlineUsersOnly: false,
|
|
945
|
+
apnsText: option.nick + "正在呼叫您",
|
|
946
|
+
done: function(error, msg) {
|
|
947
|
+
console.log(msg);
|
|
948
|
+
}
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
/** 群聊发起音视频tip信息
|
|
955
|
+
* @param {object} option
|
|
956
|
+
* @param {string} option.teamId 群id
|
|
957
|
+
* @param {string} option.nick 发起人昵称
|
|
958
|
+
* @param {string} option.message 发送信息
|
|
959
|
+
*/
|
|
960
|
+
function sendTeamTip(option) {
|
|
961
|
+
window.nim.sendTipMsg({
|
|
962
|
+
isLocal: true,
|
|
963
|
+
scene: "team",
|
|
964
|
+
to: option.teamId,
|
|
965
|
+
tip: option.nick + option.message,
|
|
966
|
+
time: Date.now(),
|
|
967
|
+
isPushable: false,
|
|
968
|
+
isHistoryable: false,
|
|
969
|
+
isRoamingable: false,
|
|
970
|
+
done: function(err, data) {
|
|
971
|
+
if (!err) {
|
|
972
|
+
store.commit("SET_MSGS", data)
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
});
|
|
976
|
+
}
|
|
977
|
+
export function getDevices() {
|
|
978
|
+
window.netcall.getDevicesOfType().then(function(obj) {
|
|
979
|
+
console.log("音频设备列表:", obj)
|
|
980
|
+
})
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
export function rejectMeeting(channelIds) {
|
|
984
|
+
window.netcall.control({
|
|
985
|
+
channelId: channelIds || that.channelId,
|
|
986
|
+
command: WebRTC.NETCALL_CONTROL_COMMAND_BUSY
|
|
987
|
+
});
|
|
988
|
+
changeMeetState("refuse")
|
|
989
|
+
if (!channelIds) {
|
|
990
|
+
that.showBecalling = false
|
|
991
|
+
that.showSession = false
|
|
992
|
+
clearRingPlay()
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
// 音频开关
|
|
996
|
+
export function deviceAudioIn(_this, flg) {
|
|
997
|
+
if (flg) {
|
|
998
|
+
window.netcall.startDevice({
|
|
999
|
+
type: WebRTC.DEVICE_TYPE_AUDIO_IN
|
|
1000
|
+
}).then(function() {
|
|
1001
|
+
_this.microphoneIsClose = false
|
|
1002
|
+
window.netcall.setCaptureVolume(255)
|
|
1003
|
+
window.netcall.control({
|
|
1004
|
+
command: WebRTC.NETCALL_CONTROL_COMMAND_NOTIFY_AUDIO_ON
|
|
1005
|
+
})
|
|
1006
|
+
Message.success("麦克风已开启")
|
|
1007
|
+
}).catch(function() {
|
|
1008
|
+
_this.microphoneAvail = false
|
|
1009
|
+
_this.microphoneIsClose = true
|
|
1010
|
+
Message.error("麦克风启动失败")
|
|
1011
|
+
})
|
|
1012
|
+
} else {
|
|
1013
|
+
window.netcall.stopDevice(WebRTC.DEVICE_TYPE_AUDIO_IN).then(function() {
|
|
1014
|
+
Message.warning("麦克风已关闭")
|
|
1015
|
+
window.netcall.control({
|
|
1016
|
+
command: WebRTC.NETCALL_CONTROL_COMMAND_NOTIFY_AUDIO_OFF
|
|
1017
|
+
})
|
|
1018
|
+
_this.microphoneIsClose = true
|
|
1019
|
+
})
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
// 视频开关
|
|
1023
|
+
export function deviceVideoIn(_this, flg) {
|
|
1024
|
+
if (flg) {
|
|
1025
|
+
window.netcall.startDevice({
|
|
1026
|
+
type: WebRTC.DEVICE_TYPE_VIDEO,
|
|
1027
|
+
width: 640,
|
|
1028
|
+
height: 480
|
|
1029
|
+
}).then(function() {
|
|
1030
|
+
_this.cameraIsClose = false
|
|
1031
|
+
// 预览本地画面
|
|
1032
|
+
const node = that.isMeeting ? document.getElementById("remote-" + store.state.user.imAccount) : document.getElementById("localContainer")
|
|
1033
|
+
window.netcall.startLocalStream(
|
|
1034
|
+
node
|
|
1035
|
+
)
|
|
1036
|
+
const eleChild = node.getElementsByTagName("div")[0];
|
|
1037
|
+
eleChild.style.display = "block"
|
|
1038
|
+
// 设置本地预览画面大小
|
|
1039
|
+
window.netcall.setVideoViewSize({
|
|
1040
|
+
width: 500,
|
|
1041
|
+
height: 500,
|
|
1042
|
+
cut: true
|
|
1043
|
+
})
|
|
1044
|
+
Message.success("摄像头已开启")
|
|
1045
|
+
}).catch(function(err) {
|
|
1046
|
+
that.cameraAvail = false
|
|
1047
|
+
that.cameraIsClose = true
|
|
1048
|
+
if (err.code == 65002) {
|
|
1049
|
+
console.log("设备不存在/无任何设备")
|
|
1050
|
+
}
|
|
1051
|
+
Message.error("摄像头启动失败")
|
|
1052
|
+
})
|
|
1053
|
+
} else {
|
|
1054
|
+
window.netcall.stopDevice(WebRTC.DEVICE_TYPE_VIDEO).then(function() {
|
|
1055
|
+
Message.warning("摄像头已关闭")
|
|
1056
|
+
_this.cameraIsClose = true
|
|
1057
|
+
const node = that.isMeeting ? document.getElementById("remote-" + store.state.user.imAccount) : document.getElementById("localContainer")
|
|
1058
|
+
const eleChild = node.getElementsByTagName("div")[0];
|
|
1059
|
+
eleChild.style.display = "none"
|
|
1060
|
+
})
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
// 提示声音播放
|
|
1064
|
+
export function playRing(name, count, done) {
|
|
1065
|
+
done = done || function() { };
|
|
1066
|
+
playRingInstance = playRingInstance || {};
|
|
1067
|
+
var url = nameMap[name];
|
|
1068
|
+
function doPlay(url, playDone) {
|
|
1069
|
+
var audio = document.createElement("audio");
|
|
1070
|
+
audio.autoplay = true;
|
|
1071
|
+
function onEnded() {
|
|
1072
|
+
playRingInstance.cancel = null;
|
|
1073
|
+
audio = null;
|
|
1074
|
+
playDone();
|
|
1075
|
+
}
|
|
1076
|
+
audio.addEventListener("ended", onEnded);
|
|
1077
|
+
audio.src = url;
|
|
1078
|
+
playRingInstance.cancel = function() {
|
|
1079
|
+
audio.removeEventListener("ended", onEnded);
|
|
1080
|
+
audio.pause();
|
|
1081
|
+
audio = null;
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
var wrap = function() {
|
|
1085
|
+
playRingInstance = null
|
|
1086
|
+
done();
|
|
1087
|
+
};
|
|
1088
|
+
for (var i = 0; i < count; i++) {
|
|
1089
|
+
wrap = (function(wrap) {
|
|
1090
|
+
return function() {
|
|
1091
|
+
doPlay(url, wrap);
|
|
1092
|
+
};
|
|
1093
|
+
})(wrap);
|
|
1094
|
+
}
|
|
1095
|
+
wrap();
|
|
1096
|
+
}
|
|
1097
|
+
export function clearRingPlay() {
|
|
1098
|
+
if (playRingInstance) {
|
|
1099
|
+
playRingInstance.cancel && playRingInstance.cancel();
|
|
1100
|
+
playRingInstance = null;
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
function setMemberStatue(_this) {
|
|
1105
|
+
_this.meetingCall.members.forEach(item => {
|
|
1106
|
+
if (!_this.meetingCall.membersState[item]) {
|
|
1107
|
+
_this.meetingCall.membersState[item] = 4
|
|
1108
|
+
}
|
|
1109
|
+
})
|
|
1110
|
+
_this.meetingCall.membersState = Object.assign({}, _this.meetingCall.membersState)
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
export function startShare() {
|
|
1114
|
+
window.netcall.startDevice({
|
|
1115
|
+
type: WebRTC.DEVICE_TYPE_DESKTOP_CHROME_SCREEN
|
|
1116
|
+
}).then(res => {
|
|
1117
|
+
console.log(res)
|
|
1118
|
+
const node = document.getElementById("remote-" + store.state.user.imAccount)
|
|
1119
|
+
window.netcall.startLocalStream(node)
|
|
1120
|
+
}).catch(function(err) {
|
|
1121
|
+
Message.error("屏幕共享失败,共享功能只支持在谷歌浏览器上使用")
|
|
1122
|
+
console.log("启动屏幕共享失败", err)
|
|
1123
|
+
})
|
|
1124
|
+
}
|
|
1125
|
+
// 关闭对应人员视频
|
|
1126
|
+
export function stopRemoteStream(account) {
|
|
1127
|
+
window.netcall.stopRemoteStream({
|
|
1128
|
+
account: account
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1131
|
+
// 开启对应人员视频
|
|
1132
|
+
export function startRemoteStream(account) {
|
|
1133
|
+
window.netcall.startRemoteStream({
|
|
1134
|
+
account: account,
|
|
1135
|
+
node: document.getElementById("remote-" + account)
|
|
1136
|
+
})
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
// 关闭对应人员音频
|
|
1140
|
+
export function stopAudio(account) {
|
|
1141
|
+
window.netcall.setAudioBlack(account)
|
|
1142
|
+
}
|
|
1143
|
+
// 开启对应人员音频
|
|
1144
|
+
export function startAudio(account) {
|
|
1145
|
+
window.netcall.setAudioStart(account)
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
// 发起会议接口调用
|
|
1149
|
+
export async function startedMeeting(info) {
|
|
1150
|
+
const param = {
|
|
1151
|
+
"topic": info.theme,
|
|
1152
|
+
"meetingNo": info.channelName,
|
|
1153
|
+
"creator": info.no,
|
|
1154
|
+
"companyNo": info.cno,
|
|
1155
|
+
"chatId": info.channelId,
|
|
1156
|
+
"telPhone": info.telPhone,
|
|
1157
|
+
"personalFlag": "YES",
|
|
1158
|
+
"members": info.members
|
|
1159
|
+
}
|
|
1160
|
+
const res = await api.startedMeeting(param)
|
|
1161
|
+
if (res.data.state == "ok") {
|
|
1162
|
+
that.meetingId = res.data.data
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
// 结束会议接口调用
|
|
1166
|
+
export async function endMeeting(id) {
|
|
1167
|
+
const res = await api.endedMeeting({ id })
|
|
1168
|
+
if (res.data.state == "ok") {
|
|
1169
|
+
that.meetingId = ""
|
|
1170
|
+
store.commit("UPDATAREFRESHLIST")
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
export async function changeMeetState(type) {
|
|
1174
|
+
// 进入 in 、离开 out 、拒绝 refuse
|
|
1175
|
+
const res = await api.changeState({ meetingNo: that.meetingCall.channelName, imAccount: [that.user.imAccount], type: type })
|
|
1176
|
+
if (res.data.state == "ok") {}
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
|
|
1180
|
+
|