PatRegister.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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. isagree:true
  71. },
  72. showAgree: false,
  73. agreementInfo:{}
  74. }
  75. },
  76. methods: {
  77. goPage(path) {
  78. this.$router.push(path)
  79. },
  80. timeCounter() {
  81. if (!this.form.phone) {
  82. MessageBox({
  83. title: '提示',
  84. message: '请输入手机号?'
  85. })
  86. return
  87. }
  88. let _this = this
  89. this.$api.sendPhcode(this.form).then(res => {})
  90. var timer = setInterval(function () {
  91. if (_this.seconds < 2) {
  92. clearInterval(timer)
  93. _this.seconds = 60
  94. _this.timeCouterText = '发送'
  95. _this.disable = false
  96. return
  97. }
  98. _this.seconds -= 1
  99. _this.timeCouterText = _this.seconds + '秒后重新发送'
  100. _this.disable = true
  101. }, 1000)
  102. },
  103. checkOnClick(e) {
  104. if (e.target.checked) {
  105. this.form.isagree = true
  106. } else {
  107. this.form.isagree = false
  108. }
  109. },
  110. submit() {
  111. if (!this.form.name) {
  112. MessageBox({
  113. title: '提示',
  114. message: '请输入姓名'
  115. })
  116. return
  117. }
  118. if (!this.form.phone) {
  119. MessageBox({
  120. title: '提示',
  121. message: '请输入手机号'
  122. })
  123. return
  124. } else {
  125. if (!this.$recheck.checkPhone(this.form.phone)) {
  126. MessageBox({
  127. title: '提示',
  128. message: '请输入正确的手机号'
  129. })
  130. return
  131. }
  132. }
  133. if (!this.form.phcode) {
  134. MessageBox({
  135. title: '提示',
  136. message: '请输入验证码'
  137. })
  138. return
  139. }
  140. if (!this.form.isagree) {
  141. MessageBox({
  142. title: '提示',
  143. message: '请先同意《PK程序用户隐私条款》'
  144. })
  145. return
  146. }
  147. let params = this.form
  148. params.role = 2
  149. this.$api.login(params).then(res => {
  150. if (!res.data.code) {
  151. var login_info=this.form
  152. localStorage.setItem('login_info',JSON.stringify(login_info))
  153. localStorage.setItem("token", res.data.data.token)
  154. this.goPage("/patindex")
  155. } else {
  156. Toast(res.data.message)
  157. }
  158. })
  159. }
  160. },
  161. created() {
  162. this.$api.getUserAgreementInfo({id:2}).then(res=>{
  163. this.agreementInfo = res.data.data
  164. })
  165. var info=localStorage.getItem('login_info')
  166. var tag=localStorage.getItem('tag')
  167. var openid=localStorage.getItem('openid')
  168. this.form.openid=openid?openid:''
  169. this.form.tag=tag?tag:''
  170. if(info){
  171. info=JSON.parse(info)
  172. this.form={
  173. name:info.name,
  174. phone:info.phone,
  175. isagree:true
  176. }
  177. }
  178. },
  179. }
  180. </script>
  181. <style scoped lang="scss">
  182. .content {
  183. position: relative;
  184. z-index: 1;
  185. .loginForm {
  186. .sendPhcode {
  187. /* width: 6rem; */
  188. width: 100%;
  189. margin-top: 1rem;
  190. height: 3.0rem;
  191. border-radius: 1.4rem;
  192. }
  193. }
  194. .footer {
  195. /* position: absolute; */
  196. bottom: 1rem;
  197. margin: 0 auto;
  198. left: 0;
  199. right: 0;
  200. bottom: 1rem;
  201. .agreeInfo {
  202. margin: 2rem 0;
  203. }
  204. }
  205. }
  206. .dialogContainer {
  207. position: absolute;
  208. z-index: 100;
  209. top: 0px;
  210. .agreeForm {
  211. width: 90%;
  212. margin: auto;
  213. margin-top: 1rem;
  214. /* border:1px solid red; */
  215. height: 70vh;
  216. border-radius: 1rem;
  217. background: #fff;
  218. padding: 10px;
  219. }
  220. .agreedoc {
  221. height: 100%;
  222. overflow-y: scroll;
  223. p{
  224. text-align: left;
  225. }
  226. }
  227. }
  228. </style>