|
@@ -1,5 +1,6 @@
|
|
// pages/login/login.js
|
|
// pages/login/login.js
|
|
import WxValidate from '../../utils/wxValidate'
|
|
import WxValidate from '../../utils/wxValidate'
|
|
|
|
+const { type } = require('../../utils/dict');
|
|
const app = getApp()
|
|
const app = getApp()
|
|
Page({
|
|
Page({
|
|
|
|
|
|
@@ -13,14 +14,7 @@ Page({
|
|
info: { id: '1234567', name: '测试人员', phone: '12345678901', email: '123456@qq.com', address: '1', dept: '1', zw: '1', company: '1', type: '0', type_name: '超级管理员' },
|
|
info: { id: '1234567', name: '测试人员', phone: '12345678901', email: '123456@qq.com', address: '1', dept: '1', zw: '1', company: '1', type: '0', type_name: '超级管理员' },
|
|
form: {},
|
|
form: {},
|
|
// 用户类别
|
|
// 用户类别
|
|
- typeList: [
|
|
|
|
- { value: '0', label: '超级管理员' },
|
|
|
|
- { value: '1', label: '科室人员' },
|
|
|
|
- { value: '2', label: '办公室人员' },
|
|
|
|
- { value: '3', label: '采购部门' },
|
|
|
|
- { value: '4', label: '入库管理部门' },
|
|
|
|
- { value: '5', label: '财务部门' },
|
|
|
|
- { value: '6', label: '供货单位' },]
|
|
|
|
|
|
+ typeList: type
|
|
},
|
|
},
|
|
initValidate() {
|
|
initValidate() {
|
|
const rules = { type_name: { required: true, }, name: { required: true, }, phone: { required: true, tel: true }, email: { required: true, }, address: { required: true, }, dept: { required: true, }, zw: { required: true, }, company: { required: true, } }
|
|
const rules = { type_name: { required: true, }, name: { required: true, }, phone: { required: true, tel: true }, email: { required: true, }, address: { required: true, }, dept: { required: true, }, zw: { required: true, }, company: { required: true, } }
|
|
@@ -44,15 +38,19 @@ Page({
|
|
},
|
|
},
|
|
// 提交修改
|
|
// 提交修改
|
|
onSubmit: function (e) {
|
|
onSubmit: function (e) {
|
|
- console.log(e.detail.value)
|
|
|
|
|
|
+ const params = e.detail.value;
|
|
|
|
+ if (!this.WxValidate.checkForm(params)) {
|
|
|
|
+ const error = this.WxValidate.errorList[0];
|
|
|
|
+ wx.showToast({ title: `${error.msg}`, icon: 'error', duration: 2000 })
|
|
|
|
+ return false
|
|
|
|
+ } else {
|
|
|
|
+ console.log(params);
|
|
|
|
+ }
|
|
},
|
|
},
|
|
/**
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
*/
|
|
onLoad: function (options) {
|
|
onLoad: function (options) {
|
|
- if (options.id) {
|
|
|
|
- this.setData({ 'form': this.data.info })
|
|
|
|
- }
|
|
|
|
//验证规则函数
|
|
//验证规则函数
|
|
this.initValidate();
|
|
this.initValidate();
|
|
// 计算高度
|
|
// 计算高度
|