| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- <template>
- <div class="container">
- <div class="bgimg"></div>
- <div class="content">
- <div class="title">登录信息</div>
- <div class="loginForm">
- <mt-field placeholder="姓 名" v-model="form.name"></mt-field>
- <div style="display:flex;">
- <div style="width:75%;">
- <mt-field placeholder="手机号" v-model="form.phone"></mt-field>
- </div>
- <div style="width:25%;">
- <mt-button :disabled="disable" type="primary" class="sendPhcode" @click="timeCounter">{{timeCouterText}}
- </mt-button>
- </div>
- </div>
- <mt-field placeholder="短信验证码" v-model="form.phcode" type="number"></mt-field>
- </div>
- <div class="footer">
- <div class="jbbtn" @click="submit">提交</div>
- <div class="agreeInfo">
- <input type="checkbox" checked v-if="form.isagree" @change="checkOnClick" />
- <input type="checkbox" v-else @change="checkOnClick" />
- <!-- <mt-checklist v-model="form.isagree" :options="['选项A', '选项B', '选项C']"></mt-checklist> -->
- <span>我已知晓<span @click="showAgree=true" style="color:blue;">《用户隐私条款》</span></span>
- </div>
- </div>
- </div>
- <!-- 用户隐私条款 -->
- <div class="container dialogContainer" v-if="showAgree">
- <div class="bgimg"></div>
- <div class="content">
- <div class="title">用户隐私条款</div>
- <div class="agreeForm">
- <div class="agreedoc" v-html="agreementInfo.content">
- </div>
- </div>
- <div class="footer">
- <div class="jbbtn" @click="showAgree=false">确定</div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import {
- Field,
- Button,
- Toast,
- MessageBox,
- Checklist
- } from 'mint-ui'
- export default {
- name: 'Index',
- components: {
- Field,
- Button,
- Toast,
- MessageBox,
- Checklist
- },
- data() {
- return {
- email: '',
- timeCouterText: '发送',
- seconds: 60,
- disable: false,
- isagree: false,
- form: {
- isagree:true
- },
- showAgree: false,
- agreementInfo:{}
- }
- },
- methods: {
- goPage(path) {
- this.$router.push(path)
- },
- timeCounter() {
- if (!this.form.phone) {
- MessageBox({
- title: '提示',
- message: '请输入手机号?'
- })
- return
- }
- let _this = this
- this.$api.sendPhcode(this.form).then(res => {})
- var timer = setInterval(function () {
- if (_this.seconds < 2) {
- clearInterval(timer)
- _this.seconds = 60
- _this.timeCouterText = '发送'
- _this.disable = false
- return
- }
- _this.seconds -= 1
- _this.timeCouterText = _this.seconds + '秒后重新发送'
- _this.disable = true
- }, 1000)
- },
- checkOnClick(e) {
- if (e.target.checked) {
- this.form.isagree = true
- } else {
- this.form.isagree = false
- }
- },
- submit() {
- if (!this.form.name) {
- MessageBox({
- title: '提示',
- message: '请输入姓名'
- })
- return
- }
- if (!this.form.phone) {
- MessageBox({
- title: '提示',
- message: '请输入手机号'
- })
- return
- } else {
- if (!this.$recheck.checkPhone(this.form.phone)) {
- MessageBox({
- title: '提示',
- message: '请输入正确的手机号'
- })
- return
- }
- }
- if (!this.form.phcode) {
- MessageBox({
- title: '提示',
- message: '请输入验证码'
- })
- return
- }
- if (!this.form.isagree) {
- MessageBox({
- title: '提示',
- message: '请先同意《PK程序用户隐私条款》'
- })
- return
- }
- let params = this.form
- params.role = 2
- this.$api.login(params).then(res => {
- if (!res.data.code) {
- var login_info=this.form
- localStorage.setItem('login_info',JSON.stringify(login_info))
- localStorage.setItem("token", res.data.data.token)
- this.goPage("/patindex")
- } else {
- Toast(res.data.message)
- }
- })
- }
- },
- created() {
- this.$api.getUserAgreementInfo({id:2}).then(res=>{
- this.agreementInfo = res.data.data
- })
- var info=localStorage.getItem('login_info')
- var tag=localStorage.getItem('tag')
- var openid=localStorage.getItem('openid')
- this.form.openid=openid?openid:''
- this.form.tag=tag?tag:''
- if(info){
- info=JSON.parse(info)
- this.form={
- name:info.name,
- phone:info.phone,
- isagree:true
- }
- }
- },
- }
- </script>
- <style scoped lang="scss">
- .content {
- position: relative;
- z-index: 1;
- .loginForm {
- .sendPhcode {
- /* width: 6rem; */
- width: 100%;
- margin-top: 1rem;
- height: 3.0rem;
- border-radius: 1.4rem;
- }
- }
- .footer {
- /* position: absolute; */
- bottom: 1rem;
- margin: 0 auto;
- left: 0;
- right: 0;
- bottom: 1rem;
- .agreeInfo {
- margin: 2rem 0;
- }
- }
- }
- .dialogContainer {
- position: absolute;
- z-index: 100;
- top: 0px;
- .agreeForm {
- width: 90%;
- margin: auto;
- margin-top: 1rem;
- /* border:1px solid red; */
- height: 70vh;
- border-radius: 1rem;
- background: #fff;
- padding: 10px;
- }
- .agreedoc {
- height: 100%;
- overflow-y: scroll;
- p{
- text-align: left;
- }
- }
- }
- </style>
|