1
PC-20250623MANY\Administrator
2025-07-22 beff59e6065d3283cc9fb10fe7151f2b757cd154
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
<template>
  <div class="advance-auth">
    <div class="router-view">
      <section data-v-b78bf5cc="" class="container">
        <section data-v-b78bf5cc="" class="header">
          <i
            data-v-b78bf5cc=""
            class="el-icon"
            style="font-size: 30px; --color: #fff"
            ><svg
              data-v-b78bf5cc=""
              xmlns="http://www.w3.org/2000/svg"
              viewBox="0 0 1024 1024"
            >
              <path
                fill="currentColor"
                d="M224 480h640a32 32 0 1 1 0 64H224a32 32 0 0 1 0-64"
              ></path>
              <path
                fill="currentColor"
                d="m237.248 512 265.408 265.344a32 32 0 0 1-45.312 45.312l-288-288a32 32 0 0 1 0-45.312l288-288a32 32 0 1 1 45.312 45.312z"
              ></path>
            </svg>
          </i>
          <p data-v-b78bf5cc="" class="header-content">高級認證</p>
        </section>
        <section data-v-b78bf5cc="" class="content">
          <p data-v-b78bf5cc="" class="content-title">高級認證照片</p>
          <div data-v-b78bf5cc="" class="form">
            <div
              data-v-b78bf5cc=""
              class="el-row"
              element-loading-background="transparent"
            >
              <div data-v-b78bf5cc="" class="uploader-container">
                <el-upload
                  data-v-b78bf5cc=""
                  class="avatar-uploader"
                  :action="`${nowUrl}/wap/public/uploadimg!execute.action`"
                  accept=".jpg,.jpeg,.png,.gif.JPG,.JPEG,.PNG,.GIF"
                  :show-file-list="false"
                  :on-success="handelDoucumentsFront"
                  :before-upload="(file) => beforeUpload(file, 0)"
                  :on-change="(file) => handleChange(file, 0)"
                >
                  <span
                    data-v-b78bf5cc=""
                    class="avatar-uploader-icon1 avatar-uploader-icons"
                  ></span>
                  <img
                    v-if="previewList[0]"
                    :src="previewList[0]"
                    class="preview-img"
                  />
                </el-upload>
                <p data-v-b78bf5cc="" class="avatar-uploader__title">
                  身份證正面照
                </p>
                <p data-v-b78bf5cc="" class="avatar-uploader__desc">
                  請上傳身份證正面照
                </p>
              </div>
            </div>
            <div
              data-v-b78bf5cc=""
              class="el-row"
              element-loading-background="transparent"
            >
              <div data-v-b78bf5cc="" class="uploader-container">
                <el-upload
                  data-v-b78bf5cc=""
                  class="avatar-uploader"
                  :action="`${nowUrl}/wap/public/uploadimg!execute.action`"
                  accept=".jpg,.jpeg,.png,.gif.JPG,.JPEG,.PNG,.GIF"
                  :on-success="handelDoucumentsBack"
                  :show-file-list="false"
                  :before-upload="(file) => beforeUpload(file, 1)"
                  :on-change="(file) => handleChange(file, 1)"
                >
                  <div class="upload-inner">
                    <span
                      data-v-b78bf5cc=""
                      class="avatar-uploader-icon1 avatar-uploader-icons"
                    ></span>
                    <img
                      v-if="previewList[1]"
                      :src="previewList[1]"
                      class="preview-img"
                    />
                  </div>
                </el-upload>
                <p data-v-b78bf5cc="" class="avatar-uploader__title">
                  身份證反面照
                </p>
                <p data-v-b78bf5cc="" class="avatar-uploader__desc">
                  請上傳身份證反面照
                </p>
              </div>
            </div>
            <div
              data-v-b78bf5cc=""
              class="el-row"
              element-loading-background="transparent"
            >
              <div data-v-b78bf5cc="" class="uploader-container">
                <el-upload
                  data-v-b78bf5cc=""
                  class="avatar-uploader"
                  action=""
                  :action="`${nowUrl}/wap/public/uploadimg!execute.action`"
                  accept=".jpg,.jpeg,.png,.gif.JPG,.JPEG,.PNG,.GIF"
                  :on-success="holdIdCardSuccess"
                  :show-file-list="false"
                  :before-upload="(file) => beforeUpload(file, 2)"
                  :on-change="(file) => handleChange(file, 2)"
                >
                  <span
                    data-v-b78bf5cc=""
                    class="avatar-uploader-icon1 avatar-uploader-icons"
                  ></span>
                  <img
                    v-if="previewList[2]"
                    :src="previewList[2]"
                    class="preview-img"
                  />
                </el-upload>
                <p data-v-b78bf5cc="" class="avatar-uploader__title">
                  手持證件照片
                </p>
                <p data-v-b78bf5cc="" class="avatar-uploader__desc">
                  請上傳手持證件照片
                </p>
              </div>
            </div>
          </div>
        </section>
        <button data-v-b78bf5cc="" class="page-btn" @click="onSubmit">
          提交審核
        </button>
      </section>
    </div>
  </div>
  <footer-view></footer-view>
</template>
<script setup>
import { ref } from "vue";
import { ElMessage } from "element-plus";
import Axios2 from "@/api/my.js";
 
// 三张图片的文件和预览
const fileList = ref([null, null, null]);
const previewList = ref([null, null, null]);
 
//上传背面
const idBackImg = ref(null);
const idFrontImg = ref(null);
const handheldPhoto = ref(null);
function handelDoucumentsFront(res, file) {
  const { path, httpUrl } = res.data;
  console.log("上传成功", path);
  // this.twoImg = httpUrl;
  idFrontImg.value = path;
}
function handelDoucumentsBack(res, file) {
  const { path, httpUrl } = res.data;
  console.log("上传成功", path);
  // this.twoImg = httpUrl;
  idBackImg.value = path;
}
function holdIdCardSuccess(res, file) {
  const { path, httpUrl } = res.data;
  console.log("上传成功", path);
  // this.twoImg = httpUrl;
  handheldPhoto.value = path;
}
 
function beforeUpload(file, idx) {
  console.log("beforeUpload", file, idx);
  if (!file.type.startsWith("image/")) {
    ElMessage.error("請選擇圖片文件");
    return false;
  }
  fileList.value[idx] = file;
  // 生成本地预览
  const reader = new FileReader();
  reader.onload = (ev) => {
    previewList.value[idx] = ev.target.result;
  };
  reader.readAsDataURL(file);
  // 阻止自动上传
  return false;
}
function handleChange(file, idx) {
  // 这里可以根据需要处理 file
}
// 提交
async function onSubmit() {
  if (!fileList.value[0] || !fileList.value[1] || !fileList.value[2]) {
    ElMessage.error("請上傳所有照片");
    return;
  }
  const formData = new FormData();
  formData.append("front", fileList.value[0]);
  formData.append("back", fileList.value[1]);
  formData.append("hand", fileList.value[2]);
  Axios2.apply({
    // nationality: this.nationality,
    // idNumber: this.idNumber,
    idName: "id/passpost",
    // name: this.name,
    idFrontImg: idFrontImg.value,
    idBackImg: idBackImg.value,
    handheldPhoto: handheldPhoto.value,
  }).then((res) => {
    if (res.code == "0") {
      // 出来一个弹窗,显示已经提交成功
      ElMessage.success("提交成功,請等待審核");
      this.$parent.getIdentifyInfo();
    }
  });
}
</script>
<style scoped>
@import url("@/assets/css/my/index-0c4c93e2.css");
@import url("@/assets/css/my/index-a4ccec66.css");
 
.preview-img {
  width: 300px;
  height: 200px;
  object-fit: cover;
  margin-top: 8px;
  border-radius: 6px;
  border: 1px solid #eee;
}
.el-upload__input {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  /* 不要用 display: none; */
}
.avatar-uploader {
  position: relative;
  display: inline-block;
}
.upload-inner {
  position: relative;
  width: 100%;
  height: 100%;
}
.avatar-uploader-icons {
  display: block;
  width: 100%;
  height: 100%;
  line-height: 120px;
  text-align: center;
  font-size: 32px;
  color: #8c939d;
}
.preview-img {
  position: absolute;
  left: 0;
  top: -8px;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #eee;
  z-index: 2;
}
</style>