init.js 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * 服务之窗APP内嵌webview,初始化一些入口参数,方便本地调试
  3. */
  4. (function() {
  5. // 1. 设置sessionStorage 点击app端下单-导航栏-复制粘贴
  6. const info = {
  7. "href": "https://wx.palmnest.com/super_cloud/wx/appPlaceOrder/?module=canteenReserve&appChannel=placeOrders&saleId=192&v=1693385424786#/productList?saleId=192",
  8. "userToken": "84a069af0a99e4f7cc5cd64b71fd38d3",
  9. "EquipmentSN": "f9f72c49ac6f7df3",
  10. "token": "eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2OTMzNzc3MDksInN1YiI6ImFsaXRlc3Q3In0.Qkwkus7viZ3Fp2FAo81JzVLfXK6eZOeX-zUUHwBgiAg"
  11. }
  12. sessionStorage.setItem("EquipmentSN", info.EquipmentSN);
  13. sessionStorage.setItem("token", info.token);
  14. sessionStorage.setItem("userToken", info.userToken);
  15. sessionStorage.setItem("isNFC", "true");
  16. })();
  17. // 2. 设置cookie 在测试域名`wx.palmnest.com`上添加JSESSION_ID
  18. // console.log("[init end ok]");
  19. // JSESSION_ID: 79b65bff9f2f4d7e9faf8d070e217318
  20. // JSESSION_IDx去掉x
  21. // document.cookie="JSESSION_IDx=79b65bff9f2f4d7e9faf8d070e217318; Path=/;";
  22. function getCookie() {
  23. return document.cookie
  24. .split(";")
  25. .map((item) => item.split("="))
  26. .reduce((acc, [k, v]) => (acc[k.trim().replace('"', "")] = v) && acc, {});
  27. }
  28. console.log(`all cookies`, getCookie());