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