Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

App.vue 3.5KB

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