|
|
@@ -1,14 +1,15 @@
|
|
|
import React, {Component} from 'react'
|
|
|
import './index.css'
|
|
|
-import {NavBar, Icon} from 'antd-mobile'
|
|
|
+import {NavBar, Icon, ActivityIndicator, List, ImagePicker, InputItem, Button} from 'antd-mobile'
|
|
|
+import {message} from 'antd'
|
|
|
import {withRouter} from 'react-router-dom'
|
|
|
-import {ActivityIndicator, List, ImagePicker, InputItem, Button} from 'antd-mobile'
|
|
|
import axios from 'axios'
|
|
|
import {Query, Mutation} from "react-apollo"
|
|
|
import gql from "graphql-tag"
|
|
|
import {shop_by_props, create_shop, update_shop} from "../../../../utils/gql"
|
|
|
import {storeFile} from "../../../../configs/url"
|
|
|
import moment from 'moment'
|
|
|
+import {getCookie} from "../../../../utils/cookie"
|
|
|
|
|
|
const Item = List.Item
|
|
|
|
|
|
@@ -99,9 +100,10 @@ class ShopRender extends Component {
|
|
|
}
|
|
|
|
|
|
onChange = (files, operationType) => {
|
|
|
- console.log("files", files, "operationType", operationType)
|
|
|
+ // console.log("files", files, "operationType", operationType)
|
|
|
|
|
|
let imgDatas = []
|
|
|
+ let openid = getCookie("openid")
|
|
|
let {shopID} = this.state
|
|
|
|
|
|
files.forEach((file, index) => {
|
|
|
@@ -110,7 +112,7 @@ class ShopRender extends Component {
|
|
|
let imgNewName = `slideshow_${index}_shopID_${shopID}.${imgType}`
|
|
|
|
|
|
const imgData = {
|
|
|
- 'file-name': `e-commerce/images/${imgNewName}`,
|
|
|
+ 'file-name': `e-commerce/images/${openid}/slideshow/${imgNewName}`,
|
|
|
'bucket': 'case',
|
|
|
'cont': base64Cont,
|
|
|
'public': true,
|
|
|
@@ -124,7 +126,7 @@ class ShopRender extends Component {
|
|
|
files
|
|
|
})
|
|
|
|
|
|
- console.log(imgDatas, 'imgDatas')
|
|
|
+ // console.log(imgDatas, 'imgDatas')
|
|
|
}
|
|
|
|
|
|
onReset = () => {
|
|
|
@@ -257,10 +259,24 @@ class UpdateShopButton extends Component {
|
|
|
let slideshow = imgDatas.length === 1 ? prefix + imgDatas[0]['file-name'] : imgDatas.map((imgData, index) => (
|
|
|
prefix + imgDatas[index]['file-name']
|
|
|
))
|
|
|
- updatestore({variables: {...varObj, slideshow}})
|
|
|
+ updatestore({variables: {...varObj, slideshow}}).then((data)=>{
|
|
|
+ // console.log("updatestore1 data",data)
|
|
|
+ if(data.data && data.data.updateshop.result === "ok"){
|
|
|
+ message.success('更新成功')
|
|
|
+ }else {
|
|
|
+ message.success('更新失败,请稍后重试')
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
} else {
|
|
|
- updatestore({variables: varObj})
|
|
|
+ updatestore({variables: varObj}).then((data)=>{
|
|
|
+ // console.log("updatestore1 data",data)
|
|
|
+ if(data.data && data.data.updateshop.result === "ok"){
|
|
|
+ message.success('更新成功')
|
|
|
+ }else {
|
|
|
+ message.success('更新失败,请稍后重试')
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
}}>更新</Button>
|
|
|
)
|
|
|
@@ -333,4 +349,4 @@ class CreateShopButton extends Component {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-export default withRouter(Shop)
|
|
|
+export default withRouter(Shop)
|