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.

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