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