import { approveUser, getApproveList } from "../../../../service/user" import { alertInfo, alertSuccess, wxModal } from "../../../../utils/index"; import request from "../../../../utils/request" const { OK } = request; Component({ /** * 组件的属性列表 */ properties: { }, /** * 组件的初始数据 */ data: { list: [] }, lifetimes: { attached: function() { // this.setData({ // list: [] // }) this.init(); } }, /** * 组件的方法列表 */ methods: { async init() { const result = await getApproveList() this.setData({ list: result.data }) }, async setAdmin(e) { const { user } = e.currentTarget.dataset; await wxModal({ content: `你的管理员身份将转交给${user.nickName}` }) const { code, message } = await approveUser({ userId: user.id, type: 2 }) if (code !== OK) { alertInfo(message) return; } alertSuccess("转交成功") wx.clearStorageSync() wx.exitMiniProgram() }, async disAgree(e) { const { user } = e.currentTarget.dataset; await wxModal({ content: `拒绝${user.nickName}的申请?` }) const { code, message } = await approveUser({ userId: user.id, type: 0 }) if (code !== OK) { alertInfo(message) return; } alertSuccess("已拒绝") this.init() } } })