diff --git a/config/dev.js b/config/dev.js index 0377634..f982e9a 100644 --- a/config/dev.js +++ b/config/dev.js @@ -5,5 +5,6 @@ module.exports = { defineConstants: { }, weapp: {}, + h5: {} } diff --git a/config/index.js b/config/index.js index bd8e041..d103a22 100644 --- a/config/index.js +++ b/config/index.js @@ -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) { diff --git a/src/app.scss b/src/app.scss index 364745c..5681042 100644 --- a/src/app.scss +++ b/src/app.scss @@ -66,4 +66,7 @@ page{ text-align: center; font-size: 25rpx; +} +.ali-blue-color{ + color: #108ee9; } \ No newline at end of file diff --git a/src/component/AliShopTypeInteraction/AliShopTypeInteraction.js b/src/component/AliShopTypeInteraction/AliShopTypeInteraction.js index 57e6052..ed45d28 100644 --- a/src/component/AliShopTypeInteraction/AliShopTypeInteraction.js +++ b/src/component/AliShopTypeInteraction/AliShopTypeInteraction.js @@ -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 { 取消 - 确定 + 确定 diff --git a/src/component/AliShopTypeInteraction/AliShopTypeInteraction.scss b/src/component/AliShopTypeInteraction/AliShopTypeInteraction.scss index a59865d..d401d96 100644 --- a/src/component/AliShopTypeInteraction/AliShopTypeInteraction.scss +++ b/src/component/AliShopTypeInteraction/AliShopTypeInteraction.scss @@ -77,7 +77,6 @@ } .confirm-button{ flex:1; - color:#FF7142; text-align: right; } } diff --git a/src/component/aliIndustryTypeInteraction/aliIndustryTypeInteraction.js b/src/component/aliIndustryTypeInteraction/aliIndustryTypeInteraction.js new file mode 100644 index 0000000..ad24226 --- /dev/null +++ b/src/component/aliIndustryTypeInteraction/aliIndustryTypeInteraction.js @@ -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 ( + + + + + + + {this.state.AliIsShowPicker ? + + + + + 取消 + 确定 + + + + {this.state.interactionMultiArray.map((item, index) => { + return {item.name} + })} + + + {this.state.interactionMultiArray[this.state.multiIndex[0]].children.map((item, index) => { + return {item.name} + })} + + + + : null} + + + + ) + } +} + +export default AliIndustryTypeInteraction + diff --git a/src/component/aliIndustryTypeInteraction/aliIndustryTypeInteraction.scss b/src/component/aliIndustryTypeInteraction/aliIndustryTypeInteraction.scss new file mode 100644 index 0000000..061d03a --- /dev/null +++ b/src/component/aliIndustryTypeInteraction/aliIndustryTypeInteraction.scss @@ -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; + } + } diff --git a/src/component/pictureUploadComponent/pictureUploadComponent.js b/src/component/aliPictureUploadComponent/aliPictureUploadComponent.js similarity index 96% rename from src/component/pictureUploadComponent/pictureUploadComponent.js rename to src/component/aliPictureUploadComponent/aliPictureUploadComponent.js index 7515da4..a0fb240 100644 --- a/src/component/pictureUploadComponent/pictureUploadComponent.js +++ b/src/component/aliPictureUploadComponent/aliPictureUploadComponent.js @@ -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 @@ -166,7 +161,6 @@ class PictureUploadComponent extends Component { /> }) - return ( {this.state.imageURL.length < maxLength ? : null} < View className='image-container' > {imageElementArray} diff --git a/src/component/pictureUploadComponent/pictureUploadComponent.scss b/src/component/aliPictureUploadComponent/aliPictureUploadComponent.scss similarity index 100% rename from src/component/pictureUploadComponent/pictureUploadComponent.scss rename to src/component/aliPictureUploadComponent/aliPictureUploadComponent.scss diff --git a/src/component/shopTypeInteractionComp/shopTypeInteractionComp.js b/src/component/shopTypeInteractionComp/shopTypeInteractionComp.js index 3dc7253..20ff36b 100644 --- a/src/component/shopTypeInteractionComp/shopTypeInteractionComp.js +++ b/src/component/shopTypeInteractionComp/shopTypeInteractionComp.js @@ -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) diff --git a/src/pages/goods/aliGoodCommentSection/aliGoodCommentSection.js b/src/pages/goods/aliGoodCommentSection/aliGoodCommentSection.js new file mode 100644 index 0000000..52821e1 --- /dev/null +++ b/src/pages/goods/aliGoodCommentSection/aliGoodCommentSection.js @@ -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 + {item.title} + + }) + const subTabArrayElement = subTabList.map((item, index) => { + return + {item.title} + + }) + const itemDescriptionPicsElementArray = productImagesUrl.map((item, index) => { + return + + + + }) + return ( + + + + {tabArrayElement} + + + {mainActived === 0 && + + 商品细节: + + {itemDescriptionPicsElementArray} + + + + + } + {mainActived === 1 && + {subTabArrayElement} + + + { + subActived === 0 && 全部 + } + { + subActived === 1 && 好评 + } + { + subActived === 2 && 中评 + } + { + subActived === 3 && 差评 + } + { + subActived === 4 && 公开 + } + { + subActived === 5 && 匿名 + } + + + + + } + {mainActived === 2 && 标签页三的内容} + + + + + ) + } +} + +export default AliGoodCommentSection diff --git a/src/pages/goods/aliGoodCommentSection/aliGoodCommentSection.scss b/src/pages/goods/aliGoodCommentSection/aliGoodCommentSection.scss new file mode 100644 index 0000000..ccf4169 --- /dev/null +++ b/src/pages/goods/aliGoodCommentSection/aliGoodCommentSection.scss @@ -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%; + } + +} \ No newline at end of file diff --git a/src/pages/goods/goodCommentSection/goodCommentSection.js b/src/pages/goods/goodCommentSection/goodCommentSection.js new file mode 100644 index 0000000..f8a0af5 --- /dev/null +++ b/src/pages/goods/goodCommentSection/goodCommentSection.js @@ -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 +//productImagesUrl,current,subCurrent,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 + + + + }) + return ( + + + {/* 大类 */} + + + + + 商品细节: + + {itemDescriptionPicsElementArray} + + + + + + + + { /*子标签类*/} + + { + this.state.subCurrent === 0 + ? + 全部 + + : null + } + { + this.state.subCurrent === 1 + ? 好评 + : null + } + { + this.state.subCurrent === 2 + ? 中评 + : null + } + { + this.state.subCurrent === 3 + ? 差评 + : null + } + { + this.state.subCurrent === 4 + ? 公开 + : null + } + { + this.state.subCurrent === 5 + ? 匿名 + : null + } + + + + + 标签页三的内容 + + + + + + ) + } +} + +export default GoodCommentSection diff --git a/src/pages/goods/goodCommentSection/goodCommentSection.scss b/src/pages/goods/goodCommentSection/goodCommentSection.scss new file mode 100644 index 0000000..d7bb1f3 --- /dev/null +++ b/src/pages/goods/goodCommentSection/goodCommentSection.scss @@ -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; + } + +} diff --git a/src/pages/goods/goods.js b/src/pages/goods/goods.js index be90ee7..142cb30 100644 --- a/src/pages/goods/goods.js +++ b/src/pages/goods/goods.js @@ -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 - {item.title} - - }) - const subTabArrayElement = subTabList.map((item, index) => { - return - {item.title} - - }) + // const subTabList = [{ title: '全部' }, { title: '好评' }, { title: '差评' }, { title: '公开' }, { title: '匿名' }] @@ -189,25 +179,19 @@ class Goods extends Component { }) - const itemDescriptionPicsElementArray = this.state.productImagesUrl.map((item, index) => { - return - - - - }) return ( {/* */} {itemPicsBannerElementArray} @@ -273,54 +257,20 @@ class Goods extends Component { {/* 详情和评论区 */} - - - {tabArrayElement} - - - - {actived === 0 && - - 商品细节: - - {itemDescriptionPicsElementArray} - - - - - } - {actived===1&& - {subTabArrayElement} - - - { - subActived===0&&全部 - } - { - subActived===1&&好评 - } - { - subActived===2&&中评 - } - { - subActived===3&&差评 - } - { - subActived===4&&公开 - } - { - subActived===5&&匿名 - } - - - - - } - {actived === 2 && 标签页三的内容} - - - + {platformChecker() ? : } diff --git a/src/pages/goods/goods.scss b/src/pages/goods/goods.scss index ce5c924..0d2cdf7 100644 --- a/src/pages/goods/goods.scss +++ b/src/pages/goods/goods.scss @@ -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%; - } - - } \ No newline at end of file diff --git a/src/pages/goodsPublish/goodsPublish.js b/src/pages/goodsPublish/goodsPublish.js index 7f1958d..6ce2ac3 100644 --- a/src/pages/goodsPublish/goodsPublish.js +++ b/src/pages/goodsPublish/goodsPublish.js @@ -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 { * 上传图片: - - - {/* + {platformChecker() ? - */} + : + } + {/* 店铺分类 */} - {process.env.TARO_ENV === 'weapp' ? : + + + : { 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 { 需求图片: (最多4张) - - {/* + {platformChecker() ? - */} - + : } diff --git a/src/pages/myGoodList/myGoodList.js b/src/pages/myGoodList/myGoodList.js index 3dab597..cbdb1fe 100644 --- a/src/pages/myGoodList/myGoodList.js +++ b/src/pages/myGoodList/myGoodList.js @@ -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 diff --git a/src/pages/myGoodsEdit/myGoodsEdit.js b/src/pages/myGoodsEdit/myGoodsEdit.js index 69a5c1d..ddd271b 100644 --- a/src/pages/myGoodsEdit/myGoodsEdit.js +++ b/src/pages/myGoodsEdit/myGoodsEdit.js @@ -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 { * 上传图片: - - {/* + {platformChecker() ? - */} + : } + {/* 店铺分类 */} - {process.env.TARO_ENV === 'weapp' ? : + } + onPassDataToChild={this.getDataFromShopChild.bind(this) + }> + : } {/* 店铺分类结束 */} diff --git a/src/pages/myGoodsEdit/myGoodsEdit.scss b/src/pages/myGoodsEdit/myGoodsEdit.scss index 51bc471..426eed1 100644 --- a/src/pages/myGoodsEdit/myGoodsEdit.scss +++ b/src/pages/myGoodsEdit/myGoodsEdit.scss @@ -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; } \ No newline at end of file diff --git a/src/pages/myNeedsEdit/myNeedsEdit.js b/src/pages/myNeedsEdit/myNeedsEdit.js index 3cbfd6c..ad424f3 100644 --- a/src/pages/myNeedsEdit/myNeedsEdit.js +++ b/src/pages/myNeedsEdit/myNeedsEdit.js @@ -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 { {deleteModalWindowElement} {/* 行业分类 */} - + {platformChecker() ? + + : } {/* 需求类型 */} - - - - - - *需求类型: {this.state.needsTypeSelected.name} + + + + + + + *需求类型: {this.state.needsTypeSelected.name} + + - - - + + - - - * + * + /> - - - * - - - - - * - 联系电话: - - - - - - - 联系地址: + + * + + + + + * + 联系电话: + + + - - - - - *需求内容: - - - - - - 需求图片: - (最多4张) - - + + + 联系地址: + - - + + + + + *需求内容: + + + + + + 需求图片: + (最多4张) + + {platformChecker() ? + + : } + + + + + + + + + + + *状态: {this.state.needsStateSelected.name} + - - - - - *状态: {this.state.needsStateSelected.name} - - - + + - - - - - - {/* + + + + + {/* */} - - - - {/* + + + + {/* */} + + + - - - ) } diff --git a/src/pages/myNeedsEdit/myNeedsEdit.scss b/src/pages/myNeedsEdit/myNeedsEdit.scss index 5434177..158aeb5 100644 --- a/src/pages/myNeedsEdit/myNeedsEdit.scss +++ b/src/pages/myNeedsEdit/myNeedsEdit.scss @@ -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 diff --git a/src/pages/myNeedsPublish/myNeedsPublish.js b/src/pages/myNeedsPublish/myNeedsPublish.js index c5e2376..052be54 100644 --- a/src/pages/myNeedsPublish/myNeedsPublish.js +++ b/src/pages/myNeedsPublish/myNeedsPublish.js @@ -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 { {/* 行业分类 */} - - {/* 需求类型 */} - + > : } + 需求类型: {this.state.needsTypeSelected.name} - - - * - + * + - - - * - - - - - * - 联系电话: - - - - - - - - 联系地址: - - - - - - - *需求内容: - - - - - - - - - 需求图片: - (最多4张) - - - - {/* 微信使用 */} - {/* - - */} + + + * + + + + + * + 联系电话: + + + + - - + + + 联系地址: + + + + + + + + *需求内容: + + + + + + + + + 需求图片: + (最多4张) + + {platformChecker() ? + + : + } + + + + + + + + + + *状态: {this.state.needsStateSelected.name} + - - - - - *状态: {this.state.needsStateSelected.name} - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - ) } diff --git a/src/pages/myNeedsPublish/myNeedsPublish.scss b/src/pages/myNeedsPublish/myNeedsPublish.scss index 5b1778c..028c3ac 100644 --- a/src/pages/myNeedsPublish/myNeedsPublish.scss +++ b/src/pages/myNeedsPublish/myNeedsPublish.scss @@ -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 diff --git a/src/pages/supplyDemandPublish/supplyDemandPublish.js b/src/pages/supplyDemandPublish/supplyDemandPublish.js index ef7a2d8..76ff98c 100644 --- a/src/pages/supplyDemandPublish/supplyDemandPublish.js +++ b/src/pages/supplyDemandPublish/supplyDemandPublish.js @@ -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({ 需求图片: (最多4张) - - - {/* + {platformChecker() ? - */} + : + } + diff --git a/src/serviceAPI.config.js b/src/serviceAPI.config.js index 79fc7c9..c8e6e7a 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 = "https://www.ihome6.com/" const URL = { Base: LOCALURL, diff --git a/src/util/getSetStoage.js b/src/util/getSetStoage.js index cd8353e..7bb903e 100644 --- a/src/util/getSetStoage.js +++ b/src/util/getSetStoage.js @@ -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 } \ No newline at end of file diff --git a/src/util/plaformChecker.js b/src/util/plaformChecker.js new file mode 100644 index 0000000..a9662a0 --- /dev/null +++ b/src/util/plaformChecker.js @@ -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 \ No newline at end of file