legal.js 912 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // pages/legal/legal.js
  2. import { postApi, getApi } from "../../apis/api";
  3. import router from "../../utils/router";
  4. Page({
  5. data: {
  6. legalAidIntroduce: {},
  7. lawyerIntroduce: {},
  8. },
  9. async getIntroduce() {
  10. let { data } = await getApi("/legal/aid/introduce");
  11. if (data.status === 0) {
  12. this.setData({
  13. ...data.result,
  14. });
  15. } else {
  16. this.setData({
  17. legalAidIntroduce: {},
  18. lawyerIntroduce: {},
  19. });
  20. wx.showToast({
  21. title: data.msg,
  22. icon: "none",
  23. });
  24. }
  25. },
  26. preview(e) {
  27. wx.previewImage({
  28. urls: [e.currentTarget.dataset.url],
  29. });
  30. },
  31. goTo(e) {
  32. router(e.currentTarget.dataset.path);
  33. },
  34. onLoad(options) {
  35. this.getIntroduce();
  36. },
  37. onShow() {
  38. if (typeof this.getTabBar === "function" && this.getTabBar()) {
  39. this.getTabBar().setData({
  40. selected: 3,
  41. });
  42. }
  43. },
  44. });