Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

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