微信权限,登入。 图片上传
This commit is contained in:
parent
1383fe403d
commit
6887d4ccd8
@ -1,6 +1,6 @@
|
|||||||
import Taro, { Component } from '@tarojs/taro'
|
import Taro, { Component } from '@tarojs/taro'
|
||||||
import { View, Text, Radio, RadioGroup, Label } from '@tarojs/components'
|
import { View, Text, Radio, RadioGroup, Label } from '@tarojs/components'
|
||||||
import { AtInput, AtImagePicker, AtTextarea, AtButton, Picker } from 'taro-ui'
|
import { AtInput, AtImagePicker, AtTextarea, AtButton, Picker, AtToast } from 'taro-ui'
|
||||||
|
|
||||||
import SearchBarComponent from '../../component/searchBarComponent/searchBarComponent'
|
import SearchBarComponent from '../../component/searchBarComponent/searchBarComponent'
|
||||||
import copyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
import copyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||||
@ -23,15 +23,11 @@ class GoodsPublish extends Component {
|
|||||||
productPrice: '',
|
productPrice: '',
|
||||||
productUnit: '',
|
productUnit: '',
|
||||||
productDescript: '',
|
productDescript: '',
|
||||||
files: [{
|
files: [], // 上传的图片
|
||||||
url: 'https://jimczj.gitee.io/lazyrepay/aragaki1.jpeg',
|
isUploadImageSuccess: false,
|
||||||
},
|
uploadImageTextTip: '',
|
||||||
{
|
isUploadProductSuccess: false,
|
||||||
url: 'https://jimczj.gitee.io/lazyrepay/aragaki2.jpeg',
|
uploadProductTextTip: '',
|
||||||
},
|
|
||||||
{
|
|
||||||
url: 'https://jimczj.gitee.io/lazyrepay/aragaki3.png',
|
|
||||||
}], // 上传的图片
|
|
||||||
list: [
|
list: [
|
||||||
{
|
{
|
||||||
value: '美国',
|
value: '美国',
|
||||||
@ -59,7 +55,8 @@ class GoodsPublish extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 发布商品api
|
// 发布商品api
|
||||||
uploadGoods() {
|
//{ goods_name = "test2", goods_price= "1.00", goods_unit= "1",goods_profiles= "test2",class_id= "10103",shop_class_id= "1899", file_id= "27959",file_type= 1,if_cover= 1,file_sort= 1}
|
||||||
|
uploadGoods({ goods_name = "test2", goods_price = "1.00", goods_unit = "1", goods_profiles = "test2", class_id = "10103", shop_class_id = "1899", file_id = "27959", file_type = 1, if_cover = 1, file_sort = 1 }) {
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: URL.UploadProduct,
|
url: URL.UploadProduct,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -67,38 +64,39 @@ class GoodsPublish extends Component {
|
|||||||
data: {
|
data: {
|
||||||
deployType: 1,
|
deployType: 1,
|
||||||
action: 1,
|
action: 1,
|
||||||
goods: JSON.stringify({ "goods_name": "test2", "goods_price": "1.00", "goods_unit": "1", "goods_profiles": "test2", "class_id": "10103", "shop_class_id": "1899" }),
|
goods: JSON.stringify({
|
||||||
goodsFiles: JSON.stringify([{ "file_id": "27959", "file_type": 1, "if_cover": 1, "file_sort": 1 }])
|
goods_name: goods_name,
|
||||||
|
goods_price: goods_price,
|
||||||
|
goods_unit: goods_unit,
|
||||||
|
goods_profiles: goods_profiles,
|
||||||
|
class_id: class_id,
|
||||||
|
shop_class_id: shop_class_id
|
||||||
|
}),
|
||||||
|
goodsFiles: JSON.stringify([{
|
||||||
|
file_id: file_id,
|
||||||
|
file_type: file_type,
|
||||||
|
if_cover: if_cover,
|
||||||
|
file_sort: file_sort
|
||||||
|
}])
|
||||||
},
|
},
|
||||||
header: {
|
header: {
|
||||||
'content-type': 'application/x-www-form-urlencoded',
|
'content-type': 'application/x-www-form-urlencoded',
|
||||||
|
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||||
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
|
this.setState({ uploadProductTextTip: '发布成功', isUploadProductSuccess: true })
|
||||||
console.log('上传商品', res) // 提示非法请求 ----- to be continue
|
console.log('上传商品', res) // 提示非法请求 ----- to be continue
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
.catch(error => {
|
||||||
|
this.setState({ uploadProductTextTip: '发布失败', isUploadProductSuccess: true })
|
||||||
|
})
|
||||||
}
|
}
|
||||||
// 上传商品图片api
|
|
||||||
uploadGoodsImage() {
|
|
||||||
Taro.request({
|
|
||||||
url: URL.UploadPorductImage,
|
|
||||||
method: 'POST',
|
|
||||||
dataType: 'json',
|
|
||||||
data: {
|
|
||||||
file: 1,
|
|
||||||
},
|
|
||||||
header: {
|
|
||||||
'content-type': 'application/x-www-form-urlencoded',
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.then(res => {
|
|
||||||
console.log('上传商品图片', res)
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
// 改变商品分类状态
|
// 改变商品分类状态
|
||||||
onChange(e) {
|
onChangeProductType(e) {
|
||||||
this.setState({
|
this.setState({
|
||||||
selectorChecked: this.state.selector[e.detail.value]
|
selectorChecked: this.state.selector[e.detail.value]
|
||||||
})
|
})
|
||||||
@ -124,17 +122,37 @@ class GoodsPublish extends Component {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
// 上传图片
|
// 上传图片
|
||||||
onChangeImg(files, operationType,index) {
|
onChangeImg(files, operationType, index) {
|
||||||
|
const that = this
|
||||||
if (operationType === 'add') {
|
if (operationType === 'add') {
|
||||||
this.setState({
|
Taro.uploadFile({
|
||||||
files
|
url: URL.UploadPorductImage, // 仅为示例,非真实的接口地址
|
||||||
|
filePath: files[files.length - 1].url,
|
||||||
|
name: 'file',
|
||||||
|
formData: {
|
||||||
|
user: 'test'
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
'content-type': 'multipart/form-data',
|
||||||
|
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||||
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
|
},
|
||||||
|
success(response) {
|
||||||
|
const data = JSON.parse(response.data)
|
||||||
|
const imagePath = URL.Base + data.file_path
|
||||||
|
const newFiles = that.state.files.concat({ url: imagePath })
|
||||||
|
|
||||||
|
that.setState({ files: newFiles, isUploadImageSuccess: true, uploadImageTextTip: '上传成功' })
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (operationType === 'remove') {
|
if (operationType === 'remove') {
|
||||||
this.state.files.splice(index, 1);
|
this.state.files.splice(index, 1);
|
||||||
this.setState({ files: this.state.files });
|
this.setState({ files: this.state.files });
|
||||||
|
that.setState({ isUploadImageSuccess: true, uploadImageTextTip: '删除成功' })
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// 图片上传失败
|
// 图片上传失败
|
||||||
onFail(mes) {
|
onFail(mes) {
|
||||||
@ -142,9 +160,28 @@ class GoodsPublish extends Component {
|
|||||||
}
|
}
|
||||||
// 删除图片
|
// 删除图片
|
||||||
onImageClick(index) {
|
onImageClick(index) {
|
||||||
|
|
||||||
}
|
}
|
||||||
componentDidMount(){
|
onClickUploadGoods() {
|
||||||
|
if (this.state.productName && this.state.productPrice && this.state.productUnit && this.state.files.length) {
|
||||||
|
this.uploadGoods({
|
||||||
|
goods_name: this.state.productName,
|
||||||
|
goods_price: this.state.productPrice,
|
||||||
|
goods_unit: this.state.productUnit,
|
||||||
|
goods_profiles: this.state.productDescript,
|
||||||
|
class_id: "10103",
|
||||||
|
shop_class_id: "1899",
|
||||||
|
file_id: "27959",
|
||||||
|
file_type: 1,
|
||||||
|
if_cover: 1,
|
||||||
|
file_sort: 1
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
this.setState({ uploadProductTextTip: '请填写完表格', isUploadProductSuccess: true })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,14 +196,25 @@ class GoodsPublish extends Component {
|
|||||||
componentDidHide() { }
|
componentDidHide() { }
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const imageUploadSuccess = <AtToast
|
||||||
|
isOpened={this.state.isUploadImageSuccess}
|
||||||
|
text={this.state.uploadImageTextTip}
|
||||||
|
duration={1000}
|
||||||
|
></AtToast>
|
||||||
|
const productUploadSuccess = <AtToast
|
||||||
|
isOpened={this.state.isUploadProductSuccess}
|
||||||
|
text={this.state.uploadProductTextTip}
|
||||||
|
duration={1000}
|
||||||
|
></AtToast>
|
||||||
return (
|
return (
|
||||||
<View className='goods-publish'>
|
<View className='goods-publish'>
|
||||||
|
{imageUploadSuccess}
|
||||||
|
{productUploadSuccess}
|
||||||
<SearchBarComponent></SearchBarComponent>
|
<SearchBarComponent></SearchBarComponent>
|
||||||
<View className='goods-category'>
|
<View className='goods-category'>
|
||||||
<View className='page-section'>
|
<View className='page-section'>
|
||||||
|
|
||||||
<View>
|
<View>
|
||||||
<Picker mode='selector' range={this.state.selector} onChange={this.onChange}>
|
<Picker mode='selector' range={this.state.selector} onChange={this.onChangeProductType.bind(this)}>
|
||||||
<View className='picker'>
|
<View className='picker'>
|
||||||
<View className='title-box'>
|
<View className='title-box'>
|
||||||
<Text className='title'><Text className='require'>*</Text>商品分类:</Text> <Text className='selected'>{this.state.selectorChecked}</Text>
|
<Text className='title'><Text className='require'>*</Text>商品分类:</Text> <Text className='selected'>{this.state.selectorChecked}</Text>
|
||||||
@ -295,7 +343,7 @@ class GoodsPublish extends Component {
|
|||||||
</View>
|
</View>
|
||||||
<View className='button-box'>
|
<View className='button-box'>
|
||||||
<View className='button'>
|
<View className='button'>
|
||||||
<AtButton type='primary' size='small'>发布</AtButton>
|
<AtButton type='primary' size='small' onClick={this.onClickUploadGoods.bind(this)}>发布</AtButton>
|
||||||
</View>
|
</View>
|
||||||
<View className='button'>
|
<View className='button'>
|
||||||
<AtButton type='primary' className='button-a' size='small'>发布并新增</AtButton>
|
<AtButton type='primary' className='button-a' size='small'>发布并新增</AtButton>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Taro, { Component } from '@tarojs/taro'
|
import Taro, { Component } from '@tarojs/taro'
|
||||||
import { View, Button, Text, Swiper, SwiperItem, Image, } from '@tarojs/components'
|
import { View, Button, Text, Swiper, SwiperItem, Image, } from '@tarojs/components'
|
||||||
import { AtModal } from 'taro-ui'
|
import { AtModal, AtButton } from 'taro-ui'
|
||||||
import filteredShopComponent from '../../component/filteredShopComponent/filteredShopComponent'
|
import filteredShopComponent from '../../component/filteredShopComponent/filteredShopComponent'
|
||||||
import bottomNav from '../../component/bottomNav/bottomNav'
|
import bottomNav from '../../component/bottomNav/bottomNav'
|
||||||
import URL from '../../serviceAPI.config'
|
import URL from '../../serviceAPI.config'
|
||||||
@ -24,16 +24,7 @@ class Home extends Component {
|
|||||||
isOpen: false, // 抢单消息提示
|
isOpen: false, // 抢单消息提示
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
componentWillMount() {
|
|
||||||
|
|
||||||
}
|
|
||||||
componentDidMount() {
|
|
||||||
// 页面加载后 得到首页的基本信息和推荐店铺的信息
|
|
||||||
Taro.showLoading({ title: '加载中' })
|
|
||||||
this.getShops()
|
|
||||||
this.getHomeCategoriesInfo()
|
|
||||||
this.login()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -82,16 +73,12 @@ class Home extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 登入api
|
// 登入api
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
login() {
|
login() {
|
||||||
Taro.login({
|
Taro.login({
|
||||||
|
|
||||||
success(res) {
|
success(res) {
|
||||||
if (res.code) {
|
if (res.code) {
|
||||||
// 发起网络请求
|
// 发起网络请求
|
||||||
console.log(res)
|
console.log('手机端微信code:',res.code)
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: URL.Login,
|
url: URL.Login,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -104,17 +91,41 @@ class Home extends Component {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
console.log('登入', response)
|
// console.log('登入', response)
|
||||||
|
//储存后台返回的session_id 到local Storage
|
||||||
|
Taro.setStorageSync('session_id', response.data.session_id)
|
||||||
|
|
||||||
}
|
}
|
||||||
)}
|
)
|
||||||
else {
|
}
|
||||||
|
else {
|
||||||
console.log('登录失败!' + res.errMsg)
|
console.log('登录失败!' + res.errMsg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// 微信用户设置
|
||||||
|
// wxUserSetting() {
|
||||||
|
// Taro.getSetting({
|
||||||
|
// success(res) {
|
||||||
|
// if (res.authSetting['scope.userInfo']) {
|
||||||
|
// console.log('personal info', res)
|
||||||
|
// Taro.authorize({
|
||||||
|
// scope: 'scope.userInfo',
|
||||||
|
// success() {
|
||||||
|
// // 用户已经同意小程序使用录音功能,后续调用 wx.startRecord 接口不会弹窗询问
|
||||||
|
// // Taro.getUserInfo({
|
||||||
|
// // success(res1) {
|
||||||
|
// // console.log('res1',res1)
|
||||||
|
// // }
|
||||||
|
// // })
|
||||||
|
// console.log('权限允许')
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
// }
|
||||||
// api 抢单请求
|
// api 抢单请求
|
||||||
GrabDemand({ demandId = 218 }) {
|
GrabDemand({ demandId = 218 }) {
|
||||||
Taro.request({
|
Taro.request({
|
||||||
@ -164,6 +175,19 @@ class Home extends Component {
|
|||||||
// 确认抢单之后
|
// 确认抢单之后
|
||||||
this.GrabDemand({})
|
this.GrabDemand({})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
// 页面加载后 得到首页的基本信息和推荐店铺的信息
|
||||||
|
Taro.showLoading({ title: '加载中' })
|
||||||
|
this.getShops()
|
||||||
|
this.getHomeCategoriesInfo()
|
||||||
|
this.login()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillMount() {
|
||||||
|
|
||||||
|
}
|
||||||
componentWillUnmount() { }
|
componentWillUnmount() { }
|
||||||
|
|
||||||
componentDidShow() { }
|
componentDidShow() { }
|
||||||
@ -171,10 +195,19 @@ class Home extends Component {
|
|||||||
componentDidHide() { }
|
componentDidHide() { }
|
||||||
|
|
||||||
|
|
||||||
|
// 微信用户信息
|
||||||
|
onGotUserInfo(e) {
|
||||||
|
console.log(e.detail.errMsg)
|
||||||
|
console.log(e.detail.userInfo)
|
||||||
|
console.log(e.detail.rawData)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
||||||
// 提示弹窗element
|
// 提示弹窗element
|
||||||
const modalMessage = <AtModal className='modal'
|
const modalMessageGrab= <AtModal className='modal'
|
||||||
isOpened={this.state.isOpen}
|
isOpened={this.state.isOpen}
|
||||||
title='提示'
|
title='提示'
|
||||||
cancelText='取消'
|
cancelText='取消'
|
||||||
@ -241,7 +274,10 @@ class Home extends Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View className='home'>
|
<View className='home'>
|
||||||
{modalMessage}
|
{/* 获取微信用户的信息 */}
|
||||||
|
{/* <AtButton open-type='getUserInfo' lang='zh_CN' type='primary' size='normal' onGetUserInfo={this.onGotUserInfo.bind(this)}>获取微信用户的信息</AtButton> */}
|
||||||
|
|
||||||
|
{modalMessageGrab}
|
||||||
{/* 第一行图片滚动条 */}
|
{/* 第一行图片滚动条 */}
|
||||||
|
|
||||||
<View className='first-banner'>
|
<View className='first-banner'>
|
||||||
|
@ -27,14 +27,11 @@ class Index extends Component {
|
|||||||
|
|
||||||
//http://ihome6.com/Shop-supplyShops
|
//http://ihome6.com/Shop-supplyShops
|
||||||
componentDidMount(){
|
componentDidMount(){
|
||||||
Taro.setStorageSync('PFWSSS','hq0erouhm4mea8b0mg34gdj0q7')
|
|
||||||
Taro.setStorageSync('X-Token','eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.IntcInVzZXJfaWRcIjpcIjI3XCIsXCJsb2dpbl9uYW1lXCI6XCJ5YW5neGJcIixcImF0XCI6XCIyMDE4LTEyLTE4IDEzOjM1OjUxXCJ9Ig.gXvZxXgU5asfwUJAG-z7k5g2p3dbts2e1X9L902KksE')
|
|
||||||
Taro.setStorageSync('PLU','%2Fm-more')
|
|
||||||
Taro.setStorageSync('localCity','think%3A%7B%2214%22%3A%22%25E7%25A6%258F%25E5%25BB%25BA%25E7%259C%2581%22%2C%2214001%22%3A%22%25E7%25A6%258F%25E5%25B7%259E%25E5%25B8%2582%22%7D')
|
|
||||||
|
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url: '/pages/home/home'
|
url: '/pages/home/home'
|
||||||
// url: '/pages/goodsPublish/goodsPublish'
|
// url: '/pages/goodsPublish/goodsPublish'
|
||||||
// url:'/pages/supplyDemandPublish/supplyDemandPublish'
|
// url:'/pages/supplyDemandPublish/supplyDemandPublish'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import Taro, { Component } from '@tarojs/taro'
|
import Taro, { Component } from '@tarojs/taro'
|
||||||
import { View, Text } from '@tarojs/components'
|
import { View, Text } from '@tarojs/components'
|
||||||
import { AtInput, AtButton, Picker,AtIcon } from 'taro-ui'
|
import { AtInput, AtButton, Picker, AtIcon } from 'taro-ui'
|
||||||
import URL from '../../serviceAPI.config'
|
import URL from '../../serviceAPI.config'
|
||||||
|
|
||||||
import copyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
import copyrightComponent from '../../component/copyrightComponent/copyrightComponent'
|
||||||
@ -19,37 +19,50 @@ class MySupplyDemand extends Component {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super(...arguments)
|
super(...arguments)
|
||||||
this.state = {
|
this.state = {
|
||||||
demandSupplyCate: ['全部','需求', '供应', '人才'],
|
demandSupplyCate: ['全部', '需求', '供应', '人才'],
|
||||||
demandSupplyCateSelected: '全部',
|
demandSupplyCateSelected: '全部',
|
||||||
demandSupplyState: ['全部','上架', '下架'],
|
demandSupplyState: ['全部', '上架', '下架'],
|
||||||
demandSupplyStatesSelected: '全部',
|
demandSupplyStatesSelected: '全部',
|
||||||
title:'',
|
title: '',
|
||||||
startDateSel: '2018-04-22',
|
startDateSel: '2018-04-22',
|
||||||
endDateSel: '2018-04-22',
|
endDateSel: '2018-04-22',
|
||||||
|
allDemandSupply: [],
|
||||||
|
totalDemandSupply:'',
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//MySupplyDemand
|
//MySupplyDemand
|
||||||
getMySupplyDemand({ curr_page=1, page_count=20}) {
|
getMySupplyDemand({ curr_page = 1, page_count = 20 }) {
|
||||||
Taro.request({
|
Taro.request({
|
||||||
url: URL.MySupplyDemand,
|
url: URL.MySupplyDemand,
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
|
|
||||||
data: {
|
data: {
|
||||||
curr_page: curr_page,
|
param: JSON.stringify({
|
||||||
page_count: page_count
|
curr_page: curr_page,
|
||||||
|
page_count: page_count
|
||||||
|
})
|
||||||
},
|
},
|
||||||
header: {
|
header: {
|
||||||
|
'Cookie': 'PFWSSS=' + Taro.getStorageSync('session_id'),
|
||||||
'content-type': 'application/x-www-form-urlencoded',
|
'content-type': 'application/x-www-form-urlencoded',
|
||||||
'X-Requested-With': 'XMLHttpRequest'
|
'X-Requested-With': 'XMLHttpRequest'
|
||||||
}
|
}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log(res) // ------------------------------------------- to be continue----
|
console.log(res) // ------------------------------------------- to be continue----
|
||||||
console.log('个人供求=》暂时无数据, 后台需要权限验证')
|
// console.log('个人供求=》暂时无数据, 后台需要权限验证')
|
||||||
|
if (res.data.err_msg === "success") {
|
||||||
|
this.setState({ allDemandSupply: res.data.supplys,totalDemandSupply:res.data.count })
|
||||||
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//修改供求类型
|
//修改供求类型
|
||||||
demSupplyCateChange = e => {
|
demSupplyCateChange = e => {
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -62,8 +75,8 @@ class MySupplyDemand extends Component {
|
|||||||
demandSupplyStatesSelected: this.state.demandSupplyState[e.detail.value]
|
demandSupplyStatesSelected: this.state.demandSupplyState[e.detail.value]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
titleChange(event){
|
titleChange(event) {
|
||||||
this.setState({title:event})
|
this.setState({ title: event })
|
||||||
}
|
}
|
||||||
// 修改开始日期
|
// 修改开始日期
|
||||||
onStartDateChange = e => {
|
onStartDateChange = e => {
|
||||||
@ -81,7 +94,7 @@ class MySupplyDemand extends Component {
|
|||||||
console.log(this.props, nextProps)
|
console.log(this.props, nextProps)
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount () {
|
componentDidMount() {
|
||||||
this.getMySupplyDemand({})
|
this.getMySupplyDemand({})
|
||||||
}
|
}
|
||||||
componentWillUnmount() { }
|
componentWillUnmount() { }
|
||||||
@ -91,6 +104,47 @@ class MySupplyDemand extends Component {
|
|||||||
componentDidHide() { }
|
componentDidHide() { }
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const demandSupplyElementArray = this.state.allDemandSupply.length ? this.state.allDemandSupply.map((item, index) => {
|
||||||
|
return <View key={index} className='info-container'>
|
||||||
|
<View className='type'>
|
||||||
|
<Text className='title'>需求类型:</Text>
|
||||||
|
<Text className='info'>{item.type_name}</Text>
|
||||||
|
</View>
|
||||||
|
<View className='demand-title'>
|
||||||
|
<Text className='title'>需求标题:</Text>
|
||||||
|
<Text className='info'>{item.sd_title}</Text>
|
||||||
|
</View>
|
||||||
|
<View className='contact-name'>
|
||||||
|
<Text className='title'>联系人:</Text>
|
||||||
|
<Text className='info'>{item.user_name}</Text>
|
||||||
|
</View>
|
||||||
|
<View className='contact-number'>
|
||||||
|
<Text className='title'>电话号码:</Text>
|
||||||
|
<Text className='info'>{item.user_phone}</Text>
|
||||||
|
</View>
|
||||||
|
<View className='demand-status'>
|
||||||
|
<Text className='title'>需求状态:</Text>
|
||||||
|
<Text className='info'>{item.state}</Text>
|
||||||
|
</View>
|
||||||
|
<View className='update-time'>
|
||||||
|
<Text className='title'>更新时间:</Text>
|
||||||
|
<Text className='info'>{item.update_date}</Text>
|
||||||
|
</View>
|
||||||
|
<View className='info-button-box'>
|
||||||
|
<View className='button'>
|
||||||
|
<AtButton type='primary' size='small'>查看</AtButton>
|
||||||
|
</View>
|
||||||
|
<View className='button'>
|
||||||
|
<AtButton type='primary' size='small'>编辑</AtButton>
|
||||||
|
</View>
|
||||||
|
<View className='button'>
|
||||||
|
<AtButton type='primary' className='button-a' size='small'>删除</AtButton>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
|
||||||
|
</View>
|
||||||
|
}) : null
|
||||||
return (
|
return (
|
||||||
<View className='mySupplyDemand'>
|
<View className='mySupplyDemand'>
|
||||||
<searchBarComponent></searchBarComponent>
|
<searchBarComponent></searchBarComponent>
|
||||||
@ -124,12 +178,12 @@ class MySupplyDemand extends Component {
|
|||||||
<View className='input-box'>
|
<View className='input-box'>
|
||||||
<Text className='require'>*</Text>
|
<Text className='require'>*</Text>
|
||||||
<AtInput
|
<AtInput
|
||||||
name='value'
|
name='value'
|
||||||
title='供求标题:'
|
title='供求标题:'
|
||||||
placeholder='供求标题·'
|
placeholder='供求标题·'
|
||||||
type='text'
|
type='text'
|
||||||
value={this.state.title}
|
value={this.state.title}
|
||||||
onChange={this.titleChange.bind(this)}
|
onChange={this.titleChange.bind(this)}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
{/* 开始和结束日期 */}
|
{/* 开始和结束日期 */}
|
||||||
@ -143,7 +197,7 @@ class MySupplyDemand extends Component {
|
|||||||
|
|
||||||
</View>
|
</View>
|
||||||
</Picker>
|
</Picker>
|
||||||
<Picker className='picker-container' mode='date' onChange={this.onEndDateChange}>
|
<Picker className='picker-container' mode='date' onChange={this.onEndDateChange}>
|
||||||
<View className='picker'>
|
<View className='picker'>
|
||||||
<View className='title-box'>
|
<View className='title-box'>
|
||||||
<Text className='title'><Text className='require'>*</Text>结束日期:</Text> <Text className='selected'>{this.state.endDateSel}</Text>
|
<Text className='title'><Text className='require'>*</Text>结束日期:</Text> <Text className='selected'>{this.state.endDateSel}</Text>
|
||||||
@ -158,59 +212,18 @@ class MySupplyDemand extends Component {
|
|||||||
<View className='button'>
|
<View className='button'>
|
||||||
<AtButton type='primary' size='small'>
|
<AtButton type='primary' size='small'>
|
||||||
<AtIcon value='search' size='12' color='white'></AtIcon>
|
<AtIcon value='search' size='12' color='white'></AtIcon>
|
||||||
搜索</AtButton>
|
搜索</AtButton>
|
||||||
</View>
|
</View>
|
||||||
<View className='button'>
|
<View className='button'>
|
||||||
<AtButton type='primary' className='button-a' size='small'>
|
<AtButton type='primary' className='button-a' size='small'>
|
||||||
<AtIcon value='add' size='12' color='white'></AtIcon>
|
<AtIcon value='add' size='12' color='white'></AtIcon>
|
||||||
新增</AtButton>
|
新增</AtButton>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className='total-count'>一共<Text className='number'>20</Text> 条记录</View>
|
<View className='total-count'>一共<Text className='number'>{this.state.totalDemandSupply}</Text> 条记录</View>
|
||||||
{/* 我的供求信息 */}
|
{/* 我的供求信息 */}
|
||||||
<View className='info-box'>
|
<View className='info-box'>
|
||||||
<View className='info-container'>
|
{demandSupplyElementArray}
|
||||||
|
|
||||||
<View className='type'>
|
|
||||||
<Text className='title'>需求类型:</Text>
|
|
||||||
<Text className='info'>1</Text>
|
|
||||||
</View>
|
|
||||||
<View className='demand-title'>
|
|
||||||
<Text className='title'>需求标题:</Text>
|
|
||||||
<Text className='info'>1</Text>
|
|
||||||
</View>
|
|
||||||
<View className='contact-name'>
|
|
||||||
<Text className='title'>联系人:</Text>
|
|
||||||
<Text className='info'>1</Text>
|
|
||||||
</View>
|
|
||||||
<View className='contact-number'>
|
|
||||||
<Text className='title'>电话号码:</Text>
|
|
||||||
<Text className='info'>1</Text>
|
|
||||||
</View>
|
|
||||||
<View className='demand-status'>
|
|
||||||
<Text className='title'>需求状态:</Text>
|
|
||||||
<Text className='info'></Text>
|
|
||||||
</View>
|
|
||||||
<View className='update-time'>
|
|
||||||
<Text className='title'>更新时间:</Text>
|
|
||||||
<Text className='info'>1</Text>
|
|
||||||
</View>
|
|
||||||
<View className='info-button-box'>
|
|
||||||
<View className='button'>
|
|
||||||
<AtButton type='primary' size='small'>查看</AtButton>
|
|
||||||
</View>
|
|
||||||
<View className='button'>
|
|
||||||
<AtButton type='primary' size='small'>编辑</AtButton>
|
|
||||||
</View>
|
|
||||||
<View className='button'>
|
|
||||||
<AtButton type='primary' className='button-a' size='small'>删除</AtButton>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
|
|
||||||
|
|
||||||
</View>
|
|
||||||
|
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ const URL = {
|
|||||||
BuyConsult: LOCALURL + 'Shop-consult',// 购买咨询
|
BuyConsult: LOCALURL + 'Shop-consult',// 购买咨询
|
||||||
GetShopItemDetail: LOCALURL + 'GoodsQuery-wxGoodsDetail',// 商品详情
|
GetShopItemDetail: LOCALURL + 'GoodsQuery-wxGoodsDetail',// 商品详情
|
||||||
// 商品发布api接口
|
// 商品发布api接口
|
||||||
UploadPorductImage: LOCALURL + 'Goods-fileUp',// 上传商品图片
|
UploadPorductImage: LOCALURL + 'Goods-fileUpload',// 上传商品图片
|
||||||
UploadProduct: LOCALURL + 'Goods-phonePost',// 上传商品
|
UploadProduct: LOCALURL + 'Goods-phonePost',// 上传商品
|
||||||
UploadSupplyDemand: LOCALURL + 'Supply-post',// 上传供求
|
UploadSupplyDemand: LOCALURL + 'Supply-post',// 上传供求
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user