You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
251 lines
5.3 KiB
251 lines
5.3 KiB
<template>
|
|
<view>
|
|
<view class="demand-box">
|
|
<view>
|
|
<text>企业名称:</text>
|
|
<input type="text" disabled="" v-model="name"/>
|
|
</view>
|
|
<view>
|
|
<text>联系人:</text>
|
|
<input type="text" v-model="man"/>
|
|
</view>
|
|
<view>
|
|
<text>联系方式:</text>
|
|
<input type="text" v-model="tel"/>
|
|
</view>
|
|
<view>
|
|
<text>需求类型:</text>
|
|
<view class="select-content" @click="changetype">
|
|
<text>{{publishingData}}</text>
|
|
<icon class="iconfont icon-jiantou-xia triangle" type=""></icon>
|
|
</view>
|
|
<view class="publishing-box" :class="state == 1 ? 'show' : ''">
|
|
<view v-for="(item,index) in stateList" :key="index" class="publishing-type" @click="changedatavalue(item,index)">{{item}}</view>
|
|
</view>
|
|
</view>
|
|
<view>
|
|
<text>需求内容:</text>
|
|
<button @click="uploadfile">上传文件</button>
|
|
<textarea maxlength="1000" class="demand-content" v-model="content"/>
|
|
</view>
|
|
</view>
|
|
<view class="padding flex flex-direction">
|
|
<button class="cu-btn bg-red margin-tb-sm lg" @click="release">发布</button>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { detail } from 'api/detail'
|
|
import { publish } from 'api/publish'
|
|
import { upLoad } from 'api/upLoad'
|
|
|
|
export default {
|
|
onShareAppMessage(res) {
|
|
if (res.from === 'button') {// 来自页面内分享按钮
|
|
console.log(res.target)
|
|
}
|
|
return {
|
|
title: '',
|
|
path: '/pages/RequirementRelease/RequirementRelease'
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
state:0,
|
|
name:'',
|
|
man:'',
|
|
tel:'',
|
|
content:'',
|
|
publishingData:'技术转移转化',
|
|
publishingNum:0,
|
|
msg: 0,
|
|
fileIds:[],
|
|
stateList :['技术转移转化','工业设计咨询','科技金融建设','政策项目咨询','知识产权咨询','创新体系建设','创新创业咨询','信息技术服务','协同创新服务'],
|
|
}
|
|
},
|
|
async onLoad(option){
|
|
const that = this
|
|
if(option.man){
|
|
that.man = decodeURI(option.man)
|
|
that.tel = decodeURI(option.tel)
|
|
that.publishingData = decodeURI(option.type)
|
|
for(var i=0;i<that.stateList.length-1;i++){
|
|
if(decodeURI(option.type) == that.stateList[i]){
|
|
that.publishingNum = i
|
|
}
|
|
}
|
|
that.content = decodeURI(option.content)
|
|
var arr = []
|
|
arr = decodeURI(option.id).split(',')
|
|
that.fileIds = arr
|
|
console.log(that.fileIds)
|
|
}else if(that.man == ''){
|
|
const params1 = {
|
|
param:{
|
|
}
|
|
}
|
|
const data1 = await detail(params1)
|
|
that.name = data1.name
|
|
that.man = data1.contacts
|
|
that.tel = data1.contactPhone
|
|
}
|
|
const params2 = {
|
|
param:{
|
|
}
|
|
}
|
|
const data2 = await detail(params2)
|
|
that.name = data2.name
|
|
},
|
|
onUnload: function () {
|
|
uni.switchTab({
|
|
url:'/pages/tabBar/Enterprise'
|
|
})
|
|
},
|
|
methods: {
|
|
changetype(){
|
|
if(this.state != 1){
|
|
this.state = 1
|
|
}else{
|
|
this.state = 0
|
|
}
|
|
},
|
|
changedatavalue(item,index){
|
|
this.publishingData = item
|
|
this.publishingNum = index
|
|
this.state = 0
|
|
},
|
|
async release(){
|
|
const that = this
|
|
var Arr = []
|
|
for(var i=0;i<that.fileIds.length;i++){
|
|
Arr.push(that.fileIds[i] - 0)
|
|
}
|
|
try{
|
|
const params = {
|
|
param:{
|
|
contactPhone: that.tel,
|
|
contacts: that.man,
|
|
content: that.content,
|
|
fileIds: Arr,
|
|
type: that.publishingNum
|
|
}
|
|
}
|
|
const data = await publish(params)
|
|
that.$store.state.policy.release++
|
|
uni.showToast({
|
|
title:'即将跳转...',
|
|
icon:"success",
|
|
duration: 2000
|
|
})
|
|
setTimeout(function(){
|
|
uni.switchTab({
|
|
url:'/pages/tabBar/Enterprise'
|
|
})
|
|
},2000)
|
|
}catch(e){
|
|
console.log(e)
|
|
uni.showToast({
|
|
title:'发布失败 : ' + e,
|
|
icon:'none'
|
|
})
|
|
}
|
|
},
|
|
uploadfile(){
|
|
const that = this
|
|
const man = that.man
|
|
const tel = that.tel
|
|
const type = that.publishingData
|
|
const content = that.content
|
|
uni.navigateTo({
|
|
url:`/pages/RequirementRelease/upload?man=${man}&tel=${tel}&type=${type}&content=${content}&Token=` + that.$store.state.user.token
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.demand-box{
|
|
margin: 10px 15px;
|
|
background-color: $white;
|
|
|
|
view{
|
|
display: flex;
|
|
height: auto;
|
|
line-height: 40px;
|
|
padding-left: 20px;
|
|
border-bottom: 1px solid $grey;
|
|
position: relative;
|
|
input{
|
|
position: absolute;
|
|
height: 20px;
|
|
font-size: 14px;
|
|
left: 200upx;
|
|
top: 8px;
|
|
}
|
|
.select-content{
|
|
position: absolute;
|
|
left: 200upx;
|
|
padding-left: 0;
|
|
top: 0px;
|
|
width: 400upx;
|
|
display: flex;
|
|
text{
|
|
flex: 1;
|
|
}
|
|
icon{
|
|
flex: 1;
|
|
}
|
|
}
|
|
.publishing-box{
|
|
left: 160upx;
|
|
padding-left: 0;
|
|
top: 42px;
|
|
display: none;
|
|
position: absolute;
|
|
background-color: $white;
|
|
border-radius: 5px;
|
|
z-index: 1000;
|
|
height: auto;
|
|
width: 300upx;
|
|
.publishing-type{
|
|
height: 40px;
|
|
line-height: 40px;
|
|
text-align: center;
|
|
}
|
|
}
|
|
|
|
button{
|
|
height: 20px;
|
|
line-height: 20px;
|
|
font-size: 12px;
|
|
width: 80px;
|
|
position: absolute;
|
|
top: 10px;
|
|
right: 15px;
|
|
}
|
|
}
|
|
}
|
|
.demand-content{
|
|
border: 1px solid $grey;
|
|
flex: 1;
|
|
margin-top: 40px;
|
|
margin-left: -140upx;
|
|
margin-right: 15px;
|
|
padding: 0 10px;
|
|
border-radius: 5px;
|
|
margin-bottom: 10px;
|
|
height: 150px;
|
|
}
|
|
.show{
|
|
display: block !important;
|
|
}
|
|
.triangle{
|
|
margin-left: 6upx;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
font-size: 24upx;
|
|
color: $gray;
|
|
}
|
|
</style>
|
|
|