App.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970
  1. <script>
  2. import { getDictByKey,getAppVersion,getRealLinkDomainName } from '@/api/common'
  3. //参考文档 插件市场 https://ext.dcloud.net.cn/plugin?id=741
  4. import {appCheckUdate,openDownload } from '@/utils/APPUpdate.js'
  5. import {getUserInfo,getPushLogRead} from '@/api/user'
  6. import { healthButlerPop } from '@/utils/healthButlerPop.js'
  7. // #ifdef APP-PLUS
  8. import TIM from "tim-wx-sdk";
  9. import TIMUploadPlugin from "tim-upload-plugin";
  10. import Aegis from "aegis-weex-sdk";
  11. export { TIM, TIMUploadPlugin, Aegis };
  12. // import {coursePopup} from '@/utils/coursePopup.js'
  13. // var jpushModule = uni.requireNativePlugin("JG-JPush");
  14. // #endif
  15. // #ifdef H5
  16. import TIM from "tim-js-sdk";
  17. import TIMUploadPlugin from "tim-upload-plugin";
  18. import Aegis from "aegis-web-sdk";
  19. export { TIM, TIMUploadPlugin, Aegis };
  20. // #endif
  21. // #ifdef MP-WEIXIN
  22. import TIM from "tim-js-sdk";
  23. import TIMUploadPlugin from "tim-upload-plugin";
  24. import Aegis from "aegis-mp-sdk";
  25. export { TIM, TIMUploadPlugin, Aegis };
  26. // #endif
  27. import { TUIConversationServer, TUIProfileServer } from "@/pages/TUIKit/TUICore/server";
  28. import store from "@/store";
  29. // 创建 sdk 实例
  30. var appId=1400825410;
  31. uni.$TUIKit = TIM.create({
  32. SDKAppID: appId,
  33. });
  34. uni.$TIM = TIM;
  35. // 注册文件上传插件
  36. uni.$TUIKit.registerPlugin({
  37. "tim-upload-plugin": TIMUploadPlugin,
  38. });
  39. uni.$TUIKit.TUIConversationServer = new TUIConversationServer();
  40. uni.$TUIKit.TUIProfileServer = new TUIProfileServer();
  41. var isIos=false;
  42. // #ifdef APP-PLUS
  43. const uPushPlugin = uni.requireNativePlugin("DCloud-PushSound");
  44. const TUICallKit = uni.requireNativePlugin('TencentCloud-TUICallKit');
  45. uni.$TUICallKit = TUICallKit; //全局引入
  46. uni.$TUICallKit2 = TUICallKit; //全局引入
  47. isIos = (plus.os.name == "iOS")
  48. import permision1 from "@/utils/permission.js"
  49. // #endif
  50. import { getTlsSig } from '@/api/common.js'
  51. import { qconfig } from './utils/config';
  52. import { premissionCheck } from "@/js_sdk/wa-permission/permission.js"
  53. // import { utils } from 'xlsx';
  54. import { updateMsgDot } from "@/utils/common.js"
  55. let healthTimer=null;
  56. let tSeconds=0;
  57. const healthSeconds=180;
  58. export default {
  59. globalData: {
  60. wsUrl: 'ws://doctor.ai.cdwjyyh.com',
  61. danmuWSUrl:'ws://api.cdwjyyh.com',
  62. aiWSUrl:'ws://doctor.ai.cdwjyyh.com',
  63. kfurl: 'https://work.weixin.qq.com/kfid/kfc3731c5008ebd8906', //企业微信客服链接
  64. corpId: 'ww70ac72e824957fc9', //企业id
  65. },
  66. onLaunch: function () {
  67. uni.removeStorageSync("openUrl")
  68. if(this.$isLogin()) {
  69. uni.setStorageSync("onLaunch",1)
  70. this.$setSource()
  71. }
  72. //设置字体大小
  73. let fontsize = uni.getStorageSync("fontSize")
  74. if (fontsize) {
  75. store.commit("timStore/setScaleFontSize", fontsize);
  76. uni.setStorageSync("fontSize",fontsize);
  77. }
  78. else{
  79. let scale = this.getSystemFontScale();
  80. let oriFontSize=18;
  81. fontsize=oriFontSize*scale;
  82. if(fontsize<oriFontSize){
  83. fontsize=oriFontSize;
  84. }
  85. if(fontsize<16){
  86. fontsize=16;
  87. }
  88. if(fontsize>=21){
  89. fontsize=21;
  90. }
  91. uni.setStorageSync("fontSize",fontsize);
  92. store.commit("timStore/setScaleFontSize", fontsize);
  93. }
  94. this.bindTIMEvent();
  95. var that=this;
  96. uni.$on('refreshIM', () => {
  97. that.imLogin()
  98. });
  99. uni.$on('refreshMsgCount', () => {
  100. that.$updateMsgDot();
  101. });
  102. // #ifdef APP-PLUS
  103. uni.$on('showHealthButler', () => {
  104. if(plus.runtime.channel=="baidu" || plus.runtime.channel=="yybadv" || plus.runtime.channel=="yybadv1"){
  105. that.runTimer();
  106. }
  107. });
  108. // const baiduAdv = uni.requireNativePlugin('baidu-adv-plugin');
  109. // //console.log("-----qxj baiduAdv:"+baiduAdv);
  110. // baiduAdv.initSDK(21427,"e8b431ba309234a9c842fddf967b7d0e", (msg) => {
  111. // console.log('------qxj SDK1初始化:', msg);
  112. // });
  113. this.checkPush1();
  114. uni.onPushMessage((res) => {
  115. console.log("监听推送消息 ")
  116. if(res.type=="receive") {
  117. uni.createPushMessage({
  118. title: res.data.title,
  119. content: res.data.content,
  120. payload: res.data.payload,
  121. // sound: 'system', // 默认值为system
  122. category: res.data.category,
  123. success: ()=>{
  124. console.log("创建在线推送消息成功: ")
  125. store.commit("newMsg/SET_UPDATATIME",new Date().getTime());
  126. },
  127. fail: (err) =>{
  128. console.log("创建在线推送消息失败: ",err)
  129. },
  130. })
  131. }
  132. this.$updateMsgDot()
  133. this.handlePushMessage(res)
  134. })
  135. //#endif
  136. },
  137. onLoad() {
  138. // #ifdef APP-PLUS
  139. if(plus.runtime.isAgreePrivacy()) {
  140. uni.getSystemInfo({success: function (res) {
  141. if (res.platform === 'android') {
  142. }
  143. }
  144. });
  145. }
  146. //#endif
  147. },
  148. onShow() {
  149. this.geth5Path()
  150. var that=this;
  151. if(that.$isLogin()){
  152. that.imLogin();
  153. that.$getRegistrationID('update');
  154. // this.getClipboardData()
  155. }
  156. // #ifdef APP-PLUS
  157. if(plus.runtime.isAgreePrivacy()) {
  158. this.$getRegistrationID();
  159. if(plus.runtime.channel=="baidu" || plus.runtime.channel=="yybadv" || plus.runtime.channel=="yybadv1"){
  160. this.runTimer();
  161. }
  162. }
  163. //that.bdAdvFeedback();
  164. that.checkUpdateApp();
  165. var args= plus.runtime.arguments;
  166. if(args){
  167. console.log('args=====',args)
  168. // 处理args参数,如直达到某新页面等
  169. if(args=="rtlive://course"){
  170. uni.switchTab({url: '/pages/course/index'});
  171. }else if(args=="rtlive://livingApp"){
  172. uni.switchTab({url: '/pages/course/video/living-app'});
  173. }else {
  174. let url = ''
  175. if(args.indexOf("rtlive://pagesApp") != -1) {
  176. // 打开对应pages
  177. url=args.replace("rtlive://pagesApp?pagesUrl=","");
  178. url=decodeURIComponent(url);
  179. } else if (args.indexOf("rtlive://courseAnswer") != -1) {
  180. // 看课
  181. url=args.replace("rtlive://courseAnswer","");
  182. url="/pages/courseAnswer/index"+url;
  183. } else {
  184. url=args.replace("rtlive://course","");
  185. url="/pages/course/info"+url;
  186. }
  187. if(args.indexOf("rtlive://") != -1&&url) {
  188. uni.setStorageSync("openUrl",url)
  189. if(this.$isLogin()){
  190. uni.navigateTo({
  191. url: url,
  192. success: function(res) {
  193. uni.removeStorageSync("openUrl")
  194. plus.runtime.arguments = ''
  195. }
  196. })
  197. }
  198. }
  199. }
  200. }
  201. //#endif
  202. },
  203. onHide() {
  204. uni.removeStorageSync("onLaunch")
  205. },
  206. methods: {
  207. getSystemFontScale:function () {
  208. let scale = 1;
  209. if (uni.getSystemInfoSync) {
  210. let systemInfo = uni.getSystemInfoSync();
  211. if (systemInfo.fontSizeSetting) {
  212. scale = systemInfo.fontSizeSetting / 16; // 16 是默认字体大小
  213. }
  214. }
  215. return scale;
  216. },
  217. adjustFontSize:function() {
  218. let scale = getSystemFontScale();
  219. let rootElement = document.documentElement;
  220. rootElement.style.fontSize = 16 * scale + 'px';
  221. },
  222. /* 检查更新 在线更新 */
  223. checkUpdateApp:function(){
  224. if(isIos){
  225. return;
  226. }
  227. let that=this;
  228. plus.runtime.getProperty(plus.runtime.appid, function(widgetinfo) {
  229. // 可以根据manifest.json里的应用名称来进行针对性的APP升级
  230. if (widgetinfo.name == qconfig.appName) { //APP名称
  231. // 获取manifest.json里的版本号
  232. let platform = uni.getSystemInfoSync().platform;
  233. let isAndroid=platform=="android";
  234. let type=isAndroid?1:2;
  235. getAppVersion(type).then(srcData => {
  236. //console.log("qxj getAppVersion srcData:"+JSON.stringify(srcData)+" isAppStore:"+that.$qconfig.isAppStore);
  237. if(srcData.code==200){
  238. let data = srcData.data;
  239. let version = widgetinfo.versionCode,//用户当前app版本
  240. appVersion = data.versionCode,//升级包版本
  241. appName = widgetinfo.name, //app名称
  242. isForce = data.isForce,//是否强制热更新
  243. updateConfig=JSON.parse(data.updateConfig),
  244. appurl = data.url,//升级包地址
  245. intro = data.note;//升级包提示
  246. //如果用户版本号小于升级包版本号,先升级
  247. let afterVer=false;
  248. if(plus.runtime.channel=="baidu"){
  249. afterVer=that.$qconfig.isAppStore?updateConfig.baidu:false;
  250. }
  251. else if(plus.runtime.channel=="huawei"){
  252. afterVer=that.$qconfig.isAppStore?updateConfig.huawei:false;
  253. }
  254. else if(plus.runtime.channel=="xiaomi"){
  255. afterVer=that.$qconfig.isAppStore?updateConfig.xiaomi:false;
  256. }
  257. else if(plus.runtime.channel=="yyb"){
  258. afterVer=that.$qconfig.isAppStore?updateConfig.yyb:false;
  259. }
  260. else{
  261. afterVer=that.$qconfig.isAppStore?isForce:true;
  262. }
  263. if(data && (version < appVersion) && afterVer){
  264. uni.showModal({
  265. title:"更新提示",
  266. confirmText:"立即升级",
  267. content:intro,
  268. cancelText:'确定',
  269. confirmText:'取消',
  270. success: (res) => {
  271. if (res.cancel) {
  272. openDownload(srcData.data);
  273. } else if (res.confirm) {
  274. if(isForce==1){
  275. uni.showToast({title:"请先升级APP版本",icon:"none",duration:2000});
  276. //退出app
  277. setTimeout(function(){
  278. plus.runtime.quit();
  279. },2000)
  280. }
  281. }
  282. },
  283. fail: () => {
  284. uni.hideLoading();
  285. }
  286. })
  287. }
  288. }
  289. },
  290. rej => {}
  291. ).catch(()=>{
  292. //联网失败, 结束加载
  293. this.mescroll.endErr();
  294. });
  295. }
  296. });
  297. },
  298. imLogin(){
  299. var user=JSON.parse(uni.getStorageSync('userInfo'));
  300. var uid="U-"+user.userId;
  301. var data={userId:uid};
  302. getTlsSig(data).then(res => {
  303. console.log(data)
  304. if(res.code==200){
  305. var sign=res.data;
  306. //console.log("-----qxj sign:"+sign);
  307. uni.setStorageSync('sign',sign);
  308. uni.setStorageSync('userID',uid);
  309. uni.$TUIKit.login({ userID: uid,userSig:sign }).then((res) => {
  310. // sdk 初始化,当 sdk 处于ready 状态,才可以使用API,文档
  311. console.log("im登录成功");
  312. var avatar=user.avatar;
  313. var nickName=user.nickName;
  314. if(avatar==null){
  315. avatar=""
  316. }
  317. uni.$TUIKit.updateMyProfile({
  318. nick: nickName,
  319. avatar:avatar,
  320. gender: TIM.TYPES.GENDER_MALE,
  321. selfSignature: '我的个性签名',
  322. allowType: TIM.TYPES.ALLOW_TYPE_ALLOW_ANY
  323. }).then((res) => {
  324. // sdk 初始化,当 sdk 处于ready 状态,才可以使用API,文档
  325. console.log("个人信息修改成功")
  326. });
  327. var sign=uni.getStorageSync('sign');
  328. uni.$emit('refreshMsgCount');
  329. // #ifdef APP-PLUS
  330. uni.$TUICallKit.login({
  331. SDKAppID: appId, // 开通实时音视频服务创建应用后分配的 SDKAppID
  332. userID: uid, // 用户 ID,可以由您的帐号系统指定
  333. userSig: sign, // 身份签名,相当于登录密码的作用
  334. }, (res) => {
  335. if (res.code === 0) {
  336. uni.$TUICallKit.enableFloatWindow(true); // 开启小浮窗
  337. } else {
  338. console.error(`login failed, error message = ${res.msg}`);
  339. }
  340. });
  341. // #endif
  342. });
  343. }
  344. else{
  345. uni.showToast({
  346. icon:'none',
  347. title: "请求失败",
  348. });
  349. }
  350. },
  351. rej => {}
  352. );
  353. },
  354. bindTIMEvent() {
  355. uni.$TUIKit.on(uni.$TIM.EVENT.SDK_READY, this.handleSDKReady);
  356. uni.$TUIKit.on(uni.$TIM.EVENT.SDK_NOT_READY, this.handleSDKNotReady);
  357. uni.$TUIKit.on(uni.$TIM.EVENT.KICKED_OUT, this.handleKickedOut);
  358. },
  359. // sdk ready 以后可调用 API
  360. handleSDKReady(event) {
  361. uni.$chat_isSDKReady = true;
  362. uni.hideLoading();
  363. },
  364. handleSDKNotReady(event) {
  365. },
  366. handleKickedOut(event) {
  367. //uni.clearStorageSync();
  368. uni.showToast({
  369. title: `${this.kickedOutReason(event.data.type)}被踢出。`,
  370. icon: "none",
  371. });
  372. },
  373. kickedOutReason(type) {
  374. switch (type) {
  375. case uni.$TIM.TYPES.KICKED_OUT_MULT_ACCOUNT:
  376. return "多实例登录";
  377. case uni.$TIM.TYPES.KICKED_OUT_MULT_DEVICE:
  378. return "多设备登录";
  379. case uni.$TIM.TYPES.KICKED_OUT_USERSIG_EXPIRED:
  380. return "userSig 过期";
  381. case uni.$TIM.TIM.TYPES.KICKED_OUT_REST_API:
  382. return "REST API kick 接口踢出";
  383. default:
  384. return "";
  385. }
  386. },
  387. runTimer(){
  388. let that=this;
  389. // healthButlerPop(function(data){
  390. // if(data==1){
  391. // }else{
  392. // that.$showLoginPage();
  393. // }
  394. // });
  395. let dateNowDay=this.$dateFormatStr("YYYY-mm-dd",new Date());
  396. let healthButler=uni.getStorageSync("healthButler");
  397. let userInfo=uni.getStorageSync('userInfo');
  398. console.log("------qxj dateStr:"+dateNowDay+" healthButler:"+healthButler);
  399. let dayNum=0;
  400. if(userInfo!=null && userInfo.isAddQw){ //已加过企微不在弹窗
  401. return;
  402. }
  403. if(!!healthButler){
  404. healthButler=JSON.parse(healthButler);
  405. dayNum=healthButler.dayNum;
  406. if(healthButler.day==dateNowDay){ //今天已经弹窗过 防止再弹窗
  407. return;
  408. }
  409. }
  410. if(dayNum==0){ //第一天下载App
  411. if(this.$qconfig.healthTimer==null){
  412. this.$qconfig.healthTimer=setInterval(() => {
  413. if(this.$qconfig.healthSeconds==healthSeconds){
  414. this.$qconfig.healthSeconds=0;
  415. healthButlerPop(function(data){
  416. if(data==1){
  417. that.bdAdvFeedback();
  418. clearInterval(that.$qconfig.healthTimer);
  419. }else{
  420. that.resetTimer();
  421. that.$showLoginPage();
  422. }
  423. });
  424. }
  425. this.$qconfig.healthSeconds++;
  426. //console.log("healthTimer tSeconds:"+this.$qconfig.healthSeconds);
  427. }, 1000);
  428. }
  429. }
  430. else{ //第二天,第三天,,
  431. healthButlerPop(function(data){
  432. if(data==1){
  433. clearInterval(that.$qconfig.healthTimer);
  434. }else{
  435. that.$showLoginPage();
  436. }
  437. });
  438. }
  439. },
  440. resetTimer(){
  441. clearInterval(this.$qconfig.healthTimer);
  442. this.$qconfig.healthTimer=null; //重置定时器
  443. this.$qconfig.healthSeconds=healthSeconds;
  444. },
  445. getUserInfo(healthButler){
  446. getUserInfo().then(res => {
  447. if(res.code==200){
  448. if(res.user!=null){
  449. uni.setStorageSync('userInfo',JSON.stringify(res.user));
  450. let userInfo=res.user;
  451. healthButler.isAddQw=userInfo.isAddQw;
  452. uni.setStorageSync("healthButler",JSON.stringify(healthButler));
  453. }
  454. }
  455. },
  456. rej => {}
  457. );
  458. },
  459. jumpToNotificationSettings() {
  460. uni.request({
  461. url: 'content://settings/action/notification_settings',
  462. success: function (res) {
  463. console.log('跳转成功:', res);
  464. },
  465. fail: function (err) {
  466. console.log('跳转失败:', err);
  467. }
  468. });
  469. },
  470. bdAdvFeedback(){
  471. // #ifdef APP-PLUS
  472. if(plus.runtime.isAgreePrivacy()) {
  473. if(plus.runtime.channel=="baidu"){
  474. let bdCmdType=uni.getStorageSync("bdCmdType");
  475. if(this.$isEmpty(bdCmdType)){
  476. this.$registerIdCode("goToQw",4,0);
  477. }
  478. }
  479. }
  480. // #endif
  481. },
  482. async checkPush1(){
  483. let result = await premissionCheck("PUSH");
  484. if(result == 1) {
  485. }
  486. // uPushPlugin.setCustomPushChannel({
  487. // soundName: "",
  488. // channelId: "133898",
  489. // channelDesc:"看课提醒",
  490. // enableLights:true,
  491. // enableVibration:true,
  492. // importance:4,
  493. // lockscreenVisibility:1
  494. // });
  495. // uPushPlugin.getAllChannels((p) => {
  496. // console.log("qxj push channels :" + JSON.stringify(p));//返回数组
  497. // });
  498. // const manager = uni.getChannelManager()
  499. // manager.setPushChannel({
  500. // "channelId":"Push",
  501. // "channelDesc":"消息推送",
  502. // "enableLights":true,
  503. // "importance":4,
  504. // "lockscreenVisibility":1
  505. // //soundName: "pushsound" // 已经把声音文件存储到/res/raw/pushsound.mp3
  506. // });
  507. },
  508. async checkPush(){
  509. //检测是否开启推送通知
  510. const notificationAuthorized = uni.getAppAuthorizeSetting().notificationAuthorized
  511. if(notificationAuthorized=='denied'){
  512. uni.showModal({
  513. title: '提示',
  514. content: '是否前往打开通知权限',
  515. success: res => {
  516. if (res.confirm) {
  517. let status = this.checkPermission();
  518. if (status !== 1) {
  519. console.log('未开启权限');
  520. }
  521. } else if (res.cancel) {
  522. console.log('用户点击取消');
  523. }
  524. }
  525. })
  526. }
  527. },
  528. async checkPermission() {
  529. let status = permision1.isIOS ? await permision1.requestIOS('push') :
  530. await permision1.requestAndroid('android.permission.REQUEST_NOTIFICATION_POLICY');
  531. if (status === null || status === 1) {
  532. status = 1;
  533. } else if (status === 2) {
  534. uni.showModal({
  535. content: "系统通知已关闭",
  536. confirmText: "确定",
  537. showCancel: false,
  538. success: function(res) {
  539. }
  540. })
  541. } else if (status.code) {
  542. uni.showModal({
  543. content: status.message
  544. })
  545. } else {
  546. uni.showModal({
  547. content: "需要通知权限",
  548. confirmText: "设置",
  549. success: function(res) {
  550. if (res.confirm) {
  551. permision1.gotoAppSetting();
  552. }
  553. }
  554. })
  555. }
  556. return status;
  557. },
  558. geth5Path() {
  559. getRealLinkDomainName().then(res=>{
  560. if(res.code == 200) {
  561. uni.setStorageSync('h5Path',res.data);
  562. }
  563. })
  564. },
  565. handlePushMessage(res) {
  566. const that = this
  567. if(res.type == 'click') {
  568. // 如果需要跳转app内指定页面,则自己实现下方的跳转代码。
  569. if(this.$isLogin()){
  570. const pages = getCurrentPages();
  571. const url = pages[ pages.length - 1];
  572. const isOnLaunch = uni.getStorageSync("onLaunch")
  573. // 判断前一个页面路径是一样
  574. const flag = pages&&url.route&&res.data.payload.url.indexOf(url.route)
  575. // console.log("点击===========",url.route,flag)
  576. if(isOnLaunch&&isOnLaunch==1) {
  577. uni.hideLoading({
  578. title: '处理中..'
  579. })
  580. setTimeout(()=>{
  581. uni.hideLoading()
  582. if(flag==-1) {
  583. uni.navigateTo({
  584. url: res.data.payload.url,
  585. success: function() {
  586. uni.removeStorageSync("openUrl")
  587. that.setReadAll(res.data.payload.url)
  588. }
  589. })
  590. }else {
  591. uni.redirectTo({
  592. url: res.data.payload.url,
  593. success: function() {
  594. uni.removeStorageSync("openUrl")
  595. that.setReadAll(res.data.payload.url)
  596. }
  597. })
  598. }
  599. },1000)
  600. } else {
  601. uni.hideLoading()
  602. if(flag==-1) {
  603. uni.navigateTo({
  604. url: res.data.payload.url,
  605. success: function() {
  606. uni.removeStorageSync("openUrl")
  607. that.setReadAll(res.data.payload.url)
  608. }
  609. })
  610. }else {
  611. uni.redirectTo({
  612. url: res.data.payload.url,
  613. success: function() {
  614. uni.removeStorageSync("openUrl")
  615. that.setReadAll(res.data.payload.url)
  616. }
  617. })
  618. }
  619. }
  620. }
  621. } else if(res.type == 'receive') {
  622. // 监听在线推送消息,若云函数设置了 "force_notification":true,则不会触发此 receive。
  623. }
  624. },
  625. // 系统通知全部已读
  626. setReadAll(url) {
  627. if(url&&url.indexOf("/pages/courseAnswer/index") == -1) {
  628. getPushLogRead([]).then(res=>{
  629. if(res.code == 200) {
  630. this.$updateMsgDot()
  631. }
  632. })
  633. }
  634. },
  635. // 获取剪贴板内容跳转到看课
  636. getClipboardData() {
  637. // #ifdef APP-PLUS
  638. console.log("获取剪贴板内容跳转到看课==========")
  639. const course = {
  640. }
  641. coursePopup(course,()=>{
  642. // uni.getClipboardData({
  643. // success: function (res) {
  644. // console.log("res.data===",res);
  645. // let Context = plus.android.importClass("android.content.Context");
  646. // let main = plus.android.runtimeMainActivity();
  647. // let clip = main.getSystemService(Context.CLIPBOARD_SERVICE);
  648. // plus.android.invoke(clip,"setText","");
  649. // }
  650. // });
  651. });
  652. // #endif
  653. }
  654. }
  655. };
  656. </script>
  657. <style lang="scss">
  658. /*每个页面公共css */
  659. @import "@/uni_modules/uview-plus/index.scss";
  660. /*#ifndef APP-NVUE*/
  661. view{
  662. box-sizing: border-box;
  663. }
  664. .ellipsis{
  665. overflow: hidden;
  666. text-overflow: ellipsis;
  667. white-space: nowrap;
  668. }
  669. .ellipsis2{
  670. overflow:hidden;
  671. text-overflow:ellipsis;
  672. display:-webkit-box;
  673. -webkit-box-orient:vertical;
  674. -webkit-line-clamp:2;
  675. }
  676. uni-modal {
  677. z-index: 1100;
  678. }
  679. // 猜你喜欢样式
  680. .like-box{
  681. display: flex;
  682. align-items: center;
  683. justify-content: center;
  684. image{
  685. height: 40upx;
  686. width: 40upx;
  687. }
  688. .text{
  689. font-size: 28upx;
  690. color: #000;
  691. font-weight: bold;
  692. margin: 0 10upx;
  693. }
  694. }
  695. .no-data-box{
  696. height:100%;
  697. width: 100%;
  698. display: flex;
  699. justify-content: center;
  700. align-items: center;
  701. flex-direction: column;
  702. image{
  703. width: 264upx;
  704. height: 212upx;
  705. }
  706. .empty-title{
  707. margin-top: 20rpx;
  708. font-size: 28rpx;
  709. color: gray;
  710. }
  711. }
  712. .doctor-box{
  713. margin-top: 15rpx;
  714. padding: 20rpx 0rpx 0rpx;
  715. display: flex;
  716. flex-direction: column;
  717. align-items: flex-start;
  718. justify-content: flex-start;
  719. .doctor{
  720. width: 100%;
  721. margin-bottom: 15rpx;
  722. background: #f9f8fe;
  723. padding: 15rpx;
  724. display: flex;
  725. flex-direction: column;
  726. align-items: flex-start;
  727. justify-content: flex-start;
  728. &:last-child{
  729. margin-bottom: 0rpx;
  730. }
  731. .item{
  732. width: 100%;
  733. display: flex;
  734. align-items: flex-start;
  735. justify-content: flex-start;
  736. .left{
  737. .head-box{
  738. width:92rpx;
  739. height:92rpx;
  740. position: relative;
  741. .isline{
  742. width:92rpx;
  743. height:92rpx;
  744. border-radius: 50%;
  745. border: 2rpx solid #E69A22;
  746. display: flex;
  747. align-items: center;
  748. justify-content: center;
  749. position: absolute;
  750. bottom: 0rpx;
  751. .img{
  752. position: absolute;
  753. bottom: 1rpx;
  754. width:75rpx;
  755. height:35rpx;
  756. image{
  757. width:75rpx;
  758. height:35rpx;
  759. }
  760. .name{
  761. width:75rpx;
  762. height:35rpx;
  763. bottom: -3rpx;
  764. text-align: center;
  765. position: absolute;
  766. font-size: 16upx;
  767. font-family: PingFang SC;
  768. font-weight: bold;
  769. color: #ffffff;
  770. }
  771. }
  772. }
  773. .doc-img{
  774. border-radius: 50%;
  775. width:100%;
  776. height:100%;
  777. }
  778. }
  779. }
  780. .right{
  781. width: calc(100% - 100rpx);
  782. margin-left: 20rpx;
  783. display: flex;
  784. flex-direction: column;
  785. align-items: flex-start;
  786. justify-content: flex-start;
  787. .doc-box{
  788. display: flex;
  789. align-items: center;
  790. justify-content: space-between;
  791. .doc-name{
  792. font-size: 32upx;
  793. font-family: PingFang SC;
  794. font-weight: bold;
  795. color: #111111;
  796. }
  797. .doc-position{
  798. margin-left: 16rpx;
  799. font-size: 26upx;
  800. font-weight: bold;
  801. font-family: PingFang SC;
  802. color: #2A2B2E;
  803. }
  804. .doc-dept{
  805. margin-left: 16rpx;
  806. font-size: 26upx;
  807. font-weight: bold;
  808. font-family: PingFang SC;
  809. color: #2A2B2E;
  810. }
  811. }
  812. .hospital-box{
  813. display: flex;
  814. align-items: center;
  815. justify-content: flex-start;
  816. margin-top: 10rpx;
  817. .tag{
  818. display: flex;
  819. align-items: center;
  820. justify-content: center;
  821. background-color: #4FC06B;
  822. border-radius: 10rpx;
  823. padding: 5rpx 10rpx;
  824. font-size: 20upx;
  825. font-weight: bold;
  826. font-family: PingFang SC;
  827. color: #ffffff;
  828. }
  829. .name{
  830. margin-left: 6rpx;
  831. font-size: 26upx;
  832. font-weight: bold;
  833. font-family: PingFang SC;
  834. color: #2A2B2E;
  835. }
  836. }
  837. .doc-spec{
  838. width: 100%;
  839. display: flex;
  840. align-items: center;
  841. justify-content: flex-start;
  842. margin-top: 15rpx;
  843. .spec{
  844. font-size: 26upx;
  845. font-family: PingFang SC;
  846. color: #626468;
  847. }
  848. }
  849. .doc-count{
  850. margin-top: 15rpx;
  851. display: flex;
  852. align-items: center;
  853. justify-content: flex-start;
  854. .name{
  855. font-size: 24upx;
  856. font-family: PingFang SC;
  857. color: #9B9B9B;
  858. }
  859. .count{
  860. margin: 0rpx 5rpx;
  861. font-size: 24upx;
  862. font-family: PingFang SC;
  863. color: #2A2B2E;
  864. }
  865. }
  866. .doc-price{
  867. width: 100%;
  868. margin-top: 15rpx;
  869. display: flex;
  870. align-items: center;
  871. justify-content: flex-start;
  872. .btn{
  873. display: flex;
  874. align-items: center;
  875. justify-content: center;
  876. background-color: #FEEFD7;
  877. padding: 15rpx 30rpx;
  878. border-radius: 30rpx;
  879. font-size: 26upx;
  880. font-family: PingFang SC;
  881. color: #E69A22;
  882. }
  883. }
  884. }
  885. }
  886. }
  887. }
  888. /*#endif*/
  889. </style>
  890. <style lang="less">
  891. /*每个页面公共css */
  892. // @import './assets/iconfont/iconfont.css';
  893. @import './assets/css/common.less';
  894. /* 全局flex样式 */
  895. @import './common/css/flexCommon.css';
  896. /*引入全局补充样式*/
  897. @import './assets/css/czy/es.1.base.css';
  898. @import './assets/css/czy/es.2.color.css';
  899. @import './assets/css/czy/es.3.icon.css';
  900. @import './assets/css/czy/es.4.view.css';
  901. .textOne {
  902. overflow: hidden;
  903. white-space: nowrap;
  904. text-overflow: ellipsis;
  905. }
  906. .textTwo {
  907. overflow: hidden;
  908. text-overflow: ellipsis;
  909. display: -webkit-box;
  910. -webkit-line-clamp: 2;
  911. -webkit-box-orient: vertical;
  912. }
  913. </style>