闫增涛
2025-03-28 b97bfcb85b2ded3b1f380e9a98b54b836faabba5
pages/digitalCourses/index.js
@@ -1,4 +1,7 @@
// pages/digitalCourses/index.js
import {
  loginInfo
} from '../../assets/js/login';
const app = getApp()
import {
  setSessionGuid,
@@ -68,7 +71,8 @@
      });
    }
    this.getCourseTypeListList()
    this.getShoppingCartList()
    const token = wx.getStorageSync(app.config.tokenKey)
    if (token) this.getShoppingCartList()
  },
  /**
@@ -288,6 +292,7 @@
    })
  },
  addCart(e) {
    const addFun = () => {
    const {
      item
    } = e.currentTarget.dataset;
@@ -336,7 +341,17 @@
        console.error('出错了:', error)
      }
    }
    }
    const token = wx.getStorageSync(app.config.tokenKey)
    if (token) {
      addFun()
    } else {
      loginInfo(app, (data) => {
        if (data) {
          this.getShoppingCartList()
        }
      })
    }
  },
})