公寓小程序端前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
2.9 KiB

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