loginPage.mixin.js 1.6 KB
Newer Older
芊里 已提交
1
const helpPage = '/pages/ucenter/help/help';	// 帮助页面
提交  
芊里 已提交
2 3 4 5
import {
		mapGetters,
		mapMutations
	} from 'vuex';
芊里 已提交
6
let mixin = {
L
123  
linju 已提交
7 8 9 10 11 12
	// // 监听帮助按钮
	// onNavigationBarButtonTap(event) {
	// 	uni.navigateTo({
	// 		url:helpPage
	// 	})
	// },
芊里 已提交
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
	data(){
		return {
			// 用户协议页面跳转
			link: [{
				text: '用户协议',
				to: '/pages/ucenter/agree-list/service/service'
			}, {
				text: '隐私政策',
				to: '/pages/ucenter/agree-list/privacy/privacy'
			}],
			formData:{
				phone:'',
				code:'',
				pwd:''
			},
			rules: {
				phone:{
					rules:[{
							required: true,
							errorMessage: '请输入手机号',
						},
						{
							pattern: /^1\d{10}$/,
							errorMessage: '手机号格式不正确',
						}
					]
				},
				code: {
					rules: [{
							required: true,
							errorMessage: '请输入验证码',
						},
						{
							pattern: /^.{6}$/,
							errorMessage: '请输入6位验证码',
						}
					]
				},
				pwd:{
					rules: [{
							required: true,
							errorMessage: '请输入密码',
						},
						{
							pattern: /^.{6,20}$/,
							errorMessage: '密码应为6到20位',
						}
					]
				}
			}
		}
	},
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
	computed: {
		isPhone(){
			let reg_phone = /^1\d{10}$/;
			let isPhone = reg_phone.test(this.formData.phone);
			return isPhone;
		},
		isPwd(){
			let reg_pwd = /^.{6,20}$/;
			let isPwd = reg_pwd.test(this.formData.pwd);
			return isPwd;
		},
		isCode(){
			let reg_code = /^\d{6}$/;
			let isCode = reg_code.test(this.formData.code);
			return isCode;
		}
	},
提交  
芊里 已提交
82 83 84 85 86
	methods:{
		...mapMutations({
			setUserInfo: 'user/login'
		})
	}
芊里 已提交
87 88
}
export default mixin