| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- var content = {
- 'cn':{
- item1:'银行卡照片',
- UpdatePrompt: "银行卡照片上传,可减少因银行信息输入有误,而导致无法到账或到账不及时的情况",
- IMG: "上传图片大小不能超过 3MB!",
- JPG: "上传图片只能是 JPG、JPEG、PNG、PDF 格式!",
- btn:'确认上传',
- success:'上传成功,请在PC端查看...',
- },
- 'en':{
- item1:'Bank card photo',
- UpdatePrompt: "The uploading of bank card photos can reduce the situation that the account cannot be received or the account is not timely due to the wrong input of bank information",
- IMG: "Upload image size cannot exceed 3MB!",
- JPG: "Upload image can only be JPG, JPEG, PNG, PDF format!",
- btn:'Confirm upload',
- success:'Upload succeeded, please check on PC',
- }
- }
- let vm = new Vue({
- el: "#index",
- data: {
- ho:'',
- //多语言
- langList: {
- en: "ENGLISH",
- cn: "中文简体"
- },
- language: "cn",
- lang:{},
- imageUrl:'',
- imgUrl:''
- },
- computed: {
- AccessToken(){
- return{
- 'Access-Token': window.location.href.split('=')[1]
- }
- }
- },
- methods: {
- // 语言切换函数
- chooseLang (key) {
- this.lang = content[key];
- this.language = key;
- },
- //确认上传按钮
- update(){
- if (!this.imageUrl) {
- return
- }
- this.$message({
- message: content[this.language].success,
- type: 'success'
- });
- },
- //图片上传
- handleAvatarSuccess1 (res, file) {
- if (res.code == 200) {
- this.$message({
- message: res.msg,
- type: 'success'
- });
- this.imageUrl = URL.createObjectURL(file.raw);
- } else {
- this.$message.error(res.msg);
- }
- },
- beforeAvatarUpload (file) {
- const imageType = ['image/jpeg', 'image/png', 'image/jpg', 'image/pdf'];
- const isJPG = imageType.indexOf(file.type.toLocaleLowerCase()) == -1 ? false : true;
- const isLt2M = file.size / 1024 / 1024 < 3;
- if (!isJPG) {
- this.$message.error(content[this.language].JPG);
- }
- if (!isLt2M) {
- this.$message.error(content[this.language].IMG);
- }
- return isJPG && isLt2M;
- },
- },
- mounted() {
- let hostParts = window.location.host.split('.');
- let tld = hostParts.slice(2).join('.') || 'com';
- this.ho = window.location.host.split('.')[1];
- this.imgUrl = 'https://secure.' + this.ho + '.' + tld
- var jsSrc =(navigator.language || navigator.browserLanguage).toLowerCase();
- if(jsSrc.indexOf('zh') >= 0){
- this.language = 'cn'
- this.lang = content['cn'];
- }else{
- this.language = 'en'
- this.lang = content['en'];
- }
- }
- });
|