Browse Source

[WHAT] 會員相關 [WHY] 開發 ShowEasy 前台

1. 忘記密碼防呆
2. 儲存電話國碼
Dev
Janie 2 years ago
parent
commit
a68c60d71a
  1. 96
      FrontEnd/pages/user/editPersonalInfo.vue
  2. 28
      FrontEnd/pages/user/forgot.vue

96
FrontEnd/pages/user/editPersonalInfo.vue

@ -52,7 +52,11 @@
@click="handleUploadEvent">
{{ $t("userProfile.uploadPicture") }}
</button>
<input type="file" class="d-none" ref="uploader" @change="userPictureUpload" />
<input type="file" class="d-none" ref="uploader" @change="getNewPicture" />
<!-- <input type="file" class="d-none" ref="uploader" @change="userPictureUpload" /> -->
</div>
</div>
<!-- form -->
@ -106,7 +110,7 @@
{{ $t("userProfile.phone") }}
</div>
<div>
<vue-country-code class="d-none" v-model="countryCode" enabledCountryCode :enabledFlags="false"
<vue-country-code class="d-none" v-model="countryCode" enabldCountryCode :enabledFlags="false"
@onSelect="showCode"></vue-country-code>
<vue-phone-number-input v-model="userData.Phone" color="#EF5A5A" valid-color="#EE9546" :border-radius="5"
no-flags no-example @update="getPhoneData" :translations="translateOption">
@ -179,7 +183,7 @@
</div>
</div>
<CropImageDialog :isCropImageDialogActive="isCropImageDialogActive" :cropImagePreview="cropImagePreview"
@close-crop-dialog="closeCropDialog" @upload-image-success="handleImageUpdate"></CropImageDialog>
@close-crop-dialog="closeCropDialog" @upload-image-success="userPictureUpload"></CropImageDialog>
</div>
</template>
<script>
@ -271,13 +275,17 @@ export default {
picName: "",
picSize: "",
picType: "",
picPath:"",
mozFullPath:"",
},
dialCode:"",
};
},
created() {
this.fetchCountry();
this.$store.dispatch("updatePicture");
this.fetchUserData();
},
mounted() {
this.yearOptions = Array.from(new Array(103), (val, index) =>
@ -304,10 +312,18 @@ export default {
});
},
methods: {
getPhoneData(phoneData) {
this.countryCode = phoneData.countryCode;
this.userData.PhoneCode = phoneData.countryCallingCode;
this.phoneValid = phoneData.isValid;
},
showCode(object) {
//this.userData.PhoneCode = object.dialCode;
},
patchUserData() {
if (this.width < 1366) {
this.isEditInfoDialogActive = !this.isEditInfoDialogActive;
}
// if (this.width < 1366) {
// this.isEditInfoDialogActive = !this.isEditInfoDialogActive;
// }
this.validators();
// if (this.validators()) {
@ -341,8 +357,9 @@ export default {
}
const patchData = JSON.parse(JSON.stringify(this.userData));
// delete patchData.LoginLog;
// delete patchData.UserCompany;
//delete patchData.UserCompany;
// delete patchData.UserSocialRelation;
// delete patchData.UserExhibition;
this.$axios
@ -358,12 +375,12 @@ export default {
});
}
this.fetchUserData();
// this.$auth.$storage.setUniversal("userPicture", patchData.MemberPicture);
this.$auth.$storage.setUniversal("userPicture", patchData.MemberPicture);
// this.$auth.$storage.setUniversal(
// "userLastName",
// patchData.LastName
// );
// this.$store.dispatch("updatePicture");
this.$store.dispatch("updatePicture");
})
.catch((error) => {
console.log(error);
@ -383,11 +400,12 @@ export default {
this.firstName = this.userData.FirstName;
this.lastName = this.userData.LastName;
this.userData.Phone ? (this.phoneValid = true): (this.phoneValid = false);
//this.countryCode = this.userData.PhoneCode;
if(this.userData.ArgumentID == "en-US"){
if(this.userData.LanguageID == "en-US"){
this.languageSelect.en = true;
}else if(this.userData.ArgumentID == "zh-TW"){
}else if(this.userData.LanguageID == "zh-TW"){
this.languageSelect.zhtw = true;
}else{
@ -422,39 +440,29 @@ export default {
handleUploadEvent() {
window.addEventListener("focus", () => { }, { once: true });
this.$refs.uploader.click();
},
userPictureUpload(e) {
//const payload = new FormData();
//payload.append("file", e.target.files[0].name);
const name = (JSON.stringify(e.target.files[0].name)).toString();
const size = (JSON.stringify(e.target.files[0].size)).toString();
const type = (JSON.stringify(e.target.files[0].type)).toString();
console.log("size:" + name);
//this.payload.push(name, size, type);
this.payload.picName = name;
this.payload.picSize = size;
this.payload.picType = type;
console.log("payload:" + JSON.stringify(this.payload));
},
getNewPicture(e) {
const path = URL.createObjectURL(e.target.files[0]);
this.cropImagePreview = path ;
console.log("image:" + this.cropImagePreview);
this.isCropImageDialogActive = !this.isCropImageDialogActive;
},
const fileSize = (e.target.files[0].size / 1024 / 1024).toFixed(1);
if (fileSize >= 2) {
userPictureUpload(e) {
const fileSize = (e.target.files[0].size / 1024 / 1024).toFixed(1);
if (fileSize >= 2) {
this.fileTooBig = !this.fileTooBig;
} else {
this.$axios
//.post("/users/images", payload)
//.post("/trending/api/Members/UploadAvatar)
.post(
`/trending/api/Members/UploadAvatar`
)
.then((response) => {
console.log(JSON.stringify(response));
//console.log(JSON.stringify(response));
if(response && response.data && response.data.DATA && response.data.DATA.rel){
let data = response.data.DATA.rel
if(data){
@ -464,19 +472,14 @@ export default {
})
.catch((error) => {
console.log(error);
});
this.isCropImageDialogActive = !this.isCropImageDialogActive;
}
}
},
getPhoneData(phoneData) {
this.countryCode = phoneData.countryCode;
this.phoneValid = phoneData.isValid;
},
showCode(object) {
this.userData.country_code = object.dialCode;
},
fetchCountry() {
this.$axios
@ -506,11 +509,12 @@ export default {
closeCropDialog() {
this.isCropImageDialogActive = !this.isCropImageDialogActive;
},
handleImageUpdate(pictureURL) {
this.userData.MemberPicture = pictureURL;
this.patchUserData();
handleImageUpdate() {
this.fetchUserData();
//this.patchUserData();
this.closeCropDialog();
},
validators() {
if (is.empty(this.userData.FirstName)) {
this.validation.FirstName = false;

28
FrontEnd/pages/user/forgot.vue

@ -163,25 +163,29 @@ export default {
},
methods: {
sendForgotMail() {
this.disableBtn = !this.disableBtn;
this.timeout = setInterval(() => {
if (this.countdown > 0) {
this.countdown--;
}
if (this.countdown === 0) {
this.disableBtn = !this.disableBtn;
this.countdown = 60;
clearInterval(this.timeout);
}
}, 1000);
this.$axios
.post(`/trending/api/Signup/SendForgotMail?Email=${this.Email}`)
.then((response) => {
console.log(JSON.stringify(response));
//console.log(JSON.stringify(response));
if(response.data.STATUSCODE == "404"){
//console.log("");
this.resendValid = false;
}
if(response && response.data && response.data.DATA && response.data.DATA.rel){
let data = response.data.DATA.rel
if(data){
this.result = data;
this.disableBtn = !this.disableBtn;
this.timeout = setInterval(() => {
if (this.countdown > 0) {
this.countdown--;
}
if (this.countdown === 0) {
this.disableBtn = !this.disableBtn;
this.countdown = 60;
clearInterval(this.timeout);
}
}, 1000);
}
}
})

Loading…
Cancel
Save