123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456 |
- <script>
- // #ifdef APP-PLUS
- import TIM from "tim-wx-sdk";
- import TIMUploadPlugin from "tim-upload-plugin";
- import Aegis from "aegis-weex-sdk";
- export { TIM, TIMUploadPlugin, Aegis };
- // #endif
-
- // #ifdef H5
- import TIM from "tim-js-sdk";
- import TIMUploadPlugin from "tim-upload-plugin";
- import Aegis from "aegis-web-sdk";
- export { TIM, TIMUploadPlugin, Aegis };
-
- // #endif
-
- // #ifdef MP-WEIXIN
- // import TIM from "tim-js-sdk";
- const TIM = require('tim-wx-sdk');
- import TIMUploadPlugin from "tim-upload-plugin";
- // import Aegis from "aegis-mp-sdk";
- export { TIM, TIMUploadPlugin };
- // #endif
-
- import { TUIConversationServer, TUIProfileServer } from "@/pages/TUIKit/TUICore/server";
- var appId=1400825410
- // var appId=1600023785;
- // 创建 sdk 实例
- uni.$TUIKit = TIM.create({
- SDKAppID: appId,
- });
- uni.$TIM = TIM;
- // 注册文件上传插件
- uni.$TUIKit.registerPlugin({
- "tim-upload-plugin": TIMUploadPlugin,
- });
- uni.$TUIKit.TUIConversationServer = new TUIConversationServer();
- uni.$TUIKit.TUIProfileServer = new TUIProfileServer();
- const { CallManager } = require ('./wxcomponents/TUICallKit/TUICallKit/serve/callManager');
- import { getTlsSig } from '@/api/common.js'
- import { checkLogin } from '@/api/user.js'
- export default {
- onLaunch: function () {
- this.bindTIMEvent();
- // wx.CallManager = new CallManager();
- var that=this;
- uni.$on('refreshIM', () => {
- this.checkLogin();
- })
- var urls="https://1701081189.cdwjyyh.com;https://1696746017.cdwjyyh.com;https://1708196565.cdwjyyh.com;https://1700206673.cdwjyyh.com;https://1723317680.cdwjyyh.com;https://1700575323.cdwjyyh.com;https://1706979252.cdwjyyh.com;https://1697148962.cdwjyyh.com;https://1722131630.cdwjyyh.com;https://1716969562.cdwjyyh.com;https://1695072024.cdwjyyh.com;https://1720639647.cdwjyyh.com;https://1695440159.cdwjyyh.com;https://1707741400.cdwjyyh.com;https://1708937934.cdwjyyh.com;https://1718087536.cdwjyyh.com;https://1724494814.cdwjyyh.com;https://1703101076.cdwjyyh.com;https://1712251670.cdwjyyh.com;https://1701764981.cdwjyyh.com;https://1709430520.cdwjyyh.com;https://1716356434.cdwjyyh.com;https://1716808011.cdwjyyh.com;https://1710609621.cdwjyyh.com;https://1705257092.cdwjyyh.com;https://1721137588.cdwjyyh.com;https://1703567784.cdwjyyh.com;https://1721509816.cdwjyyh.com;https://1720396718.cdwjyyh.com;https://1721936263.cdwjyyh.com;https://1716050799.cdwjyyh.com;https://1713109810.cdwjyyh.com;https://1725223167.cdwjyyh.com;https://1722019208.cdwjyyh.com;https://1702848339.cdwjyyh.com;https://1707911907.cdwjyyh.com;https://1717849419.cdwjyyh.com;https://1703809724.cdwjyyh.com;https://1724650239.cdwjyyh.com;https://1707113459.cdwjyyh.com;https://1715669104.cdwjyyh.com;https://1710051545.cdwjyyh.com;https://1722269330.cdwjyyh.com;https://1710003925.cdwjyyh.com;https://1714555145.cdwjyyh.com;https://1720634288.cdwjyyh.com;https://1696593184.cdwjyyh.com;https://1704962208.cdwjyyh.com;https://1703146177.cdwjyyh.com;https://1704346325.cdwjyyh.com;https://1697387624.cdwjyyh.com;https://1702551094.cdwjyyh.com;https://1720523201.cdwjyyh.com;https://1714391651.cdwjyyh.com;https://1698957834.cdwjyyh.com;https://1710582715.cdwjyyh.com;https://1696073814.cdwjyyh.com;https://1701427000.cdwjyyh.com;https://1703620825.cdwjyyh.com;https://1716954881.cdwjyyh.com;https://1709258681.cdwjyyh.com;https://1702178349.cdwjyyh.com;https://1696037454.cdwjyyh.com;https://1707163288.cdwjyyh.com;https://1698272613.cdwjyyh.com;https://1695736399.cdwjyyh.com;https://1707979666.cdwjyyh.com;https://1699631662.cdwjyyh.com;https://1725584568.cdwjyyh.com;https://1709711499.cdwjyyh.com;https://1707988905.cdwjyyh.com;https://1709289861.cdwjyyh.com;https://1720027873.cdwjyyh.com;https://1723979172.cdwjyyh.com;https://1711804525.cdwjyyh.com;https://1702653210.cdwjyyh.com;https://1711075739.cdwjyyh.com;https://1710979987.cdwjyyh.com;https://1724292527.cdwjyyh.com;https://1704964596.cdwjyyh.com;https://1703840482.cdwjyyh.com;https://1709061808.cdwjyyh.com;https://1718492957.cdwjyyh.com;https://1708829102.cdwjyyh.com;https://1716362553.cdwjyyh.com;https://1710541443.cdwjyyh.com;https://1715811900.cdwjyyh.com;https://1718208786.cdwjyyh.com;https://1704651745.cdwjyyh.com;https://1699759405.cdwjyyh.com;https://1713080422.cdwjyyh.com;https://1715403843.cdwjyyh.com;https://1696900518.cdwjyyh.com;https://1707770189.cdwjyyh.com;https://1700034515.cdwjyyh.com;https://1715466167.cdwjyyh.com;https://1709976677.cdwjyyh.com;https://1712370330.cdwjyyh.com;https://1706087997.cdwjyyh.com;https://1703496196.cdwjyyh.com;https://1712266369.cdwjyyh.com;https://1712318592.cdwjyyh.com;https://1712812440.cdwjyyh.com;https://1715678161.cdwjyyh.com;https://1702028001.cdwjyyh.com;https://1721667850.cdwjyyh.com;https://1696462985.cdwjyyh.com;https://1707192149.cdwjyyh.com;https://1704821512.cdwjyyh.com;https://1723797034.cdwjyyh.com;https://1704429569.cdwjyyh.com;https://1709243255.cdwjyyh.com;https://1722028860.cdwjyyh.com;https://1712967809.cdwjyyh.com;https://1705848887.cdwjyyh.com;https://1695675535.cdwjyyh.com;https://1725746755.cdwjyyh.com;https://1723025937.cdwjyyh.com;https://1723488798.cdwjyyh.com;https://1700104177.cdwjyyh.com;https://1724293219.cdwjyyh.com;https://1726204998.cdwjyyh.com;https://1714031757.cdwjyyh.com;https://1713130421.cdwjyyh.com;https://1723148318.cdwjyyh.com;https://1725755505.cdwjyyh.com;https://1720760127.cdwjyyh.com;https://1709058929.cdwjyyh.com;https://1706935822.cdwjyyh.com;https://1698429582.cdwjyyh.com;https://1725312611.cdwjyyh.com;https://1709158760.cdwjyyh.com;https://1712496042.cdwjyyh.com;https://1707326074.cdwjyyh.com;https://1704652832.cdwjyyh.com;https://1722471447.cdwjyyh.com;https://1715081607.cdwjyyh.com;https://1722709008.cdwjyyh.com;https://1705411096.cdwjyyh.com;https://1722112356.cdwjyyh.com;https://1713176285.cdwjyyh.com;https://1710638388.cdwjyyh.com;https://1703201862.cdwjyyh.com;https://1716520084.cdwjyyh.com;https://1716201102.cdwjyyh.com;https://1714278120.cdwjyyh.com;https://1695811036.cdwjyyh.com;https://1696612587.cdwjyyh.com;https://1720738395.cdwjyyh.com;https://1722208363.cdwjyyh.com;https://1697138661.cdwjyyh.com;https://1717887413.cdwjyyh.com;https://1715113705.cdwjyyh.com;https://1696048580.cdwjyyh.com;https://1696166861.cdwjyyh.com;https://1707853597.cdwjyyh.com;https://1709274679.cdwjyyh.com;https://1722858089.cdwjyyh.com;https://1715419874.cdwjyyh.com;https://1715116007.cdwjyyh.com;https://1722314568.cdwjyyh.com;https://1724746541.cdwjyyh.com;https://1718762128.cdwjyyh.com;https://1720163684.cdwjyyh.com;https://1724770857.cdwjyyh.com;https://1708580403.cdwjyyh.com;https://1705948747.cdwjyyh.com;https://1700682425.cdwjyyh.com;https://1702858903.cdwjyyh.com;https://1725605169.cdwjyyh.com;https://1699065003.cdwjyyh.com;https://1696786637.cdwjyyh.com;https://1708356387.cdwjyyh.com;https://1699525562.cdwjyyh.com;https://1720968292.cdwjyyh.com;https://1710909698.cdwjyyh.com;https://1700467361.cdwjyyh.com;https://1695683561.cdwjyyh.com;https://1725858080.cdwjyyh.com;https://1702911871.cdwjyyh.com";
- var urlList=urls.split(";");
- console.log(this.getRandomInt(0,urlList.length-1))
- var path = urlList[this.getRandomInt(0,urlList.length-1)];
- console.log(path)
- uni.setStorageSync('requestPath',path)
- },
- onUnload() {
-
- },
- onShow() {
- uni.getSystemInfo({
- success: (result) => {
- // 获取手机系统的状态栏高度(不同手机的状态栏高度不同)
- // console.log('当前手机的状态栏高度',result.statusBarHeight)
- let statusBarHeight = result.statusBarHeight + 'px'
- // 获取右侧胶囊的信息 单位px
- //#ifndef H5 || APP-PLUS
- const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
-
- //bottom: 胶囊底部距离屏幕顶部的距离
- //height: 胶囊高度
- //left: 胶囊左侧距离屏幕左侧的距离
- //right: 胶囊右侧距离屏幕左侧的距离
- //top: 胶囊顶部距离屏幕顶部的距离
- //width: 胶囊宽度
- // console.log(menuButtonInfo.width, menuButtonInfo.height, menuButtonInfo.top)
- // console.log('计算胶囊右侧距离屏幕右边距离', result.screenWidth - menuButtonInfo.right)
- let menuWidth = menuButtonInfo.width + 'px'
- let menuHeight = menuButtonInfo.height + 'px'
- let menuBorderRadius = menuButtonInfo.height / 2 + 'px'
- let menuRight = result.screenWidth - menuButtonInfo.right + 'px'
- let menuTop = menuButtonInfo.top + 'px'
- let contentTop = result.statusBarHeight + 44 + 'px'
- let menuInfo = {
- statusBarHeight: statusBarHeight,//状态栏高度----用来给自定义导航条页面的顶部导航条设计padding-top使用:目的留出系统的状态栏区域
- menuWidth: menuWidth,//右侧的胶囊宽度--用来给自定义导航条页面的左侧胶囊设置使用
- menuHeight: menuHeight,//右侧的胶囊高度--用来给自定义导航条页面的左侧胶囊设置使用
- menuBorderRadius: menuBorderRadius,//一半的圆角--用来给自定义导航条页面的左侧胶囊设置使用
- menuRight: menuRight,//右侧的胶囊距离右侧屏幕距离--用来给自定义导航条页面的左侧胶囊设置使用
- menuTop: menuTop,//右侧的胶囊顶部距离屏幕顶部的距离--用来给自定义导航条页面的左侧胶囊设置使用
- contentTop: contentTop,//内容区距离页面最上方的高度--用来给自定义导航条页面的内容区定位距离使用
- }
- uni.setStorageSync('menuInfo', menuInfo)
- //#endif
- },
- fail: (error) => {
- console.log(error)
- }
- })
-
- },
- methods: {
-
- getRandomInt(min, max) {
- const minCeiled = Math.ceil(min);
- const maxFloored = Math.floor(max);
- return Math.floor(Math.random() * (maxFloored - minCeiled + 1) + minCeiled); // 包含最小值和最大值
- },
- checkLogin(){
- var data={};
- checkLogin(data).then(
- res => {
- if(res.code==200){
- this.imLogin(res.userId)
- }
- },
- rej => {}
- );
- },
- imLogin(userId){
- var uid="U-"+userId;
- // var userIDList=[];
- // userIDList.push(userId);
- // uni.$TUIKit.getUserStatus({ userIDList: userIDList}).then((res) => {
- // const { userID, statusType, customStatus } = res.data;
- // console.log
- // if(statusType==uni.$TUIKit.TYPES.USER_STATUS_ONLINE){
- // }
- // else{
-
- // }
-
- // });
- var data={userId:uid};
- getTlsSig(data).then(
- res => {
- console.log(data)
- if(res.code==200){
- var sign=res.data;
- uni.setStorageSync('sign',sign);
- //全局TRTC使用
- uni.$chat_SDKAppID = appId;
- uni.$chat_userID = uid;
- uni.$chat_userSig = sign;
- uni.$TUIKit.login({ userID: uid,userSig:sign }).then((res) => {
- // sdk 初始化,当 sdk 处于ready 状态,才可以使用API,文档
- console.log("im登录成功")
-
- });
- }else{
- uni.showToast({
- icon:'none',
- title: "请求失败",
- });
- }
- },
- rej => {}
- );
-
- },
- bindTIMEvent() {
- uni.$TUIKit.on(uni.$TIM.EVENT.SDK_READY, this.handleSDKReady);
- uni.$TUIKit.on(uni.$TIM.EVENT.SDK_NOT_READY, this.handleSDKNotReady);
- uni.$TUIKit.on(uni.$TIM.EVENT.KICKED_OUT, this.handleKickedOut);
- },
- // sdk ready 以后可调用 API
- handleSDKReady(event) {
- uni.$chat_isSDKReady = true;
- var userId=uni.getStorageSync('userId');
- var avatar=uni.getStorageSync('avatar');
- var nickName=uni.getStorageSync('nickName');
- console.log(avatar)
- uni.$TUIKit.updateMyProfile({
- nick: nickName,
- avatar:avatar,
- gender: TIM.TYPES.GENDER_MALE,
- selfSignature: '我的个性签名',
- allowType: TIM.TYPES.ALLOW_TYPE_ALLOW_ANY
- }).then((res) => {
- // sdk 初始化,当 sdk 处于ready 状态,才可以使用API,文档
- console.log("个人信息修改成功")
- });
- // if(uid!=null){
- // wx.CallManager.init({
- // sdkAppID: appId, // 替换为用户自己的 sdkAppID
- // userID: userId, // 替换为用户自己的 userID
- // userSig: sign, // 替换为用户自己的 userSig
- // globalCallPagePath: 'wxcomponents/TUICallKit/TUICallKit/pages/globalCall/globalCall_uni', // 替换为步骤一里注册的全局监听页面
- // });
- // }
- uni.$emit('refreshMsgCount');
- },
- handleSDKNotReady(event) {
-
- console.log("SDK没有准备"+event)
- },
- handleKickedOut(event) {
- uni.clearStorageSync();
- uni.showToast({
- title: `${this.kickedOutReason(event.data.type)}被踢出。`,
- icon: "none",
- });
- },
- kickedOutReason(type) {
- switch (type) {
- case uni.$TIM.TYPES.KICKED_OUT_MULT_ACCOUNT:
- return "多实例登录";
- case uni.$TIM.TYPES.KICKED_OUT_MULT_DEVICE:
- return "多设备登录";
- case uni.$TIM.TYPES.KICKED_OUT_USERSIG_EXPIRED:
- return "userSig 过期";
- case uni.$TIM.TIM.TYPES.KICKED_OUT_REST_API:
- return "REST API kick 接口踢出";
- default:
- return "";
- }
- },
- },
- };
- </script>
- <style lang="scss">
- /*每个页面公共css */
- @import "@/uni_modules/uview-plus/index.scss";
-
- view{
- box-sizing: border-box;
- }
- .ellipsis{
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .ellipsis2{
- overflow:hidden;
- text-overflow:ellipsis;
- display:-webkit-box;
- -webkit-box-orient:vertical;
- -webkit-line-clamp:2;
- }
- .no-data-box{
- box-sizing: border-box;
- width: 100%;
- padding: 200rpx 50rpx;
- text-align: center;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- image{
- width: 200upx;
- height: 150upx;
- }
- .empty-title{
- margin-top: 20rpx;
- font-size: 28rpx;
- color: #bbbbbb;
-
- }
- }
- .doctor-box{
- margin-top: 15rpx;
- padding: 20rpx 0rpx 0rpx;
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- justify-content: flex-start;
- .doctor{
- width: 100%;
- margin-bottom: 15rpx;
- background: #f9f8fe;
- padding: 15rpx;
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- justify-content: flex-start;
- &:last-child{
- margin-bottom: 0rpx;
- }
- .item{
- width: 100%;
- display: flex;
- align-items: flex-start;
- justify-content: flex-start;
- .left{
- .head-box{
- width:92rpx;
- height:92rpx;
- position: relative;
- .isline{
- width:92rpx;
- height:92rpx;
- border-radius: 50%;
- border: 2rpx solid #E69A22;
- display: flex;
- align-items: center;
- justify-content: center;
- position: absolute;
- bottom: 0rpx;
- .img{
- position: absolute;
- bottom: 1rpx;
- width:75rpx;
- height:35rpx;
- image{
- width:75rpx;
- height:35rpx;
- }
- .name{
- width:75rpx;
- height:35rpx;
- bottom: -3rpx;
- text-align: center;
- position: absolute;
- font-size: 16upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #ffffff;
- }
- }
-
-
- }
- .doc-img{
- border-radius: 50%;
- width:100%;
- height:100%;
-
- }
-
- }
- }
-
- .right{
- width: calc(100% - 100rpx);
- margin-left: 20rpx;
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- justify-content: flex-start;
- .doc-box{
- display: flex;
- align-items: center;
- justify-content: space-between;
- .doc-name{
- font-size: 32upx;
- font-family: PingFang SC;
- font-weight: bold;
- color: #111111;
-
- }
- .doc-position{
- margin-left: 16rpx;
- font-size: 26upx;
- font-weight: bold;
- font-family: PingFang SC;
- color: #2A2B2E;
- }
- .doc-dept{
- margin-left: 16rpx;
- font-size: 26upx;
- font-weight: bold;
- font-family: PingFang SC;
- color: #2A2B2E;
- }
- }
- .hospital-box{
- display: flex;
- align-items: center;
- justify-content: flex-start;
- margin-top: 10rpx;
- .tag{
- display: flex;
- align-items: center;
- justify-content: center;
- background-color: #4FC06B;
- border-radius: 10rpx;
- padding: 5rpx 10rpx;
- font-size: 20upx;
- font-weight: bold;
- font-family: PingFang SC;
- color: #ffffff;
- }
- .name{
- margin-left: 6rpx;
- font-size: 26upx;
- font-weight: bold;
- font-family: PingFang SC;
- color: #2A2B2E;
- }
-
- }
- .doc-spec{
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: flex-start;
- margin-top: 15rpx;
- .spec{
- font-size: 26upx;
- font-family: PingFang SC;
- color: #626468;
- }
- }
- .doc-count{
- margin-top: 15rpx;
- display: flex;
- align-items: center;
- justify-content: flex-start;
- .name{
- font-size: 24upx;
- font-family: PingFang SC;
- color: #9B9B9B;
- }
- .count{
- margin: 0rpx 5rpx;
- font-size: 24upx;
- font-family: PingFang SC;
- color: #2A2B2E;
- }
- }
- .doc-price{
- width: 100%;
- margin-top: 15rpx;
- display: flex;
- align-items: center;
- justify-content: flex-start;
- .btn{
- display: flex;
- align-items: center;
- justify-content: center;
- background-color: #FEEFD7;
- padding: 15rpx 30rpx;
- border-radius: 30rpx;
- font-size: 26upx;
- font-family: PingFang SC;
- color: #E69A22;
- }
- }
-
- }
- }
-
- }
- }
-
- </style>
- <style lang="less">
- /*每个页面公共css */
- @import './assets/iconfont/iconfont.css';
- @import './assets/css/common.less';
- /* 全局flex样式 */
- @import './common/css/flexCommon.css';
- </style>
|