import { getUserInfo, bindIdCard } from "../../../api/user"; // import { checkContentStatus } from "../../../../api/audit"; // const QQMapWX = require("../../../../utils/qqmap-wx-jssdk"); // const config = require("../../../../utils/config"); const app = getApp(); Page({ /** * 页面的初始数据 */ data: { name: null, nickName: "微信用户", idCard: null, mobile: null, remainingDays: null, fileList: [ // { // url: "https://elink-esua-epdc.oss-cn-qingdao.aliyuncs.com/epmet/test/20240830/de2ccb0304eb4bab9513d11472fb3454.png", // type: "image", // name: "image", // }, ], }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.getUserInfo(); }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() {}, /** * 生命周期函数--监听页面显示 */ onShow() {}, /** * 生命周期函数--监听页面隐藏 */ onHide() {}, /** * 生命周期函数--监听页面卸载 */ onUnload() {}, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() {}, /** * 页面上拉触底事件的处理函数 */ onReachBottom() {}, chooseAvatar() { wx.chooseMedia({ count: 1, // 最多选择 1 张图片 mediaType: ["image"], // 只选择图片 success: (res) => { if (res.tempFiles.length > 0) { const tempFilePath = res.tempFiles[0].tempFilePath; this.setData({ avatarUrl: tempFilePath, }); // 如果你需要将图片上传到服务器,可以在这里添加上传逻辑 // wx.uploadFile({ // url: 'your_upload_url', // filePath: tempFilePath, // name: 'avatar', // success: (uploadRes) => { // console.log('上传成功', uploadRes); // }, // fail: (err) => { // console.error('上传失败', err); // } // }); } }, fail: (err) => { console.error("选择图片失败", err); }, }); }, /** * 用户点击右上角分享 */ onShareAppMessage() {}, getUserInfo() { getUserInfo().then((res) => { this.setData({ nickName: res.data.nickName, idCard: res.data.idCard, name: res.data.name, mobile: res.data.phone, remainingDays: res.data.leftQuota, }); }); }, onsubmit() { bindIdCard({ idCard: this.data.idCard, name: this.data.name, phone: this.data.mobile, }).then((res) => { if (res.code == 200) { wx.showToast({ title: res.msg, }); } }); }, });