data":"Sessions number reached limit" 原创

qq66cc1180c0374
发布于 2024-9-7 10:23
浏览
0收藏

切换路由,修改用户数据,根据最新数据获取app的最新数据,就会出现 Sessions number reached limit

文档提示到,可以将session 减少到 16 个以内 ,还有其他的操作方式吗??

 router.replaceUrl({
           url: 'pages/IndexPage',
 });
//切到 indexpage  indexPage  是一个首页通过tabs 切换组件

  Column() {
      Tabs({ index: this.activeIndex }) {
        ForEach(this.HomeTabs, (item: tabsModule, index: number) => {
          TabContent() {
            if (this.CswCourseList.length) {
              if (index === 0) {
                HomePage()
              } else if (index === 1) {
                SolveProblemPage()
              } else if (index === 2) {
                FirstCoursePage({ courseList: this.CswCourseList })
              } else if (index === 3) {
                MinePage()
              }
            } else {
              if (index === 0) {
                HomePage()
              } else if (index === 1) {
                SolveProblemPage()
              } else if (index === 2) {
                MinePage()
              }
            }
          }
          .tabBar(this.TabBar(item, index)) // 导航栏设置
        })
      }
      .barPosition(BarPosition.End)
      .scrollable(false)
      .onTabBarClick((index: number) => {
        this.activeIndex = index
      })
    }
//indexpage的数据加载没有问题,但是但是HomePage 加载就会报错!!!!

//homePage 
 aboutToAppear() {
    emitter.on("SelectHomePage", async () => {
      this.userInfo = UserInfoManger.getInstance().getUserInfo() //用户信息
      promptAction.showToast({
        message: "触发广播事件",
        duration: 3000
      })
      await this.getData()
      console.info("VnInfoList 数据", JSON.stringify(this.VnInfoList));
    })
  }
//请求逻辑
  async getData() {
    try {
      const results = await Promise.all([
        getTestDay(this.userInfo.appEName),
        getBannerList(),
        getHomeMaterialList(this.userInfo.appEName, 0),
        getVnInfo(this.userInfo.appID as number, this.userInfo.appEName),
        getMyMaterialList(this.userInfo.appEName)
      ])

      // 更新状态
      this.ClockState = results[0];
      this.bannerList = results[1];
      this.HomeMaterialList = results[2];
      this.VnInfoList = results[3].vnList;
      this.MyMaterialList = results[4];
    } catch (error) {
      console.error("请求错误", JSON.stringify(error));
      promptAction.showToast({
        message: error.message || "请求错误",
        duration: 2000,
      });
    }
  }

©著作权归作者所有,如需转载,请注明出处,否则将追究法律责任
标签
收藏
回复
举报
回复
    相关推荐