index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <template>
  2. <div class="box">
  3. <div class="footerbox">
  4. <div class="topbox">
  5. {{$t('register.WELCOME')}}
  6. </div>
  7. <div class="taps_footerbox">
  8. <el-input class="inputbox" v-model="from.email" :placeholder="$t('register.Address')"></el-input>
  9. <div class="red-t">*</div>
  10. </div>
  11. <div class="taps_footerbox">
  12. <el-input class="inputbox" v-model="from.password" show-password :placeholder="$t('register.Password')"></el-input>
  13. <div class="red-t">*</div>
  14. </div>
  15. <div class="taps_footerbox">
  16. <el-input class="inputbox" v-model="from.confirmPassword" show-password :placeholder="$t('register.Confirm')"></el-input>
  17. <div class="red-t">*</div>
  18. </div>
  19. <div class="taps_footerbox">
  20. <el-input class="inputbox" v-model="from.name" :placeholder="$t('register.Fullname')"></el-input>
  21. <!-- <div class="red-t">*</div> -->
  22. </div>
  23. <div class="taps_footerbox">
  24. <el-input class="inputbox" v-model="from.company" :placeholder="$t('register.Company')"></el-input>
  25. <!-- <div class="red-t">*</div> -->
  26. </div>
  27. <div class="taps_footerbox">
  28. <el-select v-model="from.country" :placeholder="$t('register.Country')">
  29. <el-option
  30. v-for="item in regionList"
  31. :key="item.en"
  32. :label="item.en"
  33. :value="item.en">
  34. </el-option>
  35. </el-select>
  36. </div>
  37. <div class="taps_footerbox">
  38. <el-select v-model="from.accountType" :placeholder="$t('register.Account')">
  39. <el-option
  40. v-for="item in accountTypeList"
  41. :key="item.name"
  42. :label="item.name"
  43. :value="item.name">
  44. </el-option>
  45. </el-select>
  46. </div>
  47. <el-button class="buttonbox_taps" type="primary" v-loading.fullscreen.lock="fullscreenLoading" @click="postRegister">{{$t('register.Agree')}}</el-button>
  48. </div>
  49. <div class="rightbox">
  50. <div class="rightcenterbox">
  51. <div class="rightcenterbox_f">
  52. <!-- Contact Us -->
  53. {{$t('button.contactUs')}}
  54. </div>
  55. <div class="rightcenterbox_b">
  56. <p>{{$t('bottomBar.Tel')}} {{$t('taps.Telnum')}}</p>
  57. <p>{{$t('bottomBar.Email')}} {{$t('taps.Emailnum')}}</p>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. </template>
  63. <script>
  64. import region from '@/js/region'
  65. export default {
  66. components: {
  67. },
  68. name: 'register',
  69. data () {
  70. return {
  71. fullscreenLoading: false,
  72. langShow: this.$util.localeStorage(),
  73. checked: true,
  74. checkedp: true,
  75. regionList: [],
  76. from: {
  77. accountType: '',
  78. company: '',
  79. confirmPassword: '',
  80. country: '',
  81. email: '',
  82. name: '',
  83. password: '',
  84. country: ''
  85. },
  86. accountTypeList: [{
  87. name: 'Industry',
  88. nameCn: '工业客户'
  89. }, {
  90. name: 'Academic',
  91. nameCn: '科研客户'
  92. }, {
  93. name: 'Distributor',
  94. nameCn: '经销商'
  95. }]
  96. }
  97. },
  98. methods: {
  99. postRegister () { // 注册
  100. if (this.verification()) {
  101. this.fullscreenLoading = true;
  102. this.$api.post('auth/register', this.from).then((res) => {
  103. if (res.code == 0) {
  104. this.fullscreenLoading = false;
  105. this.$message({
  106. message: this.$t('message.registration'),
  107. type: 'success'
  108. })
  109. this.$router.push({
  110. name: 'registration'
  111. })
  112. } else if (res.code == 226) {
  113. this.$message(this.$t('message.alreadyExists'))
  114. this.fullscreenLoading = false;
  115. } else if (res.code == 407) {
  116. this.$message(this.$t('message.hasFailed'))
  117. this.fullscreenLoading = false;
  118. } else {
  119. this.$message(res.msg)
  120. this.fullscreenLoading = false;
  121. }
  122. })
  123. }
  124. },
  125. verification () {
  126. // if (!this.from.email) {
  127. // this.$message.error(this.$t('register.Address') + this.$t('register.Cannot'))
  128. // return false
  129. // } else if (!this.$util.isEmail(this.from.email)) {
  130. // this.$message.error(this.$t('input.email') + this.$t('message.email'))
  131. // return false
  132. // } else if (!this.from.password) {
  133. // this.$message.error(this.$t('register.Password') + this.$t('register.Cannot'))
  134. // return false
  135. // } else if (!this.$util.passwordValid(this.from.password)) {
  136. // this.$message.error(this.$t('register.kinds'))
  137. // return false
  138. // } else if (this.from.password !== this.from.confirmPassword) {
  139. // this.$message.error(this.$t('register.inconsistent'))
  140. // return false
  141. // } else if (!this.from.name) {
  142. // this.$message.error(this.$t('register.Fullname') + this.$t('register.Cannot'))
  143. // return false
  144. // } else if (!this.from.company) {
  145. // this.$message.error(this.$t('register.Company') + this.$t('register.Cannot'))
  146. // return false
  147. // } else if (!this.from.country) {
  148. // this.$message.error(this.$t('register.Country') + this.$t('register.Cannot'))
  149. // return false
  150. // } else if (!this.from.accountType) {
  151. // this.$message.error(this.$t('register.Account') + this.$t('register.Cannot'))
  152. // return false
  153. // } else {
  154. // return true
  155. // }
  156. if (!this.from.email) {
  157. this.$message.error(this.$t('register.Address') + this.$t('register.Cannot'))
  158. return false
  159. } else if (!this.$util.isEmail(this.from.email)) {
  160. this.$message.error(this.$t('input.email') + this.$t('message.email'))
  161. return false
  162. } else if (!this.from.password) {
  163. this.$message.error(this.$t('register.Password') + this.$t('register.Cannot'))
  164. return false
  165. } else if (!this.$util.passwordValid(this.from.password)) {
  166. this.$message.error(this.$t('register.kinds'))
  167. return false
  168. } else if (this.from.password !== this.from.confirmPassword) {
  169. this.$message.error(this.$t('register.inconsistent'))
  170. return false
  171. } else {
  172. return true
  173. }
  174. }
  175. },
  176. mounted () {
  177. },
  178. created () {
  179. this.regionList = region
  180. }
  181. }
  182. </script>
  183. <style lang="scss" scoped>
  184. @media screen and (min-width: 751px) and (max-width: 9999px) {
  185. .box{
  186. overflow: hidden;
  187. margin-bottom: 3rem;
  188. }
  189. .footerbox{
  190. width: 40%;
  191. float: left;
  192. margin-left: 2rem;
  193. margin-top: 1.8rem;
  194. margin-right: 8rem;
  195. .topbox{
  196. margin-bottom: 1.8rem;
  197. font-size: 1.4rem;
  198. color: #005BAB;
  199. font-weight: 600;
  200. text-align: center;
  201. }
  202. .taps_footerbox /deep/{
  203. position: relative;
  204. margin-bottom: 0.8rem;
  205. .el-select{
  206. width: 100%;
  207. }
  208. .inputbox{
  209. width: 100%;
  210. }
  211. .red-t{
  212. font-size: 1.5rem;
  213. color: #E52323;
  214. position: absolute;
  215. top: 40%;
  216. left: -1rem;
  217. }
  218. }
  219. .buttonbox_taps{
  220. font-size: 16px;
  221. width: 100%;
  222. background: #0166b4;
  223. height: 3rem;
  224. padding: 0;
  225. margin-top: 1rem;
  226. }
  227. }
  228. .register_box{
  229. margin-top: 0.6rem;
  230. }
  231. .rightbox{
  232. width: 30%;
  233. float: left;
  234. .rightcenterbox{
  235. width: 100%;
  236. margin-top: 5.2rem;
  237. border: 1px solid #DBDBDB;
  238. .rightcenterbox_f{
  239. height: 3rem;
  240. font-size: 1.2rem;
  241. font-weight: 700;
  242. color: #313131;
  243. background: #F5F5F5;
  244. line-height: 3rem;
  245. text-indent: 1rem;
  246. }
  247. .rightcenterbox_b{
  248. font-size: 1rem;
  249. padding: 1rem;
  250. }
  251. }
  252. }
  253. .rightcenterbox_b>p:nth-of-type(1){
  254. margin-top: 0;
  255. }
  256. .rightcenterbox_b>p{
  257. margin-top: 1rem;
  258. color: #6f6f6f;
  259. }
  260. }
  261. @media screen and (min-width: 0px) and (max-width: 750px) {
  262. .box{
  263. overflow: hidden;
  264. // margin-bottom: 3rem;
  265. }
  266. .footerbox{
  267. width: 90%;
  268. margin: 0 auto;
  269. // overflow: hidden;
  270. background: #ffffff;
  271. .topbox{
  272. margin-bottom: 0.24rem;
  273. font-size: 0.2rem;
  274. color: #005BAB;
  275. font-weight: 600;
  276. text-align: center;
  277. }
  278. .taps_footerbox /deep/{
  279. position: relative;
  280. margin-bottom: 0.16rem;
  281. .el-select{
  282. width: 100%;
  283. }
  284. .inputbox{
  285. width: 100%;
  286. }
  287. .red-t{
  288. font-size: 0.2rem;
  289. color: #E52323;
  290. position: absolute;
  291. top: 50%;
  292. transform: translateY(-50%);
  293. left: -0.1rem;
  294. }
  295. }
  296. .buttonbox_taps{
  297. font-size: 0.16rem;
  298. width: 100%;
  299. background: #0166b4;
  300. height: 0.42rem;
  301. padding: 0;
  302. margin-top: 0.2rem;
  303. }
  304. }
  305. .register_box{
  306. margin-top: 0.1rem;
  307. }
  308. .rightbox{
  309. display: none;
  310. }
  311. }
  312. </style>