Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <script setup>
  2. import {
  3. request
  4. } from "@/utils/network/request.js"
  5. import {
  6. etcQYAction
  7. } from "@/utils/network/api.js"
  8. import {
  9. msg,
  10. } from "./utils/utils";
  11. import {
  12. getItem
  13. } from "./utils/storage";
  14. import {
  15. onLaunch,
  16. onShow,
  17. onLoad,
  18. onHide
  19. } from '@dcloudio/uni-app';
  20. onLaunch((option) => {
  21. console.log('App Launch', uni.getLaunchOptionsSync().path)
  22. // #ifdef MP-WEIXIN
  23. uni.setStorageSync("extraData", option.referrerInfo.extraData)
  24. //获取小程序更新机制兼容
  25. if (uni.canIUse('getUpdateManager')) {
  26. // pdateManager,用于管理小程序更新。
  27. const updateManager = uni.getUpdateManager();
  28. updateManager.onCheckForUpdate(function(res) {
  29. // 请求完新版本信息的回调
  30. if (res.hasUpdate) {
  31. updateManager.onUpdateReady(function() {
  32. uni.showModal({
  33. title: '更新提示',
  34. content: '新版本已经准备好,是否重启应用?',
  35. success: function(res) {
  36. if (res.confirm) {
  37. // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
  38. updateManager.applyUpdate()
  39. }
  40. }
  41. })
  42. });
  43. updateManager.onUpdateFailed(function() {
  44. // 新的版本下载失败
  45. uni.showModal({
  46. title: '已经有新版本了哟~',
  47. content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~',
  48. showCancel: false,
  49. confirmText: '我知道了'
  50. })
  51. });
  52. }
  53. });
  54. } else {
  55. // 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示
  56. uni.showModal({
  57. title: '提示',
  58. content: '当前微信版本过低,无法更好体验程序,请升级到最新微信版本后重试。',
  59. showCancel: false,
  60. confirmText: '我知道了'
  61. });
  62. }
  63. // #endif
  64. });
  65. onShow((option) => {
  66. console.log(option);
  67. // #ifdef MP-WEIXIN
  68. if (option && option.scene === 1038) {
  69. // 场景值1038:从被打开的小程序返回
  70. const {
  71. appId,
  72. extraData
  73. } = option.referrerInfo;
  74. if (appId == "wxbcad394b3d99dac9") {
  75. console.log(getItem("QYorder"));
  76. const orders = getItem("QYorder")
  77. // appId为wxbcad394b3d99dac9:从车主小程序跳转回来
  78. // TODO
  79. // 客户端小程序不确定授权结果,需要发起‘查询车牌服务开通信息’确认授权结果
  80. var data = {
  81. orderId: orders.orderId,
  82. subOpenId: orders.openid,
  83. };
  84. const options = {
  85. type: 2,
  86. data: data,
  87. method: "POST",
  88. showLoading: true,
  89. };
  90. request(etcQYAction, options).then((res) => {
  91. console.log(res);
  92. msg("授权成功");
  93. //如果我当前路由是签约页面才能跳转
  94. let routes = getCurrentPages();
  95. let curRoute = routes[routes.length - 1].route
  96. console.log(curRoute)
  97. if (curRoute === 'applyCard/sign-up') {
  98. uni.navigateTo({
  99. url: `/applyCard/product-detail?orderId=${orders.orderId}&&clientFee=${getItem("clientFee")}&&id=${getItem("productId")}`,
  100. });
  101. }
  102. if (curRoute === 'pages/app/sign') {
  103. //扫描签约成功
  104. uni.switchTab({
  105. url: "/pages/index/index"
  106. })
  107. }
  108. });
  109. return;
  110. }
  111. }
  112. // #endif
  113. console.log(option);
  114. });
  115. onLoad((option) => {
  116. console.log(option)
  117. });
  118. onHide((option) => {
  119. console.log(option)
  120. });
  121. </script>
  122. <style lang="scss">
  123. /*每个页面公共css */
  124. @import './static/css/common.scss';
  125. // @import './uni_modules/vk-uview-ui/index.scss';
  126. page {
  127. font-family: "Microsoft Yahei";
  128. // filter: grayscale(1)
  129. }
  130. </style>