Commit ff085aaa authored by 王志鹏's avatar 王志鹏

bug修复

parent e13b0b6c
...@@ -8,6 +8,10 @@ let api = {} ...@@ -8,6 +8,10 @@ let api = {}
api.userLogin = function (data) { api.userLogin = function (data) {
return req.post('/common/login', data) return req.post('/common/login', data)
} }
// 获取登录配置
api.getLoginConfig = function (data) {
return req.post('/common/getLoginConfig', data)
}
//查询当前语言 //查询当前语言
api.getLanguageL = function (data) { api.getLanguageL = function (data) {
return req.post(`/web/getLanguage`, data) return req.post(`/web/getLanguage`, data)
......
...@@ -28,51 +28,35 @@ ...@@ -28,51 +28,35 @@
:value="item.value" :value="item.value"
v-for="(item, index) in this.options.idType" v-for="(item, index) in this.options.idType"
:key="index" :key="index"
> >{{ item.name }}</a-select-option>
{{ item.name }}
</a-select-option>
</a-select> </a-select>
</a-form-model-item> </a-form-model-item>
<a-form-model-item ref="idNo" label="证件号" prop="idNo"> <a-form-model-item ref="idNo" label="证件号" prop="idNo">
<a-input <a-input v-model="form.idNo" @blur="handleIdCardBlur" />
v-model="form.idNo"
@blur="
() => {
$refs.idNo.onFieldBlur()
}
"
/>
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="性别" prop="sex"> <a-form-model-item label="性别" prop="sex">
<a-radio-group v-model="form.sex"> <a-radio-group v-model="form.sex">
<a-radio value="M"></a-radio> <a-radio value="M"></a-radio>
<a-radio value="F"> </a-radio> <a-radio value="F"></a-radio>
</a-radio-group> </a-radio-group>
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="生日日期" prop="birthDate"> <a-form-model-item label="出生日期" prop="birthDate">
<a-date-picker <a-date-picker
v-model="form.birthDate" v-model="form.birthDate"
@change="onChange" @change="onChange"
type="date" type="date"
placeholder="选择生日" placeholder="选择出生日期"
style="width: 100%" style="width: 100%"
/> />
</a-form-model-item> </a-form-model-item>
<a-form-model-item label="婚姻状况" prop="maritalStatus"> <a-form-model-item label="婚姻状况" prop="maritalStatus">
<a-radio-group v-model="form.maritalStatus"> <a-radio-group v-model="form.maritalStatus">
<a-radio value="1">未婚 </a-radio> <a-radio value="1">未婚</a-radio>
<a-radio value="2">已婚</a-radio> <a-radio value="2">已婚</a-radio>
</a-radio-group> </a-radio-group>
</a-form-model-item> </a-form-model-item>
<a-form-model-item ref="name" label="联系电话" prop="phone"> <a-form-model-item ref="name" label="联系电话" prop="phone">
<a-input <a-input v-model="form.phone" @blur="checkPhone" />
v-model="form.phone"
@blur="
() => {
$refs.name.onFieldBlur()
}
"
/>
</a-form-model-item> </a-form-model-item>
<a-form-model-item :wrapper-col="{ span: 14, offset: 4 }"> <a-form-model-item :wrapper-col="{ span: 14, offset: 4 }">
<a-button type="primary" @click="onSubmit">立即预约</a-button> <a-button type="primary" @click="onSubmit">立即预约</a-button>
...@@ -82,115 +66,161 @@ ...@@ -82,115 +66,161 @@
</template> </template>
<script> <script>
import api from '@/api/customer' const regIdCard = /^(^[1-9]\d{7}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}$)|(^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])((\d{4})|\d{3}[Xx])$)$/;
import options from '@/utils/options' const phoneReg = /^((0\d{2,3}-?\d{7,8})|(1[3465789]\d{9}))$/;
import api from "@/api/customer";
import options from "@/utils/options";
export default { export default {
name: 'self-form', name: "self-form",
components: {}, components: {},
data() { data() {
return { return {
options: {}, options: {},
labelCol: { span: 4 }, labelCol: { span: 4 },
wrapperCol: { span: 14 }, wrapperCol: { span: 14 },
other: '', other: "",
form: { form: {
id: '', id: "",
name: '', //名字 name: "", //名字
idType: '1', //证件类型,默认身份证件 idType: "1", //证件类型,默认身份证件
idNo: '', //证件号 idNo: "", //证件号
sex: 'M', //性别 M男 F女 sex: "M", //性别 M男 F女
phone: '', //电话 phone: "", //电话
birthDate: '', //生日 birthDate: "", //生日
maritalStatus: '1', //婚姻 01:未婚,02:已婚, 03:未知 maritalStatus: "1" //婚姻 01:未婚,02:已婚, 03:未知
}, },
rules: { rules: {
name: [ name: [
{ {
required: true, required: true,
message: '请输入姓名', message: "请输入姓名",
trigger: 'blur', trigger: "blur"
}, },
{ {
max: 5, max: 5,
message: '姓名长度不低于3', message: "姓名长度不低于3",
trigger: 'blur', trigger: "blur"
}, }
], ],
idType: [ idType: [
{ {
required: true, required: true,
message: '请选择证件类型', message: "请选择证件类型",
trigger: 'change', trigger: "change"
}, }
], ],
idNo: [ idNo: [
{ {
required: true, required: true,
message: '请输入证件号', message: "请输入证件号",
trigger: 'blur', trigger: "blur"
}, }
], ],
phone: [ phone: [
{ {
required: true, required: true,
message: '请输入手机号吗', message: "请输入手机号码",
trigger: 'blur', trigger: "blur"
}, }
], ]
}, }
} };
}, },
created() { created() {
const { id } = this.$route.query const { id } = this.$route.query;
this.form.id = id ? id : '' this.form.id = id ? id : "";
this.options = options //下拉选项数据集合:包括证件类型/婚姻状况/性别等 this.options = options; //下拉选项数据集合:包括证件类型/婚姻状况/性别等
}, },
computed: {}, computed: {},
methods: { methods: {
// 立即预约 // 立即预约
onSubmit() { onSubmit() {
this.$refs.ruleForm.validate((valid) => { this.$refs.ruleForm.validate(valid => {
if (valid) { if (valid) {
const query = { const query = {
...this.form, ...this.form
} };
api.improveInformation(query).then((res) => { api.improveInformation(query).then(res => {
if (res.returnCode == '0000') { if (res.returnCode == "0000") {
// 提交成功之后,提示成功信息,关闭"个人信息填写弹窗",并刷新当前页面 // 提交成功之后,提示成功信息,关闭"个人信息填写弹窗",并刷新当前页面
this.$message.success('提交信息成功') this.$message.success("提交信息成功");
setTimeout(() => { setTimeout(() => {
this.$emit('hideModal') this.$emit("hideModal");
// 刷新列表 // 刷新列表
}, 1500) }, 1500);
} else { } else {
this.$message.error(res.returnMsg) this.$message.error(res.returnMsg);
} }
}) });
} else { } else {
console.log('error submit!!') console.log("error submit!!");
return false return false;
} }
}) });
}, },
// 下拉选项 // 下拉选项
handleChange(value) { handleChange(value) {
console.log(`selected ${value}`) console.log(`selected ${value}`);
},
checkIdNumber(val) {
return regIdCard.test(val);
},
checkPhone() {
let val = this.form.phone
if (!phoneReg.test(val)) {
this.$message.error("请输入手机号码不正确");
this.form.phone = "";
}
},
handleIdCardBlur() {
// 填完身份证根据身份证自动带出生日跟性别
const type = this.form.idType;
const value = this.form.idNo;
if (type != "1") {
return;
}
if (this.checkIdNumber(value)) {
const { birth, sex } = this.calcBGByIdCardNumber(value);
this.form.sex = sex;
this.form.birthDate = birth;
} else {
this.$message.error("身份证号不正确");
this.form.idNo = "";
}
},
calcBGByIdCardNumber(idNumber) {
// 根据身份证自动带出生日跟性别
const year = idNumber.slice(6, 10);
const mon = idNumber.slice(10, 12);
const day = idNumber.slice(12, 14);
const birth = year + "-" + mon + "-" + day;
const sex = idNumber.slice(16, 17) % 2 == 1 ? "M" : "F";
return {
birth,
sex,
gender: sex
};
}, },
// 选择生日 // 选择生日
onChange(date, dateString) { onChange(date, dateString) {
this.form.birthDate = dateString this.form.birthDate = dateString;
}, }
}, }
} };
</script> </script>
<style lang="less">
.ant-form-item-label {
text-align: left;
}
</style>
<style lang="less" scoped> <style lang="less" scoped>
::v-deep .ant-btn { ::v-deep .ant-btn {
position: relative; position: relative;
left: 100px; left: 100px;
width: 120px; width: 120px;
} }
::v-deep .ant-form-item-control { ::v-deep .ant-form-item-control {
width: 360px; width: 360px;
} }
</style> </style>
\ No newline at end of file
...@@ -4,116 +4,121 @@ ...@@ -4,116 +4,121 @@
<div class="title"> <div class="title">
<span class="point"></span> {{ item.servicepackageName }} <span class="point"></span> {{ item.servicepackageName }}
</div> </div>
<div class="detail" @click="$router.push(item.detailUrl)"> <!-- $router.push(item.fileList[0]&&item.fileList[0].url) -->
<img :src="eyes" alt="" />点击查看体检套餐详情 <div class="detail" @click="openModel">
<img :src="eyes" alt="" />点击查看服务套餐详情
<!-- {{item.fileList[0].url}} --> <!-- {{item.fileList[0].url}} -->
</div> </div>
</div> </div>
<div class="right"> <div class="right">
<a-button <a-button v-if="listType == 2" style="background: #ffcc00; color: white; border: none; width: 86px"
v-if="listType == 2" @click="handleReadDetail">查看</a-button>
style="background: #ffcc00; color: white; border: none; width: 86px" <a-button v-else style="background: #3f7ffb; color: white; border: none; width: 86px" @click="handleSubmit">立即预约
@click="handleReadDetail" </a-button>
>查看</a-button
>
<a-button
v-else
style="background: #3f7ffb; color: white; border: none; width: 86px"
@click="handleSubmit"
>立即预约</a-button
>
<div class="date"> <div class="date">
{{ listType == 1 ? (' 有效期至:'+item.validityEnd ): ('预约体检日期:'+item.customerAppDate) }} {{ listType == 1 ? (' 有效期至:'+item.validityEnd ): ('预约体检日期:'+item.customerAppDate) }}
</div> </div>
</div> </div>
<a-modal v-model="visible" width="1000px" :footer='null'>
<img style="width: 100%;padding: 20px 20px;" :src="item.fileList[0]&&item.fileList[0].url" alt="">
</a-modal>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: 'item', name: 'item',
components: {}, components: {},
props: { props: {
listType: { listType: {
type: String, type: String,
default: '', default: '',
},
id: {
type: String | Number,
default: '',
},
item: {
type: Object,
default: () => { },
},
}, },
id: { data() {
type: String | Number, return {
default: '', visible: false,
}, eyes: require('@/assets/imgs/index/eyes.png'),
item: { }
type: Object,
default: () => {},
}, },
}, methods: {
data() { // 立即预约
return { handleSubmit() {
eyes: require('@/assets/imgs/index/eyes.png'), console.log('立即预约~', this.item.chooseList)
}
},
methods: {
// 立即预约
handleSubmit() {
console.log('立即预约~', this.item.chooseList)
// 本地存储数据-该产品下可选择的体检套餐 // 本地存储数据-该产品下可选择的体检套餐
window.localStorage.setItem('reservedInfo', JSON.stringify(this.item)) window.localStorage.setItem('reservedInfo', JSON.stringify(this.item))
this.$router.push({ this.$router.push({
name: 'Flow', name: 'Flow',
query: { query: {
id: this.id, //客户id id: this.id, //客户id
servicepackageId: this.item.id, //产品id servicepackageId: this.item.id, //产品id
}, },
}) })
}, },
// 查看-预约详情 // 查看-预约详情
handleReadDetail() { handleReadDetail() {
this.$router.push({ this.$router.push({
name: 'Detail', name: 'Detail',
query: { query: {
id: this.id, id: this.id,
}, },
}) })
},
openModel() {
this.visible = true
}
}, },
}, }
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.item { .item {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
background: #fafafa; background: #fafafa;
padding: 14.5px 12px; padding: 14.5px 12px;
border-radius: 8px; border-radius: 8px;
margin-top: 12px; margin-top: 12px;
.right {
text-align: right; .right {
.date { text-align: right;
color: #999999;
font-size: 14px; .date {
margin-top: 12px; color: #999999;
} font-size: 14px;
} margin-top: 12px;
.left { }
.title {
color: #333333;
font-size: 14px;
font-weight: bold;
} }
.detail {
font-size: 14px; .left {
color: #999999; .title {
line-height: 30px; color: #333333;
margin-top: 12px; font-size: 14px;
cursor: pointer; font-weight: bold;
img { }
position: relative;
top: -2px; .detail {
margin-right: 3px; font-size: 14px;
color: #999999;
line-height: 30px;
margin-top: 12px;
cursor: pointer;
img {
position: relative;
top: -2px;
margin-right: 3px;
}
} }
} }
} }
} </style>
</style> \ No newline at end of file
<template> <template>
<div class="login"> <div class="login">
<div class="header"> <div class="header">
<img :src="logo" alt="" /> <img :src="logo" alt />
</div> </div>
<div class="center"> <div class="center">
<div class="left"> <div class="left">
<img :src="left" alt="" /> <img :src="left" alt />
</div> </div>
<div class="right"> <div class="right">
<div class="logo"> <div class="logo">
<img :src="logo" alt="" /> <img :src="logo" alt />
</div> </div>
<div class="tips">账号密码登陆</div> <div class="tips">健康服务预约</div>
<div class="form"> <div class="form">
<a-form <a-form
id="components-form-demo-normal-login" id="components-form-demo-normal-login"
...@@ -27,18 +27,14 @@ ...@@ -27,18 +27,14 @@
rules: [ rules: [
{ {
required: true, required: true,
message: '请输入体检卡号码!', message: userNameHolder,
}, },
], ],
}, },
]" ]"
placeholder="请输入体检卡号码" :placeholder= 'userNameHolder'
> >
<a-icon <a-icon slot="prefix" type="user" style="color: rgba(0, 0, 0, 0.25)" />
slot="prefix"
type="user"
style="color: rgba(0, 0, 0, 0.25)"
/>
</a-input> </a-input>
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
...@@ -49,35 +45,26 @@ ...@@ -49,35 +45,26 @@
rules: [ rules: [
{ {
required: true, required: true,
message: '请输入卡号密码!', message: passwordHolder,
}, },
], ],
}, },
]" ]"
type="password" type="password"
placeholder="请输入密码(默认身份证后6位)" :placeholder="passwordHolder"
> >
<a-icon <a-icon slot="prefix" type="lock" style="color: rgba(0, 0, 0, 0.25)" />
slot="prefix"
type="lock"
style="color: rgba(0, 0, 0, 0.25)"
/>
</a-input> </a-input>
</a-form-item> </a-form-item>
<a-form-item> <a-form-item>
<!-- :disabled="isSub" --> <!-- :disabled="isSub" -->
<a-button <a-button type="primary" html-type="submit" class="login-form-button">登陆</a-button>
type="primary"
html-type="submit"
class="login-form-button"
>
登陆
</a-button>
</a-form-item> </a-form-item>
</a-form> </a-form>
<div class="concat"> <div class="concat">
如果遇到操作问题,请拨打椋鸟健康热线 <!-- 如果遇到操作问题,请拨打椋鸟健康热线
<span class="code">400-820-6523</span> <span class="code">400-820-6523</span> -->
<img :src="downImg" alt="">
</div> </div>
</div> </div>
</div> </div>
...@@ -86,63 +73,113 @@ ...@@ -86,63 +73,113 @@
</template> </template>
<script> <script>
import api from '@/api/login'; import api from "@/api/login";
export default { export default {
name: "login", name: "login",
components: {}, components: {},
data() { data() {
return { return {
logo: require("../../assets/imgs/login/logo.png"), logo:"",
left: require("../../assets/imgs/login/left-bg.png"), left: require("../../assets/imgs/login/left-bg.png"),
downImg:'',
isSub: true, isSub: true,
loading: false,//是否显示loading passwordHolder:"",
userNameHolder:"",
fields:[],
loading: false //是否显示loading
}; };
}, },
beforeCreate() { beforeCreate() {
this.form = this.$form.createForm(this, { name: "normal_login" }); this.form = this.$form.createForm(this, { name: "normal_login" });
}, },
created() {
// let url = location.href;
// let splitParmsArr = url.split("/");
// let idParms = splitParmsArr.slice(-1)[0];
this.getLoginConfigFn();
},
methods: { methods: {
isNumber(val) {
//判断是否是数字
var regPos = /^\d+(\.\d+)?$/; //非负浮点数
var regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数
if (regPos.test(val) && regNeg.test(val)) {
return true;
} else {
return false;
}
},
// 控制提交是否可用 // 控制提交是否可用
subState() { subState() {
this.isSub = false; this.isSub = false;
}, },
getLoginConfigFn() {
const query = {
id: "1002" //暂时写死的
};
api.getLoginConfig(query).then(res => {
if(res.returnCode == '0000'){ //logo 配置
if(res.content.loginUp&&res.content.loginUp[0]){
this.logo = res.content.loginUp[0].url
this.logo = res.content.loginUp[0].url
}
if(res.content.loginDown&&res.content.loginDown[0]){ //电话说明配置
this.downImg = res.content.loginDown[0].url
}
if(res.content.lnhConfigs){
let lnhConfigs = res.content.lnhConfigs
this.fields = lnhConfigs
this.userNameHolder = `请输入`+lnhConfigs[0].remark
this.passwordHolder = `请输入`+lnhConfigs[1].remark
}
}
});
},
handleSubmit(e) { handleSubmit(e) {
e.preventDefault(); e.preventDefault();
this.form.validateFields((err, values) => { this.form.validateFields((err, values) => {
if (!err) { if (!err) {
console.log('登陆values=',values); console.log("登陆values=", values);
const query = { const query = {
id: "1002",//使用"体检卡口令"登陆,id必须是'1002',目前只有一种登陆方式,是写死的,后边会使用配置 id: "1002", //使用"体检卡口令"登陆,id必须是'1002',目前只有一种登陆方式,是写死的,后边会使用配置
fields:[ fields: [
{fieldName: "体检卡口令", value: values.userName, field: "medical_test_word"}, {
{fieldName: "体检卡密码", value: values.password, field: "job_num"} fieldName: this.fields[0].remark,
value: values.userName,
field: this.fields[0].field
},
{
fieldName: this.fields[1].remark,
value: values.password,
field: this.fields[1].field
}
] ]
} };
api.userLogin(query).then((res)=>{ api.userLogin(query).then(res => {
console.log(res); console.log(res);
if(res.returnCode == '0000'){ if (res.returnCode == "0000") {
console.log("登陆成功"); console.log("登陆成功");
// 显示登陆成功-并跳转到index页面 // 显示登陆成功-并跳转到index页面
this.$message.success('登陆成功'); this.$message.success("登陆成功");
setTimeout(() => { setTimeout(() => {
// 需要获取用户id // 需要获取用户id
this.$router.push({ this.$router.push({
name:'Index', name: "Index",
query:{ query: {
id:res.content.id id: res.content.id
} }
}) });
}, 1000); }, 1000);
}else{ } else {
this.$message.error(res.returnMsg); this.$message.error(res.returnMsg);
} }
}) });
console.log("Received values of form: ", values); console.log("Received values of form: ", values);
} }
}); });
}, }
}, }
}; };
</script> </script>
...@@ -150,31 +187,44 @@ export default { ...@@ -150,31 +187,44 @@ export default {
.login { .login {
min-height: 100vh; min-height: 100vh;
background: url(../../assets/imgs/login/bg.png) 100%; background: url(../../assets/imgs/login/bg.png) 100%;
.header { .header {
padding: 2.5px 21.5px; padding: 2.5px 21.5px;
background: rgba(225, 225, 225, 0.32); background: rgba(225, 225, 225, 0.32);
img{
width: 70px;
height: 50px;
}
} }
.center { .center {
display: flex; display: flex;
justify-content: center; justify-content: center;
margin: 69.5px auto; margin: 69.5px auto;
.left { .left {
img { img {
width: 320.5px; width: 320.5px;
} }
position: relative; position: relative;
left: 27.5px; left: 27.5px;
top: 58px; top: 58px;
} }
.right { .right {
padding-bottom: 38px; padding-bottom: 38px;
position: relative; position: relative;
right: 27.5px; right: 27.5px;
.tips { .tips {
text-align: center; text-align: center;
margin-bottom: 23.5px; margin-bottom: 23.5px;
margin-top: 5px; margin-top: 5px;
font-family: Microsoft YaHei;
font-weight: 600;
} }
.logo { .logo {
width: 115.5px; width: 115.5px;
height: 44.5px; height: 44.5px;
...@@ -184,33 +234,43 @@ export default { ...@@ -184,33 +234,43 @@ export default {
margin: 0 auto; margin: 0 auto;
img { img {
width: 29.7px; width: 40px;
height: 29.7px; height: 29.7px;
position: relative; position: relative;
top: 7px; top: 7px;
} }
position: relative; position: relative;
top: -21px; top: -21px;
} }
width: 340px; width: 340px;
background: #ffffff; background: #ffffff;
box-shadow: 0px 7px 14px 1px rgba(214, 207, 194, 0.14); box-shadow: 0px 7px 14px 1px rgba(214, 207, 194, 0.14);
border-radius: 12px; border-radius: 12px;
.concat { .concat {
font-size: 12px; font-size: 12px;
text-align: center; text-align: center;
transform: scale(0.8); transform: scale(0.8);
.code { .code {
color: #3f7ffb; color: #3f7ffb;
} }
img{
width: 100%;
}
} }
.form { .form {
::v-deep .ant-form { ::v-deep .ant-form {
.ant-input { .ant-input {
font-size: 12px; font-size: 12px;
} }
width: 260.8px; width: 260.8px;
margin: 0 auto; margin: 0 auto;
.login-form-button { .login-form-button {
width: 96%; width: 96%;
position: relative; position: relative;
...@@ -221,4 +281,4 @@ export default { ...@@ -221,4 +281,4 @@ export default {
} }
} }
} }
</style> </style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment