上传代码

This commit is contained in:
2025-08-18 09:57:10 +08:00
commit ff52db1edc
560 changed files with 102250 additions and 0 deletions

View File

@ -0,0 +1,119 @@
/* 页面样式 */
.example-body.data-v-ae7e1909 {
background-color: #fff;
padding: 10px;
}
.page.data-v-ae7e1909 {
background-color: #fff;
padding: 20px;
}
/* 返回按钮样式 */
.back-button.data-v-ae7e1909 {
position: absolute;
top: 20px;
left: 20px;
}
/* 表单项样式 */
.form-item.data-v-ae7e1909 {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
border-bottom: 1px solid #ddd;
padding-bottom: 10px;
}
.label.data-v-ae7e1909 {
font-size: 16px;
color: #000;
}
.value.data-v-ae7e1909 {
font-size: 16px;
color: #666;
}
/* 上传区域样式 */
.upload-section.data-v-ae7e1909 {
margin-top: 20px;
display: flex;
flex-direction: column;
/* 改为垂直排列 */
gap: 20px;
/* 增加间距 */
}
.upload-item.data-v-ae7e1909 {
background-color: #ecf5ff;
border: 2px dashed #a6b2da;
border-radius: 10px;
padding: 10px;
text-align: center;
width: 100%;
/* 设置宽度为100% */
box-sizing: border-box;
position: relative;
height: 200px;
/* 固定高度 */
}
.upload-item .upload-icon-text.data-v-ae7e1909 {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.upload-item image.data-v-ae7e1909 {
width: 100%;
height: 100%;
object-fit: cover;
/* 确保图片覆盖容器并保持比例 */
border-radius: 8px;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
.upload-text.data-v-ae7e1909 {
font-size: 14px;
color: #8cb7fd;
}
/* 提交按钮样式 */
.submit-button.data-v-ae7e1909 {
width: 100%;
height: 50px;
background-color: #5e7dec;
border: none;
border-radius: 10px;
color: #fff;
font-size: 16px;
margin-top: 20px;
}
/* 提交记录样式 */
.submit.data-v-ae7e1909 {
margin-top: 20px;
padding: 20px;
border: 1px solid #ddd;
border-radius: 10px;
background-color: #f9f9f9;
}
.submit-title.data-v-ae7e1909 {
font-size: 18px;
font-weight: bold;
margin-bottom: 10px;
}
.submit-bankCard.data-v-ae7e1909 {
font-size: 16px;
color: #333;
margin-bottom: 10px;
}
.submit-frontIdCard image.data-v-ae7e1909,
.submit-backIdCard image.data-v-ae7e1909 {
width: 100%;
height: auto;
border-radius: 8px;
max-height: 300px; /* 设置最大高度以防图片过大 */
object-fit: contain; /* 确保图片内容完整显示 */
}

View File

@ -0,0 +1 @@
<view class="page data-v-ae7e1909"><view class="form-item data-v-ae7e1909"><view class="label data-v-ae7e1909">银行卡号</view><view class="value data-v-ae7e1909"><input class="data-v-ae7e1909" type="text" placeholder="请输入银行卡号" value="{{a}}" onInput="{{b}}"/></view></view><view class="upload-section data-v-ae7e1909"><view class="upload-item data-v-ae7e1909" onTap="{{g}}"><view a:if="{{c}}" class="upload-icon-text data-v-ae7e1909"><uni-icons class="data-v-ae7e1909" u-i="ae7e1909-0" onVI="__l" u-p="{{d||''}}"></uni-icons><view class="upload-text data-v-ae7e1909">点击上传身份证国徽面</view></view><image a:if="{{e}}" class="data-v-ae7e1909" src="{{f}}"></image></view><view class="upload-item data-v-ae7e1909" onTap="{{l}}"><view a:if="{{h}}" class="upload-icon-text data-v-ae7e1909"><uni-icons class="data-v-ae7e1909" u-i="ae7e1909-1" onVI="__l" u-p="{{i||''}}"></uni-icons><view class="upload-text data-v-ae7e1909">点击上传身份证人像面</view></view><image a:if="{{j}}" class="data-v-ae7e1909" src="{{k}}"></image></view></view><button class="submit-button data-v-ae7e1909" onTap="{{m}}">提交</button><view a:if="{{n}}" class="submit data-v-ae7e1909"><view class="submit-title data-v-ae7e1909"> 提交记录 </view><view class="submit-bankCard data-v-ae7e1909">{{o}}</view><view class="submit-frontIdCard data-v-ae7e1909"><view class="submit-title data-v-ae7e1909"> 身份证正面 </view><image class="data-v-ae7e1909" src="{{p}}" mode="widthFix"></image></view><view class="submit-backIdCard data-v-ae7e1909"><view class="submit-title data-v-ae7e1909"> 身份证背面 </view><image class="data-v-ae7e1909" src="{{q}}" mode="widthFix"></image></view></view></view>

View File

@ -0,0 +1,160 @@
"use strict";
const common_vendor = require("../../common/vendor.js");
const API_api = require("../../API/api.js");
const _sfc_main = {
data() {
return {
photoSrcFront: "",
// 徽面照片路径
photoSrcBack: "",
// 人像面照片路径
bankCard: "",
// 银行卡号
submitRecord: {},
// 修改为对象
currentUser: common_vendor.index.getStorageSync("currentUser")
};
},
onLoad() {
this.getAuditRecords();
},
methods: {
takePhoto(side) {
const that = this;
common_vendor.index.chooseImage({
count: 1,
sourceType: ["camera"],
success(res) {
if (side === "front") {
that.photoSrcFront = res.tempFilePaths[0];
that.uploadPhoto(res.tempFilePaths[0], "front");
} else if (side === "back") {
that.photoSrcBack = res.tempFilePaths[0];
that.uploadPhoto(res.tempFilePaths[0], "back");
}
}
});
},
uploadPhoto(filePath, side) {
common_vendor.index.uploadFile({
url: API_api.apiImageUrl + "/api/file/upload/server",
filePath,
name: "file",
formData: {
biz: "card"
},
success: (res) => {
console.log("上传成功:", res);
},
fail: (err) => {
console.error("上传失败:", err);
}
});
},
submit() {
const data = {
backIdCard: this.photoSrcBack,
bankCard: this.bankCard,
errandId: this.currentUser.id,
frontIdCard: this.photoSrcFront
};
common_vendor.index.request({
url: API_api.apiImageUrl + "/api/errandAuth/add",
method: "POST",
data,
header: {
"Content-Type": "application/json",
// 确保设置正确的 Content-Type
"cookie": common_vendor.index.getStorageSync("cookie") || ""
},
success: (res) => {
console.log("提交成功:", res);
if (res.data.code === 4e4) {
common_vendor.index.showToast({
title: res.data.description,
icon: "fail",
duration: 2e3
});
} else if (res.data.code === 0) {
common_vendor.index.showToast({
title: "提交成功",
icon: "success",
duration: 2e3
});
}
},
fail: (err) => {
console.error("提交失败:", err);
}
});
},
getAuditRecords() {
common_vendor.index.request({
url: API_api.apiImageUrl + "/api/errandAuth/get/my",
method: "POST",
header: {
"Content-Type": "application/json",
// 确保设置正确的 Content-Type
"cookie": common_vendor.index.getStorageSync("cookie") || ""
},
success: (res) => {
console.log(res);
if (res.data.code === 0 && res.data.data) {
this.submitRecord = res.data.data;
}
},
fail: (err) => {
console.error("获取审核记录失败:", err);
}
});
}
}
};
if (!Array) {
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
_easycom_uni_icons2();
}
const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
if (!Math) {
_easycom_uni_icons();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: $data.bankCard,
b: common_vendor.o(($event) => $data.bankCard = $event.detail.value),
c: !$data.photoSrcFront
}, !$data.photoSrcFront ? {
d: common_vendor.p({
type: "plusempty",
size: "30",
color: "#6a7cbf"
})
} : {}, {
e: $data.photoSrcFront
}, $data.photoSrcFront ? {
f: $data.photoSrcFront
} : {}, {
g: common_vendor.o(($event) => $options.takePhoto("front")),
h: !$data.photoSrcBack
}, !$data.photoSrcBack ? {
i: common_vendor.p({
type: "plusempty",
size: "30",
color: "#6a7cbf"
})
} : {}, {
j: $data.photoSrcBack
}, $data.photoSrcBack ? {
k: $data.photoSrcBack
} : {}, {
l: common_vendor.o(($event) => $options.takePhoto("back")),
m: common_vendor.o((...args) => $options.submit && $options.submit(...args)),
n: $data.submitRecord
}, $data.submitRecord ? {
o: common_vendor.t($data.submitRecord.bankCard),
p: $data.submitRecord.frontIdCard,
q: $data.submitRecord.backIdCard
} : {});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-ae7e1909"]]);
my.createPage(MiniProgramPage);

View File

@ -0,0 +1,7 @@
{
"defaultTitle": "身份认证",
"titleBarColor": "#5e7dec",
"usingComponents": {
"uni-icons": "../../uni_modules/uni-icons/components/uni-icons/uni-icons"
}
}