call-check-version.js 693 B

123456789101112131415161718192021222324252627282930313233
  1. export default function() {
  2. // #ifdef APP-PLUS
  3. return new Promise((resolve, reject) => {
  4. plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) {
  5. const data = {
  6. action: 'checkVersion',
  7. appid: plus.runtime.appid,
  8. appVersion: plus.runtime.version,
  9. wgtVersion: widgetInfo.version
  10. }
  11. console.log("data: ",data);
  12. uniCloud.callFunction({
  13. name: 'uni-upgrade-center',
  14. data,
  15. success: (e) => {
  16. console.log("e: ", e);
  17. resolve(e)
  18. },
  19. fail: (error) => {
  20. reject(error)
  21. }
  22. })
  23. })
  24. })
  25. // #endif
  26. // #ifndef APP-PLUS
  27. return new Promise((resolve, reject) => {
  28. reject({
  29. message: '请在App中使用'
  30. })
  31. })
  32. // #endif
  33. }