You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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