guide.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. handleD() {
  34. if (this.data.active) wx.navigateBack();
  35. },
  36. _update(result: string[]) {
  37. if (result.length) {
  38. this.setData({ result });
  39. this.triggerEvent('next', { component: 'guide', scroll: true });
  40. } else {
  41. setTimeout(() => wx.showToast({ title: `没有更改项`, icon: 'none' }), 300)
  42. }
  43. }
  44. }
  45. })