App.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741
  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. });
  246. uni.setStorage({
  247. key: "updated",
  248. data: {
  249. completed: true,
  250. packgePath: packgePath,
  251. },
  252. success: (res) => {
  253. console.log("成功安装上次的更新,应用需要重启才能继续完成");
  254. },
  255. });
  256. uni.showModal({
  257. title: "温馨提示",
  258. content: "应用将重启以完成更新",
  259. showCancel: false,
  260. complete: () => {
  261. plus.runtime.restart();
  262. },
  263. });
  264. }else{
  265. uni.setStorage({
  266. key: "updated",
  267. data: {
  268. completed: false,
  269. packgePath: packgePath,
  270. },
  271. success: () => {
  272. console.log("成功保存记录");
  273. },
  274. });
  275. }
  276. // 任务完成,关闭下载任务
  277. console.log(
  278. "任务完成,关闭下载任务,下一次启动应用时将安装更新"
  279. );
  280. downloadTask.abort();
  281. downloadTask = null;
  282. },
  283. });
  284. }
  285. },
  286. });
  287. } else {
  288. console.log("下载地址未准备,无法开启下载任务");
  289. }
  290. } else {
  291. //不是热更新是在线更新 校验是否强制升级
  292. if (res.method == "true") {
  293. uni.showModal({
  294. showCancel: false,
  295. confirmText: "立即更新",
  296. title: "发现新版本",
  297. content: res.des,
  298. success: (res) => {
  299. if (res.confirm) {
  300. that.$queue.showLoading("下载中...");
  301. if (uni.getSystemInfoSync().platform == "android") {
  302. uni.downloadFile({
  303. url: androidLink,
  304. success: (downloadResult) => {
  305. if (downloadResult.statusCode === 200) {
  306. plus.runtime.install(
  307. downloadResult.tempFilePath,
  308. {
  309. force: false,
  310. },
  311. (d) => {
  312. console.log("install success...");
  313. plus.runtime.restart();
  314. },
  315. (e) => {
  316. console.error("install fail...");
  317. }
  318. );
  319. }
  320. },
  321. });
  322. }
  323. if (uni.getSystemInfoSync().platform == "ios") {
  324. plus.runtime.openURL(iosLink, function (res) {});
  325. }
  326. } else if (res.cancel) {
  327. console.log("取消");
  328. }
  329. },
  330. });
  331. } else {
  332. uni.showModal({
  333. title: "发现新版本",
  334. confirmText: "立即更新",
  335. cancelText: "下次更新",
  336. content: res.des,
  337. success: (res) => {
  338. if (res.confirm) {
  339. that.$queue.showLoading("下载中...");
  340. if (uni.getSystemInfoSync().platform == "android") {
  341. uni.downloadFile({
  342. url: androidLink,
  343. success: (downloadResult) => {
  344. if (downloadResult.statusCode === 200) {
  345. plus.runtime.install(
  346. downloadResult.tempFilePath,
  347. {
  348. force: false,
  349. },
  350. (d) => {
  351. console.log("install success...");
  352. plus.runtime.restart();
  353. },
  354. (e) => {
  355. console.error("install fail...");
  356. }
  357. );
  358. }
  359. },
  360. });
  361. }
  362. if (uni.getSystemInfoSync().platform == "ios") {
  363. plus.runtime.openURL(iosLink, function (res) {});
  364. }
  365. } else if (res.cancel) {
  366. console.log("取消");
  367. }
  368. },
  369. });
  370. }
  371. }
  372. }
  373. });
  374. });
  375. }
  376. //#endif
  377. // #ifdef APP-PLUS
  378. // 检查是否首次启动 - 引导页逻辑
  379. let firstUpload = uni.getStorageSync("firstUpload") || false;
  380. let token = this.$queue.getData('token')
  381. let userType = this.$queue.getData('userType')
  382. let companyStatus = this.$queue.getData('companyStatus')
  383. if (!firstUpload) {
  384. // 跳转到引导页
  385. uni.reLaunch({
  386. url: "/pages/my/jobApplicant/startPage",
  387. success: () => {
  388. // 标记已经显示过引导页
  389. uni.setStorageSync("firstUpload", true);
  390. }
  391. });
  392. // 这里需要return,避免执行后面的代码
  393. return;
  394. } else if (
  395. token &&
  396. (!userType || (userType == 2 && companyStatus != 2))
  397. ) {
  398. // 有登录token,但是没有userType,跳转选择角色页面,强制用户选择
  399. // 有登录token,并且userType为2,但是公司状态没有通过
  400. uni.reLaunch({
  401. url: '/pages/my/jobApplicant/guidePage',
  402. })
  403. return
  404. } else if (token && userType) {
  405. // 已经登录,且有userType
  406. uni.reLaunch({
  407. url: '/pages/index/index',
  408. })
  409. }
  410. // #endif
  411. },
  412. onShow: function () {
  413. // uni.removeStorageSync('firstLogin');
  414. // uni.removeStorageSync('firstUpload');
  415. //关键词过滤 602
  416. this.$Request.getT("/app/common/type/602").then((res) => {
  417. if (res.code == 0) {
  418. if (res.data && res.data.value) {
  419. this.$queue.setData("chatSearchKeys", res.data.value);
  420. }
  421. }
  422. });
  423. // 小程序是否上线
  424. // this.$Request.get('/app/common/type/238').then(res => {
  425. // if (res.code == 0) {
  426. // // #ifdef MP-WEIXIN
  427. // this.$queue.setData('XCXIsSelect', res.data.value);
  428. // // #endif
  429. // // #ifndef MP-WEIXIN
  430. // this.$queue.setData('XCXIsSelect', '是');
  431. // // #endif
  432. // }
  433. // });
  434. this.$Request.get("/app/common/type/257").then((res) => {
  435. if (res.code == 0) {
  436. // #ifdef MP-WEIXIN
  437. this.$queue.setData("XCXIsSelect", res.data.value);
  438. // #endif
  439. // #ifndef MP-WEIXIN
  440. this.$queue.setData("XCXIsSelect", "是");
  441. // #endif
  442. }
  443. });
  444. //用户客服
  445. // 企业微信链接 274
  446. this.$Request.get("/app/common/type/322").then((res) => {
  447. if (res.code == 0) {
  448. this.$queue.setData("kefu", res.data.value);
  449. }
  450. });
  451. // 企业微信客服APPID 275
  452. this.$Request.get("/app/common/type/324").then((res) => {
  453. if (res.code == 0) {
  454. this.$queue.setData("kefuAppid", res.data.value);
  455. }
  456. });
  457. //企业端客服
  458. this.$Request.get("/app/common/type/321").then((res) => {
  459. if (res.code == 0) {
  460. this.$queue.setData("kefuq", res.data.value);
  461. }
  462. });
  463. // 企业微信客服APPID 275
  464. this.$Request.get("/app/common/type/323").then((res) => {
  465. if (res.code == 0) {
  466. this.$queue.setData("kefuAppidq", res.data.value);
  467. }
  468. });
  469. // 企业会员每天免费联系次数 421
  470. this.$Request.get("/app/common/type/421").then((res) => {
  471. if (res.code == 0) {
  472. this.$queue.setData("vipMsgNum", res.data.value);
  473. }
  474. });
  475. // 企业非会员每天免费联系次数 422
  476. this.$Request.get("/app/common/type/422").then((res) => {
  477. if (res.code == 0) {
  478. this.$queue.setData("msgNum", res.data.value);
  479. }
  480. });
  481. // 企业会员每次联系价格 419
  482. this.$Request.get("/app/common/type/419").then((res) => {
  483. if (res.code == 0) {
  484. this.$queue.setData("vipMsgPrice", res.data.value);
  485. }
  486. });
  487. // 企业非会员每次联系价格 420
  488. this.$Request.get("/app/common/type/420").then((res) => {
  489. if (res.code == 0) {
  490. this.$queue.setData("msgPrice", res.data.value);
  491. }
  492. });
  493. //腾讯云实时语音SDKAppID
  494. this.$Request.get("/app/common/type/814").then((res) => {
  495. if (res.code == 0) {
  496. uni.setStorageSync("sdkAppId", res.data.value);
  497. }
  498. });
  499. console.log("App Show");
  500. // #ifdef H5
  501. // let sysTem = uni.getSystemInfoSync()
  502. // if (sysTem.model == 'PC') { //如果是pc访问移动端域名
  503. // this.$Request.get('/app/common/type/432').then(res => {
  504. // if (res.code == 0) {
  505. // if (res.data.value == '是') {
  506. // this.$Request.get('/app/common/type/433').then(ree => {
  507. // if (ree.code == 0) {
  508. // if (ree.data.value) {
  509. // window.location.href = ree.data.value;
  510. // }
  511. // }
  512. // })
  513. // }
  514. // }
  515. // })
  516. // }
  517. // #endif
  518. // #ifdef APP-PLUS
  519. if (uni.getSystemInfoSync().platform == "android") {
  520. let clientid = plus.push.getClientInfo().clientid;
  521. let userId = this.$queue.getData("userId");
  522. if (userId) {
  523. this.$Request
  524. .postT("/app/user/updateClientId?clientId=" + clientid + "&userId=" + userId)
  525. .then((res) => {});
  526. }
  527. }
  528. //#endif
  529. //#ifdef H5
  530. let isopen = false;
  531. this.$Request.get("/app/common/type/237").then((res) => {
  532. if (res.data.value == "是") {
  533. isopen = true;
  534. }
  535. });
  536. if (isopen) {
  537. let ua = navigator.userAgent.toLowerCase();
  538. if (ua.indexOf("micromessenger") !== -1) {
  539. let openid = uni.getStorageSync("openid");
  540. let userId = uni.getStorageSync("userId");
  541. let that = this;
  542. if (!openid) {
  543. if (
  544. window.location.href.indexOf("?code=") !== -1 ||
  545. window.location.href.indexOf("&code=") !== -1
  546. ) {
  547. let code;
  548. if (window.location.href.indexOf("?code=") !== -1) {
  549. code = window.location.href.split("?code=")[1].split("&")[0];
  550. } else {
  551. code = window.location.href.split("&code=")[1].split("&")[0];
  552. }
  553. this.$Request.get("/app/Login/getOpenId?code=" + code).then((ret) => {
  554. uni.setStorageSync("openId", ret.data);
  555. this.$Request
  556. .get("/app/Login/openid/login?openId=" + ret.data)
  557. .then((res) => {
  558. this.$queue.setData("userId", res.user.userId);
  559. this.$queue.setData("token", res.token);
  560. this.$queue.setData("phone", res.user.phone);
  561. this.$queue.setData("userName", res.user.userName);
  562. this.$queue.setData("avatar", res.user.avatar);
  563. this.$queue.setData("invitationCode", res.user.invitationCode);
  564. this.$queue.setData("inviterCode", res.user.inviterCode);
  565. });
  566. });
  567. } else {
  568. this.$Request.get("/app/common/type/108").then((res) => {
  569. if (res.data.value == "是") {
  570. window.location.href =
  571. "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" +
  572. that.$queue.getWxAppid() +
  573. "&redirect_uri=" +
  574. window.location.href.split("#")[0] +
  575. "&response_type=code&scope=snsapi_userinfo#wechat_redirect";
  576. }
  577. });
  578. }
  579. }
  580. if (userId && openid) {
  581. this.$Request
  582. .get("/app/Login/bindOpenId?userId=" + userId + "&openId=" + openid)
  583. .then((res) => {
  584. });
  585. }
  586. }
  587. }
  588. //#endif
  589. },
  590. onHide: function () {
  591. console.log("App Hide");
  592. },
  593. methods: {
  594. // 初始化极光推送
  595. initJPush() {
  596. // 确保在App环境下执行(H5/小程序不支持)
  597. if (uni.getSystemInfoSync().platform === 'android' || uni.getSystemInfoSync().platform === 'ios') {
  598. const jpushModule = uni.requireNativePlugin('JG-JPush')
  599. if (!jpushModule) {
  600. console.error('极光推送插件未找到,请检查导入和调试基座')
  601. return;
  602. }
  603. jpushModule.initJPushService()
  604. // 监听:点击通知(用户点击通知栏的通知)
  605. jpushModule.addNotificationListener((res) => {
  606. console.log('点击了通知:', res)
  607. // 可在这里跳转到指定页面(比如根据通知的extra参数跳转)
  608. if (res.notificationEventType == 'notificationOpened' && res.extras && res.extras.page) {
  609. // tab页面
  610. // /pages/index/index
  611. // /pages/talentSearch/index
  612. // /pages/index/game/gameList
  613. // /pages/msg/index
  614. // /pages/my/index
  615. const tabPages = [
  616. '/pages/index/index',
  617. '/pages/talentSearch/index',
  618. '/pages/index/game/gameList',
  619. '/pages/msg/index',
  620. '/pages/my/index'
  621. ]
  622. setTimeout(() => {
  623. if (tabPages.includes(res.extras?.page)) {
  624. uni.switchTab({
  625. url: res.extras.page // 例如:/pages/detail/detail?id=123
  626. })
  627. } else {
  628. uni.navigateTo({
  629. url: res.extras.page
  630. })
  631. }
  632. }, 500)
  633. }
  634. })
  635. const saveRid = (rid) => {
  636. if (!rid) return false
  637. this.$queue.setData('registerID', rid)
  638. console.log('jpushModule registerID:', rid)
  639. return true
  640. }
  641. const tryGetRid = (maxTry = 12) => {
  642. let n = 0
  643. const run = () => {
  644. jpushModule.getRegistrationID((res) => {
  645. console.log('获取设备ID', res)
  646. // 不同版本字段名可能不同,这里做兼容
  647. const rid = res?.registerID || res?.registrationID || res?.registrationId
  648. if (res?.code === 0 && saveRid(rid)) return
  649. n++
  650. if (n >= maxTry) {
  651. console.warn('jpushModule registerID empty after retry:', res)
  652. return
  653. }
  654. setTimeout(run, 400 * n) // 递增重试
  655. })
  656. }
  657. run()
  658. }
  659. jpushModule.addConnectEventListener && jpushModule.addConnectEventListener((result) => {
  660. console.log('jpushModule connect:', result)
  661. if (result.connectEnable) {
  662. tryGetRid(12)
  663. }
  664. })
  665. tryGetRid(12)
  666. // jpushModule.getRegistrationID((res) => {
  667. // if (res.code === 0) {
  668. // console.log('获取设备ID', res)
  669. // this.$queue.setData('registerID', res?.registerID || '')
  670. // } else {
  671. // console.error('获取RegistrationID失败:', res)
  672. // }
  673. // })
  674. }
  675. },
  676. }
  677. };
  678. </script>
  679. <style lang="scss">
  680. /*每个页面公共css */
  681. @import "uview-ui/index.scss";
  682. @import "components/colorui/main.css";
  683. @import "components/colorui/icon.css";
  684. page {
  685. background-color: #ffffff;
  686. color: #343546;
  687. }
  688. .bg {
  689. background-color: #f7f7f7;
  690. }
  691. /*文本省略*/
  692. .m-ellipsis {
  693. overflow: hidden;
  694. white-space: nowrap;
  695. text-overflow: ellipsis;
  696. }
  697. .m-ellipsis-l2,
  698. .m-ellipsis-l3 {
  699. display: -webkit-box;
  700. overflow: hidden;
  701. text-overflow: ellipsis;
  702. -webkit-box-orient: vertical;
  703. word-break: break-all;
  704. }
  705. .m-ellipsis-l2 {
  706. -webkit-line-clamp: 2;
  707. }
  708. .m-ellipsis-l3 {
  709. -webkit-line-clamp: 3;
  710. }
  711. .popup-content .popup-text-permission{
  712. padding: 100rpx;
  713. color: #343546;
  714. }
  715. </style>