Commit 3805787c authored by XieZhiXiong's avatar XieZhiXiong
parents ce9c3ee3 489e0557
......@@ -3,8 +3,8 @@
background-color: #ffffff;
border-radius: 8px;
overflow: hidden;
height: 100%;
padding-bottom: 24px;
margin-bottom: 24px;
.img_box {
position: relative;
......
import React, { forwardRef, useState, useCallback } from 'react'
import { Button, Input } from 'antd'
import { Button, Input, Modal } from 'antd'
import UploadImage from '@/components/UploadImage'
import { filterPropsFunction, getAdvertType } from '../../../../utils'
import SettingPanel from '../../../../components/SettingPanel'
......@@ -243,9 +243,25 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
}
const handleCancel = useCallback(() => {
if (JSON.stringify(props) !== JSON.stringify(newProps)) {
Modal.confirm({
content: "您还没有保存修改的内容,是否确认关闭?",
okText: "确认",
cancelText: "取消",
onOk: () => {
clearSelectedStatus()
}
})
} else {
clearSelectedStatus()
}
}, [newProps])
return (
<SettingPanel
confirmLoading={confirmLoading}
onCancel={handleCancel}
onOK={handleConfirmSave}
>
<div className={styles.advert_setting}>
......
import React, { useState, useEffect } from 'react'
import React, { useState, useEffect, useCallback } from 'react'
import { clearSelectedStatus, changeProps } from 'lingxi-editor-core'
import { Row, Col, Button, Input, Pagination, Form, message } from 'antd'
import { Row, Col, Button, Input, Pagination, Form, message, Modal } from 'antd'
import SettingList from '../../../../components/SettingList'
import BrandItem from './BrandItem'
import SettingPanel from '../../../../components/SettingPanel'
......@@ -160,10 +160,24 @@ const BrandSetting: React.FC<ShopSettingPropsType> = (props) => {
setBrandIds(keys)
setSelectList(selectBrandList)
}
const handleCancel = () => {
if (JSON.stringify(brandList) !== JSON.stringify(selectBrandList)) {
Modal.confirm({
content: "您还没有保存修改的内容,是否确认关闭?",
okText: "确认",
cancelText: "取消",
onOk: () => {
clearSelectedStatus()
}
})
} else {
clearSelectedStatus()
}
}
return (
<SettingPanel
confirmLoading={confirmLoading}
onCancel={handleCancel}
onOK={() => handleConfirm()}
>
<div className={styles.goods_setting}>
......
import React, { useState, useEffect, useCallback } from 'react'
import { Checkbox, Row, Col, message } from 'antd'
import { Checkbox, Row, Col, message, Modal } from 'antd'
import UploadImage from '@/components/UploadImage'
import SettingPanel from '../../../../components/SettingPanel'
import { clearSelectedStatus, changeProps } from 'lingxi-editor-core'
......@@ -19,41 +19,6 @@ interface CategoryRecommendSettingPropsType {
categoryid?: number;
}
const mock_category_list = [
{
categoryId: 1,
categoryName: '牛皮'
},
{
categoryId: 2,
categoryName: '羊皮'
},
{
categoryId: 3,
categoryName: '猪皮'
},
{
categoryId: 4,
categoryName: '马皮'
},
{
categoryId: 5,
categoryName: '小牛皮'
},
{
categoryId: 6,
categoryName: '猪皮'
},
{
categoryId: 7,
categoryName: '羊皮'
},
{
categoryId: 8,
categoryName: '猪皮'
}
]
const CategoryRecommendSetting: React.FC<CategoryRecommendSettingPropsType> = (props) => {
console.log(props)
const { secondCategoryList = [], categoryAdvertPicUrl = '', onChange, templateid, categoryid } = props
......@@ -124,6 +89,21 @@ const CategoryRecommendSetting: React.FC<CategoryRecommendSettingPropsType> = (p
})
}, [newProps])
const handleCancel = useCallback(() => {
if (JSON.stringify(props) !== JSON.stringify(newProps)) {
Modal.confirm({
content: "您还没有保存修改的内容,是否确认关闭?",
okText: "确认",
cancelText: "取消",
onOk: () => {
clearSelectedStatus()
}
})
} else {
clearSelectedStatus()
}
}, [newProps])
const saveCategory = (data: any) => {
return new Promise((resolve, reject) => {
const { categoryAdvertPicUrl } = data
......@@ -152,6 +132,7 @@ const CategoryRecommendSetting: React.FC<CategoryRecommendSettingPropsType> = (p
return (
<SettingPanel
confirmLoading={confirmLoading}
onCancel={handleCancel}
onOK={handleConfirmSave}
>
<div className={styles.category_recommend}>
......
......@@ -18,7 +18,7 @@ const GoodsItem: React.FC<GoodsItemPropsType> = (props) => {
<div className={styles.goods_item_info_name}>{dataInfo.goodsName}</div>
<div className={styles.goods_item_info_price}>
<i></i>
<span>{dataInfo.priceRange}</span>
<span>{dataInfo.priceRange || dataInfo.goodsPrice}</span>
</div>
<div className={styles.goods_item_info_brief}>
<span>品类:</span>
......
import React, { useState, useEffect, useCallback } from 'react'
import React, { useState, useEffect } from 'react'
import { clearSelectedStatus, changeProps } from 'lingxi-editor-core'
import { Row, Col, Button, Input, Pagination, Select, Form, message } from 'antd'
import { Row, Col, Button, Input, Pagination, Select, Form, message, Modal } from 'antd'
import SettingList from '../../../../components/SettingList'
import GoodsItem from './GoodsItem'
import SettingPanel from '../../../../components/SettingPanel'
......@@ -44,16 +44,53 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
const [filterParam, setFilterParam] = useState()
const [newProps, setNewProps] = useState(props)
const [categoryResponseList, setCategoryResponseList] = useState<any>([])
const [noSelectBrands, setNoSelectBrands] = useState<any[]>([])
const changeNewProps = (key: string, data: any) => {
const newProps = { ...props }
newProps[key] = data
setNewProps(newProps)
}
useEffect(() => {
fetchBrandsList()
fetchCategoryList()
}, [])
useEffect(() => {
fetchGoodsList()
}, [filterParam])
const fetchCategoryList = () => {
let param = {
categoryId: categoryid,
templateId: templateid
}
//@ts-ignore
PublicApi.getTemplatePlatformFindCategoryList(param).then(res => {
const data = res.data
setCategoryResponseList(data.categoryBOList || [])
})
}
const fetchBrandsList = () => {
let param = {
type: 0,
templateId: templateid,
categoryId: categoryid,
current: 1,
pageSize: 100
}
//@ts-ignore
PublicApi.getTemplatePlatformFindBrandList(param).then((res: any) => {
if (res.code === 1000) {
const dataInfo = res.data
setNoSelectBrands(dataInfo.data || [])
}
})
}
const fetchGoodsList = () => {
let param = {
type: 0,
......@@ -63,7 +100,9 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
pageSize
}
if (filterParam) {
param = Object.assign(param, filterParam)
console.log(filterParam, param)
}
//@ts-ignore
PublicApi.getTemplatePlatformFindGoodsList(param).then((res: any) => {
......@@ -105,6 +144,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
const handleSearch = () => {
setCurrent(1)
console.log(form.getFieldsValue())
let param = filterProps(form.getFieldsValue())
setFilterParam(param)
}
......@@ -122,22 +162,30 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
}
const handleConfirmSave = () => {
console.log('handleConfirmSave1')
if (JSON.stringify(goodsList) === JSON.stringify(selectGoodsList)) {
return
}
console.log('handleConfirmSave2')
if (selectGoodsList.length <= 0) {
message.error("请选择要推荐的商品")
return
}
setConfirmLoading(true)
let newList = JSON.parse(JSON.stringify(selectGoodsList))
newList = newList.map(item => {
let minPrice = 0
if (item.priceRange && typeof item.priceRange === 'string') {
minPrice = item.priceRange.split("~")[0]
item.goodsPrice = minPrice
}
return item
})
saveGoods().then(() => {
changeProps({
props: {
templateid,
categoryid,
goodsList: selectGoodsList
goodsList: newList
}
})
clearSelectedStatus()
......@@ -147,6 +195,21 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
})
}
const handleCancel = () => {
if (JSON.stringify(goodsList) !== JSON.stringify(selectGoodsList)) {
Modal.confirm({
content: "您还没有保存修改的内容,是否确认关闭?",
okText: "确认",
cancelText: "取消",
onOk: () => {
clearSelectedStatus()
}
})
} else {
clearSelectedStatus()
}
}
const saveGoods = () => {
return new Promise((resolve, reject) => {
let param: any = {
......@@ -182,6 +245,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
return (
<SettingPanel
confirmLoading={confirmLoading}
onCancel={handleCancel}
onOK={() => handleConfirm()}
>
<div className={styles.goods_setting}>
......@@ -246,7 +310,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
name="supplyName"
className={styles.mar_bot_0}
>
<Input placeholder="供应会员" />
<Input placeholder="供应会员" onPressEnter={handleSearch} />
</Form.Item>
</Col>
<Col span={6}>
......@@ -254,8 +318,10 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
name="twoCategoryId"
className={styles.mar_bot_0}
>
<Select placeholder="品类" style={{ width: 180 }}>
<Select.Option value="1">1</Select.Option>
<Select placeholder="品类" style={{ width: 180 }} onChange={handleSearch}>
{
categoryResponseList.map((item, index) => <Select.Option kye={`select_category_item_${index}`} value={item.categoryId}>{item.categoryName}</Select.Option>)
}
</Select>
</Form.Item>
</Col>
......@@ -264,8 +330,11 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
name="brandId"
className={styles.mar_bot_0}
>
<Select placeholder="品牌" style={{ width: 180 }}>
<Select.Option value="1">1</Select.Option>
<Select placeholder="品牌" style={{ width: 180 }} onChange={handleSearch}>
{
noSelectBrands.map((item, index) => (<Select.Option kye={`select_brand_item_${index}`} value={item.brandId}>{item.brandName}</Select.Option>))
}
</Select>
</Form.Item>
</Col>
......
import React, { useState, useEffect } from 'react'
import { clearSelectedStatus, changeProps } from 'lingxi-editor-core'
import { Row, Col, Button, Input, Pagination, Form, message } from 'antd'
import { Row, Col, Button, Input, Pagination, Form, message, Modal } from 'antd'
import SettingList from '../../../../components/SettingList'
import ShopItem from './ShopItem'
import SettingPanel from '../../../../components/SettingPanel'
......@@ -130,6 +130,21 @@ const ShopSetting: React.FC<ShopSettingPropsType> = (props) => {
})
}
const handleCancel = () => {
if (JSON.stringify(shopsList) !== JSON.stringify(selectShopsList)) {
Modal.confirm({
content: "您还没有保存修改的内容,是否确认关闭?",
okText: "确认",
cancelText: "取消",
onOk: () => {
clearSelectedStatus()
}
})
} else {
clearSelectedStatus()
}
}
const saveShop = () => {
return new Promise((resolve, reject) => {
let param: any = {
......@@ -165,6 +180,7 @@ const ShopSetting: React.FC<ShopSettingPropsType> = (props) => {
return (
<SettingPanel
confirmLoading={confirmLoading}
onCancel={handleCancel}
onOK={() => handleConfirm()}
>
<div className={styles.goods_setting}>
......
......@@ -6,6 +6,10 @@
padding: 10px !important;
}
.ant-drawer-title {
font-weight: bold;
}
.children-container {
background: #ffffff;
border: 1px solid rgba(0, 0, 0, 0.15);
......
......@@ -7,7 +7,7 @@ import { inject } from 'mobx-react'
import UseModal from '../components/useModal'
import DetailPage from '@/components/DetailPage'
import { PublicApi } from '@/services/api'
import { GetTemplatePlatformFindTemplateDetailsResponse } from '@/services'
import { GetTemplatePlatformFindTemplateDetailsResponse } from '@/services/TemplateApi'
import styles from './index.less'
interface TemplateDetailPropsType {
......@@ -20,21 +20,23 @@ interface TemplateDetailPropsType {
}
}
const Environment_Status = {
0: {
name: "所有"
},
1: {
name: "PC "
name: "web"
},
2: {
name: "H5 "
name: "H5"
},
3: {
name: "APP "
name: "小程序"
},
4: {
name: "APP"
}
}
const TemplateDetail: React.FC<TemplateDetailPropsType> = (props) => {
const { query: { type, id } } = props.location
const { siteId } = props.SiteStore
......
import React, {Component} from 'react';
import React, { Component } from 'react';
import { Button, Row, Col, Form, Input, message } from 'antd';
import { history } from 'umi';
import { UserOutlined, LockOutlined, CloudFilled, SafetyOutlined } from '@ant-design/icons';
......@@ -29,7 +29,7 @@ async function fakeAccountLogin(params: { password: string; username: string })
class Index extends Component<{}, IndexState> {
private timer: number | undefined;
constructor(props:any) {
constructor(props: any) {
super(props);
this.state = {
isOften: false,
......@@ -48,14 +48,14 @@ class Index extends Component<{}, IndexState> {
isLoading: true
})
// @ts-ignore
this.timer = setInterval(()=>{
this.timer = setInterval(() => {
this.handleTimer()
}, 1000)
}
handleTimer() {
const { timeNumber } = this.state
if(timeNumber > 0){
if (timeNumber > 0) {
let n = timeNumber - 1
this.setState({
timeNumber: n,
......@@ -63,7 +63,7 @@ class Index extends Component<{}, IndexState> {
btnText: `${n}s 后重发`,
isLoading: false
})
}else{
} else {
clearInterval(this.timer)
this.setState({
timeNumber: 60,
......@@ -77,9 +77,11 @@ class Index extends Component<{}, IndexState> {
clearInterval(this.timer)
}
onFinish = (values:any) => {
onFinish = (values: any) => {
console.log('Received values of form: ', values);
PublicApi.postMemberManageLogin(values).then(res => {
message.destroy()
message.success("登录成功")
const { data } = res
setAuth(data)
setRouters(data.urls)
......@@ -149,11 +151,11 @@ class Index extends Component<{}, IndexState> {
>
<Input
size="large"
placeholder="输入验证码"/>
placeholder="输入验证码" />
</Form.Item>
</Col>
<Col span={8}>
<Button loading={isLoading} className="send-code" onClick={()=>{this.handleSendVerifyCode()}} disabled={isBan} size="large">{btnText}</Button>
<Button loading={isLoading} className="send-code" onClick={() => { this.handleSendVerifyCode() }} disabled={isBan} size="large">{btnText}</Button>
</Col>
</Row>
</Form.Item>
......@@ -162,7 +164,7 @@ class Index extends Component<{}, IndexState> {
{
isLongTime && (
<Form.Item>
<Button icon={ <CloudFilled />} size="large" className="verify-btn">
<Button icon={<CloudFilled />} size="large" className="verify-btn">
点击按钮进行验证
</Button>
</Form.Item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment