cert.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // pages/cert/cert.js
  2. import { postApi, getApi } from "../../apis/api";
  3. Page({
  4. data: {
  5. certs: [],
  6. contacts: [],
  7. introduce: {},
  8. },
  9. async getCerts() {
  10. let { data } = await postApi("/ship/cert/list", {
  11. userId: wx.getStorageSync("userId"),
  12. });
  13. if (data.status === 0) {
  14. this.setData({
  15. certs: data.result,
  16. });
  17. } else {
  18. this.setData({
  19. certs: [],
  20. });
  21. wx.showToast({
  22. title: data.msg,
  23. icon: "none",
  24. });
  25. }
  26. },
  27. async getContacts() {
  28. let { data } = await getApi("/ship/cert/operation/contacts");
  29. if (data.status === 0) {
  30. this.setData({
  31. contacts: data.result,
  32. });
  33. } else {
  34. this.setData({
  35. contacts: [],
  36. });
  37. wx.showToast({
  38. title: data.msg,
  39. icon: "none",
  40. });
  41. }
  42. },
  43. async getIntroduce() {
  44. let { data } = await getApi("/ship/cert/operation/introduce");
  45. if (data.status === 0) {
  46. this.setData({
  47. introduce: data.result,
  48. });
  49. } else {
  50. this.setData({
  51. introduce: [],
  52. });
  53. wx.showToast({
  54. title: data.msg,
  55. icon: "none",
  56. });
  57. }
  58. },
  59. makePhoneCall(e) {
  60. wx.makePhoneCall({
  61. phoneNumber: e.currentTarget.dataset.phone,
  62. });
  63. },
  64. preview(e) {
  65. wx.previewImage({
  66. urls: [e.currentTarget.dataset.url],
  67. });
  68. },
  69. onLoad(options) {
  70. this.getCerts();
  71. this.getContacts();
  72. this.getIntroduce();
  73. },
  74. });