diff --git a/package.json b/package.json
index 4955c11..74b7817 100644
--- a/package.json
+++ b/package.json
@@ -36,23 +36,23 @@
"taro-ui": "^1.5.0"
},
"devDependencies": {
- "@types/react": "^16.4.8",
- "@types/webpack-env": "^1.13.6",
"@tarojs/plugin-babel": "^1.2.0-beta.3",
"@tarojs/plugin-csso": "^1.2.0-beta.3",
- "@tarojs/plugin-sass": "^1.2.0-beta.3",
+ "@tarojs/plugin-sass": "^1.2.0",
"@tarojs/plugin-uglifyjs": "^1.2.0-beta.3",
"@tarojs/webpack-runner": "^1.2.0-beta.3",
+ "@types/react": "^16.4.8",
+ "@types/webpack-env": "^1.13.6",
+ "babel-eslint": "^8.2.3",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-jsx-stylesheet": "^0.6.5",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.6.1",
- "babel-eslint": "^8.2.3",
"eslint": "^4.19.1",
"eslint-config-taro": "^1.2.0-beta.3",
- "eslint-plugin-react": "^7.8.2",
"eslint-plugin-import": "^2.12.0",
+ "eslint-plugin-react": "^7.8.2",
"eslint-plugin-taro": "^1.2.0-beta.3"
}
}
diff --git a/src/app.js b/src/app.js
index 176927f..608f128 100644
--- a/src/app.js
+++ b/src/app.js
@@ -26,7 +26,7 @@ class App extends Component {
'pages/supplyDemandPublish/supplyDemandPublish',
'pages/mySupplyDemand/mySupplyDemand',
'pages/allDemanding/allDemanding',
- 'pages/shopDescription/shopDescription',
+ // 'pages/shopDescription/shopDescription',
],
window: {
backgroundTextStyle: 'light',
diff --git a/src/component/filteredShopComponent/filteredShopComponent.js b/src/component/filteredShopComponent/filteredShopComponent.js
index b08bbb9..2422139 100644
--- a/src/component/filteredShopComponent/filteredShopComponent.js
+++ b/src/component/filteredShopComponent/filteredShopComponent.js
@@ -10,6 +10,9 @@ const hornIcon = require('../../icons/horn.png')
const houseIcon = require('../../icons/house.png')
class recommondShop extends Component {
+ static options = {
+ addGlobalClass: true
+ }
config = {
navigationBarTitleText: 'recommondShop'
@@ -194,44 +197,44 @@ class recommondShop extends Component {
const voucherModalElement =
优惠卷须知:
-
+
提示:具体可以前往实体店进行领取优惠卷或通过电话进行咨询
当前优惠卷{voucherLeft}张
{!this.state.voucherCanConsult ? {this.state.voucherResponseMsg} : null}
-
+
const consultModalElement =
咨询
提示:{this.state.consultTip}
@@ -239,8 +242,8 @@ class recommondShop extends Component {
// 请提示元素
const toast = {
+ console.log('商品详情:', res)
+ this.setState({
+ productImagesUrl: res.data.goods.goods_pic,
+ productName: res.data.goods.goods_name,
+ productDes: res.data.goods.goods_profiles,
+ oldPirce: res.data.goods.goods_org_price,
+ specialPrice: res.data.goods.goods_price,
+ productType: res.data.goods.goods_type_name,
+ serviceArea: res.data.goodsRegionName[0],
+ monthSold: res.data.goods.month_sales,
+ totalSold: res.data.goods.sales_volume,
+ browsingCount: res.data.goods.browse_times,
+ })
+ }
+ )
+ }
-
// 大类评论区方法
handleClick(value) {
this.setState({
@@ -38,14 +81,14 @@ class Goods extends Component {
})
}
// 去其他页面
- goShopPage(){
+ goShopPage() {
Taro.navigateTo({
url: '/pages/shop/shop'
})
}
// 收藏商品
- saveItem(){
- this.setState({isOpened:true})
+ saveItem() {
+ this.setState({ isOpened: true })
}
// 数量或者规格方法
onChange = e => {
@@ -54,7 +97,8 @@ class Goods extends Component {
})
}
componentDidMount() {
-
+ //this.$router.params.id
+ this.getShopDescription()
}
componentWillReceiveProps(nextProps) {
console.log(this.props, nextProps)
@@ -69,92 +113,126 @@ class Goods extends Component {
render() {
const mainTabList = [{ title: '宝贝详情' }, { title: '全部评价' }, { title: '猜你喜欢' }]
// const subTabList = [{ title: '全部' }, { title: '好评' }, { title: '差评' }, { title: '公开' }, { title: '匿名' }]
-
+ const itemPicsBannerElementArray=this.state.productImagesUrl.map((item,index)=>{
+ return < SwiperItem key={index} >
+
+
+
+
+ })
+
+ const itemDescriptionPicsElementArray = this.state.productImagesUrl.map((item, index) => {
+ return
+
+
+
+
+ })
return (
-
-
+ {/* */}
+
+ {itemPicsBannerElementArray}
+
+
+
- 11
+ {this.state.productName}
- 11
+ {this.state.productDes}
原价
- ¥11
+ ¥{this.state.oldPirce}
促销价
- ¥11
+ ¥{this.state.specialPrice}
商品类型
- 设计师商品
+ {this.state.productType}
服务区域
- 中国/福建省(全省)
+ {this.state.serviceArea}
月销量
- 0
+ {this.state.monthSold}
总销量
- 0
+ {this.state.totalSold}
浏览量
- 13
+ {this.state.browsingCount}
- {/* 规格或者数量 */}
-
+ {/* 规格或者数量 */}
+
可选规格:
{this.state.selectorChecked}
-
-
+
+
{/* 详情和评论区 */}
- {/* 大类 */}
+ {/* 大类 */}
-
- 商品细节:
+
+
+
+ 商品细节:
+
+ {itemDescriptionPicsElementArray}
+
+
+
+
- { /*子标签类*/}
+ { /*子标签类*/}
{
this.state.subCurrent === 0
?
- 全部
-
+ 全部
+
: null
}
{
@@ -182,15 +260,15 @@ class Goods extends Component {
? 匿名
: null
}
-
+
标签页三的内容
-
-
+
+
@@ -201,13 +279,13 @@ class Goods extends Component {
进店
-
+
- 收藏商品
+ 收藏商品
加入购物车
diff --git a/src/pages/goods/goods.scss b/src/pages/goods/goods.scss
index c71df86..cb98e1b 100644
--- a/src/pages/goods/goods.scss
+++ b/src/pages/goods/goods.scss
@@ -1,188 +1,200 @@
// border: 1px solid #ddd;
// padding: 5px 0;
-.img-box{
- border: 1px solid #ddd;
- padding: 20px 0;
- text-align: center;
- .img{
- height: 700px;
- width: 60%
- }
-}
-.title-box{
- border: 1px solid #ddd;
- padding: 5px 0;
-
- .main-title{
- margin-left: 20px;
- font-size: 30px;
- font-weight: bold;
- }
- .subtitle-box{
- margin-left: 20px;
- font-size: 25px;
-
- }
-
-}
-.price-box{
- border: 1px solid #ddd;
- padding: 5px 0;
- color:#999;
- font-size: 25px;
- .org-box{
- margin-left: 20px;
- .title{
- font-weight: bold
- }
- .price{
- text-decoration-line: line-through
- }
- }
- .spe-price{
- font-weight: bold;
- margin-left: 20px;
-
- .price{
- font-size: 40px;
- color: #c00;
-
- }
- }
-}
-.info-box{
- border: 1px solid #ddd;
- padding: 5px 0;
- color:#999;
- font-size: 25px;
- .type, .district{
- margin-left: 20px;
- padding: 5px 0;
- .title{
- font-weight: bold
- }
- .desc{
- color: black;
- display: inline-block;
- margin-left: 20px
- }
- }
-
-}
-.counter-box{
- width: 100%;
- display: flex;
- flex-direction: row;
- flex-wrap: nowrap;
- .month-sold,.total-sold,.browsing-amount{
- flex:1;
- font-size: 25px;
- text-align: center;
- margin:20px 0;
- border-right: 1px solid #ddd;
- .amount{
- display: inline-block;
- margin-left: 20px;
- color: #c00;
- font-weight: bold
- }
- }
- .browsing-amount{
- border-right: 0px solid #ddd;
- }
-}
-.standard-box{
-
- .picker{
- border: 1px solid #ddd;
- padding: 10px 0;
- color:#999;
- font-size: 25px;
- display: flex;
- flex-direction: row;
- flex-wrap: nowrap;
- .title{
- flex:1;
- font-weight: bold;
- margin-left: 20px;
-
-
- }
- .more{
- flex:1;
- text-align: right;
- margin-right: 20px;
- }
-
- }
-
-
-}
-//------------------------------
-.details-box{
-
- .at-tabs{
-
- .at-tabs__item--active{
- color:#FF7142
- }
- }
-}
-//------------------------------
-.copyright-box{
-
- padding:0 20px;
- .title{
- text-align: center;
- line-height: 100px;
- font-size: 25px;
-
- }}
-
-.gap{
+ .img-box{
+ // border: 1px solid #ddd;
+ padding: 20px 0;
+ text-align: center;
+ height: 600px;
- height:150px;
}
-.shop-bottom-box{
- position: fixed;
- bottom: 0;
- width: 100%;
- z-index: 600;
- .shop-bottom-nav{
- display: flex;
- flex-wrap: nowrap;
- flex-direction: row;
- text-align: center;
- height: 90px;
- line-height: 90px;
- font-size: 30px;
-
-
- .to-shop{
- flex:1;
- color: #333;
- background-color: white;
-
+ .title-box{
+ border: 1px solid #ddd;
+ padding: 5px 0;
+
+ .main-title{
+ margin-left: 20px;
+ font-size: 30px;
+ font-weight: bold;
+ }
+ .subtitle-box{
+ margin:0 20px;
+ font-size: 25px;
+
+ }
+
}
- .collection{
- flex:1;
- background-color: #FF9500;
- color: white;
- .icon{
- vertical-align: middle
- }
+ .price-box{
+ border: 1px solid #ddd;
+ padding: 5px 0;
+ color:#999;
+ font-size: 25px;
+ .org-box{
+ margin-left: 20px;
+ .title{
+ font-weight: bold
+ }
+ .price{
+ text-decoration-line: line-through
+ }
+ }
+ .spe-price{
+ font-weight: bold;
+ margin-left: 20px;
+
+ .price{
+ font-size: 40px;
+ color: #c00;
+
+ }
+ }
+ }
+ .info-box{
+ border: 1px solid #ddd;
+ padding: 5px 0;
+ color:#999;
+ font-size: 25px;
+ .type, .district{
+ margin-left: 20px;
+ padding: 5px 0;
+ .title{
+ font-weight: bold
+ }
+ .desc{
+ color: black;
+ display: inline-block;
+ margin-left: 20px
+ }
+ }
+
+ }
+ .counter-box{
+ width: 100%;
+ display: flex;
+ flex-direction: row;
+ flex-wrap: nowrap;
+ .month-sold,.total-sold,.browsing-amount{
+ flex:1;
+ font-size: 25px;
+ text-align: center;
+ margin:20px 0;
+ border-right: 1px solid #ddd;
+ .amount{
+ display: inline-block;
+ margin-left: 20px;
+ color: #c00;
+ font-weight: bold
+ }
+ }
+ .browsing-amount{
+ border-right: 0px solid #ddd;
+ }
+ }
+ .standard-box{
+
+ .picker{
+ border: 1px solid #ddd;
+ padding: 10px 0;
+ color:#999;
+ font-size: 25px;
+ display: flex;
+ flex-direction: row;
+ flex-wrap: nowrap;
.title{
- display: inline-block;
- margin-left: 10px;
- }
-
+ flex:1;
+ font-weight: bold;
+ margin-left: 20px;
+
+
+ }
+ .more{
+ flex:1;
+ text-align: right;
+ margin-right: 20px;
+ }
+
+ }
+
+
}
- .add-cart{
- flex:1;
- background-color:#F03726;
- color: white;
+ //------------------------------
+ .details-box{
+ .at-tabs{
+
+ .at-tabs__item--active{
+ color:#FF7142
+ }
+ }
+ .description-title{
+ font-size:35px;
+ color:#999;
+ margin-top:20px;
+ margin-left: 20px;
+ margin-bottom: 20px;
+ font-weight: bold;
+ }
+
+ .description-img{
+ padding:0 10px;
+ font-size: 0px;
+ }
+
}
-}
-}
-
+ //------------------------------
+ .copyright-box{
+
+ padding:0 20px;
+ .title{
+ text-align: center;
+ line-height: 100px;
+ font-size: 25px;
+
+ }}
+
+ .gap{
+
+ height:150px;
+ }
+ .shop-bottom-box{
+ position: fixed;
+ bottom: 0;
+ width: 100%;
+ z-index: 600;
+ .shop-bottom-nav{
+ display: flex;
+ flex-wrap: nowrap;
+ flex-direction: row;
+ text-align: center;
+ height: 90px;
+ line-height: 90px;
+ font-size: 30px;
+
+
+ .to-shop{
+ flex:1;
+ color: #333;
+ background-color: white;
+
+ }
+ .collection{
+ flex:1;
+ background-color: #FF9500;
+ color: white;
+ .icon{
+ vertical-align: middle
+ }
+ .title{
+ display: inline-block;
+ margin-left: 10px;
+ }
+
+ }
+ .add-cart{
+ flex:1;
+ background-color:#F03726;
+ color: white;
+ }
+ }
+ }
+
+
\ No newline at end of file
diff --git a/src/pages/goodsPublish/goodsPublish.js b/src/pages/goodsPublish/goodsPublish.js
index 4170d90..fbeee9a 100644
--- a/src/pages/goodsPublish/goodsPublish.js
+++ b/src/pages/goodsPublish/goodsPublish.js
@@ -1,9 +1,10 @@
import Taro, { Component } from '@tarojs/taro'
-import { View, Text, Radio, RadioGroup, Label } from '@tarojs/components'
-import { AtInput, AtImagePicker, AtTextarea, AtButton, Picker } from 'taro-ui'
+import { View, Text, Radio, RadioGroup, Label } from '@tarojs/components'
+import { AtInput, AtImagePicker, AtTextarea, AtButton, Picker } from 'taro-ui'
import SearchBarComponent from '../../component/searchBarComponent/searchBarComponent'
import copyrightComponent from '../../component/copyrightComponent/copyrightComponent'
+import URL from '../../serviceAPI.config'
import './goodsPublish.scss'
@@ -18,10 +19,10 @@ class GoodsPublish extends Component {
this.state = {
selector: ['需求', '供应', '人才'], // 应该是树型结构,需要修改
selectorChecked: '需求',
- productName:'',
- productPrice:'',
- productUnit:'',
- productDescript:'',
+ productName: '',
+ productPrice: '',
+ productUnit: '',
+ productDescript: '',
files: [{
url: 'https://jimczj.gitee.io/lazyrepay/aragaki1.jpeg',
},
@@ -52,38 +53,78 @@ class GoodsPublish extends Component {
text: '日本',
checked: false
}
-
+
] // 店铺分类选项
}
}
+
+ // 发布商品api
+ uploadGoods() {
+ Taro.request({
+ url: URL.UploadProduct,
+ method: 'POST',
+ dataType: 'json',
+ data: {
+ deployType: 1,
+ action: 1,
+ goods: JSON.stringify({ "goods_name": "test2", "goods_price": "1.00", "goods_unit": "1", "goods_profiles": "test2", "class_id": "10103", "shop_class_id": "1899" }),
+ goodsFiles: JSON.stringify([{ "file_id": "27959", "file_type": 1, "if_cover": 1, "file_sort": 1 }])
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded',
+ }
+ })
+ .then(res => {
+ console.log('上传商品', res) // 提示非法请求 ----- to be continue
+ }
+ )
+ }
+ // 上传商品图片api
+ uploadGoodsImage() {
+ Taro.request({
+ url: URL.UploadPorductImage,
+ method: 'POST',
+ dataType: 'json',
+ data: {
+ file: 1,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded',
+ }
+ })
+ .then(res => {
+ console.log('上传商品图片', res)
+ }
+ )
+ }
// 改变商品分类状态
- onChange(e){
+ onChange(e) {
this.setState({
selectorChecked: this.state.selector[e.detail.value]
})
}
- productNameChange(event){
+ productNameChange(event) {
this.setState({
productName: event
})
}
- productPriceChange(event){
+ productPriceChange(event) {
this.setState({
productPrice: event
})
}
- productUnitChange(event){
+ productUnitChange(event) {
this.setState({
productUnit: event
})
}
- productDescriptChange(event){
+ productDescriptChange(event) {
this.setState({
productDescript: event.target.value
})
}
// 上传图片
- onChangeImg(files,operationType) {
+ onChangeImg(files, operationType,index) {
if (operationType === 'add') {
this.setState({
files
@@ -93,7 +134,7 @@ class GoodsPublish extends Component {
this.state.files.splice(index, 1);
this.setState({ files: this.state.files });
}
-
+
}
// 图片上传失败
onFail(mes) {
@@ -101,9 +142,12 @@ class GoodsPublish extends Component {
}
// 删除图片
onImageClick(index) {
-
+
}
-
+ componentDidMount(){
+
+ }
+
componentWillReceiveProps(nextProps) {
console.log(this.props, nextProps)
}
@@ -136,33 +180,33 @@ class GoodsPublish extends Component {
*
*
-
-
+
+
*
-
+
{/* 图片上传 */}
@@ -172,16 +216,16 @@ class GoodsPublish extends Component {
- {/* 店铺分类 */}
+ {/* 店铺分类 */}
*
店铺分类:
@@ -231,20 +275,20 @@ class GoodsPublish extends Component {
-
+
-
+
商品简介:
-
+
@@ -254,13 +298,13 @@ class GoodsPublish extends Component {
发布
- 发布并新增
+ 发布并新增
- 商品列表
+ 商品列表
-
-
+
+
diff --git a/src/pages/home/home.js b/src/pages/home/home.js
index ebab431..ad22c71 100644
--- a/src/pages/home/home.js
+++ b/src/pages/home/home.js
@@ -11,43 +11,44 @@ class Home extends Component {
config = {
navigationBarTitleText: '首页'
}
-
+
constructor() {
super(...arguments);
this.state = {
shopsDetails: [], // 推荐店铺的信息
ads: [], //广告图片数组
categories: [],// 大类
- subCate:[], //小类
+ subCate: [], //小类
demanding: [],// 业主需求
- otherData:[], // 底部导航栏
- isOpen:false, // 抢单消息提示
+ otherData: [], // 底部导航栏
+ isOpen: false, // 抢单消息提示
}
}
- componentWillMount(){
-
- }
+ componentWillMount() {
+
+ }
componentDidMount() {
// 页面加载后 得到首页的基本信息和推荐店铺的信息
Taro.showLoading({ title: '加载中' })
this.getShops()
this.getHomeCategoriesInfo()
+ this.login()
}
-
-
-//api 得到首页的信息
+
+
+ //api 得到首页的信息
getHomeCategoriesInfo() {
Taro.request({
url: URL.ShopWxStore,
})
.then(res => {
- console.log('首页基本信息',res)
+ console.log('首页基本信息', res)
this.setState({
ads: res.data.data.adsLb,
categories: res.data.data.supplyClass,
demanding: res.data.data.demand.supplys,
- otherData:res.data.otherData
+ otherData: res.data.otherData
})
})
}
@@ -79,25 +80,60 @@ class Home extends Component {
}
)
}
- // api 抢单请求
- GrabDemand({demandId=218}){
- Taro.request({
- url: URL.GrabDemand,
- method: 'POST',
- dataType: 'json',
- data: {
- demandId: demandId
- },
- header: {
- 'content-type': 'application/x-www-form-urlencoded',
- 'X-Requested-With': 'XMLHttpRequest'
- }
- })
- .then(res => {
- console.log('抢单请求:',res)
- })
-}
+ // 登入api
+
+
+
+ login() {
+ Taro.login({
+
+ success(res) {
+ if (res.code) {
+ // 发起网络请求
+ console.log(res)
+ Taro.request({
+ url: URL.Login,
+ method: 'POST',
+ dataType: 'json',
+ data: {
+ code: res.code
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded',
+ }
+ })
+ .then(response => {
+ console.log('登入', response)
+
+ }
+ )}
+ else {
+ console.log('登录失败!' + res.errMsg)
+ }
+ }
+ })
+
+ }
+ // api 抢单请求
+ GrabDemand({ demandId = 218 }) {
+ Taro.request({
+ url: URL.GrabDemand,
+ method: 'POST',
+ dataType: 'json',
+ data: {
+ demandId: demandId
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded',
+ 'X-Requested-With': 'XMLHttpRequest'
+ }
+ })
+ .then(res => {
+ console.log('抢单请求:', res)
+ })
+
+ }
// 点击大类icon
onClickParentCate(item) {
this.setState({ subCate: item.children })
@@ -108,23 +144,23 @@ class Home extends Component {
this.getShops(item.parent_class_id, item.class_id, 2)
}
// 转到其他页面
- goToAllDemandingPage(){
+ goToAllDemandingPage() {
Taro.navigateTo({
url: '/pages/allDemanding/allDemanding'
})
}
- grabOrder(){
- this.setState({isOpen:true})
-
+ grabOrder() {
+ this.setState({ isOpen: true })
+
}
- handleGrabModalClose(){
- this.setState({isOpen:false})
+ handleGrabModalClose() {
+ this.setState({ isOpen: false })
}
- handleGrabModalCancel(){
- this.setState({isOpen:false})
+ handleGrabModalCancel() {
+ this.setState({ isOpen: false })
}
- handleGrabConfirm(){
- this.setState({isOpen:false})
+ handleGrabConfirm() {
+ this.setState({ isOpen: false })
// 确认抢单之后
this.GrabDemand({})
}
@@ -133,10 +169,11 @@ class Home extends Component {
componentDidShow() { }
componentDidHide() { }
-
+
render() {
- // 提示弹窗element
+
+ // 提示弹窗element
const modalMessage =
- const demandingElemensArray = this.state.demanding.length?this.state.demanding.map((item, index) => {
+
+
+
+ const demandingElemensArray = this.state.demanding.length ? this.state.demanding.map((item, index) => {
return < SwiperItem key={index} >
@@ -157,7 +197,7 @@ class Home extends Component {
{item.sd_title}
- {item.user_address||'无地址'}
+ {item.user_address || '无地址'}
业主:{item.user_name}
@@ -167,37 +207,37 @@ class Home extends Component {
- }) :null
+ }) : null
- const adsImgElementsArray = this.state.ads.length?this.state.ads.map((item, index) => {
+ const adsImgElementsArray = this.state.ads.length ? this.state.ads.map((item, index) => {
return
-
+
- }):null
+ }) : null
// 这里应该代码可以优化-----
- const categoriesElementsArray1 = this.state.categories.length?this.state.categories[0].map((item, index) => {
+ const categoriesElementsArray1 = this.state.categories.length ? this.state.categories[0].map((item, index) => {
return
{item.class_name}
- }):null
- const categoriesElementsArray2 = this.state.categories.length?this.state.categories[1].map((item, index) => {
+ }) : null
+ const categoriesElementsArray2 = this.state.categories.length ? this.state.categories[1].map((item, index) => {
return
-
+
{item.class_name}
- }):null
- const shopCollectionElementsArray = this.state.shopsDetails.length?this.state.shopsDetails.map((item, index) => {
+ }) : null
+ const shopCollectionElementsArray = this.state.shopsDetails.length ? this.state.shopsDetails.map((item, index) => {
return
- }):null
-
- const subCateElementsArray = this.state.subCate.length?this.state.subCate.map((item, index) => {
+ }) : null
+
+ const subCateElementsArray = this.state.subCate.length ? this.state.subCate.map((item, index) => {
return
{item.class_name}
- }):null
-
+ }) : null
+
return (
@@ -227,7 +267,7 @@ class Home extends Component {
hotizontal
circular
indicatorDots
- // autoplay
+ // autoplay
>
@@ -253,15 +293,15 @@ class Home extends Component {
indicatorDots
autoplay>
-
+
-
+
-
+
{/* 业主需求和行业推荐 */}
@@ -285,8 +325,8 @@ class Home extends Component {
{demandingElemensArray}
-
-
+
+
{this.state.subCate.length ? 4.5 ? 4.5 : this.state.subCate.length}
>
{subCateElementsArray}
- :null}
+ : null}
行业推荐
-
-
+
+
{shopCollectionElementsArray}
{this.state.shopsDetails.length !== 0 ?
沒有更多了...
- : < View className='title' >
- 没有找到...
- }
+ : < View className='title' >
+ 没有找到...
+ }
-
+
-
+
-
+
)
diff --git a/src/pages/index/index.js b/src/pages/index/index.js
index 389592a..7cee317 100644
--- a/src/pages/index/index.js
+++ b/src/pages/index/index.js
@@ -27,10 +27,15 @@ class Index extends Component {
//http://ihome6.com/Shop-supplyShops
componentDidMount(){
+ Taro.setStorageSync('PFWSSS','hq0erouhm4mea8b0mg34gdj0q7')
+ Taro.setStorageSync('X-Token','eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.IntcInVzZXJfaWRcIjpcIjI3XCIsXCJsb2dpbl9uYW1lXCI6XCJ5YW5neGJcIixcImF0XCI6XCIyMDE4LTEyLTE4IDEzOjM1OjUxXCJ9Ig.gXvZxXgU5asfwUJAG-z7k5g2p3dbts2e1X9L902KksE')
+ Taro.setStorageSync('PLU','%2Fm-more')
+ Taro.setStorageSync('localCity','think%3A%7B%2214%22%3A%22%25E7%25A6%258F%25E5%25BB%25BA%25E7%259C%2581%22%2C%2214001%22%3A%22%25E7%25A6%258F%25E5%25B7%259E%25E5%25B8%2582%22%7D')
+
Taro.navigateTo({
- // url: '/pages/home/home'
- // url: '/pages/goodsPublish/goodsPublish'
url: '/pages/home/home'
+ // url: '/pages/goodsPublish/goodsPublish'
+ // url:'/pages/supplyDemandPublish/supplyDemandPublish'
})
}
componentWillReceiveProps (nextProps) {
diff --git a/src/pages/mySupplyDemand/mySupplyDemand.js b/src/pages/mySupplyDemand/mySupplyDemand.js
index 4754e77..5674d20 100644
--- a/src/pages/mySupplyDemand/mySupplyDemand.js
+++ b/src/pages/mySupplyDemand/mySupplyDemand.js
@@ -44,6 +44,7 @@ class MySupplyDemand extends Component {
'X-Requested-With': 'XMLHttpRequest'
}
}).then(res => {
+ console.log(res) // ------------------------------------------- to be continue----
console.log('个人供求=》暂时无数据, 后台需要权限验证')
})
diff --git a/src/pages/shop/shop.js b/src/pages/shop/shop.js
index 41ac388..fb05743 100644
--- a/src/pages/shop/shop.js
+++ b/src/pages/shop/shop.js
@@ -24,11 +24,11 @@ class Shop extends Component {
shopId: '', // 店铺的id
shopName: '', // 店铺名
FilterText: '', // 筛选的可选项
- filterBar: ['all', 'amount', 'newProduct', 'price', 'popularity'],
- filterBarKeys: { all: '综合排序', amount: '销量', newProduct: '新品', price: '价格', popularity: '人气' },
+ filterBar: ['all', 'amount', 'newProduct', 'price', 'popularity'], //筛选选项
+ filterBarKeys: { all: '综合排序', amount: '销量', newProduct: '新品', price: '价格', popularity: '人气' }, // 筛选选项对应值
selectedFilterValue: 0, //筛选项
isShowFilter: false, //是否显示侧边筛选
- showShopHomePage: false,// 是否显示首页页面
+ showShopHomePage: true,// 是否显示首页页面
shopDescriptionData: '',// 店铺详情信息
shopName: '',//店铺名称
shopAddress: '',//店铺地址
@@ -154,7 +154,7 @@ class Shop extends Component {
// api 得到店铺详情请求
getShopDescription({ shopID = 808 }) {
Taro.request({
- url: URL.Base + 'shop-wxShopInfo',
+ url: URL.ShopDescription,
method: 'POST',
dataType: 'json',
data: {
@@ -173,7 +173,7 @@ class Shop extends Component {
contactNumber: res.data.userRes.phone,
shopDescription: res.data.data.shop_desc
}, () => {
- console.log(this.state.shopDescriptionData)
+ // console.log(this.state.shopDescriptionData)
})
}
diff --git a/src/pages/supplyDemandPublish/supplyDemandPublish.js b/src/pages/supplyDemandPublish/supplyDemandPublish.js
index 3dec5c1..59332b7 100644
--- a/src/pages/supplyDemandPublish/supplyDemandPublish.js
+++ b/src/pages/supplyDemandPublish/supplyDemandPublish.js
@@ -1,10 +1,11 @@
import Taro, { Component } from '@tarojs/taro'
-import { View, Button, Text } from '@tarojs/components'
-import { AtInput, AtForm, AtImagePicker, AtTextarea, AtRadio, AtButton, Picker} from 'taro-ui'
+import { View, Text } from '@tarojs/components'
+import { AtInput, AtImagePicker, AtTextarea, AtButton, Picker } from 'taro-ui'
import SearchBarComponent from '../../component/searchBarComponent/searchBarComponent'
import copyrightComponent from '../../component/copyrightComponent/copyrightComponent'
+import URL from '../../serviceAPI.config'
import './supplyDemandPublish.scss'
@@ -23,12 +24,12 @@ class SupplyDemand extends Component {
demandingSupplyCateSelected: '需求',// 当前供求类型
demandingSupplyState: ['上架', '下架'], // 状态选择
demandingSupplyStateSelected: '上架',// 当前状态
- title:'',
- contactName:'',
- contactNumber:'',
- contactAddress:'',
- content:'',
- addImg:true, // 是否支持添加图片
+ title: '',
+ contactName: '',
+ contactNumber: '',
+ contactAddress: '',
+ content: '',
+ addImg: true, // 是否支持添加图片
files: [{
url: 'https://jimczj.gitee.io/lazyrepay/aragaki1.jpeg',
},
@@ -38,9 +39,48 @@ class SupplyDemand extends Component {
{
url: 'https://jimczj.gitee.io/lazyrepay/aragaki3.png',
}]
-
+
}
}
+
+ // 上传供求api
+ uploadSupplyDemand() {
+ Taro.request({
+ url: URL.UploadSupplyDemand,
+ method: 'POST',
+ dataType: 'json',
+ data: {
+ action: 1,
+ sdInfo: JSON.stringify({ "sd_type": "2", "sd_title": "534523", "user_name": "杨夕兵", "user_phone": "18950295811", "user_address": "2342", "sd_desc": "42342", "state": "1", "file_path": [{ "file_name": "bg3.jpg", "file_size": "212678", "file_path": "Uploads/supply/user_27/201812/38bf91f30d215bbefb2686f2401217a6.jpg", "thumb_path": "Uploads/supply/user_27/201812/thumb/38bf91f30d215bbefb2686f2401217a6_200X200.jpg" }] })
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded',
+ }
+ })
+ .then(res => {
+ console.log('上传供求', res)
+ }
+ )
+ }
+
+ // 上传商品图片api
+ uploadGoodsImage() {
+ Taro.request({
+ url: URL.UploadPorductImage,
+ method: 'POST',
+ dataType: 'json',
+ data: {
+ file: 1,
+ },
+ header: {
+ 'content-type': 'application/x-www-form-urlencoded',
+ }
+ })
+ .then(res => {
+ console.log('上传商品图片', res)
+ }
+ )
+ }
// 修改供求类型
demandingSupplyCate = e => {
this.setState({
@@ -54,24 +94,28 @@ class SupplyDemand extends Component {
})
}
//改标题
- titleChange(event){
- this.setState({title:event})
+ titleChange(event) {
+ this.setState({ title: event })
}
- contactNameChange(event){
- this.setState({contactName:event})
+ contactNameChange(event) {
+ this.setState({ contactName: event })
}
- contactNumberChange(event){
- this.setState({contactNumber:event})
+ contactNumberChange(event) {
+ this.setState({ contactNumber: event })
}
- contactAddressChange(event){
- this.setState({contactAddress:event.target.value})
+ contactAddressChange(event) {
+ this.setState({ contactAddress: event.target.value })
}
- contentChange(event){
- this.setState({ content: event.target.value})
+ contentChange(event) {
+ this.setState({ content: event.target.value })
}
// 添加图片
- onChange(files, operationType,index) {
- if (operationType==='add'){
+ onChange(files, operationType, index) {
+ console.log(files[0].url)
+ Taro.uploadFile(files[0].url).then((res)=>{
+ console.log(res)
+ })
+ if (operationType === 'add') {
this.setState({
files
}, () => {
@@ -80,7 +124,7 @@ class SupplyDemand extends Component {
}
})
}
- if (operationType === 'remove'){
+ if (operationType === 'remove') {
this.state.files.splice(index, 1);
this.setState({ files: this.state.files });
}
@@ -91,6 +135,9 @@ class SupplyDemand extends Component {
onImageClick(index, file) {
console.log(index, file)
}
+ componentDidMount(){
+ this.uploadSupplyDemand()
+ }
componentWillReceiveProps(nextProps) {
console.log(this.props, nextProps)
}
@@ -106,45 +153,45 @@ class SupplyDemand extends Component {
-
+
-
- *供求类型: {this.state.demandingSupplyCateSelected}
-
-
+
+ *供求类型: {this.state.demandingSupplyCateSelected}
+
+
*
*
*
@@ -153,10 +200,10 @@ class SupplyDemand extends Component {
@@ -164,10 +211,10 @@ class SupplyDemand extends Component {
*需求内容:
@@ -178,14 +225,14 @@ class SupplyDemand extends Component {
-
+
@@ -206,7 +253,7 @@ class SupplyDemand extends Component {
发布
-
+
发布并新增
@@ -218,7 +265,7 @@ class SupplyDemand extends Component {
-
+
)
}
diff --git a/src/serviceAPI.config.js b/src/serviceAPI.config.js
index 86f1347..933f0e7 100644
--- a/src/serviceAPI.config.js
+++ b/src/serviceAPI.config.js
@@ -2,6 +2,7 @@
const LOCALURL = "http://192.168.1.230/"
const URL = {
Base:LOCALURL,
+ Login: LOCALURL + 'Applet-login', //登入接口
ShopWxStore: LOCALURL + 'Shop-wxStore', //商城首页信息
ShopSupplyShops: LOCALURL + 'Shop-supplyShops',// 商城店铺信息
GoodsSearch: LOCALURL + 'GoodsSearch-search',// 店铺页面的信息
@@ -15,6 +16,12 @@ const URL = {
GetVoucherInfo: LOCALURL + 'Shop-couponsTips',// 优惠卷信息
GetConsultInfo: LOCALURL + 'Shop-consultTips',// 咨询信息
BuyConsult: LOCALURL + 'Shop-consult',// 购买咨询
+ GetShopItemDetail: LOCALURL + 'GoodsQuery-wxGoodsDetail',// 商品详情
+ // 商品发布api接口
+ UploadPorductImage: LOCALURL + 'Goods-fileUp',// 上传商品图片
+ UploadProduct: LOCALURL + 'Goods-phonePost',// 上传商品
+ UploadSupplyDemand: LOCALURL + 'Supply-post',// 上传供求
+
}