app.ux 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <!--
  2. * @Author: ZhengXiaowei
  3. * @Date: 2019-10-15 12:02:18
  4. * @LastEditors: ZhengXiaowei
  5. * @LastEditTime: 2019-10-15 14:02:07
  6. * @Description: 主入口
  7. -->
  8. <script>
  9. /**
  10. * 应用级别的配置,供所有页面公用
  11. */
  12. import "./helper/regenerator.js";
  13. import it from "./helper/interface.js";
  14. import storage from "@system.storage";
  15. import router from '@system.router';
  16. export default {
  17. async onCreate() {
  18. this.dataCache = {
  19. }
  20. // 一进入程序就判断是否添加过主屏幕
  21. it.shortcut.systemPromptEnabled = false;
  22. await it.shortcut.hasInstalled({
  23. success: (ret) => {
  24. console.log("is installed:", ret);
  25. if (!ret) this.$def.data.backClickCount = 0;
  26. else this.$def.data.backClickCount = 1;
  27. }
  28. })
  29. it.getPushRedId(regId=>{
  30. storage.set({ key: "regId", value: regId });
  31. })
  32. /* router.push({
  33. uri: "/views/Ad",
  34. }) */
  35. },
  36. getAppData(key) {
  37. return this.dataCache[key]
  38. },
  39. setAppData(key, val) {
  40. this.dataCache[key] = val
  41. },
  42. showMenu: it.showMenu,
  43. getDeviceInfo: it.getDeviceInfo,
  44. createShortcut: it.hasCreateShortCut,
  45. data: {
  46. backClickCount: 0,
  47. cutomerQrcode: "",
  48. weChat: "wxlxf1099",
  49. appVersion: '',
  50. dataCache: {
  51. backfrom: '',
  52. options:null
  53. }
  54. }
  55. };
  56. </script>