Przeglądaj źródła

存储整个scene

张田田 4 miesięcy temu
rodzic
commit
0cc19f12bf

+ 7 - 5
miniprogram/app.ts

@@ -1,4 +1,4 @@
-import { login } from "./lib/logic"
+import { login } from "./lib/logic";
 import { appUpdate } from "./lib/wx/update";
 import { appUpdate } from "./lib/wx/update";
 import { useRouteQuery } from "./utils/route-query";
 import { useRouteQuery } from "./utils/route-query";
 // import { Get } from "./lib/request/method";
 // import { Get } from "./lib/request/method";
@@ -6,16 +6,18 @@ import { useRouteQuery } from "./utils/route-query";
 // app.ts
 // app.ts
 App<IAppOption>({
 App<IAppOption>({
   globalData: {
   globalData: {
-    doctorId: '',
-    patientId: '',
+    doctorId: "",
+    patientId: "",
     dictionaries: [],
     dictionaries: [],
   },
   },
   onLaunch(options: WechatMiniprogram.App.LaunchShowOption) {
   onLaunch(options: WechatMiniprogram.App.LaunchShowOption) {
     appUpdate(true);
     appUpdate(true);
     const query = useRouteQuery(options.query.scene);
     const query = useRouteQuery(options.query.scene);
+    const scene = decodeURIComponent(query.scene);
+    wx.setStorageSync("scene", scene);
     const doctorId = query.ys;
     const doctorId = query.ys;
     this.globalData.doctorId = doctorId;
     this.globalData.doctorId = doctorId;
-    wx.setStorageSync('doctorId', doctorId);
+    wx.setStorageSync("doctorId", doctorId);
     login();
     login();
   },
   },
-})
+});

+ 1 - 0
miniprogram/lib/request/create.ts

@@ -44,6 +44,7 @@ export function createRequest(option: IRequestCreateConfig) {
     header["patientId"] = wx.getStorageSync("patientId") ?? "";
     header["patientId"] = wx.getStorageSync("patientId") ?? "";
     // header['patientId'] = '783';
     // header['patientId'] = '783';
     header["doctorId"] = wx.getStorageSync("doctorId") ?? "";
     header["doctorId"] = wx.getStorageSync("doctorId") ?? "";
+    header["scene"] = wx.getStorageSync("scene") ?? "";
     header["appId"] = miniProgram.appId ?? "";
     header["appId"] = miniProgram.appId ?? "";
     header["version"] = miniProgram.version ?? "";
     header["version"] = miniProgram.version ?? "";
     header["env"] = miniProgram.envVersion ?? "";
     header["env"] = miniProgram.envVersion ?? "";

+ 1 - 0
miniprogram/pages/home/home.ts

@@ -158,6 +158,7 @@ Page({
     appUpdate();
     appUpdate();
     const query = useRouteQuery(options.scene!);
     const query = useRouteQuery(options.scene!);
     if (query.ys) wx.setStorageSync("doctorId", query.ys);
     if (query.ys) wx.setStorageSync("doctorId", query.ys);
+    if (query.scene) wx.setStorageSync("scene", query.scene);
     this.initFabAnimated();
     this.initFabAnimated();
     if (options.switchType) {
     if (options.switchType) {
       this.setData({
       this.setData({