weapp测试结束

This commit is contained in:
郑茂强 2019-03-26 14:44:41 +08:00
parent 636304af73
commit 870fc47323
11 changed files with 98 additions and 58 deletions

View File

@ -8,16 +8,9 @@ module.exports = {
h5: { h5: {
esnextModules: ['taro-ui'], esnextModules: ['taro-ui'],
// devServer: { devServer:{
// proxy: { host: "192.168.1.120",
// '/api': 'http://192.168.1.230/Shop-ajaxStore', port:80
// changeOrigin: true, }
// headers: {
// // 后端要校验请求源,那改下 host 或者 origin 不就美滋滋了?
// Host: '192.168.1.230',
// Origin: '192.168.1.230'
// }
// }
// }
} }
} }

View File

@ -113,7 +113,7 @@ class GoodsPublish extends Component {
if (this.state.isPublish) { if (this.state.isPublish) {
// 导航到编辑页面 // 导航到编辑页面
Taro.redirectTo({ Taro.redirectTo({
url: '/pages/myGoodsList/myGoodsList' url: '/pages/myGoodList/myGoodList'
}) })
} else if (this.state.isPublishAndAdd) { } else if (this.state.isPublishAndAdd) {
// 导航到发布页面 // 导航到发布页面
@ -299,6 +299,7 @@ class GoodsPublish extends Component {
} }
} }
componentDidMount() { componentDidMount() {
} }
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
// console.log(this.props, nextProps) // console.log(this.props, nextProps)

View File

@ -17,6 +17,8 @@ $themeColor: #FF7142;
} }
} }
.item-title{ .item-title{
padding-left: 10px;
padding-right: 10px;
font-size: 40px; font-size: 40px;
min-height: 21px; min-height: 21px;
clear: both; clear: both;

View File

@ -1,45 +1,40 @@
import Taro, { Component } from '@tarojs/taro' import Taro, { Component } from '@tarojs/taro'
import { View , Swiper, SwiperItem} from '@tarojs/components' import { View, ScrollView } from '@tarojs/components'
import { AtGrid } from 'taro-ui'
import URL from '../../../serviceAPI.config'
import './subCateSlider.scss' import './subCateSlider.scss'
class SubCateSlider extends Component { class SubCateSlider extends Component {
passDataToParent(e) {
this.props.onClickChildCate(e)
}
passDataToParent(e) { render() {
const { subCateList } = this.props
const subCateElementsArray = subCateList.map((item, index) => {
return <View key={index} onClick={this.passDataToParent.bind(this, item)} className='view-item'>
<View className='text'>{item.class_name}</View>
</View>
})
this.props.onClickChildCate(e) return (
}
render() { <ScrollView
const { subCateList } = this.props className='scroll-view'
const subCateElementsArray = subCateList.map((item, index) => { scrollX
return <View key={index} onClick={this.passDataToParent.bind(this, item)} className='view-item'> scrollWithAnimation
<View className='text'>{item.class_name}</View> scrollTop='0'
</View> lowerThreshold='20'
}) upperThreshold='20'
style='white-space: nowrap;'
>
return ( {subCateElementsArray}
<ScrollView </ScrollView>
className='scroll-view' )
scrollX }
scrollWithAnimation
scrollTop='0'
lowerThreshold='20'
upperThreshold='20'
style='white-space: nowrap;'
>
{subCateElementsArray}
</ScrollView>
)
}
} }
export default SubCateSlider export default SubCateSlider

View File

@ -2,10 +2,12 @@
height:100%; height:100%;
padding:0px 0px; padding:0px 0px;
.view-item{ .view-item{
font-size: 25px;
width:150px; width:150px;
display:inline-block; display:inline-block;
text-align:center; text-align:center;
padding-bottom: 10px; padding-bottom: 10px;
border-bottom:2px solid #F2F2F2; border-bottom:2px solid #F2F2F2;
} }
} }

View File

@ -110,7 +110,7 @@ class MyNeedsEdit extends Component {
needsStateSelected: needsState, needsStateSelected: needsState,
initialImageURL: imageFile, initialImageURL: imageFile,
initialImagesInfo: res.data.sdInfo.file_path, initialImagesInfo: res.data.sdInfo.file_path,
ImageURL: imageFile, pickerImageUrl: imageFile,
ImagesInfo: res.data.sdInfo.file_path, ImagesInfo: res.data.sdInfo.file_path,
}) })
@ -301,6 +301,51 @@ class MyNeedsEdit extends Component {
}) })
} }
} }
// 上传图片
onChangeImg(files, operationType, index) {
const that = this
if (operationType === 'add') {
Taro.uploadFile({
url: URL.UploadDSPorductImage,
filePath: files[files.length - 1].url,
name: 'file',
header: {
'content-type': 'multipart/form-data',
'Cookie': 'PFWSSS=' + getGlobalStorage('session_id'),
'X-Requested-With': 'XMLHttpRequest'
},
success(response) {
const data = JSON.parse(response.data)
const imagePath = URL.Base + data.file_path
const newPickerImageUrl = that.state.pickerImageUrl.concat({ url: imagePath })
const newImageInfo = that.state.ImagesInfo.concat(data)
that.setState({
pickerImageUrl: newPickerImageUrl,
ImagesInfo: newImageInfo
})
Taro.showToast({
title: '上传成功',
icon: 'success',
duration: 1500
})
}
})
}
if (operationType === 'remove') {
this.state.ImagesInfo.splice(index, 1) // 删除显示的图片
this.state.pickerImageUrl.splice(index, 1)// 删除图片param
that.setState({
pockerImageUrl: this.state.pickerImageUrl,
ImagesInfo: this.state.ImagesInfo,
})
Taro.showToast({
title: '删除成功',
icon: 'success',
duration: 1500
})
}
}
// 从图片子组件获取信息 // 从图片子组件获取信息
getImageDetails(value) { getImageDetails(value) {
this.setState({ this.setState({

View File

@ -147,6 +147,7 @@ class MySupplyDemand extends Component {
Taro.showToast({ Taro.showToast({
title: '删除成功' title: '删除成功'
}).then(() => { }).then(() => {
Taro.showLoading()
this.getMySupplyDemand({}) this.getMySupplyDemand({})
}) })
@ -478,8 +479,10 @@ class MySupplyDemand extends Component {
<CopyrightComponent></CopyrightComponent> <CopyrightComponent></CopyrightComponent>
</View> </View>
<MovableView className='movable-point' x={this.state.screenWidth} y={this.state.screenHeight} style='opacity:0.3' direction='all' > <MovableView className='movable-point' x={this.state.screenWidth} y={this.state.screenHeight} style='opacity:0.3' direction='all' >
<View onClick={this.goToCenterPage.bind(this)}> 个人中心</View> <View className='movable-point' onClick={this.goToCenterPage.bind(this)}> 个人中心</View>
</MovableView> </MovableView>
</MovableArea> </MovableArea>

View File

@ -86,7 +86,6 @@ class SupplyDemand extends Component {
icon: res.data.err_msg == 'success' ? 'success' : 'none', icon: res.data.err_msg == 'success' ? 'success' : 'none',
duration: 1000 duration: 1000
}).then(() => { }).then(() => {
console.log('this.state.isPublishAndNew', this.state.isPublishAndNew)
setTimeout(() => { setTimeout(() => {
if (this.state.isPublishAndNew) { if (this.state.isPublishAndNew) {
Taro.navigateTo({ Taro.navigateTo({

View File

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