App.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745
  1. <script>
  2. export default {
  3. onLaunch: function () {
  4. uni.removeStorageSync('web_config')
  5. // #ifdef APP-PLUS
  6. // 初始化极光推送
  7. this.initJPush()
  8. // #endif
  9. let that = this;
  10. this.$queue.connectSocket()
  11. that.$queue.changeTabbar(that.$queue.getData('userType')||1)
  12. uni.removeStorageSync('filter')
  13. // #ifdef APP || H5
  14. uni.setStorageSync("isDial", false);
  15. setInterval(() => {
  16. // #ifdef H5 || APP
  17. let userId = uni.getStorageSync("userId");
  18. if (uni.getStorageSync("token")) {
  19. that.$Request.get("/app/chat/selectUserChatVideo").then((res) => {
  20. if (res.code == 0 && res.data) {
  21. // videoStatus 状态 1是发起 2是通话中 3是已取消 4是已拒绝 5是已结束 不过他只会返回1和2
  22. if (res.data.videoStatus) {
  23. console.log(res.data);
  24. uni.setStorageSync("videoStatus", res.data.videoStatus);
  25. uni.setStorageSync("messageType", res.data.messageType); //4视频通话 5语音通话
  26. if (res.data.videoStatus == 1) {
  27. console.log(uni.getStorageSync("isDial"));
  28. if (!uni.getStorageSync("isDial")) {
  29. uni.setStorageSync("isDial", true); //跳转通话页面 做标识 true 已跳转 false 未跳转
  30. uni.navigateTo({
  31. url:
  32. "/my/videoVoice/videoVoice?byUserId=" +
  33. res.data.userId +
  34. "&chatContentId=" +
  35. res.data.chatContentId +
  36. "&isRol=2&messageType=" +
  37. res.data.messageType +
  38. "&chatConversationId=" +
  39. res.data.chatConversationId +
  40. "&postPushId=" +
  41. res.data.postPushId +
  42. "&resumesId=" +
  43. res.data.resumesId +
  44. "&userType=" +
  45. res.data.userType,
  46. });
  47. }
  48. }
  49. }
  50. } else {
  51. uni.setStorageSync("videoStatus", 4);
  52. }
  53. });
  54. }
  55. // #endif
  56. }, 5000);
  57. // #endif
  58. // #ifdef MP-WEIXIN
  59. if (!uni.getStorageSync("token")) {
  60. uni.login({
  61. provider: "weixin",
  62. success: function (loginRes) {
  63. console.log(loginRes, "************");
  64. let data = {
  65. code: loginRes.code,
  66. };
  67. that.$Request.get("/app/Login/wxLogin", data).then((res) => {
  68. if (res.code == 0) {
  69. uni.setStorageSync("openId", res.data.open_id);
  70. uni.setStorageSync("unionId", res.data.unionId);
  71. uni.setStorageSync("sessionkey", res.data.session_key);
  72. let inviterCode = "";
  73. if (uni.getStorageSync("inviterCode")) {
  74. inviterCode = uni.getStorageSync("inviterCode");
  75. }
  76. let sendData = {
  77. openId: uni.getStorageSync("openId"),
  78. unionId: uni.getStorageSync("unionId"),
  79. userName: "游客",
  80. avatar: "",
  81. sex: "1", //性别
  82. inviterCode: inviterCode, //别人登录进来携带你的邀请码
  83. };
  84. let phoneNum = false;
  85. uni.setStorageSync("sendDataList", sendData);
  86. that.$Request.getT("/app/common/type/188").then((ret) => {
  87. if (ret.code == 0) {
  88. if (ret.data && ret.data.value && ret.data.value == "是") {
  89. phoneNum = true;
  90. let flag = res.data.flag;
  91. if (flag == "2" && phoneNum) {
  92. //需要授权手机号则走手机号授权
  93. uni.setStorageSync("weixinPhone", true);
  94. } else {
  95. //不需要手机号则则直接走授权登录
  96. uni.setStorageSync("weixinPhone", false);
  97. }
  98. } else {
  99. uni.setStorageSync("weixinPhone", false);
  100. }
  101. }
  102. });
  103. }
  104. });
  105. },
  106. });
  107. }
  108. // #endif
  109. setInterval((d) => {
  110. //定时器,定时去调取聊天未读消息
  111. let userId = uni.getStorageSync("userId");
  112. let token = uni.getStorageSync('token')
  113. if (userId && token) {
  114. this.$Request.get("/app/chat/selectChatCount").then((res) => {
  115. if (res.code === 0) {
  116. let chatCount = res.data.chatCount;
  117. let messageCount = res.data.messageCount;
  118. uni.setStorageSync("messageCount", messageCount);
  119. // #ifdef APP-PLUS
  120. plus.runtime.setBadgeNumber(chatCount + messageCount)
  121. // #endif
  122. uni.$emit('chatUnreadCount', chatCount || 0)
  123. let num = chatCount + messageCount;
  124. if (num == 0) {
  125. uni.removeTabBarBadge({
  126. index: 2,
  127. });
  128. return;
  129. }
  130. uni.setTabBarBadge({
  131. index: 2,
  132. text: num + "",
  133. });
  134. }
  135. });
  136. }
  137. }, 6000);
  138. //#ifdef APP-PLUS
  139. // APP检测更新 具体打包流程可以参考:https://ask.dcloud.net.cn/article/35667
  140. plus.screen.lockOrientation("portrait-primary"); //竖屏正方向锁定
  141. //获取是否热更新过
  142. const updated = uni.getStorageSync("updated"); // 尝试读取storage
  143. if (updated.completed === true) {
  144. // 如果上次刚更新过
  145. // 删除安装包及安装记录
  146. console.log("安装记录被删除,更新成功");
  147. uni.removeSavedFile({
  148. filePath: updated.packgePath,
  149. success: (res) => {
  150. uni.removeStorageSync("updated");
  151. },
  152. });
  153. } else if (updated.completed === false) {
  154. console.log('安装未完成,继续安装')
  155. uni.removeStorageSync("updated");
  156. plus.runtime.install(updated.packgePath, {
  157. force: true,
  158. });
  159. uni.setStorage({
  160. key: "updated",
  161. data: {
  162. completed: true,
  163. packgePath: updated.packgePath,
  164. },
  165. success: (res) => {
  166. console.log("成功安装上次的更新,应用需要重启才能继续完成");
  167. },
  168. });
  169. uni.showModal({
  170. title: "温馨提示",
  171. content: "应用将重启以完成更新",
  172. showCancel: false,
  173. complete: () => {
  174. plus.runtime.restart();
  175. },
  176. });
  177. } else {
  178. console.log('获取当前系统版本信息')
  179. //获取当前系统版本信息
  180. plus.runtime.getProperty(plus.runtime.appid, (widgetInfo) => {
  181. //请求后台接口 解析数据 对比版本
  182. that.$Request.getT("/app/user/selectNewApp").then((res) => {
  183. res = res.data[0];
  184. console.log('当前版本:',widgetInfo.version+'线上版本:'+res.version)
  185. if (res.wgtUrl && widgetInfo.version < res.version) {
  186. console.log('进入更新逻辑')
  187. let downloadLink = "";
  188. let androidLink = res.androidWgtUrl;
  189. let iosLink = res.iosWgtUrl;
  190. let ready = false;
  191. //校验是是不是热更新
  192. if (res.wgtUrl.match(RegExp(/.wgt/))) {
  193. // 判断系统类型
  194. if (plus.os.name.toLowerCase() === "android") {
  195. console.log("安卓系统");
  196. if (androidLink && androidLink !== "#") {
  197. // 我这里默认#也是没有地址,请根据业务自行修改
  198. console.log("发现下载地址");
  199. // 安卓:创建下载任务
  200. if (androidLink.match(RegExp(/.wgt/))) {
  201. console.log("确认wgt热更新包");
  202. downloadLink = androidLink;
  203. ready = true;
  204. } else {
  205. console.log("安卓推荐.wgt强制更新,.apk的强制更新请您自行修改程序");
  206. }
  207. } else {
  208. console.log("下载地址是空的,无法继续");
  209. }
  210. } else {
  211. console.log("苹果系统");
  212. if (iosLink && iosLink !== "#") {
  213. // 我这里默认#也是没有地址,请根据业务自行修改
  214. console.log("发现下载地址");
  215. // 苹果(A):进行热更新(如果iosLink是wgt更新包的下载地址)判断文件名中是否含有.wgt
  216. if (iosLink.match(RegExp(/.wgt/))) {
  217. console.log("确认wgt热更新包");
  218. downloadLink = iosLink;
  219. ready = true;
  220. } else {
  221. console.log("苹果只支持.wgt强制更新");
  222. }
  223. } else {
  224. console.log("下载地址是空的,无法继续");
  225. }
  226. }
  227. if (ready) {
  228. console.log("任务开始");
  229. let downloadTask = uni.downloadFile({
  230. url: downloadLink,
  231. success: (res) => {
  232. if (res.statusCode === 200) {
  233. // 保存下载的安装包
  234. console.log("保存安装包");
  235. uni.saveFile({
  236. tempFilePath: res.tempFilePath,
  237. success: (res) => {
  238. const packgePath = res.savedFilePath;
  239. // 保存更新记录到stroage,下次启动app时安装更新
  240. if(true){
  241. console.log('直接进行安装')
  242. uni.removeStorageSync("updated");
  243. plus.runtime.install(packgePath, {
  244. force: true,
  245. }, (res) => {
  246. console.log('安装成功', res)
  247. }, (err) => {
  248. console.log('安装失败', err)
  249. });
  250. uni.setStorage({
  251. key: "updated",
  252. data: {
  253. completed: true,
  254. packgePath: packgePath,
  255. },
  256. success: (res) => {
  257. console.log("成功安装上次的更新,应用需要重启才能继续完成");
  258. },
  259. });
  260. uni.showModal({
  261. title: "温馨提示",
  262. content: "应用将重启以完成更新",
  263. showCancel: false,
  264. complete: () => {
  265. plus.runtime.restart();
  266. },
  267. });
  268. }else{
  269. uni.setStorage({
  270. key: "updated",
  271. data: {
  272. completed: false,
  273. packgePath: packgePath,
  274. },
  275. success: () => {
  276. console.log("成功保存记录");
  277. },
  278. });
  279. }
  280. // 任务完成,关闭下载任务
  281. console.log(
  282. "任务完成,关闭下载任务,下一次启动应用时将安装更新"
  283. );
  284. downloadTask.abort();
  285. downloadTask = null;
  286. },
  287. });
  288. }
  289. },
  290. });
  291. } else {
  292. console.log("下载地址未准备,无法开启下载任务");
  293. }
  294. } else {
  295. //不是热更新是在线更新 校验是否强制升级
  296. if (res.method == "true") {
  297. uni.showModal({
  298. showCancel: false,
  299. confirmText: "立即更新",
  300. title: "发现新版本",
  301. content: res.des,
  302. success: (res) => {
  303. if (res.confirm) {
  304. that.$queue.showLoading("下载中...");
  305. if (uni.getSystemInfoSync().platform == "android") {
  306. uni.downloadFile({
  307. url: androidLink,
  308. success: (downloadResult) => {
  309. if (downloadResult.statusCode === 200) {
  310. plus.runtime.install(
  311. downloadResult.tempFilePath,
  312. {
  313. force: false,
  314. },
  315. (d) => {
  316. console.log("install success...");
  317. plus.runtime.restart();
  318. },
  319. (e) => {
  320. console.error("install fail...");
  321. }
  322. );
  323. }
  324. },
  325. });
  326. }
  327. if (uni.getSystemInfoSync().platform == "ios") {
  328. plus.runtime.openURL(iosLink, function (res) {});
  329. }
  330. } else if (res.cancel) {
  331. console.log("取消");
  332. }
  333. },
  334. });
  335. } else {
  336. uni.showModal({
  337. title: "发现新版本",
  338. confirmText: "立即更新",
  339. cancelText: "下次更新",
  340. content: res.des,
  341. success: (res) => {
  342. if (res.confirm) {
  343. that.$queue.showLoading("下载中...");
  344. if (uni.getSystemInfoSync().platform == "android") {
  345. uni.downloadFile({
  346. url: androidLink,
  347. success: (downloadResult) => {
  348. if (downloadResult.statusCode === 200) {
  349. plus.runtime.install(
  350. downloadResult.tempFilePath,
  351. {
  352. force: false,
  353. },
  354. (d) => {
  355. console.log("install success...");
  356. plus.runtime.restart();
  357. },
  358. (e) => {
  359. console.error("install fail...");
  360. }
  361. );
  362. }
  363. },
  364. });
  365. }
  366. if (uni.getSystemInfoSync().platform == "ios") {
  367. plus.runtime.openURL(iosLink, function (res) {});
  368. }
  369. } else if (res.cancel) {
  370. console.log("取消");
  371. }
  372. },
  373. });
  374. }
  375. }
  376. }
  377. });
  378. });
  379. }
  380. //#endif
  381. // #ifdef APP-PLUS
  382. // 检查是否首次启动 - 引导页逻辑
  383. let firstUpload = uni.getStorageSync("firstUpload") || false;
  384. let token = this.$queue.getData('token')
  385. let userType = this.$queue.getData('userType')
  386. let companyStatus = this.$queue.getData('companyStatus')
  387. if (!firstUpload) {
  388. // 跳转到引导页
  389. uni.reLaunch({
  390. url: "/pages/my/jobApplicant/startPage",
  391. success: () => {
  392. // 标记已经显示过引导页
  393. uni.setStorageSync("firstUpload", true);
  394. }
  395. });
  396. // 这里需要return,避免执行后面的代码
  397. return;
  398. } else if (
  399. token &&
  400. (!userType || (userType == 2 && companyStatus != 2))
  401. ) {
  402. // 有登录token,但是没有userType,跳转选择角色页面,强制用户选择
  403. // 有登录token,并且userType为2,但是公司状态没有通过
  404. uni.reLaunch({
  405. url: '/pages/my/jobApplicant/guidePage',
  406. })
  407. return
  408. } else if (token && userType) {
  409. // 已经登录,且有userType
  410. uni.reLaunch({
  411. url: '/pages/index/index',
  412. })
  413. }
  414. // #endif
  415. },
  416. onShow: function () {
  417. // uni.removeStorageSync('firstLogin');
  418. // uni.removeStorageSync('firstUpload');
  419. //关键词过滤 602
  420. this.$Request.getT("/app/common/type/602").then((res) => {
  421. if (res.code == 0) {
  422. if (res.data && res.data.value) {
  423. this.$queue.setData("chatSearchKeys", res.data.value);
  424. }
  425. }
  426. });
  427. // 小程序是否上线
  428. // this.$Request.get('/app/common/type/238').then(res => {
  429. // if (res.code == 0) {
  430. // // #ifdef MP-WEIXIN
  431. // this.$queue.setData('XCXIsSelect', res.data.value);
  432. // // #endif
  433. // // #ifndef MP-WEIXIN
  434. // this.$queue.setData('XCXIsSelect', '是');
  435. // // #endif
  436. // }
  437. // });
  438. this.$Request.get("/app/common/type/257").then((res) => {
  439. if (res.code == 0) {
  440. // #ifdef MP-WEIXIN
  441. this.$queue.setData("XCXIsSelect", res.data.value);
  442. // #endif
  443. // #ifndef MP-WEIXIN
  444. this.$queue.setData("XCXIsSelect", "是");
  445. // #endif
  446. }
  447. });
  448. //用户客服
  449. // 企业微信链接 274
  450. this.$Request.get("/app/common/type/322").then((res) => {
  451. if (res.code == 0) {
  452. this.$queue.setData("kefu", res.data.value);
  453. }
  454. });
  455. // 企业微信客服APPID 275
  456. this.$Request.get("/app/common/type/324").then((res) => {
  457. if (res.code == 0) {
  458. this.$queue.setData("kefuAppid", res.data.value);
  459. }
  460. });
  461. //企业端客服
  462. this.$Request.get("/app/common/type/321").then((res) => {
  463. if (res.code == 0) {
  464. this.$queue.setData("kefuq", res.data.value);
  465. }
  466. });
  467. // 企业微信客服APPID 275
  468. this.$Request.get("/app/common/type/323").then((res) => {
  469. if (res.code == 0) {
  470. this.$queue.setData("kefuAppidq", res.data.value);
  471. }
  472. });
  473. // 企业会员每天免费联系次数 421
  474. this.$Request.get("/app/common/type/421").then((res) => {
  475. if (res.code == 0) {
  476. this.$queue.setData("vipMsgNum", res.data.value);
  477. }
  478. });
  479. // 企业非会员每天免费联系次数 422
  480. this.$Request.get("/app/common/type/422").then((res) => {
  481. if (res.code == 0) {
  482. this.$queue.setData("msgNum", res.data.value);
  483. }
  484. });
  485. // 企业会员每次联系价格 419
  486. this.$Request.get("/app/common/type/419").then((res) => {
  487. if (res.code == 0) {
  488. this.$queue.setData("vipMsgPrice", res.data.value);
  489. }
  490. });
  491. // 企业非会员每次联系价格 420
  492. this.$Request.get("/app/common/type/420").then((res) => {
  493. if (res.code == 0) {
  494. this.$queue.setData("msgPrice", res.data.value);
  495. }
  496. });
  497. //腾讯云实时语音SDKAppID
  498. this.$Request.get("/app/common/type/814").then((res) => {
  499. if (res.code == 0) {
  500. uni.setStorageSync("sdkAppId", res.data.value);
  501. }
  502. });
  503. console.log("App Show");
  504. // #ifdef H5
  505. // let sysTem = uni.getSystemInfoSync()
  506. // if (sysTem.model == 'PC') { //如果是pc访问移动端域名
  507. // this.$Request.get('/app/common/type/432').then(res => {
  508. // if (res.code == 0) {
  509. // if (res.data.value == '是') {
  510. // this.$Request.get('/app/common/type/433').then(ree => {
  511. // if (ree.code == 0) {
  512. // if (ree.data.value) {
  513. // window.location.href = ree.data.value;
  514. // }
  515. // }
  516. // })
  517. // }
  518. // }
  519. // })
  520. // }
  521. // #endif
  522. // #ifdef APP-PLUS
  523. if (uni.getSystemInfoSync().platform == "android") {
  524. let clientid = plus.push.getClientInfo().clientid;
  525. let userId = this.$queue.getData("userId");
  526. if (userId) {
  527. this.$Request
  528. .postT("/app/user/updateClientId?clientId=" + clientid + "&userId=" + userId)
  529. .then((res) => {});
  530. }
  531. }
  532. //#endif
  533. //#ifdef H5
  534. let isopen = false;
  535. this.$Request.get("/app/common/type/237").then((res) => {
  536. if (res.data.value == "是") {
  537. isopen = true;
  538. }
  539. });
  540. if (isopen) {
  541. let ua = navigator.userAgent.toLowerCase();
  542. if (ua.indexOf("micromessenger") !== -1) {
  543. let openid = uni.getStorageSync("openid");
  544. let userId = uni.getStorageSync("userId");
  545. let that = this;
  546. if (!openid) {
  547. if (
  548. window.location.href.indexOf("?code=") !== -1 ||
  549. window.location.href.indexOf("&code=") !== -1
  550. ) {
  551. let code;
  552. if (window.location.href.indexOf("?code=") !== -1) {
  553. code = window.location.href.split("?code=")[1].split("&")[0];
  554. } else {
  555. code = window.location.href.split("&code=")[1].split("&")[0];
  556. }
  557. this.$Request.get("/app/Login/getOpenId?code=" + code).then((ret) => {
  558. uni.setStorageSync("openId", ret.data);
  559. this.$Request
  560. .get("/app/Login/openid/login?openId=" + ret.data)
  561. .then((res) => {
  562. this.$queue.setData("userId", res.user.userId);
  563. this.$queue.setData("token", res.token);
  564. this.$queue.setData("phone", res.user.phone);
  565. this.$queue.setData("userName", res.user.userName);
  566. this.$queue.setData("avatar", res.user.avatar);
  567. this.$queue.setData("invitationCode", res.user.invitationCode);
  568. this.$queue.setData("inviterCode", res.user.inviterCode);
  569. });
  570. });
  571. } else {
  572. this.$Request.get("/app/common/type/108").then((res) => {
  573. if (res.data.value == "是") {
  574. window.location.href =
  575. "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" +
  576. that.$queue.getWxAppid() +
  577. "&redirect_uri=" +
  578. window.location.href.split("#")[0] +
  579. "&response_type=code&scope=snsapi_userinfo#wechat_redirect";
  580. }
  581. });
  582. }
  583. }
  584. if (userId && openid) {
  585. this.$Request
  586. .get("/app/Login/bindOpenId?userId=" + userId + "&openId=" + openid)
  587. .then((res) => {
  588. });
  589. }
  590. }
  591. }
  592. //#endif
  593. },
  594. onHide: function () {
  595. console.log("App Hide");
  596. },
  597. methods: {
  598. // 初始化极光推送
  599. initJPush() {
  600. // 确保在App环境下执行(H5/小程序不支持)
  601. if (uni.getSystemInfoSync().platform === 'android' || uni.getSystemInfoSync().platform === 'ios') {
  602. const jpushModule = uni.requireNativePlugin('JG-JPush')
  603. if (!jpushModule) {
  604. console.error('极光推送插件未找到,请检查导入和调试基座')
  605. return;
  606. }
  607. jpushModule.initJPushService()
  608. // 监听:点击通知(用户点击通知栏的通知)
  609. jpushModule.addNotificationListener((res) => {
  610. console.log('点击了通知:', res)
  611. // 可在这里跳转到指定页面(比如根据通知的extra参数跳转)
  612. if (res.notificationEventType == 'notificationOpened' && res.extras && res.extras.page) {
  613. // tab页面
  614. // /pages/index/index
  615. // /pages/talentSearch/index
  616. // /pages/index/game/gameList
  617. // /pages/msg/index
  618. // /pages/my/index
  619. const tabPages = [
  620. '/pages/index/index',
  621. '/pages/talentSearch/index',
  622. '/pages/index/game/gameList',
  623. '/pages/msg/index',
  624. '/pages/my/index'
  625. ]
  626. setTimeout(() => {
  627. if (tabPages.includes(res.extras?.page)) {
  628. uni.switchTab({
  629. url: res.extras.page // 例如:/pages/detail/detail?id=123
  630. })
  631. } else {
  632. uni.navigateTo({
  633. url: res.extras.page
  634. })
  635. }
  636. }, 500)
  637. }
  638. })
  639. const saveRid = (rid) => {
  640. if (!rid) return false
  641. this.$queue.setData('registerID', rid)
  642. console.log('jpushModule registerID:', rid)
  643. return true
  644. }
  645. const tryGetRid = (maxTry = 12) => {
  646. let n = 0
  647. const run = () => {
  648. jpushModule.getRegistrationID((res) => {
  649. console.log('获取设备ID', res)
  650. // 不同版本字段名可能不同,这里做兼容
  651. const rid = res?.registerID || res?.registrationID || res?.registrationId
  652. if (res?.code === 0 && saveRid(rid)) return
  653. n++
  654. if (n >= maxTry) {
  655. console.warn('jpushModule registerID empty after retry:', res)
  656. return
  657. }
  658. setTimeout(run, 400 * n) // 递增重试
  659. })
  660. }
  661. run()
  662. }
  663. jpushModule.addConnectEventListener && jpushModule.addConnectEventListener((result) => {
  664. console.log('jpushModule connect:', result)
  665. if (result.connectEnable) {
  666. tryGetRid(12)
  667. }
  668. })
  669. tryGetRid(12)
  670. // jpushModule.getRegistrationID((res) => {
  671. // if (res.code === 0) {
  672. // console.log('获取设备ID', res)
  673. // this.$queue.setData('registerID', res?.registerID || '')
  674. // } else {
  675. // console.error('获取RegistrationID失败:', res)
  676. // }
  677. // })
  678. }
  679. },
  680. }
  681. };
  682. </script>
  683. <style lang="scss">
  684. /*每个页面公共css */
  685. @import "uview-ui/index.scss";
  686. @import "components/colorui/main.css";
  687. @import "components/colorui/icon.css";
  688. page {
  689. background-color: #ffffff;
  690. color: #343546;
  691. }
  692. .bg {
  693. background-color: #f7f7f7;
  694. }
  695. /*文本省略*/
  696. .m-ellipsis {
  697. overflow: hidden;
  698. white-space: nowrap;
  699. text-overflow: ellipsis;
  700. }
  701. .m-ellipsis-l2,
  702. .m-ellipsis-l3 {
  703. display: -webkit-box;
  704. overflow: hidden;
  705. text-overflow: ellipsis;
  706. -webkit-box-orient: vertical;
  707. word-break: break-all;
  708. }
  709. .m-ellipsis-l2 {
  710. -webkit-line-clamp: 2;
  711. }
  712. .m-ellipsis-l3 {
  713. -webkit-line-clamp: 3;
  714. }
  715. .popup-content .popup-text-permission{
  716. padding: 100rpx;
  717. color: #343546;
  718. }
  719. </style>