index.js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. var content = {
  2. 'cn':{
  3. item1:'文档管理',
  4. item2:'身份证明',
  5. item3:'未验证',
  6. item4:'已通过',
  7. item5:'护照/身份证/驾照。',
  8. item6:'请上传PNG、JPEG、JPG或PDF格式的彩色身份证明文件,显示您的全名。图像必须是高质量的,畅通无阻,并显示整个文档页面。如属国家身份证件,须上传身份证正反两面。文件有效期必须超过3个月。',
  9. item7:'地址证明',
  10. item8:'请以PNG、JPEG、JPG或PDF格式上传地址证明。',
  11. item9:'住址证明必须不超过180天(水电帐单/银行对账单/其他财务文件)。文件必须以申请人的姓名发出,并显示申请人在登记时所提供的目前居住地址。图像必须是高质量的,畅通无阻,并显示整个文档页面。',
  12. item10:'其它补充材料',
  13. item11:'护照/身份证/驾照。',
  14. item12:'请上传我们支持团队要求的其他文件。',
  15. IMG: "上传头像图片大小不能超过 10MB!",
  16. JPG: "上传图片只能是 JPG、JPEG、PNG、PDF 格式!"
  17. },
  18. 'en':{
  19. item1:'Document Management',
  20. item2:'Identification',
  21. item3:'Unverified',
  22. item4:'Verified',
  23. item5:'Passport / National ID / Driving License.',
  24. item6:'Please upload an identification document in color in PNG, JPEG, JPG or PDF format displaying your full name.The image must be high quality, unobstructed and show the full document page. In cases of national ID document, both sides of the ID card must be uploaded. The document must have more than 3 months validity.',
  25. item7:'Proof Of Address',
  26. item8:'Please upload a proof of address in PNG, JPEG, JPG or PDF format.',
  27. item9:'Proof of address must be no more than 180 days old (utility bill / bank statement / other financial document).The document must be issued in the applicant’s name and show their current residential address as provided during the registration.The image must be high quality, unobstructed and show the full document page.',
  28. item10:'Additional Documents',
  29. item11:'Passport / National ID / Driving License.',
  30. item12:'Please upload any additional documents requested by our support team.',
  31. IMG: "The size of uploaded avatars should not exceed 10MB!",
  32. JPG: "Upload pictures can only be JPG, JPEG, PNG, PDF format!"
  33. }
  34. }
  35. let vm = new Vue({
  36. el: "#index",
  37. data: {
  38. //多语言
  39. langList: {
  40. en: "ENGLISH",
  41. cn: "中文简体"
  42. },
  43. language: "cn",
  44. lang:{},
  45. imageUrl1: '',
  46. imageUrl2: '',
  47. imageUrl3: '',
  48. imageUrl4: '',
  49. imageUrl5: '',
  50. //文件
  51. fileListID1:{"againPath": "", "id": null, "path": "", "status": null, "type": null},
  52. fileListID2:{"againPath": "", "id": null, "path": "", "status": null, "type": null},
  53. fileListAdd1:{"againPath": "", "id": null, "path": "", "status": null, "type": null},
  54. fileListAdd2:{"againPath": "", "id": null, "path": "", "status": null, "type": null},
  55. fileListOther:{"againPath": "", "id": null, "path": "", "status": null, "type": null},
  56. actionID1:'',
  57. actionID2:'',
  58. actionAdd1:'',
  59. actionAdd2:'',
  60. actionOther:'',
  61. imgUrl:'http://47.75.159.72:8000'
  62. },
  63. computed: {
  64. AccessToken(){
  65. return{
  66. 'Access-Token': window.location.href.split('=')[1]
  67. }
  68. }
  69. },
  70. methods: {
  71. // 语言切换函数
  72. chooseLang (key) {
  73. this.lang = content[key]
  74. this.language = key;
  75. },
  76. //获取上传文件信息
  77. async getCustomFileList () {
  78. let _this = this;
  79. axios.defaults.headers.common['Access-Token'] = window.location.href.split('=')[1]
  80. axios.post('http://47.75.159.72:8000/custom/file/list', {
  81. //参数
  82. }).then(res => {//请求成功后的处理函数
  83. if (res.data.code == 200) {
  84. let myData = res.data.data;
  85. myData.forEach(item=>{
  86. if (item.type == 1){
  87. _this.fileListID1 = item;
  88. } else if (item.type == 2){
  89. _this.fileListID2 = item;
  90. } else if (item.type == 3){
  91. _this.fileListAdd1 = item;
  92. } else if (item.type == 4){
  93. _this.fileListAdd2 = item;
  94. } else if (item.type == 10){
  95. _this.fileListOther = item;
  96. }
  97. });
  98. this.actionType();
  99. } else {
  100. }
  101. }).catch(err => { //请求失败后的处理函数
  102. })
  103. },
  104. //请求头
  105. actionType(){
  106. if (this.fileListID1.status == (3 || 4)) {
  107. this.actionID1 = 'http://47.75.159.72:8000/custom/file/upload/1/' + this.fileListID1.id;
  108. } else {
  109. this.actionID1 = 'http://47.75.159.72:8000/custom/file/upload/1';
  110. }
  111. if (this.fileListID2.status == (3 || 4)) {
  112. this.actionID2 = 'http://47.75.159.72:8000/custom/file/upload/2/' + this.fileListID2.id;
  113. } else {
  114. this.actionID2 = 'http://47.75.159.72:8000/custom/file/upload/2';
  115. }
  116. if (this.fileListAdd1.status == (3 || 4)) {
  117. this.actionAdd1 = 'http://47.75.159.72:8000/custom/file/upload/3/' + this.fileListAdd1.id;
  118. } else {
  119. this.actionAdd1 = 'http://47.75.159.72:8000/custom/file/upload/3';
  120. }
  121. if (this.fileListAdd2.status == (3 || 4)) {
  122. this.actionAdd2 = 'http://47.75.159.72:8000/custom/file/upload/4/' + this.fileListAdd2.id;
  123. } else {
  124. this.actionAdd2 = 'http://47.75.159.72:8000/custom/file/upload/4';
  125. }
  126. if (this.fileListOther.status == (3 || 4)) {
  127. this.actionOther = 'http://47.75.159.72:8000/custom/file/upload/10/' + this.fileListOther.id;
  128. } else {
  129. this.actionOther = 'http://47.75.159.72:8000/custom/file/upload/10';
  130. }
  131. },
  132. //图片上传
  133. handleAvatarSuccess1 (res, file) {
  134. this.imageUrl1 = URL.createObjectURL(file.raw);
  135. },
  136. handleAvatarSuccess2 (res, file) {
  137. this.imageUrl2 = URL.createObjectURL(file.raw);
  138. },
  139. handleAvatarSuccess3 (res, file) {
  140. this.imageUrl3 = URL.createObjectURL(file.raw);
  141. },
  142. handleAvatarSuccess4 (res, file) {
  143. this.imageUrl4 = URL.createObjectURL(file.raw);
  144. },
  145. handleAvatarSuccess5 (res, file) {
  146. this.imageUrl5 = URL.createObjectURL(file.raw);
  147. },
  148. beforeAvatarUpload (file) {
  149. const isJPG = file.type === 'image/jpeg' || 'image/JPEG' || 'image/png' || 'image/PNG' || 'image/jpg' || 'image/JPG' || 'image/pdf' || 'image/PDF';
  150. const isLt2M = file.size / 1024 / 1024 < 10;
  151. if (!isJPG) {
  152. this.$message.error(content[this.language].JPG);
  153. }
  154. if (!isLt2M) {
  155. this.$message.error(content[this.language].IMG);
  156. }
  157. return isJPG && isLt2M;
  158. },
  159. },
  160. mounted() {
  161. this.getCustomFileList();
  162. this.lang = content['cn']
  163. }
  164. });