PatRegister.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <div class="container">
  3. <div class="bgimg"></div>
  4. <div class="content">
  5. <div class="title">登录信息</div>
  6. <div class="loginForm">
  7. <mt-field placeholder="姓 名" v-model="form.name"></mt-field>
  8. <div style="display:flex;">
  9. <div style="width:75%;">
  10. <mt-field placeholder="手机号" v-model="form.phone"></mt-field>
  11. </div>
  12. <div style="width:25%;">
  13. <mt-button :disabled="disable" type="primary" class="sendPhcode" @click="timeCounter">{{timeCouterText}}
  14. </mt-button>
  15. </div>
  16. </div>
  17. <mt-field placeholder="短信验证码" v-model="form.phcode" type="number"></mt-field>
  18. </div>
  19. <div class="footer">
  20. <div class="jbbtn" @click="submit">提交</div>
  21. <div class="agreeInfo">
  22. <input type="checkbox" checked v-if="form.isagree" @change="checkOnClick" />
  23. <input type="checkbox" v-else @change="checkOnClick" />
  24. <!-- <mt-checklist v-model="form.isagree" :options="['选项A', '选项B', '选项C']"></mt-checklist> -->
  25. <span>我已知晓<span @click="showAgree=true" style="color:blue;">《用户隐私条款》</span></span>
  26. </div>
  27. </div>
  28. </div>
  29. <!-- 用户隐私条款 -->
  30. <div class="container dialogContainer" v-if="showAgree">
  31. <div class="bgimg"></div>
  32. <div class="content">
  33. <div class="title">用户隐私条款</div>
  34. <div class="agreeForm">
  35. <div class="agreedoc" v-html="agreementInfo.content">
  36. </div>
  37. </div>
  38. <div class="footer">
  39. <div class="jbbtn" @click="showAgree=false">确定</div>
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. </template>
  45. <script>
  46. import {
  47. Field,
  48. Button,
  49. Toast,
  50. MessageBox,
  51. Checklist
  52. } from 'mint-ui'
  53. export default {
  54. name: 'Index',
  55. components: {
  56. Field,
  57. Button,
  58. Toast,
  59. MessageBox,
  60. Checklist
  61. },
  62. data() {
  63. return {
  64. email: '',
  65. timeCouterText: '发送',
  66. seconds: 60,
  67. disable: false,
  68. isagree: false,
  69. form: {},
  70. showAgree: false,
  71. agreementInfo:{}
  72. }
  73. },
  74. methods: {
  75. goPage(path) {
  76. this.$router.push(path)
  77. },
  78. timeCounter() {
  79. if (!this.form.phone) {
  80. MessageBox({
  81. title: '提示',
  82. message: '请输入手机号?'
  83. })
  84. return
  85. }
  86. let _this = this
  87. this.$api.sendPhcode(this.form).then(res => {})
  88. var timer = setInterval(function () {
  89. if (_this.seconds < 2) {
  90. clearInterval(timer)
  91. _this.seconds = 60
  92. _this.timeCouterText = '发送'
  93. _this.disable = false
  94. return
  95. }
  96. _this.seconds -= 1
  97. _this.timeCouterText = _this.seconds + '秒后重新发送'
  98. _this.disable = true
  99. }, 1000)
  100. },
  101. checkOnClick(e) {
  102. if (e.target.checked) {
  103. this.form.isagree = true
  104. } else {
  105. this.form.isagree = false
  106. }
  107. },
  108. submit() {
  109. if (!this.form.name) {
  110. MessageBox({
  111. title: '提示',
  112. message: '请输入姓名'
  113. })
  114. return
  115. }
  116. if (!this.form.phone) {
  117. MessageBox({
  118. title: '提示',
  119. message: '请输入手机号'
  120. })
  121. return
  122. } else {
  123. if (!this.$recheck.checkPhone(this.form.phone)) {
  124. MessageBox({
  125. title: '提示',
  126. message: '请输入正确的手机号'
  127. })
  128. return
  129. }
  130. }
  131. if (!this.form.phcode) {
  132. MessageBox({
  133. title: '提示',
  134. message: '请输入验证码'
  135. })
  136. return
  137. }
  138. if (!this.form.isagree) {
  139. MessageBox({
  140. title: '提示',
  141. message: '请先同意《PK程序用户隐私条款》'
  142. })
  143. return
  144. }
  145. let params = this.form
  146. params.role = 2
  147. this.$api.login(params).then(res => {
  148. if (!res.data.code) {
  149. localStorage.setItem("token", res.data.data.token)
  150. this.goPage("/patindex")
  151. } else {
  152. Toast(res.data.message)
  153. }
  154. })
  155. }
  156. },
  157. created() {
  158. this.$api.getUserAgreementInfo({id:2}).then(res=>{
  159. this.agreementInfo = res.data.data
  160. })
  161. },
  162. }
  163. </script>
  164. <style scoped lang="scss">
  165. .content {
  166. position: relative;
  167. z-index: 1;
  168. .loginForm {
  169. .sendPhcode {
  170. /* width: 6rem; */
  171. width: 100%;
  172. margin-top: 1rem;
  173. height: 3.0rem;
  174. border-radius: 1.4rem;
  175. }
  176. }
  177. .footer {
  178. /* position: absolute; */
  179. bottom: 1rem;
  180. margin: 0 auto;
  181. left: 0;
  182. right: 0;
  183. bottom: 1rem;
  184. .agreeInfo {
  185. margin: 2rem 0;
  186. }
  187. }
  188. }
  189. .dialogContainer {
  190. position: absolute;
  191. z-index: 100;
  192. top: 0px;
  193. .agreeForm {
  194. width: 90%;
  195. margin: auto;
  196. margin-top: 1rem;
  197. /* border:1px solid red; */
  198. height: 70vh;
  199. border-radius: 1rem;
  200. background: #fff;
  201. padding: 10px;
  202. }
  203. .agreedoc {
  204. height: 100%;
  205. overflow-y: scroll;
  206. p{
  207. text-align: left;
  208. }
  209. }
  210. }
  211. </style>