Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

App.vue 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. console.log("App Launch", uni.getLaunchOptionsSync().path);
  15. // #ifdef MP-WEIXIN
  16. //获取小程序更新机制兼容
  17. if (uni.canIUse("getUpdateManager")) {
  18. // pdateManager,用于管理小程序更新。
  19. const updateManager = uni.getUpdateManager();
  20. updateManager.onCheckForUpdate(function (res) {
  21. // 请求完新版本信息的回调
  22. if (res.hasUpdate) {
  23. updateManager.onUpdateReady(function () {
  24. uni.showModal({
  25. title: "更新提示",
  26. content: "新版本已经准备好,是否重启应用?",
  27. success: function (res) {
  28. if (res.confirm) {
  29. // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
  30. updateManager.applyUpdate();
  31. }
  32. },
  33. });
  34. });
  35. updateManager.onUpdateFailed(function () {
  36. // 新的版本下载失败
  37. uni.showModal({
  38. title: "已经有新版本了哟~",
  39. content: "新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~",
  40. showCancel: false,
  41. confirmText: "我知道了",
  42. });
  43. });
  44. }
  45. });
  46. } else {
  47. // 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示
  48. uni.showModal({
  49. title: "提示",
  50. content:
  51. "当前微信版本过低,无法更好体验程序,请升级到最新微信版本后重试。",
  52. showCancel: false,
  53. confirmText: "我知道了",
  54. });
  55. }
  56. // #endif
  57. this.globalParam();
  58. },
  59. onShow: function (option) {
  60. console.log(option);
  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. console.log(option);
  108. console.log("进入主视图");
  109. },
  110. onHide: function () {
  111. console.log("App Hide");
  112. },
  113. methods:{
  114. globalParam(){
  115. const options = {
  116. type: 2,
  117. data: {
  118. "loginSource":"69af303ba2eb4608a099163f0d2a5dbd"
  119. },
  120. method: "POST",
  121. showLoading: true,
  122. };
  123. request(getGlobalParam, options).then((res) => {
  124. const result = stringToJson(res.bizContent);
  125. setItem('globalParam', result.data)
  126. this.getGlobalParam();
  127. // getItem("globalParam")
  128. console.log("配置",result);
  129. });
  130. },
  131. getGlobalParam(){
  132. const data=getItem('globalParam')
  133. console.log("全局配置数据1111",getCodeName('IS_ENABLE',data.setGray))
  134. // 申办时是否允许修改OCR识别出来的车辆信息数据
  135. if(getCodeName('IS_ENABLE',data.setGray)=='启用'){
  136. // this.isEnableSetGray=true;
  137. // uni.setCssVar(this.$refs.element, 'filter', 'grayscale(1)');
  138. // uni.setGlobalCSSVar('--element-filter', 'grayscale(1)');
  139. const pageStyle = ` font-family: "Microsoft Yahei"; filter: grayscale(1); `;
  140. uni.setPageStyle({ style: pageStyle, });
  141. }
  142. }
  143. }
  144. };
  145. </script>
  146. <style lang="scss">
  147. /*每个页面公共css */
  148. @import "./static/css/common.scss";
  149. // @import './uni_modules/vk-uview-ui/index.scss';
  150. page {
  151. font-family: "Microsoft Yahei";
  152. // filter: grayscale(1)
  153. }
  154. </style>