Browse Source

申请加入-协同创新中心

master
lucky 5 years ago
parent
commit
b17b969f07
  1. 1
      src/components/SettledEnterprise/SettledEnterprise.vue
  2. 3
      src/config/api.js
  3. 243
      src/views/NewPlatform/components/NewModel.vue

1
src/components/SettledEnterprise/SettledEnterprise.vue

@ -74,6 +74,7 @@ export default {
}, },
methods: { methods: {
scrollBox() { scrollBox() {
console.log('滚动');
/* /*
* 启动播报滚动事件 * 启动播报滚动事件
*/ */

3
src/config/api.js

@ -31,6 +31,9 @@ export const selPolicy = params => axios.post(`${policy}/selPolicy`, params);
// 申请加入三大平台 // 申请加入三大平台
export const JoinPlatform = params => axios.post(`${greenvalley}/platform/JoinPlatform`, params); export const JoinPlatform = params => axios.post(`${greenvalley}/platform/JoinPlatform`, params);
// 创新平台申请加入
export const CreatingPlatformAdd = params => axios.post(`${greenvalley}/creatingPlatform/add`, params);
// 上传附件 // 上传附件
export const upload = `${greenvalley}/file/upload`; export const upload = `${greenvalley}/file/upload`;

243
src/views/NewPlatform/components/NewModel.vue

@ -1,38 +1,150 @@
<template> <template>
<div> <div>
<a-button type="primary" @click="showModal"> <a-button @click="showModal" type="primary">{{ str }}</a-button>
{{ str }} <a-modal
</a-button> :confirm-loading="confirmLoading"
<a-modal width="50%" :title="title" :visible="visible" :confirm-loading="confirmLoading" @ok="handleOk" @cancel="handleCancel"> :title="title"
:visible="visible"
@cancel="handleCancel"
@ok="handleOk"
width="50%"
>
<a-form :form="form"> <a-form :form="form">
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="公司名称"> <a-form-item
<a-input v-model.trim="platform.companyName" placeholder="请输入公司名称..." /> :label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="单位名称"
>
<a-input placeholder="请输入单位名称..." v-model.trim="platform.companyName" />
</a-form-item>
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="单位性质"
>
<a-input placeholder="请输入单位性质..." v-model.trim="platform.companyType " />
</a-form-item>
<a-form-item
:label-col="formItemLayoutA.labelCol"
:wrapper-col="formItemLayoutA.wrapperCol"
class="fill-width"
label="社会信用代码或组织机构代码"
>
<a-input class="flex-1" placeholder="请输入社会信用代码或组织机构代码..." v-model.trim="platform.code " />
</a-form-item>
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="所属领域"
>
<a-select
@change="handlePosition"
placeholder="请选择所属领域"
v-model.trim="platform.position "
>
<a-select-option value="1">功能食品协同创新中心</a-select-option>
<a-select-option value="2">现代医药</a-select-option>
<a-select-option value="3">生物医学工程</a-select-option>
<a-select-option value="4">数字健康开发</a-select-option>
<a-select-option value="5">其他</a-select-option>
</a-select>
</a-form-item>
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="单位负责人"
>
<a-input placeholder="请输入单位负责人..." v-model.trim="platform.ower" />
</a-form-item>
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="单位邮箱"
>
<a-input
:initial-value="platform.email"
placeholder="请输入单位邮箱..."
v-decorator="['email', { rules: emailRules }]"
/>
</a-form-item> </a-form-item>
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="联系人" required> <a-form-item
<a-input v-model.trim="platform.manName" placeholder="请输入联系人..." /> :label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="单位联系人"
required
>
<a-input placeholder="请输入单位联系人..." v-model.trim="platform.contact" />
</a-form-item> </a-form-item>
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="联系电话" required> <a-form-item
<a-input @change="changePhone" type="tel" v-decorator="['tel', { rules: phoneRules }]" placeholder="请输入联系电话.." /> :label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="联系电话"
required
>
<a-input
@change="changePhone"
placeholder="请输入联系电话.."
type="phone"
v-decorator="['phone', {initialValue: platform.phone, rules: phoneRules }]"
/>
</a-form-item> </a-form-item>
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="图片验证码" required> <a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="图片验证码"
required
>
<div class="d-flex flex-nowrap"> <div class="d-flex flex-nowrap">
<a-input placeholder="图片验证码" type="number" v-model="codeNum" /> <a-input placeholder="图片验证码" type="number" v-model="codeNum" />
<img :src="picCode.imageBase64" @click="changePicCode" class="code_img ml-2" v-if="picCode && picCode.imageBase64" /> <img
:src="picCode.imageBase64"
@click="changePicCode"
class="code_img ml-2"
v-if="picCode && picCode.imageBase64"
/>
<a-button @click="changePicCode" class="code_img ml-2" size="small" v-else>获取验证码</a-button> <a-button @click="changePicCode" class="code_img ml-2" size="small" v-else>获取验证码</a-button>
<!-- <a-input v-decorator="['account', { rules: rules.account }]" /> --> <!-- <a-input v-decorator="['account', { rules: rules.account }]" /> -->
</div> </div>
</a-form-item> </a-form-item>
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="短信验证码" required> <a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="短信验证码"
required
>
<div class="d-flex flex-nowrap"> <div class="d-flex flex-nowrap">
<a-input placeholder="请输入验证码" type="number" v-model="platform.code" /> <a-input placeholder="请输入验证码" type="number" v-model="platform.message" />
<a-button class="code_img ml-2" disabled type="primary" v-if="showInterval">重新发送 {{ interval }}</a-button> <a-button
<a-button :disabled="platform.isTel === false" @click="getCode" class="code_img ml-2" type="primary" v-else> class="code_img ml-2"
获取验证码 disabled
</a-button> type="primary"
v-if="showInterval"
>重新发送 {{ interval }}</a-button>
<a-button
:disabled="isTel === false"
@click="getCode"
class="code_img ml-2"
type="primary"
v-else
>获取验证码</a-button>
</div> </div>
</a-form-item> </a-form-item>
<a-form-item :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol" label="项目信息简述" required> <a-form-item
<a-textarea v-model.trim="platform.describe" style="height: 120px" placeholder="请输入项目信息简述..." /> :label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="上传附件"
>
<a-upload
:action="action"
:default-file-list="fileList"
@change="fileChange"
list-type="picture"
name="files"
>
<a-button>
<a-icon type="upload" />点击上传附件
</a-button>
</a-upload>
</a-form-item> </a-form-item>
</a-form> </a-form>
</a-modal> </a-modal>
@ -41,7 +153,12 @@
<script> <script>
import { mapState, mapActions } from 'vuex'; import { mapState, mapActions } from 'vuex';
import { JoinPlatform } from 'config/api'; import { CreatingPlatformAdd, upload } from 'config/api';
const formItemLayoutA = {
labelCol: { span: 8 },
wrapperCol: { span: 15 },
};
const formItemLayout = { const formItemLayout = {
labelCol: { span: 5 }, labelCol: { span: 5 },
wrapperCol: { span: 18 }, wrapperCol: { span: 18 },
@ -60,15 +177,20 @@ export default {
title: '协同创新中心加入申请', title: '协同创新中心加入申请',
str: '申请加入', str: '申请加入',
formItemLayout, formItemLayout,
formItemLayoutA,
formTailLayout, formTailLayout,
confirmLoading: false, confirmLoading: false,
platform: { platform: {
companyName: '', // companyName: '', //
manName: '', // companyType: '', //
tel: '', // code: '', //
describe: '', // position: '', //
code: '', // ower: '', //
isTel: false, email: '', //
contact: '', //
phone: '', //
message: '', //
// isTel: false,
}, },
codeRules: [ codeRules: [
{ required: true, message: '请输入验证码' }, { required: true, message: '请输入验证码' },
@ -81,18 +203,36 @@ export default {
phoneRules: [ phoneRules: [
{ required: true, pattern: new RegExp(/^[1][3,4,5,6,7,8,9][0-9]{9}$/), whitespace: true, message: '请输入正确的手机号' }, { required: true, pattern: new RegExp(/^[1][3,4,5,6,7,8,9][0-9]{9}$/), whitespace: true, message: '请输入正确的手机号' },
], ],
action: upload,
fileList: [],
emailRules: [
{
pattern: new RegExp(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/),
whitespace: true,
message: '请输入正确的邮箱格式',
},
],
}; };
}, },
computed: mapState('user', ['picCode']),
computed: {
...mapState('user', ['picCode']),
...mapState('home', ['userSer']),
isTel() {
return /^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(this.platform.phone);
},
},
async created() { async created() {
this.sendPicCode(); this.sendPicCode();
await this.getUserSer(); await this.getUserSer();
if (this.userSer) { if (this.userSer) {
if (this.userSer.name) { if (this.userSer.name) {
this.platform.manName = this.userSer.name; this.platform.contact = this.userSer.name;
} }
if (this.userSer.phone) { if (this.userSer.phone) {
this.platform.tel = this.userSer.phone; this.platform.phone = this.userSer.phone;
} }
if (this.userSer.companyName) { if (this.userSer.companyName) {
this.platform.companyName = this.userSer.companyName; this.platform.companyName = this.userSer.companyName;
@ -110,23 +250,27 @@ export default {
handleCancel(e) { handleCancel(e) {
this.visible = false; this.visible = false;
}, },
//
handlePosition(value) {
this.platform.position = value;
},
// //
changePhone(e) { changePhone(e) {
this.platform.tel = e.target.value; this.platform.phone = e.target.value;
this.platform.isTel = /^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(this.platform.tel); },
fileChange(info) {
this.fileList = info.fileList;
}, },
// //
handleOk() { handleOk() {
if (!this.platform.manName) { if (!this.platform.contact) {
this.$message.error('请输入联系人'); this.$message.error('请输入联系人');
} else if (!this.platform.tel) { } else if (!this.platform.phone) {
this.$message.error('请输入联系电话'); this.$message.error('请输入联系电话');
} else if (!this.platform.code) { } else if (!this.platform.message) {
this.$message.error('请输入验证码'); this.$message.error('请输入验证码');
} else if (!this.platform.describe) {
this.$message.error('请输入项目信息简述');
} else { } else {
if (this.platform.isTel) { if (this.isTel) {
this.subMitAdd(); this.subMitAdd();
} else { } else {
this.$message.error('请输入正确的联系电话'); this.$message.error('请输入正确的联系电话');
@ -139,15 +283,21 @@ export default {
try { try {
const params = { const params = {
param: { param: {
code: this.platform.code,
companyName: this.platform.companyName, companyName: this.platform.companyName,
contactName: this.platform.manName, companyType: this.platform.companyType,
contactPhone: this.platform.tel, code: this.platform.code,
description: this.platform.describe, position: this.platform.position,
type: 0, ower: this.platform.ower,
email: this.platform.email,
contact: this.platform.contact,
phone: this.platform.phone,
message: this.platform.message,
pic: this.codeNum,
fileList: this.fileList,
}, },
}; };
const res = await JoinPlatform(params); console.log('params: ', params);
const res = await CreatingPlatformAdd(params);
const { code, msg, data } = res.data; const { code, msg, data } = res.data;
if (code === 200) { if (code === 200) {
this.$message.success('申请成功'); this.$message.success('申请成功');
@ -156,7 +306,7 @@ export default {
for (let key in this.platform) { for (let key in this.platform) {
this.platform[key] = ''; this.platform[key] = '';
} }
this.platform.isTel = false; this.isTel = false;
} else { } else {
throw msg; throw msg;
this.confirmLoading = false; this.confirmLoading = false;
@ -168,10 +318,9 @@ export default {
}, },
// //
async getCode() { async getCode() {
console.log(111);
try { try {
const params = { const params = {
phone: this.platform.tel, phone: this.platform.phone,
verificationCodeId: this.picCode.verificationCodeId, verificationCodeId: this.picCode.verificationCodeId,
verificationCodeValue: this.codeNum, verificationCodeValue: this.codeNum,
}; };

Loading…
Cancel
Save