appInfo.tsx 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import { observable } from 'mobx'
  2. type ConfigParamList = {}
  3. export interface AppInfo {
  4. appCategory: 1|2,//1长篇 2短篇
  5. appName: string,//小程序名称
  6. appVersion: string,//小程序版本
  7. configParamList: ConfigParamList[],//小程序配置
  8. distributorId: 1,//分销商ID
  9. enabled: true,//启用状态
  10. homePage: string,//主页路径
  11. id: 4,//
  12. wechatAppId: string,//小程序ID
  13. }
  14. interface AppComponent {
  15. id: number,
  16. componentType: string,//组件名称
  17. }
  18. export interface AppInfoStore {
  19. /**app初始化信息*/
  20. appInfo?: AppInfo,
  21. /**主页组件展示信息*/
  22. appComponent?: AppComponent[],
  23. /**登录后的token*/
  24. token?: string,//token
  25. /**进入的场景*/
  26. scene?: number,
  27. /**分享值*/
  28. shareSources?:any,
  29. /**设置app初始化信息*/
  30. actionAppInfo: (appInfo: AppInfo) => void
  31. /**设置登录后的token*/
  32. actionToken: (token: string) => void
  33. /**设置组件列表*/
  34. setAppComponent: (appComponent: AppComponent[]) => void
  35. }
  36. /**
  37. * APP初始化信息
  38. * */
  39. const appInfoStore: AppInfoStore = observable({
  40. appInfo: undefined,
  41. actionAppInfo(appInfo: AppInfo) {
  42. if (appInfo) {
  43. this.appInfo = appInfo
  44. }
  45. },
  46. actionToken(token: string) {
  47. this.token = token
  48. },
  49. setAppComponent(appComponent: AppComponent[]) {
  50. if (appComponent) {
  51. this.appComponent = appComponent
  52. }
  53. }
  54. })
  55. export default appInfoStore