From ccda9ec2fe70d8f51ef184eafc04b78d22dfbabd Mon Sep 17 00:00:00 2001
From: litian <C21AF165>
Date: 星期三, 26 六月 2024 15:02:28 +0800
Subject: [PATCH] 小程序,教材,课程

---
 assets/js/userAction.js |   76 ++++++-------------------------------
 1 files changed, 13 insertions(+), 63 deletions(-)

diff --git a/assets/js/userAction.js b/assets/js/userAction.js
index 8ecf23a..cdfd7e3 100644
--- a/assets/js/userAction.js
+++ b/assets/js/userAction.js
@@ -1,40 +1,20 @@
-import config from "@/assets/js/config.js";
-
-import jobApi from "./middleGround/api/job"; // newJobWithNewView // newSession,
+import config from "./config.js";
+import jobApi from "./middleGround/api/job";// newJobWithNewView // newSession,
 
 export function setSessionGuid(type, id) {
-  var cityCode = null;
-  var SnIp = null;
-  try {
-    // eslint-disable-next-line
-    SnIp = window.returnCitySN;
-  } catch (error) {
-    SnIp = null;
-    console.log(error);
-  }
-  if (SnIp != undefined && SnIp != null) {
-    cityCode = SnIp;
-  } else {
-    cityCode = {
-      cip: "0.0.0.0",
-      cname: "鏈煡",
-    };
-  }
-  const _city = cityCode.cname.substring(3);
-  const _province = cityCode.cname.substring(0, 3);
   const params = {
     appRefCode: config.appRefCode,
     hostName: config.requestCtx,
-    ipAddress: cityCode.cip,
-    browser: myBrowser(),
-    os: navigator.platform,
+    ipAddress: "0.0.0.0", // 鍚庡彴鑾峰彇,鍓嶅彴闅忎究浼�
+    browser: 'WeChatApp',
+    os: 'WeChat',
     device: "pc",
-    province: _province,
-    city: _city ? _city : _province,
+    province: "鏈煡",// 鍚庡彴鑾峰彇,鍓嶅彴闅忎究浼�
+    city: "鏈煡",// 鍚庡彴鑾峰彇,鍓嶅彴闅忎究浼�
   };
 
   jobApi.newSession(params).then(res => {
-    storage.set("sessionGuid", res, 30);
+    wx.setStorageSync("sessionGuid", res);
     setNewView(type, id);
   });
 }
@@ -82,43 +62,13 @@
   },
 };
 
-function myBrowser() {
-  const userAgent = navigator.userAgent; //鍙栧緱娴忚鍣ㄧ殑userAgent瀛楃涓�
-  const isOpera = userAgent.indexOf("Opera") > -1;
-  if (isOpera) {
-    //鍒ゆ柇鏄惁Opera娴忚鍣�
-    return "Opera";
-  }
-  if (userAgent.indexOf("Firefox") > -1) {
-    //鍒ゆ柇鏄惁Firefox娴忚鍣�
-    return "Firefox";
-  }
-  if (userAgent.indexOf("Chrome") > -1) {
-    return "Chrome";
-  }
-  if (userAgent.indexOf("Safari") > -1) {
-    //鍒ゆ柇鏄惁Safari娴忚鍣�
-    return "Safari";
-  }
-  if (
-    userAgent.indexOf("compatible") > -1 &&
-    userAgent.indexOf("MSIE") > -1 &&
-    !isOpera
-  ) {
-    //鍒ゆ柇鏄惁IE娴忚鍣�
-    return "IE";
-  }
-  return "";
-}
-
 export function setNewView(type, id) {
-  if (!sessionStorage.getItem("sessionGuid")) {
+  if (!wx.getStorageSync("sessionGuid")) {
     setSessionGuid(type, id);
   }
-
-  const sessionGuid = sessionStorage.getItem("sessionGuid");
-  const fromPath = sessionStorage.getItem("fromPath");
-  const toPath = sessionStorage.getItem("toPath");
+  const sessionGuid = wx.getStorageSync("sessionGuid");
+  const fromPath = wx.getStorageSync("fromPath");
+  const toPath = wx.getStorageSync("toPath");
   if (sessionGuid) {
     let params = {
       sessionGuid: sessionGuid,
@@ -130,6 +80,6 @@
     if (id) {
       params[type] = id;
     }
-    jobApi.newJobWithNewView(params).then(res => {});
+    jobApi.newJobWithNewView(params).then(res => { });
   }
 }
\ No newline at end of file

--
Gitblit v1.9.1