星期二 shoppage api

This commit is contained in:
郑茂强 2018-12-18 17:37:23 +08:00
parent 6bacc5be25
commit 1383fe403d
14 changed files with 683 additions and 440 deletions

View File

@ -36,23 +36,23 @@
"taro-ui": "^1.5.0" "taro-ui": "^1.5.0"
}, },
"devDependencies": { "devDependencies": {
"@types/react": "^16.4.8",
"@types/webpack-env": "^1.13.6",
"@tarojs/plugin-babel": "^1.2.0-beta.3", "@tarojs/plugin-babel": "^1.2.0-beta.3",
"@tarojs/plugin-csso": "^1.2.0-beta.3", "@tarojs/plugin-csso": "^1.2.0-beta.3",
"@tarojs/plugin-sass": "^1.2.0-beta.3", "@tarojs/plugin-sass": "^1.2.0",
"@tarojs/plugin-uglifyjs": "^1.2.0-beta.3", "@tarojs/plugin-uglifyjs": "^1.2.0-beta.3",
"@tarojs/webpack-runner": "^1.2.0-beta.3", "@tarojs/webpack-runner": "^1.2.0-beta.3",
"@types/react": "^16.4.8",
"@types/webpack-env": "^1.13.6",
"babel-eslint": "^8.2.3",
"babel-plugin-transform-class-properties": "^6.24.1", "babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-decorators-legacy": "^1.3.4", "babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-jsx-stylesheet": "^0.6.5", "babel-plugin-transform-jsx-stylesheet": "^0.6.5",
"babel-plugin-transform-object-rest-spread": "^6.26.0", "babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.6.1", "babel-preset-env": "^1.6.1",
"babel-eslint": "^8.2.3",
"eslint": "^4.19.1", "eslint": "^4.19.1",
"eslint-config-taro": "^1.2.0-beta.3", "eslint-config-taro": "^1.2.0-beta.3",
"eslint-plugin-react": "^7.8.2",
"eslint-plugin-import": "^2.12.0", "eslint-plugin-import": "^2.12.0",
"eslint-plugin-react": "^7.8.2",
"eslint-plugin-taro": "^1.2.0-beta.3" "eslint-plugin-taro": "^1.2.0-beta.3"
} }
} }

View File

@ -26,7 +26,7 @@ class App extends Component {
'pages/supplyDemandPublish/supplyDemandPublish', 'pages/supplyDemandPublish/supplyDemandPublish',
'pages/mySupplyDemand/mySupplyDemand', 'pages/mySupplyDemand/mySupplyDemand',
'pages/allDemanding/allDemanding', 'pages/allDemanding/allDemanding',
'pages/shopDescription/shopDescription', // 'pages/shopDescription/shopDescription',
], ],
window: { window: {
backgroundTextStyle: 'light', backgroundTextStyle: 'light',

View File

@ -10,6 +10,9 @@ const hornIcon = require('../../icons/horn.png')
const houseIcon = require('../../icons/house.png') const houseIcon = require('../../icons/house.png')
class recommondShop extends Component { class recommondShop extends Component {
static options = {
addGlobalClass: true
}
config = { config = {
navigationBarTitleText: 'recommondShop' navigationBarTitleText: 'recommondShop'
@ -194,7 +197,7 @@ class recommondShop extends Component {
const voucherModalElement = <AtModal className='voucher-modal' isOpened={this.state.isOpenVouhcer}> const voucherModalElement = <AtModal className='voucher-modal' isOpened={this.state.isOpenVouhcer}>
<AtModalHeader>优惠卷须知</AtModalHeader> <AtModalHeader>优惠卷须知</AtModalHeader>
<AtModalContent> <AtModalContent>
<AtNoticebar className='warning' icon='volume-plus'> <AtNoticebar style='color:#a94442' icon='volume-plus'>
提示具体可以前往实体店进行领取优惠卷或通过电话进行咨询 提示具体可以前往实体店进行领取优惠卷或通过电话进行咨询
</AtNoticebar> </AtNoticebar>
<View className='voucher-left'>当前优惠卷{voucherLeft}</View> <View className='voucher-left'>当前优惠卷{voucherLeft}</View>
@ -215,7 +218,7 @@ class recommondShop extends Component {
{!this.state.voucherCanConsult ? <View className='voucher-ResponseMsg'>{this.state.voucherResponseMsg}</View> : null} {!this.state.voucherCanConsult ? <View className='voucher-ResponseMsg'>{this.state.voucherResponseMsg}</View> : null}
</AtModalContent> </AtModalContent>
<AtModalAction> <Button onClick={this.voucherModalClose.bind(this)} >取消</Button> <Button onClick={this.voucherModalConfirm.bind(this)}></Button> </AtModalAction> <AtModalAction> <Button onClick={this.voucherModalClose.bind(this)} >取消</Button> <Button style='color:#FF7B00' onClick={this.voucherModalConfirm.bind(this)}></Button> </AtModalAction>
</AtModal> </AtModal>
const consultModalElement = <AtModal isOpened={this.state.isOpenConsult}> const consultModalElement = <AtModal isOpened={this.state.isOpenConsult}>
<AtModalHeader>咨询</AtModalHeader> <AtModalHeader>咨询</AtModalHeader>

View File

@ -10,6 +10,7 @@
background-color: black background-color: black
} }
} }
.tip-info{ .tip-info{

View File

@ -19,10 +19,14 @@ class ShopItem extends Component {
}} }}
shopOnClickHanlder(){ shopOnClickHanlder(){
let goodId=this.props.item.goods_id
Taro.navigateTo({ Taro.navigateTo({
url: '/pages/goods/goods?id=123&name=michael' url: '/pages/goods/goods?id='+goodId
}) })
} }
componentDidMount(){
}
// 当图片无效的时候 的方法 (为什么不起作用??) // 当图片无效的时候 的方法 (为什么不起作用??)
onError(e){ onError(e){
@ -30,6 +34,7 @@ class ShopItem extends Component {
e.target.onerror = null; e.target.onerror = null;
e.target.src = 'https://raw.githubusercontent.com/shenghy/SmileVue/master/src/assets/images/errorimg.png' e.target.src = 'https://raw.githubusercontent.com/shenghy/SmileVue/master/src/assets/images/errorimg.png'
} }
render() { render() {
const imgURL =this.props.item? URL.Base +this.props.item.goods_url:null const imgURL =this.props.item? URL.Base +this.props.item.goods_url:null
const newPrice = this.props.item ? this.props.item.goods_price : null const newPrice = this.props.item ? this.props.item.goods_price : null

View File

@ -1,5 +1,6 @@
import Taro, { Component } from '@tarojs/taro' import Taro, { Component } from '@tarojs/taro'
import { View, Text, Image } from '@tarojs/components' import { View, Text, Image , Swiper, SwiperItem} from '@tarojs/components'
import { AtTabs, AtTabsPane, AtSegmentedControl, AtIcon, AtToast, Picker } from 'taro-ui' import { AtTabs, AtTabsPane, AtSegmentedControl, AtIcon, AtToast, Picker } from 'taro-ui'
import copyrightComponent from '../../component/copyrightComponent/copyrightComponent' import copyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import SearchBarComponent from '../../component/searchBarComponent/searchBarComponent' import SearchBarComponent from '../../component/searchBarComponent/searchBarComponent'
@ -8,7 +9,7 @@ import URL from '../../serviceAPI.config'
import './goods.scss' import './goods.scss'
//GetShopItemDetail
class Goods extends Component { class Goods extends Component {
config = { config = {
@ -22,9 +23,51 @@ class Goods extends Component {
isOpened: false, // 是否显示轻提示 isOpened: false, // 是否显示轻提示
selector: ['0', '1', '2', '3'], // 数量或者规格选择 selector: ['0', '1', '2', '3'], // 数量或者规格选择
selectorChecked: '0', // 已选择的数量或规格 selectorChecked: '0', // 已选择的数量或规格
}} productImagesUrl: '', // 图片地址
productName: '',// 商品名字
productDes: '',// 商品简介
oldPirce: '',// 原价
specialPrice: '',//促销价
productType: '',//商品类型
serviceArea: '',//服务区域
monthSold: '',//月销量
totalSold: '',//总销量
browsingCount: '',// 浏览数
}
}
// 商品详情api
getShopDescription() {
Taro.request({
url: URL.GetShopItemDetail,
method: 'POST',
dataType: 'json',
data: {
goodsID: this.$router.params.id,
},
header: {
'content-type': 'application/x-www-form-urlencoded',
}
})
.then(res => {
console.log('商品详情:', res)
this.setState({
productImagesUrl: res.data.goods.goods_pic,
productName: res.data.goods.goods_name,
productDes: res.data.goods.goods_profiles,
oldPirce: res.data.goods.goods_org_price,
specialPrice: res.data.goods.goods_price,
productType: res.data.goods.goods_type_name,
serviceArea: res.data.goodsRegionName[0],
monthSold: res.data.goods.month_sales,
totalSold: res.data.goods.sales_volume,
browsingCount: res.data.goods.browse_times,
})
}
)
}
// 大类评论区方法 // 大类评论区方法
handleClick(value) { handleClick(value) {
this.setState({ this.setState({
@ -54,7 +97,8 @@ class Goods extends Component {
}) })
} }
componentDidMount() { componentDidMount() {
//this.$router.params.id
this.getShopDescription()
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
console.log(this.props, nextProps) console.log(this.props, nextProps)
@ -69,55 +113,81 @@ class Goods extends Component {
render() { render() {
const mainTabList = [{ title: '宝贝详情' }, { title: '全部评价' }, { title: '猜你喜欢' }] const mainTabList = [{ title: '宝贝详情' }, { title: '全部评价' }, { title: '猜你喜欢' }]
// const subTabList = [{ title: '全部' }, { title: '好评' }, { title: '差评' }, { title: '公开' }, { title: '匿名' }] // const subTabList = [{ title: '全部' }, { title: '好评' }, { title: '差评' }, { title: '公开' }, { title: '匿名' }]
const itemPicsBannerElementArray=this.state.productImagesUrl.map((item,index)=>{
return < SwiperItem key={index} >
<Image mode='aspectFit' src={URL.Base + item.file_path} style='max-width: 100%; height:100%;' />
</SwiperItem >
})
const itemDescriptionPicsElementArray = this.state.productImagesUrl.map((item, index) => {
return <View className='description-img' key={index}>
<Image mode='widthFix' src={URL.Base + item.file_path} style='width: 100%; max-height:100%;' />
</View>
})
return ( return (
<View className='gooods=container'> <View className='gooods=container'>
<SearchBarComponent></SearchBarComponent> <SearchBarComponent></SearchBarComponent>
<View className='img-box'> <View className='img-box'>
<Image className='img' src={URL.Base + 'Uploads/zone/user_1041/201808/thumb/e10a0bfea09a3078a800af8054bc80ce_400X400.jpg'}></Image> {/* <Image className='img' src={URL.Base + this.state.productImagesUrl}></Image> */}
<Swiper
className='swipper'
style='height:100%;'
indicatorColor='#999'
indicatorActiveColor='#333'
hotizontal
circular
indicatorDots
>
{itemPicsBannerElementArray}
</Swiper>
</View> </View>
<View className='title-box'> <View className='title-box'>
<View className='main-title'> <View className='main-title'>
11 {this.state.productName}
</View> </View>
<View className='subtitle-box'> <View className='subtitle-box'>
11 {this.state.productDes}
</View> </View>
</View> </View>
<View className='price-box'> <View className='price-box'>
<View className='org-box'> <View className='org-box'>
<Text className='title'>原价</Text> <Text className='title'>原价</Text>
<Text className='price'>11</Text> <Text className='price'>{this.state.oldPirce}</Text>
</View> </View>
<View className='spe-price'> <View className='spe-price'>
<Text className='title'>促销价</Text> <Text className='title'>促销价</Text>
<Text className='price'>11</Text> <Text className='price'>{this.state.specialPrice}</Text>
</View> </View>
</View> </View>
<View className='info-box'> <View className='info-box'>
<View className='type'> <View className='type'>
<Text className='title'>商品类型</Text> <Text className='title'>商品类型</Text>
<Text className='desc'>设计师商品</Text> <Text className='desc'>{this.state.productType}</Text>
</View> </View>
<View className='district'> <View className='district'>
<Text className='title'>服务区域</Text> <Text className='title'>服务区域</Text>
<Text className='desc'>中国/福建省(全省)</Text> <Text className='desc'>{this.state.serviceArea}</Text>
</View> </View>
</View> </View>
<View className='counter-box'> <View className='counter-box'>
<View className='month-sold'> <View className='month-sold'>
<Text className='title'>月销量</Text> <Text className='title'>月销量</Text>
<Text className='amount'>0</Text> <Text className='amount'>{this.state.monthSold}</Text>
</View> </View>
<View className='total-sold'> <View className='total-sold'>
<Text className='title'>总销量</Text> <Text className='title'>总销量</Text>
<Text className='amount'>0</Text> <Text className='amount'>{this.state.totalSold}</Text>
</View> </View>
<View className='browsing-amount'> <View className='browsing-amount'>
<Text className='title'>浏览量</Text> <Text className='title'>浏览量</Text>
<Text className='amount'>13</Text> <Text className='amount'>{this.state.browsingCount}</Text>
</View> </View>
</View> </View>
@ -140,7 +210,15 @@ class Goods extends Component {
{/* 大类 */} {/* 大类 */}
<AtTabs selectedColor='#FF7142' className='alltabs' animated={false} current={this.state.current} tabList={mainTabList} onClick={this.handleClick.bind(this)}> <AtTabs selectedColor='#FF7142' className='alltabs' animated={false} current={this.state.current} tabList={mainTabList} onClick={this.handleClick.bind(this)}>
<AtTabsPane current={this.state.current} index={0} > <AtTabsPane current={this.state.current} index={0} >
<View style='padding: 100px 50px;background-color: #FAFBFC;text-align: center;' >商品细节</View> <View style='background-color: #FAFBFC;' >
<View className='description-title'>商品细节</View>
<View className='description-img'>
{itemDescriptionPicsElementArray}
</View>
</View>
</AtTabsPane> </AtTabsPane>
<AtTabsPane current={this.state.current} index={1}> <AtTabsPane current={this.state.current} index={1}>
<View style='padding: 1px 0px 100px;background-color: #FAFBFC;text-align: center;'> <View style='padding: 1px 0px 100px;background-color: #FAFBFC;text-align: center;'>

View File

@ -2,13 +2,11 @@
// padding: 5px 0; // padding: 5px 0;
.img-box{ .img-box{
border: 1px solid #ddd; // border: 1px solid #ddd;
padding: 20px 0; padding: 20px 0;
text-align: center; text-align: center;
.img{ height: 600px;
height: 700px;
width: 60%
}
} }
.title-box{ .title-box{
border: 1px solid #ddd; border: 1px solid #ddd;
@ -20,7 +18,7 @@
font-weight: bold; font-weight: bold;
} }
.subtitle-box{ .subtitle-box{
margin-left: 20px; margin:0 20px;
font-size: 25px; font-size: 25px;
} }
@ -121,13 +119,26 @@
} }
//------------------------------ //------------------------------
.details-box{ .details-box{
.at-tabs{ .at-tabs{
.at-tabs__item--active{ .at-tabs__item--active{
color:#FF7142 color:#FF7142
} }
} }
.description-title{
font-size:35px;
color:#999;
margin-top:20px;
margin-left: 20px;
margin-bottom: 20px;
font-weight: bold;
}
.description-img{
padding:0 10px;
font-size: 0px;
}
} }
//------------------------------ //------------------------------
.copyright-box{ .copyright-box{
@ -186,3 +197,4 @@
} }
} }

View File

@ -4,6 +4,7 @@ import { AtInput, AtImagePicker, AtTextarea, AtButton, Picker } 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'
import URL from '../../serviceAPI.config'
import './goodsPublish.scss' import './goodsPublish.scss'
@ -56,6 +57,46 @@ class GoodsPublish extends Component {
] // 店铺分类选项 ] // 店铺分类选项
} }
} }
// 发布商品api
uploadGoods() {
Taro.request({
url: URL.UploadProduct,
method: 'POST',
dataType: 'json',
data: {
deployType: 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" }),
goodsFiles: JSON.stringify([{ "file_id": "27959", "file_type": 1, "if_cover": 1, "file_sort": 1 }])
},
header: {
'content-type': 'application/x-www-form-urlencoded',
}
})
.then(res => {
console.log('上传商品', res) // 提示非法请求 ----- to be continue
}
)
}
// 上传商品图片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) { onChange(e) {
this.setState({ this.setState({
@ -83,7 +124,7 @@ class GoodsPublish extends Component {
}) })
} }
// 上传图片 // 上传图片
onChangeImg(files,operationType) { onChangeImg(files, operationType,index) {
if (operationType === 'add') { if (operationType === 'add') {
this.setState({ this.setState({
files files
@ -102,6 +143,9 @@ class GoodsPublish extends Component {
// 删除图片 // 删除图片
onImageClick(index) { onImageClick(index) {
}
componentDidMount(){
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {

View File

@ -32,6 +32,7 @@ class Home extends Component {
Taro.showLoading({ title: '加载中' }) Taro.showLoading({ title: '加载中' })
this.getShops() this.getShops()
this.getHomeCategoriesInfo() this.getHomeCategoriesInfo()
this.login()
} }
@ -79,6 +80,41 @@ class Home extends Component {
} }
) )
} }
// 登入api
login() {
Taro.login({
success(res) {
if (res.code) {
// 发起网络请求
console.log(res)
Taro.request({
url: URL.Login,
method: 'POST',
dataType: 'json',
data: {
code: res.code
},
header: {
'content-type': 'application/x-www-form-urlencoded',
}
})
.then(response => {
console.log('登入', response)
}
)}
else {
console.log('登录失败!' + res.errMsg)
}
}
})
}
// api 抢单请求 // api 抢单请求
GrabDemand({ demandId = 218 }) { GrabDemand({ demandId = 218 }) {
Taro.request({ Taro.request({
@ -136,6 +172,7 @@ class Home extends Component {
render() { render() {
// 提示弹窗element // 提示弹窗element
const modalMessage = <AtModal className='modal' const modalMessage = <AtModal className='modal'
isOpened={this.state.isOpen} isOpened={this.state.isOpen}
@ -147,6 +184,9 @@ class Home extends Component {
onConfirm={this.handleGrabConfirm.bind(this)} onConfirm={this.handleGrabConfirm.bind(this)}
content='确认抢单?\n' content='确认抢单?\n'
/> />
const demandingElemensArray = this.state.demanding.length ? this.state.demanding.map((item, index) => { const demandingElemensArray = this.state.demanding.length ? this.state.demanding.map((item, index) => {
return < SwiperItem key={index} > return < SwiperItem key={index} >
<View className='demanding-item'> <View className='demanding-item'>

View File

@ -27,10 +27,15 @@ 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/goodsPublish/goodsPublish'
url: '/pages/home/home' url: '/pages/home/home'
// url: '/pages/goodsPublish/goodsPublish'
// url:'/pages/supplyDemandPublish/supplyDemandPublish'
}) })
} }
componentWillReceiveProps (nextProps) { componentWillReceiveProps (nextProps) {

View File

@ -44,6 +44,7 @@ class MySupplyDemand extends Component {
'X-Requested-With': 'XMLHttpRequest' 'X-Requested-With': 'XMLHttpRequest'
} }
}).then(res => { }).then(res => {
console.log(res) // ------------------------------------------- to be continue----
console.log('个人供求=》暂时无数据, 后台需要权限验证') console.log('个人供求=》暂时无数据, 后台需要权限验证')
}) })

View File

@ -24,11 +24,11 @@ class Shop extends Component {
shopId: '', // 店铺的id shopId: '', // 店铺的id
shopName: '', // 店铺名 shopName: '', // 店铺名
FilterText: '', // 筛选的可选项 FilterText: '', // 筛选的可选项
filterBar: ['all', 'amount', 'newProduct', 'price', 'popularity'], filterBar: ['all', 'amount', 'newProduct', 'price', 'popularity'], //筛选选项
filterBarKeys: { all: '综合排序', amount: '销量', newProduct: '新品', price: '价格', popularity: '人气' }, filterBarKeys: { all: '综合排序', amount: '销量', newProduct: '新品', price: '价格', popularity: '人气' }, // 筛选选项对应值
selectedFilterValue: 0, //筛选项 selectedFilterValue: 0, //筛选项
isShowFilter: false, //是否显示侧边筛选 isShowFilter: false, //是否显示侧边筛选
showShopHomePage: false,// 是否显示首页页面 showShopHomePage: true,// 是否显示首页页面
shopDescriptionData: '',// 店铺详情信息 shopDescriptionData: '',// 店铺详情信息
shopName: '',//店铺名称 shopName: '',//店铺名称
shopAddress: '',//店铺地址 shopAddress: '',//店铺地址
@ -154,7 +154,7 @@ class Shop extends Component {
// api 得到店铺详情请求 // api 得到店铺详情请求
getShopDescription({ shopID = 808 }) { getShopDescription({ shopID = 808 }) {
Taro.request({ Taro.request({
url: URL.Base + 'shop-wxShopInfo', url: URL.ShopDescription,
method: 'POST', method: 'POST',
dataType: 'json', dataType: 'json',
data: { data: {
@ -173,7 +173,7 @@ class Shop extends Component {
contactNumber: res.data.userRes.phone, contactNumber: res.data.userRes.phone,
shopDescription: res.data.data.shop_desc shopDescription: res.data.data.shop_desc
}, () => { }, () => {
console.log(this.state.shopDescriptionData) // console.log(this.state.shopDescriptionData)
}) })
} }

View File

@ -1,10 +1,11 @@
import Taro, { Component } from '@tarojs/taro' import Taro, { Component } from '@tarojs/taro'
import { View, Button, Text } from '@tarojs/components' import { View, Text } from '@tarojs/components'
import { AtInput, AtForm, AtImagePicker, AtTextarea, AtRadio, AtButton, Picker} from 'taro-ui' import { AtInput, AtImagePicker, AtTextarea, AtButton, Picker } 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'
import URL from '../../serviceAPI.config'
import './supplyDemandPublish.scss' import './supplyDemandPublish.scss'
@ -41,6 +42,45 @@ class SupplyDemand extends Component {
} }
} }
// 上传供求api
uploadSupplyDemand() {
Taro.request({
url: URL.UploadSupplyDemand,
method: 'POST',
dataType: 'json',
data: {
action: 1,
sdInfo: JSON.stringify({ "sd_type": "2", "sd_title": "534523", "user_name": "杨夕兵", "user_phone": "18950295811", "user_address": "2342", "sd_desc": "42342", "state": "1", "file_path": [{ "file_name": "bg3.jpg", "file_size": "212678", "file_path": "Uploads/supply/user_27/201812/38bf91f30d215bbefb2686f2401217a6.jpg", "thumb_path": "Uploads/supply/user_27/201812/thumb/38bf91f30d215bbefb2686f2401217a6_200X200.jpg" }] })
},
header: {
'content-type': 'application/x-www-form-urlencoded',
}
})
.then(res => {
console.log('上传供求', res)
}
)
}
// 上传商品图片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)
}
)
}
// 修改供求类型 // 修改供求类型
demandingSupplyCate = e => { demandingSupplyCate = e => {
this.setState({ this.setState({
@ -71,6 +111,10 @@ class SupplyDemand extends Component {
} }
// 添加图片 // 添加图片
onChange(files, operationType, index) { onChange(files, operationType, index) {
console.log(files[0].url)
Taro.uploadFile(files[0].url).then((res)=>{
console.log(res)
})
if (operationType === 'add') { if (operationType === 'add') {
this.setState({ this.setState({
files files
@ -91,6 +135,9 @@ class SupplyDemand extends Component {
onImageClick(index, file) { onImageClick(index, file) {
console.log(index, file) console.log(index, file)
} }
componentDidMount(){
this.uploadSupplyDemand()
}
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
console.log(this.props, nextProps) console.log(this.props, nextProps)
} }

View File

@ -2,6 +2,7 @@
const LOCALURL = "http://192.168.1.230/" const LOCALURL = "http://192.168.1.230/"
const URL = { const URL = {
Base:LOCALURL, Base:LOCALURL,
Login: LOCALURL + 'Applet-login', //登入接口
ShopWxStore: LOCALURL + 'Shop-wxStore', //商城首页信息 ShopWxStore: LOCALURL + 'Shop-wxStore', //商城首页信息
ShopSupplyShops: LOCALURL + 'Shop-supplyShops',// 商城店铺信息 ShopSupplyShops: LOCALURL + 'Shop-supplyShops',// 商城店铺信息
GoodsSearch: LOCALURL + 'GoodsSearch-search',// 店铺页面的信息 GoodsSearch: LOCALURL + 'GoodsSearch-search',// 店铺页面的信息
@ -15,6 +16,12 @@ const URL = {
GetVoucherInfo: LOCALURL + 'Shop-couponsTips',// 优惠卷信息 GetVoucherInfo: LOCALURL + 'Shop-couponsTips',// 优惠卷信息
GetConsultInfo: LOCALURL + 'Shop-consultTips',// 咨询信息 GetConsultInfo: LOCALURL + 'Shop-consultTips',// 咨询信息
BuyConsult: LOCALURL + 'Shop-consult',// 购买咨询 BuyConsult: LOCALURL + 'Shop-consult',// 购买咨询
GetShopItemDetail: LOCALURL + 'GoodsQuery-wxGoodsDetail',// 商品详情
// 商品发布api接口
UploadPorductImage: LOCALURL + 'Goods-fileUp',// 上传商品图片
UploadProduct: LOCALURL + 'Goods-phonePost',// 上传商品
UploadSupplyDemand: LOCALURL + 'Supply-post',// 上传供求
} }