Browse Source

修改IOS上传相片时反回到首页

master
liaoxinyu 2 years ago
parent
commit
8be4107dd7
  1. 236
      pages/auth/senior.vue

236
pages/auth/senior.vue

@ -1,135 +1,139 @@
<template> <template>
<div class="layout-page" :style="themeStyle"> <div class="layout-page" :style="themeStyle">
<v-header :title="$t('auth.a4')"></v-header> <v-header :title="$t('auth.a4')"></v-header>
<main class="layout-main"> <main class="layout-main">
<div class="form-item p-md m-md"> <div class="form-item p-md m-md">
<div class="color-light p-b-xs">1{{$t('auth.b5')}}</div> <div class="color-light p-b-xs">1{{$t('auth.b5')}}</div>
<div class="d-flex justify-between m-t-md "> <div class="d-flex justify-between m-t-md ">
<div class="examples m-r-xs bg-panel-3 p-md rounded-sm box-shadow"> <div class="examples m-r-xs bg-panel-3 p-md rounded-sm box-shadow">
<img src="static/img/fill6.png" /> <img src="static/img/fill6.png"/>
</div> </div>
<div <div
@click="getFile('front_img')" @click="getFile('front_img')"
class="upload-box d-flex justify-center align-center rounded-sm bg-panel-3 box-shadow" 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" /> <van-icon v-if="!form.front_img" class="color-light fn-30" name="photograph"/>
<img v-else :src="form.front_img" alt /> <img v-else :src="form.front_img" alt/>
</div> </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/fill7.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>
</main>
<div class="p-md">
<v-button block type="green" class="w-max rounded-lg" @click="topAuth" ref="btn">{{$t('common.submit')}}
</v-button>
</div> </div>
</div> <van-toast id="van-toast"/>
<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/fill7.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="green" class="w-max rounded-lg" @click="topAuth" ref="btn">{{$t('common.submit')}}</v-button>
</div> </div>
<van-toast id="van-toast" />
</div>
</template> </template>
<script> <script>
import utils from "@/utils"; import utils from "@/utils";
import Profile from "@/api/profile"; import Profile from "@/api/profile";
import Member from "@/api/member"; import Member from "@/api/member";
import { mapGetters } from "vuex"; import {mapGetters} from "vuex";
export default { export default {
data() { data() {
return { return {
imgBase: undefined, detail: {},
form: { countryList: [],
hand_img: "", imgBase: undefined,
back_img: "", form: {
front_img: "", 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);
})
}, },
// computed: {
upLoadImg(chooseImageRes, name) { ...mapGetters(['themeStyle']),
Member.uploadImage(chooseImageRes).then((res) => {
this.form[name] = res.data.url;
this.$toast.success(this.$t('auth.c1'));
});
}, },
// methods: {
topAuth() { getFile(name) {
let data = this.form; console.log(name)
// if (!data.hand_img) { this.$getFile({count: 9}).then((res) => {
// this.$toast(this.$t('auth.b7')); this.upLoadImg(res, name);
// return; })
// } },
if (!data.back_img) { //
this.$toast(this.$t('auth.c2')); upLoadImg(chooseImageRes, name) {
return; Member.uploadImage(chooseImageRes).then((res) => {
} this.form[name] = res.data.url;
if (!data.front_img) { this.$toast.success(this.$t('auth.c1'));
this.$toast(this.$t('auth.c3')); });
return; },
} //
Profile.topAuth(data, { btn: this.$refs.btn }) topAuth() {
.then(() => { let data = this.form;
this.$toast.success(this.$t('auth.c4')+"。"); // if (!data.hand_img) {
this.$back(); // this.$toast(this.$t('auth.b7'));
}) // return;
.catch(() => {}); // }
}, 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(() => {
// alert($t('auth.c4') );
this.$toast.success(this.$t('auth.c4') + "。");
clearTimeout(this.timer); //
this.timer = setTimeout(()=>{ //
this.$router.push("/pages/base/index");
},1000);
// this.$back();
})
.catch(() => {
});
},
}
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.layout-page{
background-color: #fff !important;
background: none;
}
.examples { .examples {
width: 122px; width: 122px;
height: 70px; height: 70px;
display: flex; display: flex;
align-items: center; align-items: center;
img {
width: 100%; img {
} width: 100%;
}
} }
.upload-box { .upload-box {
width: 150px; width: 150px;
height: 100px; height: 100px;
img {
width: 100%; img {
height: 100%; width: 100%;
object-fit: cover; height: 100%;
} object-fit: cover;
}
}
.bg-panel-3{
background-color: #fff;
} }
</style> </style>
Loading…
Cancel
Save