qrcode.js 1.6 KB

12345678910111213141516171819202122232425262728293031
  1. import request from '@/utils/request'
  2. // 获取不限制的小程序码
  3. export function getUnlimitedQRCode(data = {}) {
  4. // 从本地存储获取用户类型和用户ID
  5. const userType = uni.getStorageSync('userType') || '';
  6. const userId = uni.getStorageSync('userId') || '';
  7. // 打印日志,便于调试
  8. console.log('从本地存储获取用户信息:', { userType, userId });
  9. return request({
  10. url: '/core/InviteUser/getInviteQrCode',
  11. method: 'get',
  12. params: {
  13. // scene: data.scene, // 最大32个可见字符,只支持数字,大小写英文以及部分特殊字符
  14. // page: data.page, // 默认是主页,页面 page,例如 pages/index/index
  15. // check_path: data.check_path || true, // 默认是true,检查page 是否存在
  16. // env_version: data.env_version || 'release', // 要打开的小程序版本。正式版为 "release",体验版为 "trial",开发版为 "develop"
  17. // width: data.width || 430, // 二维码的宽度,单位 px,最小 280px,最大 1280px
  18. // auto_color: data.auto_color || false, // 自动配置线条颜色
  19. // line_color: data.line_color || { r: 0, g: 0, b: 0 }, // 使用 rgb 设置颜色
  20. // is_hyaline: data.is_hyaline || false, // 是否需要透明底色
  21. referrerType: userType, // 使用本地存储的 userType
  22. referrerId: userId, // 使用本地存储的 userId
  23. page:'pages/login',
  24. scene: data.scene || `${userType}:${userId}`, // 同样使用本地存储的值生成 scene
  25. },
  26. // responseType: 'arraybuffer', // 设置响应类型为arraybuffer,因为返回的是图片二进制内容
  27. })
  28. }