支付宝-行业分类配适, 支付宝和微信小程序合并

This commit is contained in:
郑茂强 2019-03-19 17:19:51 +08:00
parent d42da99c54
commit 222d978a10
32 changed files with 1015 additions and 487 deletions

View File

@ -5,5 +5,6 @@ module.exports = {
defineConstants: {
},
weapp: {},
h5: {}
}

View File

@ -61,6 +61,7 @@ const config = {
h5: {
publicPath: '/',
staticDirectory: 'static',
esnextModules: ['@tarojs/components'],
module: {
postcss: {
autoprefixer: {
@ -69,6 +70,7 @@ const config = {
}
}
}
}
module.exports = function (merge) {

View File

@ -66,4 +66,7 @@ page{
text-align: center;
font-size: 25rpx;
}
.ali-blue-color{
color: #108ee9;
}

View File

@ -47,7 +47,7 @@ class ShopTypeInteractionComp extends Component {
if (res.data.data === null) {
return
}
console.log('店铺分类目录', res)
console.log('店铺分类目录ali', res)
if (!getGlobalStorage('shopTypeObject')) {
setGlobalStorage('shopTypeObject', res.data.data)
}
@ -56,7 +56,7 @@ class ShopTypeInteractionComp extends Component {
initailMultiArray: this.initializedData(res.data.data),
}, () => {
console.log('state', this.state.initailMultiArray, this.state.interactionMultiArray)
// console.log('state', this.state.initailMultiArray, this.state.interactionMultiArray)
// this.passDataToParent(this.state.initailMultiArray)
//返回初始选项在 在商品编辑页面
@ -184,7 +184,7 @@ class ShopTypeInteractionComp extends Component {
// 当然父组件有新的props的 会从新渲染组件
componentWillReceiveProps(nextProps) {
console.log('next props', nextProps)
}
componentWillUnmount() { }
@ -207,7 +207,7 @@ class ShopTypeInteractionComp extends Component {
<View class='ali-picker-container'>
<View className='button'>
<View className='cancel-button' onClick={this.aliCancelButton.bind(this)}>取消</View>
<View className='confirm-button' onClick={this.aliConfirmButton.bind(this)}>确定</View>
<View className='confirm-button ali-blue-color' onClick={this.aliConfirmButton.bind(this)}>确定</View>
</View>
<picker-view value={this.state.multiIndex} onChange={this.aliBindMultiPickerCol.bind(this)}>
<picker-view-column>

View File

@ -77,7 +77,6 @@
}
.confirm-button{
flex:1;
color:#FF7142;
text-align: right;
}
}

View File

@ -0,0 +1,235 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Text, Picker } from '@tarojs/components'
import { AtList, AtListItem, } from 'taro-ui'
import './aliIndustryTypeInteraction.scss'
import loginExpired from '../../util/loginExpired';
import { getGlobalStorage } from '../../util/getSetStoage';
let maxDepth = 0
let initialDataArray = []
class AliIndustryTypeInteraction extends Component {
config = {
navigationBarTitleText: 'aliIndustryTypeInteraction'
}
constructor() {
super(...arguments);
this.state = {
///---行业分类 开始
initailMultiArray: '',// 初始化底部数据
multiIndex: [0, 0],
interactionMultiArray: [],// 联动
AliIsShowPicker: false,
///---行业分类 结束
}
}
// 行业分类筛选列表GetIndustryTypeList
getIndustryTypeList(url) {
Taro.request({
url: url,
method: 'GET',
dataType: 'json',
header: {
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'content-type': 'application/x-www-form-urlencoded',
'X-Requested-With': 'XMLHttpRequest'
}
}).then(res => {
console.log('res',res)
if (res.data.err_code === 0) {
let initailMultiArray = this.recursionInitialized(res.data.data)
initailMultiArray[1].unshift({ name: '全部', id: '-1' })
initailMultiArray[0] = [{ name: '--', id: '' }]
// console.log('initailMultiArray', initailMultiArray)
this.setState({
initailMultiArray: initailMultiArray.reverse(), //initailMultiArray.reverse(),
interactionMultiArray: [{ name: '全部', id: '-1', children: [{ name: '--', id: '' }] }, ...this.recursionInteraction(res.data.data)],
multiIndex: this.recursionDepth(res.data.data),
}, () => {
initialDataArray = []
console.log('state',this.state.interactionMultiArray)
})
} else if (res.data.err_code === 88888) {
// loginExpired(res)
} else {
console.log('行业分类请求没有成功', res)
}
}
)
.catch(error => {
console.log('行业分类请求错误', error)
})
}
// 递归整理无限层联动数据
recursionInteraction(data) {
let arrayTem = []
for (let items of data) {
arrayTem.push({ name: items.class_name, id: items.class_id })
if (items.child.length) {
arrayTem[arrayTem.length - 1].children = [{ name: '--', id: '' }, ...this.recursionInteraction(items.child)]
} else {
arrayTem[arrayTem.length - 1].children = [{ name: '--', id: '' }]
}
}
return arrayTem // 返回联动数据
// return arrayTem
}
// 递归整理无限层初始数据
recursionInitialized(data) {
const arrayTem = []
const childrenHolderArray = []
if (data.length) {
for (let item of data) {
arrayTem.push({ name: item.class_name, id: item.class_id })
if (data.indexOf(item) === 0) {
item.child.length ? childrenHolderArray.push(...item.child) : null
}
}
this.recursionInitialized(childrenHolderArray)
}
arrayTem.length ? initialDataArray.push(arrayTem) : null // 数组为空则不添加
return initialDataArray
}
// 递归整理无限层层次
recursionDepth(data) {
const arrayTem = []
const childrenHolderArray = []
if (data.length) {
for (let item of data) {
arrayTem.push({ name: item.class_name, id: item.class_id })
item.child.length ? childrenHolderArray.push(...item.child) : null
}
this.recursionDepth(childrenHolderArray)
maxDepth += 1
}
return new Array(maxDepth).fill(0)
}
bindMultiPickerCol(e) {
// console.log('修改的列为', e.detail.column, ',值为', e.detail.value)
const data = {
multiArray: this.state.initailMultiArray,
multiIndex: this.state.multiIndex
}
data.multiIndex[e.detail.column] = e.detail.value
if (e.detail.column == 0) {
for (let index in data.multiArray[0]) {
const indexNumber = Number(index)
if (indexNumber === data.multiIndex[0]) {
data.multiArray[1] = this.state.interactionMultiArray[indexNumber].children
}
}
}
this.setState({ multiIndex: data.multiIndex })
}
//--------------------开始-行业分类picker
bindMultiPickerChange(e) {
this.setState({
multiIndex: e.detail.value,
}, () => {
this.passDataToParent()
})
}
//--------------------结束-行业分类picker
passDataToParent() {
const parent = this.state.interactionMultiArray[this.state.multiIndex[0]]
const child = this.state.interactionMultiArray[this.state.multiIndex[0]].children[this.state.multiIndex[1]]
child.id ? this.props.onPassDataToChild(child) : this.props.onPassDataToChild(parent)
}
aliBindMultiPickerCol(e) {
console.log('e', e)
console.log(',值为', e.detail.value)
this.setState({ multiIndex: e.detail.value })
}
aliCancelButton() {
this.setState({
AliIsShowPicker: false
})
}
aliConfirmButton() {
this.setState({
AliIsShowPicker: false
})
let result = this.state.interactionMultiArray[this.state.multiIndex[0]].children[this.state.multiIndex[1]]
this.passDataToParent(result)
}
invokeAliPicker() {
this.setState({
AliIsShowPicker: true
})
}
componentDidMount() {
this.getIndustryTypeList(this.props.url)
}
// 当然父组件有新的props的 会从新渲染组件
componentWillReceiveProps(nextProps) {
}
componentWillUnmount() { }
componentDidShow() { }
componentDidHide() { }
render() {
return (
<View className='industry-interaction' >
<View className='picker-wrapper' onClick={this.invokeAliPicker.bind(this)} >
<AtList>
<AtListItem title='行业分类' className='title' extraText={this.props.selectedValue.name} arrow='right' />
</AtList>
</View>
{this.state.AliIsShowPicker ? <View>
<View className='curtain' onClick={this.aliCancelButton.bind(this)} > </View>
<View class='ali-picker-container'>
<View className='button'>
<View className='cancel-button' onClick={this.aliCancelButton.bind(this)}>取消</View>
<View className='confirm-button ali-blue-color' onClick={this.aliConfirmButton.bind(this)}>确定</View>
</View>
<picker-view value={this.state.multiIndex} onChange={this.aliBindMultiPickerCol.bind(this)}>
<picker-view-column>
{this.state.interactionMultiArray.map((item, index) => {
return <View key={index}>{item.name}</View>
})}
</picker-view-column>
<picker-view-column>
{this.state.interactionMultiArray[this.state.multiIndex[0]].children.map((item, index) => {
return <View key={index}>{item.name}</View>
})}
</picker-view-column>
</picker-view>
</View ></View> : null}
</View>
)
}
}
export default AliIndustryTypeInteraction

View File

@ -0,0 +1,42 @@
.picker-wrapper{
.item-content__info-title{
font-weight: bold
}
.item-extra__info{
color: black
}
}
.curtain{
height: 100%;
background-color: black;
width: 100%;
position: fixed;
z-index: 99;
opacity: 0.5;
position: fixed;
top: 0;
}
.ali-picker-container{
position: fixed;
width: 100%;
bottom: 0px;
background-color: #fff;
z-index: 100;
opacity: 1;
.button{
display: flex;
flex-direction: row;
padding:20px 30px;
border-bottom: 1px solid #d6e4ef;
}
.cancel-button{
flex:1;
text-align: left;
}
.confirm-button{
flex:1;
text-align: right;
}
}

View File

@ -6,7 +6,7 @@ import { AtIcon } from 'taro-ui'
import URL from '../../serviceAPI.config'
import './pictureUploadComponent.scss'
import './aliPictureUploadComponent.scss'
import onClickValueService from '../../util/onClickValueService';
import { getGlobalStorage } from '../../util/getSetStoage';
@ -131,11 +131,9 @@ class PictureUploadComponent extends Component {
}
// 当然父组件有新的props的 会从新渲染组件
componentWillReceiveProps(nextProps) {
// 第一次的props 要给state
console.log('next props', nextProps)
if (nextProps.isReceiveImageUrl) {
if (this.state.onlyOnce) {
console.log('onlyonce')
this.setState({
imageURL: nextProps.initialImageURL,
imageDetails: nextProps.initialImagesInfo,
@ -147,14 +145,11 @@ class PictureUploadComponent extends Component {
}
componentWillUnmount() { }
componentDidShow() { }
componentDidHide() { }
render() {
console.log('state', this.state)
const { maxLength } = this.props
const imageElementArray = this.state.imageURL.map((item, index) => {
return <View key={index} className='image-wrapper'>
@ -166,7 +161,6 @@ class PictureUploadComponent extends Component {
/>
</View>
})
return (
<View class='pictureUploadComponent' > {this.state.imageURL.length < maxLength ? <Button onClick={this.uploadImage.bind(this)}>上传图片</Button> : null} < View className='image-container' > {imageElementArray}</View></View>

View File

@ -51,7 +51,7 @@ class ShopTypeInteractionComp extends Component {
}
this.setState({
interactionMultiArray: this.interactionData(res.data.data),
initailMultiArray: this.initializedData(res.data.data)[0],
initailMultiArray: this.initializedData(res.data.data),
}, () => {
console.log('state',this.state.initailMultiArray,this.state.interactionMultiArray)

View File

@ -0,0 +1,108 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Image } from '@tarojs/components'
import URL from '../../../serviceAPI.config'
import './aliGoodCommentSection.scss'
//接收的参数
// mainActived,subActived,productImagesUrl
class AliGoodCommentSection extends Component {
config = {
navigationBarTitleText: '商品详情和评论'
}
passMainCurrentToParent(value) {
this.props.onAliMainOnClick(value)
}
passSubCurrentToParent(value) {
this.props.onAliSubOnClick(value)
}
componentDidMount() {
}
componentWillReceiveProps(nextProps) {
console.log(this.props, nextProps)
}
componentWillUnmount() { }
componentDidShow() { }
componentDidHide() { }
render() {
const { mainActived, subActived, productImagesUrl } = this.props
const mainTabList = [{ title: '宝贝详情' }, { title: '全部评价' }, { title: '猜你喜欢' }]
const subTabList = [{ title: '全部' }, { title: '好评' }, { title: '中评' }, { title: '差评' }, { title: '公开' }, { title: '匿名' }]
const tabArrayElement = mainTabList.map((item, index) => {
return <View className={mainActived === index ? 'tab actived' : 'tab'} key={index} onClick={this.passMainCurrentToParent.bind(this, index)}>
{item.title}
</View>
})
const subTabArrayElement = subTabList.map((item, index) => {
return <View className={subActived === index ? 'sub-tab sub-actived' : 'sub-tab'} key={index} onClick={this.passSubCurrentToParent.bind(this, index)}>
{item.title}
</View>
})
const itemDescriptionPicsElementArray = 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 (
<View className='aliGoodCommentSection'>
<View className='tab-wrapper'>
<View className='tabs'>
{tabArrayElement}
</View>
<View className='tab-details'>
{mainActived === 0 && <View className='first-tab' style='background-color: #FAFBFC;' >
<View className='description-title'>商品细节</View>
<View className='description-img'>
{itemDescriptionPicsElementArray}
</View>
</View>
}
{mainActived === 1 && <View className='second-tab'>
<View className='tab-header'> {subTabArrayElement}</View>
{
subActived === 0 && <View className='sub-tab-details'>全部</View>
}
{
subActived === 1 && <View className='sub-tab-details'>好评</View>
}
{
subActived === 2 && <View className='sub-tab-details'>中评</View>
}
{
subActived === 3 && <View className='sub-tab-details'>差评</View>
}
{
subActived === 4 && <View className='sub-tab-details'>公开</View>
}
{
subActived === 5 && <View className='sub-tab-details'>匿名</View>
}
</View>}
{mainActived === 2 && <View className='third-tab' >标签页三的内容</View>}
</View>
</View>
</View>
)
}
}
export default AliGoodCommentSection

View File

@ -0,0 +1,72 @@
.tabs{
display: flex;
flex-wrap: nowrap;
flex-direction: row;
height: 80px;
border-bottom: 0.01px solid #d6e4ef;
.tab{
flex:1;
text-align: center;
padding: 24px;
}
.actived{
color:#FF7142;
border-bottom: 3px solid#FF7142
}
}
.tab-details{
border: 1px solid #d6e4ef;
.first-tab{
.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;
}
}
.second-tab{
.tab-header{
display: flex;
flex-wrap: nowrap;
flex-direction: row;
border-bottom: 0.1px solid #d6e4ef;
.sub-tab{
flex:1;
text-align: center;
padding: 12px;
}
}
.sub-tab-details{
padding: 100px 50px;
background-color: #FAFBFC;
text-align: center;
}
}
.third-tab{
padding: 100px 50px;
background-color: #FAFBFC;
text-align: center;
}
.actived{
color:#FF7142;
border-bottom: 3px solid#FF7142
}
.sub-actived{
color:#FF7142;
border: 2px solid#FF7142;
border-radius: 10%;
}
}

View File

@ -0,0 +1,117 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Image, Text } from '@tarojs/components'
import { AtTabs, AtTabsPane, AtSegmentedControl } from 'taro-ui'
import URL from '../../../serviceAPI.config'
import './goodCommentSection.scss'
// 需要的props
//productImagesUrlcurrentsubCurrent,onhandleClick,onClick
class GoodCommentSection extends Component {
config = {
navigationBarTitleText: '商品详情和评论'
}
passMainCurrentToParent(value){
this.props.onMainOnClick(value)
}
passSubCurrentToParent(value){
this.props.onSubOnClick(value)
}
componentDidMount() {
}
componentWillReceiveProps(nextProps) {
}
componentWillUnmount() { }
componentDidShow() { }
componentDidHide() { }
render() {
const mainTabList = [{ title: '宝贝详情' }, { title: '全部评价' }, { title: '猜你喜欢' }]
const { productImagesUrl, mainCurrent, subCurrent, } = this.props
const itemDescriptionPicsElementArray = 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 (
<View className='good-info-section'>
<View className='details-box'>
{/* 大类 */}
<AtTabs className='alltabs' animated={false} current={mainCurrent} tabList={mainTabList} onClick={this.passMainCurrentToParent.bind(this)}>
<AtTabsPane style='color:red' current={this.state.current} index={0} >
<View style='background-color: #FAFBFC;' >
<View className='description-title'>商品细节</View>
<View className='description-img'>
{itemDescriptionPicsElementArray}
</View>
</View>
</AtTabsPane>
<AtTabsPane current={subCurrent} index={1}>
<View style='padding: 1px 0px 100px;background-color: #FAFBFC;text-align: center;'>
{ /*子标签类*/}
<AtSegmentedControl selectedColor='#FF9500'
values={['全部', '好评', '中评', '差评', '公开', '匿名']}
onClick={this.passSubCurrentToParent.bind(this)}
current={subCurrent}
/>
{
this.state.subCurrent === 0
? <View className='tab-content'>
<Text className='title'>全部</Text>
</View>
: null
}
{
this.state.subCurrent === 1
? <View className='tab-content'>好评</View>
: null
}
{
this.state.subCurrent === 2
? <View className='tab-content'>中评</View>
: null
}
{
this.state.subCurrent === 3
? <View className='tab-content'>差评</View>
: null
}
{
this.state.subCurrent === 4
? <View className='tab-content'>公开</View>
: null
}
{
this.state.subCurrent === 5
? <View className='tab-content'>匿名</View>
: null
}
</View>
</AtTabsPane>
<AtTabsPane current={this.state.current} index={2}>
<View style='padding: 100px 50px;background-color: #FAFBFC;text-align: center;'>标签页三的内容</View>
</AtTabsPane>
</AtTabs>
</View>
</View>
)
}
}
export default GoodCommentSection

View File

@ -0,0 +1,22 @@
.details-box{
.at-tabs{
.at-tabs__item--active{
// color:$themeColor
}
}
.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;
}
}

View File

@ -1,9 +1,11 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Text, Image, Swiper, SwiperItem,Picker } from '@tarojs/components'
import { View, Text, Image, Swiper, SwiperItem, Picker } from '@tarojs/components'
import { AtIcon } from 'taro-ui'
import { AtIcon } from 'taro-ui'
import GoodCommentSection from './goodCommentSection/goodCommentSection'
import AliGoodCommentSection from './aliGoodCommentSection/aliGoodCommentSection'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import platformChecker from '../../util/plaformChecker'
import LoginService from '../../util/LoginService'
import URL from '../../serviceAPI.config'
import './goods.scss'
@ -35,15 +37,15 @@ class Goods extends Component {
browsingCount: '',// 浏览数
shopId: '',
actived: 0,// 默认tab
subActived:0,//默认sub-tab
subActived: 0,//默认sub-tab
}
}
// 商品详情api
getGoodDescription() {
let goodId=decodeURIComponent(this.$router.params.id)
let goodId = decodeURIComponent(this.$router.params.id)
Taro.request({
url: URL.GetShopItemDetail,
method: 'POST',
@ -52,8 +54,8 @@ class Goods extends Component {
goodsID: goodId,
},
header: {
'content-type': 'application/x-www-form-urlencoded',
'content-type': 'application/x-www-form-urlencoded',
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
}
})
@ -87,13 +89,13 @@ class Goods extends Component {
}
// 大类评论区方法
handleClick(value) {
mainTabClick(value) {
this.setState({
current: value
})
}
// 小磊评论区方法
onClick(value) {
subTabClick(value) {
this.setState({
subCurrent: value
})
@ -129,16 +131,16 @@ class Goods extends Component {
})
}
clickTabHandler(e) {
aliMainTabClick(e) {
let value = onClickValueService(e)
this.setState({
actived: value
})
}
clickSubTabHandler(e) {
aliSubTabClick(e) {
let value = onClickValueService(e)
this.setState({
subActived: value
subActived: value
})
}
// 数量或者规格方法
@ -165,19 +167,7 @@ class Goods extends Component {
componentDidHide() { }
render() {
const { actived,subActived } = this.state
const mainTabList = [{ title: '宝贝详情' }, { title: '全部评价' }, { title: '猜你喜欢' }]
const subTabList = [{ title: '全部' }, { title: '好评' }, { title: '中评' }, { title: '差评' }, { title: '公开' }, { title: '匿名' }]
const tabArrayElement = mainTabList.map((item, index) => {
return <View className={actived === index ? 'tab actived' : 'tab'} key={index} onClick={this.clickTabHandler.bind(this, index)}>
{item.title}
</View>
})
const subTabArrayElement = subTabList.map((item, index) => {
return <View className={subActived === index ? 'sub-tab sub-actived' : 'sub-tab'} key={index} onClick={this.clickSubTabHandler.bind(this, index)}>
{item.title}
</View>
})
// const subTabList = [{ title: '全部' }, { title: '好评' }, { title: '差评' }, { title: '公开' }, { title: '匿名' }]
@ -189,25 +179,19 @@ class Goods extends Component {
</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 (
<View className='gooods=container'>
<View className='img-box'>
{/* <Image className='img' src={URL.Base + this.state.productImagesUrl}></Image> */}
<Swiper
className='swipper'
style='height:100%;'
indicatorColor='#999'
indicatorActiveColor='#333'
hotizontal
circular
indicatorDots
className='swipper'
style='height:100%;'
indicatorColor='#999'
indicatorActiveColor='#333'
hotizontal
circular
indicatorDots
>
{itemPicsBannerElementArray}
@ -273,54 +257,20 @@ class Goods extends Component {
</Picker>
</View>
{/* 详情和评论区 */}
<View className='tab-wrapper'>
<View className='tabs'>
{tabArrayElement}
</View>
<View className='tab-details'>
{actived === 0 && <View className='first-tab' style='background-color: #FAFBFC;' >
<View className='description-title'>商品细节</View>
<View className='description-img'>
{itemDescriptionPicsElementArray}
</View>
</View>
}
{actived===1&& <View className='second-tab'>
<View className='tab-header'> {subTabArrayElement}</View>
{
subActived===0&&<View className='sub-tab-details'>全部</View>
}
{
subActived===1&&<View className='sub-tab-details'>好评</View>
}
{
subActived===2&&<View className='sub-tab-details'>中评</View>
}
{
subActived===3&&<View className='sub-tab-details'>差评</View>
}
{
subActived===4&&<View className='sub-tab-details'>公开</View>
}
{
subActived===5&&<View className='sub-tab-details'>匿名</View>
}
</View>}
{actived === 2 && <View className='third-tab' >标签页三的内容</View>}
</View>
</View>
{platformChecker() ? <GoodCommentSection
productImagesUrl={this.state.productImagesUrl}
mainCurrent={this.state.current}
subCurrent={this.state.subCurrent}
onMainOnClick={this.state.mainTabClick.bind(this)}
onSubOnClick={this.state.subTabClick.bind(this)}
/> : <AliGoodCommentSection
mainActived={this.state.actived}
subActived={this.state.subActived}
productImagesUrl={this.state.productImagesUrl}
onAliMainOnClick={this.state.aliMainTabClick.bind(this)}
onAliSubOnClick={this.state.aliSubTabClick.bind(this)}
/>}
<CopyrightComponent></CopyrightComponent>
<View className='gap' style='height:150rpx'>
</View>

View File

@ -190,75 +190,3 @@ $themeColor:#FF7142;
}
}
.tabs{
display: flex;
flex-wrap: nowrap;
flex-direction: row;
height: 80px;
border-bottom: 0.01px solid #d6e4ef;
.tab{
flex:1;
text-align: center;
padding: 24px;
}
.actived{
color:#FF7142;
border-bottom: 3px solid#FF7142
}
}
.tab-details{
border: 1px solid #d6e4ef;
.first-tab{
.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;
}
}
.second-tab{
.tab-header{
display: flex;
flex-wrap: nowrap;
flex-direction: row;
border-bottom: 0.1px solid #d6e4ef;
.sub-tab{
flex:1;
text-align: center;
padding: 12px;
}
}
.sub-tab-details{
padding: 100px 50px;
background-color: #FAFBFC;
text-align: center;
}
}
.third-tab{
padding: 100px 50px;
background-color: #FAFBFC;
text-align: center;
}
.actived{
color:#FF7142;
border-bottom: 3px solid#FF7142
}
.sub-actived{
color:#FF7142;
border: 2px solid#FF7142;
border-radius: 10%;
}
}

View File

@ -1,9 +1,8 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Text, Button } from '@tarojs/components'
import { AtInput, AtTextarea, } from 'taro-ui'
import { AtInput, AtTextarea, AtImagePicker } from 'taro-ui'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import PictureUploadComponent from '../../component/pictureUploadComponent/pictureUploadComponent'
import AliPictureUploadComponent from '../../component/aliPictureUploadComponent/aliPictureUploadComponent'
import ShopTypeInteractionComp from '../../component/shopTypeInteractionComp/shopTypeInteractionComp'
import AliShopTypeInteraction from '../../component/AliShopTypeInteraction/AliShopTypeInteraction'
@ -18,6 +17,7 @@ import loginExpired from '../../util/loginExpired';
import { getGlobalStorage } from '../../util/getSetStoage';
import { showLoading } from '../../util/hideShowLoading';
import { isUserShopOwner } from '../../util/checkLogin';
import platformChecker from '../../util/plaformChecker';
class GoodsPublish extends Component {
@ -291,7 +291,7 @@ class GoodsPublish extends Component {
console.log('从子组件商品分类传回来的值', value)
this.setState({ goodsTypeSelected: value })
}
componentWillMount() {
if (!getGlobalStorage('userInfo').user_id) {
LoginService()
@ -367,9 +367,7 @@ class GoodsPublish extends Component {
<Text className='require'>*</Text>
<Text className='title'>上传图片:</Text>
</View>
<PictureUploadComponent maxLength={20} isReceiveImageUrl={false} url={URL.UploadGoodsPorductImage} onGetImageDetails={this.getImageDetails.bind(this)} />
{/* <View className='img-container'>
{platformChecker() ? <View className='img-container'>
<AtImagePicker
multiple
files={this.state.pickerImageUrl}
@ -377,14 +375,19 @@ class GoodsPublish extends Component {
onFail={this.onFail.bind(this)}
onImageClick={this.onImageClick.bind(this)}
/>
</View> */}
</View> : <AliPictureUploadComponent maxLength={20} isReceiveImageUrl={false} url={URL.UploadGoodsPorductImage} onGetImageDetails={this.getImageDetails.bind(this)} />
}
</View>
{/* 店铺分类 */}
{process.env.TARO_ENV === 'weapp' ? <ShopTypeInteractionComp url={URL.GetShopCategoryList}
shopId={getGlobalStorage('shopInfo') ? getGlobalStorage('shopInfo').shop_id : ''}
selectedValue={this.state.shopTypeSelected}
onPassDataToChild={this.getDataFromShopChild.bind(this)}
></ShopTypeInteractionComp> : <AliShopTypeInteraction url={URL.GetShopCategoryList}
{platformChecker() ? <View className='ShopTypeInteractionComp-wrapper'>
<ShopTypeInteractionComp url={URL.GetShopCategoryList}
shopId={getGlobalStorage('shopInfo').shop_id}
selectedValue={this.state.shopTypeSelected}
onPassDataToChild={this.getDataFromShopChild.bind(this)}
></ShopTypeInteractionComp>
</View> : <AliShopTypeInteraction url={URL.GetShopCategoryList}
shopId={getGlobalStorage('shopInfo') ? getGlobalStorage('shopInfo').shop_id : ''}
selectedValue={this.state.shopTypeSelected}
onPassDataToChild={this.getDataFromShopChild.bind(this)}

View File

@ -25,6 +25,7 @@ $themeColor:#FF7142;
border-radius:8rpx;
}
}
.shoptype-box{
margin-top:10Px;
@ -121,3 +122,7 @@ $themeColor:#FF7142;
}
}
.ShopTypeInteractionComp-wrapper{
padding-left: 20px;
padding-right: 20px;
}

View File

@ -19,6 +19,7 @@ class IndividualCenter extends Component {
navigationBarTitleText: '个人中心'
}
constructor() {
super(...arguments);
this.state = {
client: [
{

View File

@ -11,6 +11,7 @@ class Login extends Component {
navigationBarTitleText: '登入'
}
constructor() {
super(...arguments);
this.state = {
username: '',
password: '',

View File

@ -1,8 +1,8 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Text, Button, Input,Picker } from '@tarojs/components'
import { AtInput, AtImagePicker, AtTextarea, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
import PictureUploadComponent from '../../component/pictureUploadComponent/pictureUploadComponent'
import { View, Text, Button, Input, Picker } from '@tarojs/components'
import { AtInput, AtImagePicker, AtTextarea, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
import AliPictureUploadComponent from '../../component/aliPictureUploadComponent/aliPictureUploadComponent'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import URL from '../../serviceAPI.config'
@ -11,6 +11,7 @@ import './myDemandSupplyEdit.scss'
import loginExpired from '../../util/loginExpired';
import { getGlobalStorage } from '../../util/getSetStoage';
import { showLoading } from '../../util/hideShowLoading';
import platformChecker from '../../util/plaformChecker';
@ -45,13 +46,13 @@ class MyDemandSupplyEdit extends Component {
}
//获取商品信息api GetProductInfo
getSupplyDemandInfo() {
let sdId=decodeURIComponent(this.$router.params.sdId)
let sdId = decodeURIComponent(this.$router.params.sdId)
Taro.request({
url: URL.GetSupplyDemandInfo,
method: 'GET',
dataType: 'json',
data: {
sdID:sdId ,
sdID: sdId,
},
header: {
'content-type': 'application/x-www-form-urlencoded',
@ -103,7 +104,7 @@ class MyDemandSupplyEdit extends Component {
user_address = this.state.contactAddress,
sd_desc = this.state.content,
state = this.state.demandingSupplyStateSelected.id }) {
let sd_id=decodeURIComponent(this.$router.params.sdId)
let sd_id = decodeURIComponent(this.$router.params.sdId)
const file_path = [];
this.state.ImagesInfo.forEach((item) => {
file_path.push({
@ -120,7 +121,7 @@ class MyDemandSupplyEdit extends Component {
data: {
action: 2,
sdInfo: JSON.stringify({
sd_id:sd_id ,
sd_id: sd_id,
sd_type: sd_type,
sd_title: sd_title,
user_name: user_name,
@ -450,15 +451,7 @@ class MyDemandSupplyEdit extends Component {
<Text className='title'>需求图片:</Text>
<View className='warn'>(最多4张)</View>
</View>
<PictureUploadComponent
maxLength={4}
isReceiveImageUrl={true}
initialImageURL={this.state.initialImageURL}
initialImagesInfo={this.state.initialImagesInfo}
url={URL.UploadDSPorductImage}
onGetImageDetails={this.getImageDetails.bind(this)}
/>
{/* <View className='img-container'>
{platformChecker() ? <View className='img-container'>
<AtImagePicker
multiple
showAddBtn={this.state.pickerImageUrl.length < 4}
@ -467,8 +460,14 @@ class MyDemandSupplyEdit extends Component {
onFail={this.onFail.bind(this)}
onImageClick={this.onImageClick.bind(this)}
/>
</View> */}
</View> : <AliPictureUploadComponent
maxLength={4}
isReceiveImageUrl={true}
initialImageURL={this.state.initialImageURL}
initialImagesInfo={this.state.initialImagesInfo}
url={URL.UploadDSPorductImage}
onGetImageDetails={this.getImageDetails.bind(this)}
/>}
</View>
<View className='page-section'>

View File

@ -144,14 +144,12 @@ class MyGoodList extends Component {
}
}).then(res => {
Taro.hideLoading()
const data = res.data
const data = JSON.parse(res.data)
if (data.err_code === 88888) {
loginExpired(data)
} else if (data.err_code != 10) {
console.log(res.data)
if (data.goodsCount != '0' && data.goods.length) {
data.goods.forEach(item => {
item.checked = false

View File

@ -1,17 +1,18 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Text, Button } from '@tarojs/components'
import { AtInput, AtTextarea, } from 'taro-ui'
import { AtInput, AtTextarea, AtImagePicker } from 'taro-ui'
import ShopTypeInteractionComp from '../../component/shopTypeInteractionComp/shopTypeInteractionComp'
import AliShopTypeInteraction from '../../component/AliShopTypeInteraction/AliShopTypeInteraction'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import PictureUploadComponent from '../../component/pictureUploadComponent/pictureUploadComponent'
import AliPictureUploadComponent from '../../component/aliPictureUploadComponent/aliPictureUploadComponent'
import URL from '../../serviceAPI.config'
import './myGoodsEdit.scss'
import loginExpired from '../../util/loginExpired';
import { getGlobalStorage } from '../../util/getSetStoage';
import { showLoading } from '../../util/hideShowLoading';
import platformChecker from '../../util/plaformChecker';
class MyGoodsEdit extends Component {
config = {
@ -38,13 +39,13 @@ class MyGoodsEdit extends Component {
//获取商品信息api GetProductInfo
getGoodsInfo() {
let goodsID=decodeURIComponent(this.$router.params.id)
let goodsID = decodeURIComponent(this.$router.params.id)
Taro.request({
url: URL.GetProductInfo,
method: 'GET',
dataType: 'json',
data: {
goodsID:goodsID ,
goodsID: goodsID,
},
header: {
'content-type': 'application/x-www-form-urlencoded',
@ -364,9 +365,9 @@ class MyGoodsEdit extends Component {
}
goToGoodsDetailPage() {
let goodsID=encodeURIComponent(this.$router.params.id)
let goodsID = encodeURIComponent(this.$router.params.id)
Taro.navigateTo({
url: '/pages/goods/goods?id=' +goodsID
url: '/pages/goods/goods?id=' + goodsID
})
}
goToMyGoodListPage() {
@ -388,7 +389,7 @@ class MyGoodsEdit extends Component {
}
componentWillReceiveProps(nextProps) {
}
componentWillUnmount() { }
@ -446,15 +447,7 @@ class MyGoodsEdit extends Component {
<Text className='require'>*</Text>
<Text className='title'>上传图片:</Text>
</View>
<PictureUploadComponent
maxLength={20}
isReceiveImageUrl={true}
initialImageURL={this.state.initialImageURL}
initialImagesInfo={this.state.initialImagesInfo}
url={URL.UploadGoodsPorductImage}
onGetImageDetails={this.getImageDetails.bind(this)}
/>
{/* <View className='img-container'>
{platformChecker() ? <View className='img-container'>
<AtImagePicker
multiple
files={this.state.pickerImageUrl}
@ -462,19 +455,29 @@ class MyGoodsEdit extends Component {
onFail={this.onFail.bind(this)}
onImageClick={this.onImageClick.bind(this)}
/>
</View> */}
</View> : <AliPictureUploadComponent
maxLength={20}
isReceiveImageUrl={true}
initialImageURL={this.state.initialImageURL}
initialImagesInfo={this.state.initialImagesInfo}
url={URL.UploadGoodsPorductImage}
onGetImageDetails={this.getImageDetails.bind(this)}
/>}
</View>
{/* 店铺分类 */}
{process.env.TARO_ENV === 'weapp' ? <ShopTypeInteractionComp url={URL.GetShopCategoryList}
shopId={getGlobalStorage('shopInfo') ? getGlobalStorage('shopInfo').shop_id : ''}
selectedValue={this.state.shopTypeSelected}
onPassDataToChild={this.getDataFromShopChild.bind(this)
}></ShopTypeInteractionComp> : <AliShopTypeInteraction url={URL.GetShopCategoryList}
{platformChecker() ? <View className='ShopTypeInteractionComp-wrapper'>
<ShopTypeInteractionComp url={URL.GetShopCategoryList}
shopId={getGlobalStorage('shopInfo') ? getGlobalStorage('shopInfo').shop_id : ''}
selectedValue={this.state.shopTypeSelected}
onPassDataToChild={this.getDataFromShopChild.bind(this)}
></AliShopTypeInteraction>}
onPassDataToChild={this.getDataFromShopChild.bind(this)
}></ShopTypeInteractionComp>
</View> : <AliShopTypeInteraction url={URL.GetShopCategoryList}
shopId={getGlobalStorage('shopInfo') ? getGlobalStorage('shopInfo').shop_id : ''}
selectedValue={this.state.shopTypeSelected}
onPassDataToChild={this.getDataFromShopChild.bind(this)}
></AliShopTypeInteraction>}
{/* 店铺分类结束 */}

View File

@ -11,8 +11,8 @@ $themeColor:#FF7142;
.at-input__container{
color:black;
font-weight: bold;
padding-left: 20px;
padding-right: 20px;
// padding-left: 20px;
// padding-right: 20px;
.at-input__input{
font-weight: normal
}
@ -110,4 +110,8 @@ $themeColor:#FF7142;
color:red;
line-height:100rpx;
}
.ShopTypeInteractionComp-wrapper{
padding-left: 20px;
padding-right: 20px;
}

View File

@ -1,16 +1,18 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Text, Button, Input,Picker } from '@tarojs/components'
import { AtInput, AtTextarea, AtModal, AtModalHeader, AtModalContent, AtModalAction } from 'taro-ui'
import { View, Text, Button, Input, Picker } from '@tarojs/components'
import { AtInput, AtTextarea, AtModal, AtModalHeader, AtModalContent, AtModalAction, AtImagePicker } from 'taro-ui'
import InteractionComponent from '../../component/interactionComponent/interactionComponent'
import AliIndustryTypeInteraction from '../../component/aliIndustryTypeInteraction/aliIndustryTypeInteraction'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import PictureUploadComponent from '../../component/pictureUploadComponent/pictureUploadComponent'
import AliPictureUploadComponent from '../../component/aliPictureUploadComponent/aliPictureUploadComponent'
import URL from '../../serviceAPI.config'
import './myNeedsEdit.scss'
import loginExpired from '../../util/loginExpired';
import { getGlobalStorage } from '../../util/getSetStoage';
import { showLoading } from '../../util/hideShowLoading';
import platformChecker from '../../util/plaformChecker';
class MyNeedsEdit extends Component {
@ -47,7 +49,7 @@ class MyNeedsEdit extends Component {
}
//获取需求信息api
getMyNeedEditInfo() {
let id=decodeURIComponent(this.$router.params.id)
let id = decodeURIComponent(this.$router.params.id)
Taro.request({
url: URL.EditMyNeeds,
method: 'GET',
@ -371,127 +373,141 @@ class MyNeedsEdit extends Component {
<View className='supply-demand'>
{deleteModalWindowElement}
{/* 行业分类 */}
<InteractionComponent url={URL.GetIndustryTypeList} onPassDataToChild={this.getDataFromChild.bind(this)} selectedValue={this.state.industryTypeSelected} ></InteractionComponent>
{platformChecker() ? <View className='InteractionComponent-wrapper'>
<InteractionComponent url={URL.GetIndustryTypeList} onPassDataToChild={this.getDataFromChild.bind(this)} selectedValue={this.state.industryTypeSelected} ></InteractionComponent></View>
: <AliIndustryTypeInteraction url={URL.GetIndustryTypeList} onPassDataToChild={this.getDataFromChild.bind(this)} selectedValue={this.state.industryTypeSelected} />}
{/* 需求类型 */}
<View className='page-section'>
<View>
<Picker mode='selector' rangeKey='name' range={this.state.needsType} onChange={this.needsTypeChange.bind(this)}>
<View className='picker'>
<View className='title-box'>
<Text className='title'><Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.needsTypeSelected.name}</Text>
<View className='padding-wrapper'>
<View className='page-section'>
<View>
<Picker mode='selector' rangeKey='name' range={this.state.needsType} onChange={this.needsTypeChange.bind(this)}>
<View className='picker'>
<View className='title-box'>
<Text className='title'><Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.needsTypeSelected.name}</Text>
</View>
</View>
</View>
</Picker>
</Picker>
</View>
</View>
</View>
<View className='border-box'>
<Text className='require'>*</Text><AtInput
name='value'
title='需求标题:'
type='text'
value={this.state.title}
border={false}
onChange={this.titleChange.bind(this)}
<View className='border-box'>
<Text className='require'>*</Text><AtInput
name='value'
title='需求标题:'
type='text'
value={this.state.title}
border={false}
onChange={this.titleChange.bind(this)}
/>
/>
</View>
<View className='input-box'>
<Text className='require'>*</Text>
<AtInput
name='value'
title='联系人:'
type='text'
value={this.state.contactName}
border={false}
onChange={this.contactNameChange.bind(this)}
/>
</View>
<View className='input-box' style='padding:24rpx 0;font-size:32rpx'>
<View className='title' style='font-weight:bold;'>
<Text style='color:red'>*</Text>
<Text>联系电话</Text>
</View>
<View style='margin-left:5%;'>
<Input name='value'
maxLength='11'
type='number'
value={this.state.contactNumber}
onInput={this.contactNumberChange.bind(this)}
/></View>
</View>
<View className='demanding-box'>
<View className='title-box'>
<Text className='title'>联系地址:</Text>
<View className='input-box'>
<Text className='require'>*</Text>
<AtInput
name='value'
title='联系人:'
type='text'
value={this.state.contactName}
border={false}
onChange={this.contactNameChange.bind(this)}
/>
</View>
<View className='input-box' style='padding:24rpx 0;font-size:32rpx'>
<View className='title' style='font-weight:bold;'>
<Text style='color:red'>*</Text>
<Text>联系电话</Text>
</View>
<View style='margin-left:5%;'>
<Input name='value'
maxLength='11'
type='number'
value={this.state.contactNumber}
onInput={this.contactNumberChange.bind(this)}
/></View>
</View>
<AtTextarea
value={this.state.contactAddress}
onChange={this.contactAddressChange.bind(this)}
maxlength='140'
placeholder='联系地址'
/>
</View>
<View className='demanding-box'>
<View className='title-box'>
<Text className='title'><Text className='require'>*</Text>:</Text>
</View>
<AtTextarea
value={this.state.content}
onChange={this.contentChange.bind(this)}
maxlength='140'
placeholder=''
/>
</View>
<View className='img-box'>
<View className='title-box'>
<Text className='title'>需求图片:</Text>
<View className='warn'>(最多4张)</View>
</View>
<PictureUploadComponent
maxLength={4}
isReceiveImageUrl={true}
initialImageURL={this.state.initialImageURL}
initialImagesInfo={this.state.initialImagesInfo}
url={URL.UploadDSPorductImage}
onGetImageDetails={this.getImageDetails.bind(this)}
/>
<View className='demanding-box'>
<View className='title-box'>
<Text className='title'>联系地址:</Text>
</View>
</View>
<View className='page-section'>
<AtTextarea
value={this.state.contactAddress}
onChange={this.contactAddressChange.bind(this)}
maxlength='140'
placeholder='联系地址'
/>
</View>
<View className='demanding-box'>
<View className='title-box'>
<Text className='title'><Text className='require'>*</Text>:</Text>
</View>
<AtTextarea
value={this.state.content}
onChange={this.contentChange.bind(this)}
maxlength='140'
placeholder=''
/>
</View>
<View className='img-box'>
<View className='title-box'>
<Text className='title'>需求图片:</Text>
<View className='warn'>(最多4张)</View>
</View>
{platformChecker() ? <View className='img-container'>
<AtImagePicker
multiple
showAddBtn={this.state.pickerImageUrl.length < 4}
files={this.state.pickerImageUrl}
onChange={this.onChangeImg.bind(this)}
onFail={this.onFail.bind(this)}
onImageClick={this.onImageClick.bind(this)}
/>
</View> : <AliPictureUploadComponent
maxLength={4}
isReceiveImageUrl={true}
initialImageURL={this.state.initialImageURL}
initialImagesInfo={this.state.initialImagesInfo}
url={URL.UploadDSPorductImage}
onGetImageDetails={this.getImageDetails.bind(this)}
/>}
</View>
<View className='page-section'>
<View>
<Picker mode='selector' rangeKey='name' range={this.state.needsState} onChange={this.needsStateChange.bind(this)}>
<View className='picker'>
<View className='title-box'>
<Text className='title'> <Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.needsStateSelected.name}</Text>
</View>
<View>
<Picker mode='selector' rangeKey='name' range={this.state.needsState} onChange={this.needsStateChange.bind(this)}>
<View className='picker'>
<View className='title-box'>
<Text className='title'> <Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.needsStateSelected.name}</Text>
</View>
</View>
</Picker>
</Picker>
</View>
</View>
</View>
<View className='button-box'>
<View className='button' onClick={this.saveButtonHandler.bind(this)}>
<Button size='mini' className='button-orange'>保存</Button>
</View>
{/* <View className='button' onClick={this.saveAndNewButton.bind(this)}>
<View className='button-box'>
<View className='button' onClick={this.saveButtonHandler.bind(this)}>
<Button size='mini' className='button-orange'>保存</Button>
</View>
{/* <View className='button' onClick={this.saveAndNewButton.bind(this)}>
<Button size='mini' className='button-green'>保存并新增</Button>
</View> */}
<View className='button' onClick={this.goToMyNeedsPage.bind(this)}>
<Button className='button-green' size='mini'>我的需求</Button>
</View>
{/* <View className='button' onClick={this.deleteButtonHandler.bind(this)}>
<View className='button' onClick={this.goToMyNeedsPage.bind(this)}>
<Button className='button-green' size='mini'>我的需求</Button>
</View>
{/* <View className='button' onClick={this.deleteButtonHandler.bind(this)}>
<Button className='button-dark-red' size='mini'>删除</Button>
</View> */}
</View>
<CopyrightComponent></CopyrightComponent>
</View>
<CopyrightComponent></CopyrightComponent>
</View>
)
}

View File

@ -1,8 +1,15 @@
$themeColor:#FF7142;
.supply-demand{
padding: 10px 20px;
padding: 10px ;
.padding-wrapper{
padding-left: 20px;
padding-right: 20px;
}
.InteractionComponent-wrapper{
padding-left: 20px;
padding-right: 20px;
}
.border-box{
border-bottom: 1Px solid #d6e4ef;
display: flex

View File

@ -1,10 +1,11 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Text, Button, Input, Picker } from '@tarojs/components'
import { AtInput, AtTextarea} from 'taro-ui'
import { View, Text, Button, Input, Picker } from '@tarojs/components'
import { AtInput, AtTextarea, AtImagePicker } from 'taro-ui'
import PictureUploadComponent from '../../component/pictureUploadComponent/pictureUploadComponent'
import AliPictureUploadComponent from '../../component/aliPictureUploadComponent/aliPictureUploadComponent'
import AliIndustryTypeInteraction from '../../component/aliIndustryTypeInteraction/aliIndustryTypeInteraction'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import URL from '../../serviceAPI.config'
import InteractionComponent from '../../component/interactionComponent/interactionComponent'
@ -14,7 +15,8 @@ import './myNeedsPublish.scss'
import loginExpired from '../../util/loginExpired';
import { getGlobalStorage } from '../../util/getSetStoage';
import { showLoading } from '../../util/hideShowLoading';
import {isUserLogin} from '../../util/checkLogin';
import { isUserLogin } from '../../util/checkLogin';
import platformChecker from '../../util/plaformChecker';
@ -33,7 +35,7 @@ class MyNeedsPublish extends Component {
needsTypeSelected: { name: '业主需求', id: '4' },
title: '',
contactName: '',
contactNumber: '',
contactNumber: '',
contactAddress: '',
content: '',
pickerImageUrl: [], // 上传的图片
@ -111,7 +113,7 @@ class MyNeedsPublish extends Component {
const resp = { data: { err_msg: res.err_msg } }
loginExpired(resp)
} else {
Taro.showToast({
title: res.err_msg,
icon: 'none',
@ -200,7 +202,7 @@ class MyNeedsPublish extends Component {
contentChange(event) {
this.setState({ content: event.target.value })
}
// 从图片子组件获取信息
// 从图片子组件获取信息
getImageDetails(value) {
this.setState({
@ -267,8 +269,8 @@ class MyNeedsPublish extends Component {
componentDidMount() {
this.setState({
contactName: getGlobalStorage('user_identity')?getGlobalStorage('user_identity').username : '',
contactNumber: getGlobalStorage('user_identity')?getGlobalStorage('user_identity').userphone : '',
contactName: getGlobalStorage('user_identity') ? getGlobalStorage('user_identity').username : '',
contactNumber: getGlobalStorage('user_identity') ? getGlobalStorage('user_identity').userphone : '',
})
// console.log('this.$router.params.sdId',this.$router.params.sdId)
// Taro.showLoading({title:'加载中'})
@ -296,135 +298,137 @@ class MyNeedsPublish extends Component {
<View className='supply-demand'>
{/* 行业分类 */}
<InteractionComponent url={URL.GetIndustryTypeList}
{/* 需求类型 */}
{platformChecker() ? <View className='InteractionComponent-wrapper'><InteractionComponent url={URL.GetIndustryTypeList}
onPassDataToChild={this.getDataFromChild.bind(this)}
selectedValue={this.state.industryTypeSelected}
></InteractionComponent>
{/* 需求类型 */}
<View className='page-section'>
></InteractionComponent></View> : <AliIndustryTypeInteraction url={URL.GetIndustryTypeList}
onPassDataToChild={this.getDataFromChild.bind(this)}
selectedValue={this.state.industryTypeSelected} />}
<View className='padding-wrapper'> <View className='page-section'>
<View>
<Picker mode='selector' rangeKey='name' range={this.state.needsType} onChange={this.needsTypeHandler.bind(this)}>
<View className='picker'>
<View className='title-box'>
<Text className='title'>需求类型:</Text> <Text className='selected'>{this.state.needsTypeSelected.name}</Text>
</View>
</View>
</Picker>
</View>
</View>
<View className='border-box'>
<Text className='require'>*</Text>
<AtInput
name='value'
title='需求标题:'
type='text'
value={this.state.title}
border={false}
onChange={this.titleChange.bind(this)}
<View className='border-box'>
<Text className='require'>*</Text>
<AtInput
name='value'
title='需求标题:'
type='text'
value={this.state.title}
border={false}
onChange={this.titleChange.bind(this)}
/>
</View>
<View className='input-box'>
<Text className='require'>*</Text>
<AtInput
name='value'
title='联系人:'
type='text'
value={this.state.contactName}
border={false}
onChange={this.contactNameChange.bind(this)}
/>
</View>
<View className='input-box' style='padding:24rpx 0;font-size:32rpx'>
<View className='title' style='font-weight:bold;'>
<Text style='color:red'>*</Text>
<Text>联系电话</Text>
</View>
<View style='margin-left:5%;'>
<Input name='value'
maxLength='11'
type='number'
value={this.state.contactNumber}
onInput={this.contactNumberChange.bind(this)}
/></View>
</View>
<View className='demanding-box'>
<View className='title-box'>
<Text className='title'>联系地址:</Text>
</View>
<AtTextarea
value={this.state.contactAddress}
onChange={this.contactAddressChange.bind(this)}
maxlength='140'
placeholder='联系地址'
/>
</View>
<View className='demanding-box'>
<View className='title-box'>
<Text className='title'><Text className='require'>*</Text>:</Text>
</View>
<AtTextarea
value={this.state.content}
onChange={this.contentChange.bind(this)}
maxlength='140'
placeholder=''
/>
</View>
<View className='img-box'>
<View className='title-box'>
<Text className='title'>需求图片:</Text>
<View className='warn'>(最多4张)</View>
</View>
<PictureUploadComponent maxLength={4} isReceiveImageUrl={false} url={URL.UploadDSPorductImage} onGetImageDetails={this.getImageDetails.bind(this)} />
{/* 微信使用 */}
{/* <View className='img-container'>
<AtImagePicker
multiple
showAddBtn={this.state.pickerImageUrl.length < 4}
files={this.state.pickerImageUrl}
onChange={this.onChangeImg.bind(this)}
onFail={this.onFail.bind(this)}
onImageClick={this.onImageClick.bind(this)}
/>
</View> */}
</View>
<View className='input-box'>
<Text className='require'>*</Text>
<AtInput
name='value'
title='联系人:'
type='text'
value={this.state.contactName}
border={false}
onChange={this.contactNameChange.bind(this)}
/>
</View>
<View className='input-box' style='padding:24rpx 0;font-size:32rpx'>
<View className='title' style='font-weight:bold;'>
<Text style='color:red'>*</Text>
<Text>联系电话</Text>
</View>
<View style='margin-left:5%;'>
<Input name='value'
maxLength='11'
type='number'
value={this.state.contactNumber}
onInput={this.contactNumberChange.bind(this)}
/></View>
</View>
</View>
<View className='page-section'>
<View className='demanding-box'>
<View className='title-box'>
<Text className='title'>联系地址:</Text>
</View>
<AtTextarea
value={this.state.contactAddress}
onChange={this.contactAddressChange.bind(this)}
maxlength='140'
placeholder='联系地址'
/>
</View>
<View className='demanding-box'>
<View className='title-box'>
<Text className='title'><Text className='require'>*</Text>:</Text>
</View>
<AtTextarea
value={this.state.content}
onChange={this.contentChange.bind(this)}
maxlength='140'
placeholder=''
/>
</View>
<View className='img-box'>
<View className='title-box'>
<Text className='title'>需求图片:</Text>
<View className='warn'>(最多4张)</View>
</View>
{platformChecker() ? <View className='img-container'>
<AtImagePicker
multiple
showAddBtn={this.state.pickerImageUrl.length < 4}
files={this.state.pickerImageUrl}
onChange={this.onChangeImg.bind(this)}
onFail={this.onFail.bind(this)}
onImageClick={this.onImageClick.bind(this)}
/>
</View> : <AliPictureUploadComponent maxLength={4} isReceiveImageUrl={false} url={URL.UploadDSPorductImage} onGetImageDetails={this.getImageDetails.bind(this)} />
}
</View>
<View className='page-section'>
<View>
<Picker mode='selector' rangeKey='name' range={this.state.needsState} onChange={this.needsStateHandler}>
<View className='picker'>
<View className='title-box'>
<Text className='title'> <Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.needsStateSelected.name}</Text>
</View>
<View>
<Picker mode='selector' rangeKey='name' range={this.state.needsState} onChange={this.needsStateHandler}>
<View className='picker'>
<View className='title-box'>
<Text className='title'> <Text className='require'>*</Text>:</Text> <Text className='selected'>{this.state.needsStateSelected.name}</Text>
</View>
</View>
</Picker>
</Picker>
</View>
</View>
<View className='button-box'>
<View className='button' onClick={this.publishButtonHandler.bind(this)}>
<Button size='mini' className='button-orange' >发布</Button>
</View>
<View className='button' onClick={this.publishAndNewButton.bind(this)}>
<Button className='button-green' size='mini' >发布并新增</Button>
</View>
<View className='button' onClick={this.goToMyNeedsPage.bind(this)}>
<Button className='button-green' size='mini' >我的需求</Button>
</View>
</View>
<CopyrightComponent></CopyrightComponent>
</View>
<View className='button-box'>
<View className='button' onClick={this.publishButtonHandler.bind(this)}>
<Button size='mini' className='button-orange' >发布</Button>
</View>
<View className='button' onClick={this.publishAndNewButton.bind(this)}>
<Button className='button-green' size='mini' >发布并新增</Button>
</View>
<View className='button' onClick={this.goToMyNeedsPage.bind(this)}>
<Button className='button-green' size='mini' >我的需求</Button>
</View>
</View>
<CopyrightComponent></CopyrightComponent>
</View>
)
}

View File

@ -1,8 +1,15 @@
$themeColor:#FF7142;
.supply-demand{
padding: 10px 20px;
padding: 10px ;
.padding-wrapper{
padding-left: 20px;
padding-right: 20px;
}
.InteractionComponent-wrapper{
padding-left: 20px;
padding-right: 20px;
}
.border-box{
border-bottom: 1Px solid #d6e4ef;
display: flex

View File

@ -1,11 +1,11 @@
import Taro, { Component } from '@tarojs/taro'
import { View, Text, Button, Input , Picker} from '@tarojs/components'
import { View, Text, Button, Input, Picker } from '@tarojs/components'
import { AtInput, AtImagePicker, AtTextarea } from 'taro-ui'
import CopyrightComponent from '../../component/copyrightComponent/copyrightComponent'
import PictureUploadComponent from '../../component/pictureUploadComponent/pictureUploadComponent'
import AliPictureUploadComponent from '../../component/aliPictureUploadComponent/aliPictureUploadComponent'
import LoginService from '../../util/LoginService'
import URL from '../../serviceAPI.config'
import './supplyDemandPublish.scss'
@ -13,6 +13,7 @@ import loginExpired from '../../util/loginExpired';
import { getGlobalStorage } from '../../util/getSetStoage';
import { showLoading } from '../../util/hideShowLoading';
import { isUserShopOwner } from '../../util/checkLogin';
import platformChecker from '../../util/plaformChecker';
class SupplyDemand extends Component {
config = {
@ -26,7 +27,7 @@ class SupplyDemand extends Component {
demandingSupplyState: [{ name: '上架', id: '1' }, { name: '下架', id: '0' }], // 状态选择
demandingSupplyStateSelected: { name: '上架', id: '1' },// 当前状态
title: '',
contactName:'',
contactName: '',
contactNumber: '',
contactAddress: '',
content: '',
@ -169,7 +170,7 @@ class SupplyDemand extends Component {
})
}
}
// 从图片子组件获取信息
// 从图片子组件获取信息
getImageDetails(value) {
this.setState({
ImagesInfo: value
@ -259,10 +260,10 @@ class SupplyDemand extends Component {
}
componentDidMount() {
this.setState({
contactName: getGlobalStorage('user_identity').username || '',
contactNumber: getGlobalStorage('user_identity').userphone || '',
})
this.setState({
contactName: getGlobalStorage('user_identity').username || '',
contactNumber: getGlobalStorage('user_identity').userphone || '',
})
}
componentWillReceiveProps(nextProps) {
// console.log(this.props, nextProps)
@ -356,9 +357,7 @@ this.setState({
<Text className='title'>需求图片:</Text>
<View className='warn'>(最多4张)</View>
</View>
<PictureUploadComponent maxLength={4} isReceiveImageUrl={false} url={URL.UploadDSPorductImage} onGetImageDetails={this.getImageDetails.bind(this)} />
{/* <View className='img-container'>
{platformChecker() ? <View className='img-container'>
<AtImagePicker
multiple
showAddBtn={this.state.pickerImageUrl.length < 4}
@ -367,7 +366,9 @@ this.setState({
onFail={this.onFail.bind(this)}
onImageClick={this.onImageClick.bind(this)}
/>
</View> */}
</View> : <AliPictureUploadComponent maxLength={4} isReceiveImageUrl={false} url={URL.UploadDSPorductImage} onGetImageDetails={this.getImageDetails.bind(this)} />
}
</View>
<View className='page-section'>

View File

@ -1,6 +1,6 @@
const LOCALURL = "http://192.168.1.230/"
// const LOCALURL = "https://www.ihome6.com/"
// const LOCALURL = "https://www.ihome6.com/"
const URL = {
Base: LOCALURL,

View File

@ -3,10 +3,7 @@ import Taro from '@tarojs/taro'
const setGlobalStorage = (key, value) => {
if (process.env.TARO_ENV === 'weapp') {
Taro.setStorageSync({
key: key,
data: value
})
Taro.setStorageSync(key, value)
} else if (process.env.TARO_ENV === 'alipay') {
my.setStorageSync({
@ -18,19 +15,20 @@ const setGlobalStorage = (key, value) => {
const getGlobalStorage = (key) => {
if (process.env.TARO_ENV === 'weapp') {
getGlobalStorage(key)
return Taro.getStorageSync(key)
} else if (process.env.TARO_ENV === 'alipay') {
let res = my.getStorageSync({
key: key,
})
if (res.data||res.APDataStorage) {
return res.data||res.APDataStorage
if (res.data || res.APDataStorage) {
return res.data || res.APDataStorage
} else {
return
}
}
}
export { setGlobalStorage, getGlobalStorage }

View File

@ -0,0 +1,8 @@
const platformChecker=()=>{
if(process.env.TARO_ENV==='weapp'||process.env.TARO_ENV==='h5'||process.env.TARO_ENV==='rn'){
return true
}else if(process.env.TARO_ENV==='alipay'){
return false
}
}
export default platformChecker