login.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <uv-toast ref="toast"></uv-toast>
  3. <view class="page">
  4. <uv-row justify="space-between" customStyle="margin-top: 35%" class="form">
  5. <uv-col span="10" offset="1">
  6. <uv-form labelPosition="left" :model="logininfo" :rules="rules" ref="form" >
  7. <uv-col span="10" offset="1">{{$t('telno')}}</uv-col>
  8. <uv-col span="10" offset="1">
  9. <uv-form-item prop="telno" >
  10. <uv-input v-model.trim="logininfo.telno" border="surround">
  11. </uv-input>
  12. </uv-form-item>
  13. </uv-col>
  14. <uv-col span="10" offset="1" customStyle="margin-top: 20px">{{$t('password')}}</uv-col>
  15. <uv-col span="10" offset="1">
  16. <uv-form-item prop="pw" >
  17. <uv-input v-model.trim="logininfo.pw" :type="passwordtype" border="surround">
  18. </uv-input>
  19. <template v-slot:right>
  20. <uv-icon name="eye-off-outline" color="#2979ff" size="18" v-show="!showpasswod" @click="setshowpasswod"></uv-icon>
  21. <uv-icon name="eye" color="#2979ff" size="18" v-show="showpasswod" @click="setshowpasswod"></uv-icon>
  22. </template>
  23. </uv-form-item>
  24. </uv-col>
  25. <uv-col>
  26. <text @click="showPrivacyPolicy" class="privacypolicy">นโยบายความเป็นส่วนตัว</text>
  27. </uv-col>
  28. <uv-col span="10" offset="1">
  29. <uv-button type="primary" :throttleTime="throttleTime" :text="$t('login')" customStyle="margin-top: 2rem" @click="submit"></uv-button>
  30. </uv-col>
  31. </uv-form>
  32. <uv-col span="10" offset="1">
  33. <uv-button type="primary" :plain="true" :text="$t('register')" customStyle="margin-top: 20px" @click="toregister"></uv-button>
  34. </uv-col>
  35. </uv-col>
  36. </uv-row>
  37. </view>
  38. </template>
  39. <script>
  40. import {login} from "@/common/api/user.js"
  41. export default {
  42. data() {
  43. return {
  44. throttleTime:1,
  45. logininfo:{
  46. telno:'',
  47. pw:''
  48. },
  49. rules:{
  50. 'telno':[{
  51. type: 'string',
  52. required: true,
  53. message: this.$t('telno_null'),
  54. trigger: ['blur', 'change'],
  55. },{
  56. pattern: /\d{5,}/,
  57. message: this.$t('telno_error'),
  58. trigger: ['blur', 'change'],
  59. }
  60. ],
  61. 'pw': {
  62. type: 'string',
  63. required: true,
  64. message: this.$t('password_null'),
  65. trigger: ['blur', 'change']
  66. },
  67. },
  68. showpasswod:false,
  69. passwordtype:"password"
  70. }
  71. },
  72. methods: {
  73. submit(){
  74. var that = this
  75. this.$refs.form.validate().then(res => {
  76. login(this.logininfo,that)
  77. }).catch(errors => {
  78. console.log(errors)
  79. })
  80. },
  81. setshowpasswod(){
  82. this.showpasswod = !this.showpasswod
  83. if(this.showpasswod){
  84. this.passwordtype="text"
  85. }else{
  86. this.passwordtype="password"
  87. }
  88. },
  89. toregister(){
  90. uni.navigateTo({
  91. url: '/pages/register/register'
  92. });
  93. },
  94. showPrivacyPolicy(){
  95. let weburl = 'https://app.chienxutech.com:30443/Uploads/ssjprivate_en.html';
  96. uni.navigateTo({
  97. url: '/pages/webview/webview?weburl='+weburl+'&title='+this.$t('privacy_policy')
  98. });
  99. }
  100. },
  101. mounted(){
  102. uni.setNavigationBarTitle({
  103. title: this.$t('login')
  104. });
  105. this.throttleTime = getApp().globalData.throttleTime;
  106. },
  107. created() {
  108. }
  109. }
  110. </script>
  111. <style scoped>
  112. .privacypolicy{
  113. margin-top: 10px;
  114. text-align: center;
  115. color: #2979ff;
  116. font-size: 12px;
  117. }
  118. .uv-border{
  119. border-color: #909191 !important;
  120. }
  121. </style>