1
jhzh
2025-06-16 1760942f9204e56032ca93ff1b720bbf966dd495
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
<template>
  <div class="layout-page" :style="themeStyle">
    <v-header :title="$t('auth.a4')"></v-header>
    <main class="layout-main">
      <div class="form-item   p-md m-md">
        <div class="color-light p-b-xs">1、{{$t('auth.b5')}}</div>
        <div class="d-flex justify-between m-t-md ">
          <div class="examples m-r-xs bg-panel-3 p-md rounded-sm box-shadow">
            <img src="static/img/fill6.png" />
          </div>
          <div
            @click="getFile('front_img')"
            class="upload-box d-flex justify-center align-center rounded-sm  bg-panel-3 box-shadow"
          >
            <van-icon v-if="!form.front_img" class="color-light fn-30" name="photograph" />
            <img v-else :src="form.front_img" alt />
          </div>
        </div>
      </div>
      <div class="form-item  p-md m-md">
        <div class="color-light p-b-xs">2、{{$t('auth.b6')}}</div>
        <div class="d-flex justify-between m-t-md">
          <div class="examples m-r-xs bg-panel-3 p-md rounded-sm box-shadow">
            <img src="static/img/fill6.png" />
          </div>
          <div
            @click="getFile('back_img')"
            class="upload-box d-flex justify-center align-center rounded-sm  bg-panel-3 box-shadow"
          >
            <van-icon v-if="!form.back_img" class="color-light fn-30" name="photograph" />
            <img v-else :src="form.back_img" alt />
          </div>
        </div>
      </div>
      <div class="form-item p-md m-md ">
        <div class="color-light  p-b-xs">3、{{$t('auth.b7')}}</div>
        <div class="fn-sm ">{{$t('auth.b8')}}。</div>
        <div class="d-flex justify-between m-t-md">
          <div class="examples m-r-xs bg-panel-3 p-md rounded-sm box-shadow">
            <img src="static/img/fill6.png" />
          </div>
          <div
            @click="getFile('hand_img')"
            class="upload-box d-flex justify-center align-center rounded-sm  bg-panel-3 box-shadow"
          >
            <van-icon v-if="!form.hand_img" class="color-light fn-30" name="photograph" />
            <img v-else :src="form.hand_img" alt />
          </div>
        </div>
      </div>
    </main>
    <div class="p-md">
      <v-button block type="red" class="w-max m-y-md rounded-xs" @click="topAuth" ref="btn">{{$t('common.submit')}}</v-button>
    </div>
    <van-toast id="van-toast" />
  </div>
</template>
<script>
import utils from "@/utils";
import Profile from "@/api/profile";
import Member from "@/api/member";
import { mapGetters } from "vuex";
export default {
  data() {
    return {
      imgBase: undefined,
      form: {
        hand_img: "",
        back_img: "",
        front_img: "",
      },
    };
  },
  computed: {
    ...mapGetters(['themeStyle'])
  },
  methods: {
    getFile(name) {
      //  console.log(name)
      this.$getFile({count:9}).then((res) => {
        this.upLoadImg(res, name);
      })
    },
    // 上传图片
    upLoadImg(chooseImageRes, name) {
      Member.uploadImage(chooseImageRes).then((res) => {
        this.form[name] = res.data.url;
        this.$toast.success(this.$t('auth.c1'));
      });
    },
    // 提交审核
    topAuth() {
      let data = this.form;
      if (!data.hand_img) {
        this.$toast(this.$t('auth.b7'));
        return;
      }
      if (!data.back_img) {
        this.$toast(this.$t('auth.c2'));
        return;
      }
      if (!data.front_img) {
        this.$toast(this.$t('auth.c3'));
        return;
      }
      Profile.topAuth(data, { btn: this.$refs.btn })
        .then(() => {
          this.$toast.success(this.$t('auth.c4')+"。");
          this.$back();
        })
        .catch(() => {});
    },
  },
};
</script>
<style lang="scss" scoped>
.examples {
  width: 122px;
  height: 70px;
  display: flex;
  align-items: center;
  img {
    width: 100%;
  }
}
.upload-box {
  width: 150px;
  height: 100px;
  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}
</style>