| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- // pages/cert/cert.js
- import { postApi, getApi } from "../../apis/api";
- Page({
- data: {
- certs: [],
- contacts: [],
- introduce: {},
- },
- async getCerts() {
- let { data } = await postApi("/ship/cert/list", {
- userId: wx.getStorageSync("userId"),
- });
- if (data.status === 0) {
- data.result.forEach((cert) => {
- cert.endValidTime = cert.endValidTime.split(" ")[0];
- });
- this.setData({
- certs: data.result,
- });
- } else {
- this.setData({
- certs: [],
- });
- wx.showToast({
- title: data.msg,
- icon: "none",
- });
- }
- },
- async getContacts() {
- let { data } = await getApi("/ship/cert/operation/contacts");
- if (data.status === 0) {
- this.setData({
- contacts: data.result,
- });
- } else {
- this.setData({
- contacts: [],
- });
- wx.showToast({
- title: data.msg,
- icon: "none",
- });
- }
- },
- async getIntroduce() {
- let { data } = await getApi("/ship/cert/operation/introduce");
- if (data.status === 0) {
- this.setData({
- introduce: data.result,
- });
- } else {
- this.setData({
- introduce: {},
- });
- wx.showToast({
- title: data.msg,
- icon: "none",
- });
- }
- },
- makePhoneCall(e) {
- wx.makePhoneCall({
- phoneNumber: e.currentTarget.dataset.phone,
- });
- },
- preview(e) {
- wx.previewImage({
- urls: [e.currentTarget.dataset.url],
- });
- },
- copy(e) {
- wx.setClipboardData({
- data: e.currentTarget.dataset.phone,
- success(res) {
- wx.showToast({
- title: "复制成功",
- });
- },
- });
- },
- onLoad(options) {
- this.getCerts();
- this.getContacts();
- this.getIntroduce();
- },
- onShow() {
- if (typeof this.getTabBar === "function" && this.getTabBar()) {
- this.getTabBar().setData({
- selected: 1,
- });
- }
- },
- });
|