From 870fc47323ce2bfe2903d433307241b2d9af7c36 Mon Sep 17 00:00:00 2001 From: Maoqiang Zheng Date: Tue, 26 Mar 2019 14:44:41 +0800 Subject: [PATCH] =?UTF-8?q?weapp=E6=B5=8B=E8=AF=95=E7=BB=93=E6=9D=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/dev.js | 15 ++--- src/app.js | 2 +- .../aliGoodsTypeInteraction.js | 2 +- src/pages/goodsPublish/goodsPublish.js | 3 +- .../home/clientDemanding/clientDemanding.scss | 8 ++- src/pages/home/subCateSlider/subCateSlider.js | 55 ++++++++---------- .../home/subCateSlider/subCateSlider.scss | 4 +- src/pages/myNeedsEdit/myNeedsEdit.js | 57 +++++++++++++++++-- src/pages/mySupplyDemand/mySupplyDemand.js | 5 +- .../supplyDemandPublish.js | 1 - src/serviceAPI.config.js | 4 +- 11 files changed, 98 insertions(+), 58 deletions(-) diff --git a/config/dev.js b/config/dev.js index d73844b..6536a8e 100644 --- a/config/dev.js +++ b/config/dev.js @@ -8,16 +8,9 @@ module.exports = { h5: { esnextModules: ['taro-ui'], - // devServer: { - // proxy: { - // '/api': 'http://192.168.1.230/Shop-ajaxStore', - // changeOrigin: true, - // headers: { - // // 后端要校验请求源,那改下 host 或者 origin 不就美滋滋了? - // Host: '192.168.1.230', - // Origin: '192.168.1.230' - // } - // } - // } + devServer:{ + host: "192.168.1.120", + port:80 + } } } \ No newline at end of file diff --git a/src/app.js b/src/app.js index b36edba..24a8e99 100644 --- a/src/app.js +++ b/src/app.js @@ -19,7 +19,7 @@ class App extends Component { config = { pages: [ - //'pages/index/index', // index页面 + //'pages/index/index', // index页面 'pages/home/home',//首页 --------------------- 'pages/login/login',//登入页面 --------------------- diff --git a/src/component/aliGoodsTypeInteraction/aliGoodsTypeInteraction.js b/src/component/aliGoodsTypeInteraction/aliGoodsTypeInteraction.js index 0e94ff5..7b36f27 100644 --- a/src/component/aliGoodsTypeInteraction/aliGoodsTypeInteraction.js +++ b/src/component/aliGoodsTypeInteraction/aliGoodsTypeInteraction.js @@ -47,7 +47,7 @@ class AliGoodsTypeInteraction extends Component { maxDepth = 0 initialDataArray = [] - this.recursionInitialized(res.data.data) // + this.recursionInitialized(res.data.data) // const depthInArray = this.recursionDepth(res.data.data) console.log('depthInArray', depthInArray) console.log('initialDataArray', initialDataArray) diff --git a/src/pages/goodsPublish/goodsPublish.js b/src/pages/goodsPublish/goodsPublish.js index 3f297c0..ecc755d 100644 --- a/src/pages/goodsPublish/goodsPublish.js +++ b/src/pages/goodsPublish/goodsPublish.js @@ -113,7 +113,7 @@ class GoodsPublish extends Component { if (this.state.isPublish) { // 导航到编辑页面 Taro.redirectTo({ - url: '/pages/myGoodsList/myGoodsList' + url: '/pages/myGoodList/myGoodList' }) } else if (this.state.isPublishAndAdd) { // 导航到发布页面 @@ -299,6 +299,7 @@ class GoodsPublish extends Component { } } componentDidMount() { + } componentWillReceiveProps(nextProps) { // console.log(this.props, nextProps) diff --git a/src/pages/home/clientDemanding/clientDemanding.scss b/src/pages/home/clientDemanding/clientDemanding.scss index ca8dd40..079ac91 100644 --- a/src/pages/home/clientDemanding/clientDemanding.scss +++ b/src/pages/home/clientDemanding/clientDemanding.scss @@ -17,6 +17,8 @@ $themeColor: #FF7142; } } .item-title{ + padding-left: 10px; + padding-right: 10px; font-size: 40px; min-height: 21px; clear: both; @@ -39,7 +41,7 @@ $themeColor: #FF7142; text-overflow: ellipsis; white-space: nowrap; } - + .button-orange{ color:white; font-size: 28px; @@ -49,9 +51,9 @@ $themeColor: #FF7142; .blur{ opacity: 0.5; } - + } .last{ border-right: 2px solid #ddd; -} \ No newline at end of file +} diff --git a/src/pages/home/subCateSlider/subCateSlider.js b/src/pages/home/subCateSlider/subCateSlider.js index 051ce75..f76e276 100644 --- a/src/pages/home/subCateSlider/subCateSlider.js +++ b/src/pages/home/subCateSlider/subCateSlider.js @@ -1,45 +1,40 @@ import Taro, { Component } from '@tarojs/taro' -import { View , Swiper, SwiperItem} from '@tarojs/components' -import { AtGrid } from 'taro-ui' -import URL from '../../../serviceAPI.config' +import { View, ScrollView } from '@tarojs/components' import './subCateSlider.scss' class SubCateSlider extends Component { + passDataToParent(e) { + this.props.onClickChildCate(e) + } - passDataToParent(e) { + render() { + const { subCateList } = this.props + const subCateElementsArray = subCateList.map((item, index) => { + return + {item.class_name} + + }) - this.props.onClickChildCate(e) - } + return ( - render() { - const { subCateList } = this.props - const subCateElementsArray = subCateList.map((item, index) => { - return - {item.class_name} - - }) + - return ( + {subCateElementsArray} - - className='scroll-view' - scrollX - scrollWithAnimation - scrollTop='0' - lowerThreshold='20' - upperThreshold='20' - style='white-space: nowrap;' - > - - {subCateElementsArray} - - - - ) - } + ) + } } export default SubCateSlider diff --git a/src/pages/home/subCateSlider/subCateSlider.scss b/src/pages/home/subCateSlider/subCateSlider.scss index 72031e3..f8eb75a 100644 --- a/src/pages/home/subCateSlider/subCateSlider.scss +++ b/src/pages/home/subCateSlider/subCateSlider.scss @@ -2,10 +2,12 @@ height:100%; padding:0px 0px; .view-item{ + font-size: 25px; width:150px; display:inline-block; text-align:center; padding-bottom: 10px; border-bottom:2px solid #F2F2F2; + } -} \ No newline at end of file +} diff --git a/src/pages/myNeedsEdit/myNeedsEdit.js b/src/pages/myNeedsEdit/myNeedsEdit.js index f848e65..80f0d43 100644 --- a/src/pages/myNeedsEdit/myNeedsEdit.js +++ b/src/pages/myNeedsEdit/myNeedsEdit.js @@ -47,7 +47,7 @@ class MyNeedsEdit extends Component { } } - //获取需求信息api + //获取需求信息api getMyNeedEditInfo() { let id = decodeURIComponent(this.$router.params.id) Taro.request({ @@ -110,7 +110,7 @@ class MyNeedsEdit extends Component { needsStateSelected: needsState, initialImageURL: imageFile, initialImagesInfo: res.data.sdInfo.file_path, - ImageURL: imageFile, + pickerImageUrl: imageFile, 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) { this.setState({ @@ -373,12 +418,12 @@ class MyNeedsEdit extends Component { {deleteModalWindowElement} {/* 行业分类 */} - {platformChecker() ? + {platformChecker() ? : } {/* 需求类型 */} - + @@ -463,7 +508,7 @@ class MyNeedsEdit extends Component { placeholder="" maxlength='140' /> } - + @@ -522,7 +567,7 @@ class MyNeedsEdit extends Component { - + ) } } diff --git a/src/pages/mySupplyDemand/mySupplyDemand.js b/src/pages/mySupplyDemand/mySupplyDemand.js index 18b90d9..7963f71 100644 --- a/src/pages/mySupplyDemand/mySupplyDemand.js +++ b/src/pages/mySupplyDemand/mySupplyDemand.js @@ -147,6 +147,7 @@ class MySupplyDemand extends Component { Taro.showToast({ title: '删除成功' }).then(() => { + Taro.showLoading() this.getMySupplyDemand({}) }) @@ -478,8 +479,10 @@ class MySupplyDemand extends Component { + + - 个人中心 + 个人中心 diff --git a/src/pages/supplyDemandPublish/supplyDemandPublish.js b/src/pages/supplyDemandPublish/supplyDemandPublish.js index 2ccb3ed..752323d 100644 --- a/src/pages/supplyDemandPublish/supplyDemandPublish.js +++ b/src/pages/supplyDemandPublish/supplyDemandPublish.js @@ -86,7 +86,6 @@ class SupplyDemand extends Component { icon: res.data.err_msg == 'success' ? 'success' : 'none', duration: 1000 }).then(() => { - console.log('this.state.isPublishAndNew', this.state.isPublishAndNew) setTimeout(() => { if (this.state.isPublishAndNew) { Taro.navigateTo({ diff --git a/src/serviceAPI.config.js b/src/serviceAPI.config.js index accec71..92db2f8 100644 --- a/src/serviceAPI.config.js +++ b/src/serviceAPI.config.js @@ -1,6 +1,6 @@ - //const LOCALURL = "http://192.168.1.230/" - const LOCALURL = "https://www.ihome6.com/" + const LOCALURL = "http://192.168.1.230/" + //const LOCALURL = "https://www.ihome6.com/" const URL = { Base: LOCALURL,