guide.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // module/chats/components/guide/guide.ts
  2. Component({
  3. lifetimes: {},
  4. properties: {
  5. id: { type: String, value: '' },
  6. active: { type: Boolean, value: false },
  7. },
  8. data: {
  9. result: [] as string[],
  10. result2: false,
  11. },
  12. methods: {
  13. handleA() {
  14. if (this.data.active) this.triggerEvent('next', { component: 'questionnaire', scroll: true });
  15. },
  16. handleB() {
  17. if (this.data.active) wx.navigateTo({
  18. url: '/module/health/pages/status/status',
  19. events: { update: this._update.bind(this) }
  20. });
  21. },
  22. handleC() {
  23. if (this.data.active) wx.navigateTo({
  24. url: '/module/user/pages/user-edit/user-edit',
  25. events: {
  26. update2: () => {
  27. this.setData({ result2: true });
  28. this.triggerEvent('next', { component: 'guide', scroll: true });
  29. }
  30. }
  31. });
  32. },
  33. _update(result: string[]) {
  34. if (result.length) {
  35. this.setData({ result });
  36. this.triggerEvent('next', { component: 'guide', scroll: true });
  37. } else {
  38. setTimeout(() => wx.showToast({ title: `没有更改项`, icon: 'none' }), 300)
  39. }
  40. }
  41. }
  42. })