Skip to content

Commit

Permalink
fix: 更新主题色、接口服务地址、功能完善
Browse files Browse the repository at this point in the history
  • Loading branch information
yinyuhui committed Jul 29, 2024
1 parent 9e3297a commit 6208176
Show file tree
Hide file tree
Showing 19 changed files with 5,916 additions and 3,350 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

.history
4 changes: 2 additions & 2 deletions config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ module.exports = function(webpackEnv) {
const lessOptions = {
javascriptEnabled: true,
modifyVars: {
'primary-color': '#539092',
'link-color': '#539092',
'primary-color': '#79a3b1',
'link-color': '#79a3b1',
'border-radius-base': '4px',
},
}
Expand Down
Binary file modified public/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/logo1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/favicon.ico
Binary file not shown.
Binary file added public/favicon1.ico
Binary file not shown.
46 changes: 23 additions & 23 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="logo192.png" />
<!--

<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Web site created using create-react-app" />
<link rel="apple-touch-icon" href="logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<script type="text/javascript" src="http://api.map.baidu.com/api?v=3.0&ak=h9TC83avVRaWXLilGfM3BvRing4lgqiQ"></script>
<link rel="stylesheet" href="//at.alicdn.com/t/font_1520274_q9xbl6ad3m.css" />
<!--
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<script type="text/javascript" src="http://api.map.baidu.com/api?v=3.0&ak=h9TC83avVRaWXLilGfM3BvRing4lgqiQ"></script>
<link rel="stylesheet" href="//at.alicdn.com/t/font_1520274_q9xbl6ad3m.css" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Expand All @@ -26,12 +24,13 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
<title>后台管理-react</title>
</head>

<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
Expand All @@ -41,5 +40,6 @@
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
</body>

</html>
19 changes: 10 additions & 9 deletions src/axios/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios'
import { Modal, message } from 'antd'

const domain = 'https://www.fastmock.site/mock/1e07088f8d89e91fec628ba9ffa274e9/reactMs/'
const domain = 'https://yyh.world/api/reactMs/mock/'

const getUrl = (url) => {
// 请求时 传入URL 开头可加斜线也可不加 均不会报错
Expand All @@ -22,41 +22,42 @@ const closeLoading = () => {
axios.interceptors.response.use(resp => {
closeLoading()
let res = resp.data
if(resp.status === 200) { // HTTP 状态码
if(res.status === '1' || res.code === 200) { // 前后端约定状态码
if(resp.config.method === 'post') {
if (resp.status === 200) { // HTTP 状态码
if (res.status === '1' || res.code === 200) { // 前后端约定状态码
if (resp.config.method === 'post') {
message[res.result ? 'success' : 'error'](res.result ? '操作成功' : '操作失败')
}
return res
}
Modal.info({
title: '提示',
content: res.msg || res.desc
content: res.msg || res.desc || '网络出错,请稍后再试'
})

}
else {
Modal.info({
title: '提示',
content: resp.desc
content: resp.desc || '网络出错,请稍后再试'
})
return Promise.reject(resp.result)
}
})

const checkUrl = (url) => {
if(!url) {
if (!url) {
console.error('没有传入 URL,请检查调用情况!')
return false
}
return true
}

export default class Axios {
static get(url, params, loading = true) {
static get (url, params, loading = true) {
loading && showLoading()
return checkUrl(url) && axios.get(getUrl(url), { params })
}
static post(url, data) {
static post (url, data) {
checkUrl(url)
return checkUrl(url) && axios.post(getUrl(url), data)
}
Expand Down
21 changes: 11 additions & 10 deletions src/components/Header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,19 @@ export default class Header extends Component {
state = {
userName: ''
}
async componentDidMount() {
async componentDidMount () {
this.setState(() => ({
userName: 'yyh',
date: React.$dayjs().format('YYYY-MM-DD')
date: React.$dayjs().format('YYYY-MM-DD'),
currentTab: '首页'
}))

const cityData = await React.$get('https://restapi.amap.com/v3/ip', {
key: 'ee2e38f4a5f94ea4f1ffbcd746933100'
key: '41b500f2005cb03b54dba91e48a97257'
}, false)

const weatherData = await React.$get('https://restapi.amap.com/v3/weather/weatherInfo', {
key: 'ee2e38f4a5f94ea4f1ffbcd746933100',
key: '41b500f2005cb03b54dba91e48a97257',
city: cityData && cityData.adcode
}, false)

Expand All @@ -28,11 +29,11 @@ export default class Header extends Component {
weather: weather ? `${weather.weather} ${weather.temperature}℃` : '',
}))
}
render() {

render () {
const { common } = this.props
return (
<div className="header">
<div className="header">
<div className={common ? "common-header flex flex-b" : "flex flex-b"}>
{
common ? <div className="common-logo flex">
Expand All @@ -45,10 +46,10 @@ export default class Header extends Component {
<Button type="link" style={{ padding: 0, marginLeft: 40, }}>退出</Button>
</p>
</div>

{
common ? '' : <div className="header-bottom flex flex-b">
<p span="4" className="breadcrumb flex flex-c">首页</p>
<p span="4" className="breadcrumb flex flex-c">{this.state.currentTab}</p>
<p span="20">
<span className="date">{this.state.date}</span>
<span className="weather">{this.state.position} {this.state.weather}</span>
Expand Down
2 changes: 1 addition & 1 deletion src/components/NavLeft/index.less
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.logo {
height: 90px;
padding-left: 14px;
background: #81bdbb;
background: #456268;
img {
height: 35px;
width: 35px;
Expand Down
10 changes: 5 additions & 5 deletions src/pages/bikeMap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default class BikeMap extends Component {
page: 1
}

async getData(query = this.initValue) {
async getData (query = this.initValue) {
query.startTime = moment(query.time[0]).valueOf()
query.endTime = moment(query.time[1]).valueOf()
query.time = null
Expand All @@ -90,7 +90,7 @@ export default class BikeMap extends Component {
this.renderMap()
}

renderMap() {
renderMap () {
this.map = new window.BMap.Map('bikeMap')
this.map.addControl(
new window.BMap.ScaleControl({
Expand All @@ -105,7 +105,7 @@ export default class BikeMap extends Component {
this.drewMapEl()
}

drewMapEl() {
drewMapEl () {
const { area, positions } = this.state
// 服务区
const areaList = area.map(item => new window.BMap.Point(item.longitude, item.latitude))
Expand All @@ -118,7 +118,7 @@ export default class BikeMap extends Component {
})

const centerPoint = new window.BMap.Point(114.29533492773774, 30.510833519064715)
this.map.centerAndZoom(centerPoint, 15)
this.map.centerAndZoom(centerPoint, 11)
this.map.addOverlay(polygon)

positions.forEach(point => {
Expand All @@ -145,7 +145,7 @@ export default class BikeMap extends Component {
this.getData()
}

render() {
render () {
const { total } = this.state
return (
<div>
Expand Down
12 changes: 6 additions & 6 deletions src/pages/city/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default class City extends Component {
this.getData()
}

getData(query = this.filterFormInitValues) {
getData (query = this.filterFormInitValues) {
getList(this, 'city/list', { ...this.params, ...query })
}

Expand All @@ -137,23 +137,23 @@ export default class City extends Component {
})
}

async submit() {
async submit () {
const cityForm = this.cityForm.props.form.getFieldsValue()
const res = await React.$post('city/open', cityForm)
await React.$post('city/open', cityForm)

this.setState({
showSetCity: false
})
this.cityForm.props.form.resetFields()
res.result ? message.success('操作成功') : message.error('操作失败')
// res.result ? message.success('操作成功') : message.error('操作失败')
this.getData()
}

showDetail = (text, record) => {
console.log(text, record)
}

render() {
render () {
const { list, pagination, showSetCity } = this.state
const columns = [
{
Expand Down Expand Up @@ -267,7 +267,7 @@ export default class City extends Component {
}

class OpenCityForm extends Component {
render() {
render () {
const formItemStyle = {
labelCol: {
span: 6
Expand Down
16 changes: 8 additions & 8 deletions src/pages/order/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default class Order extends Component {
this.getData()
}

getData(FilterForm = this.filterFormInitValues) {
getData (FilterForm = this.filterFormInitValues) {
FilterForm.startTime = FilterForm.time
? moment(FilterForm.time[0]).valueOf()
: FilterForm.startTime
Expand All @@ -106,7 +106,7 @@ export default class Order extends Component {
getList(this, 'order/list', { ...this.params, ...FilterForm })
}

async endOrder() {
async endOrder () {
const res = await React.$get('/order/close/detail', {
orderSn: this.state.selectedItem[0].orderSn
})
Expand All @@ -116,7 +116,7 @@ export default class Order extends Component {
})
}

async ensureClose() {
async ensureClose () {
const res = await React.$get('/order/close', {
orderSn: this.state.selectedItem[0].orderSn
})
Expand All @@ -135,7 +135,7 @@ export default class Order extends Component {
window.open(`http://${host}/#/common/order/detail/${this.state.selectedItem[0].orderSn}`)
}

render() {
render () {
const {
list,
pagination,
Expand All @@ -148,13 +148,13 @@ export default class Order extends Component {
{
title: '订单编号',
dataIndex: 'orderSn',
width: 100,
width: 120,
fixed: 'left'
},
{
title: '车辆编号',
dataIndex: 'bikeSn',
width: 100
width: 120
},
{
title: '用户名',
Expand Down Expand Up @@ -203,7 +203,7 @@ export default class Order extends Component {
{
title: '实付金额',
dataIndex: 'userPay',
width: 100
// width: 100
}
]
const btnDisabled = selectedKey.length < 1
Expand All @@ -226,7 +226,7 @@ export default class Order extends Component {
columns={columns}
dataSource={list}
pagination={pagination}
scroll={{ x: 1440 }}
scroll={{ x: 1480 }}
selectionType="radio"
selectedRowKeys={selectedKey}
selectedItems={selectedItem}
Expand Down
Loading

0 comments on commit 6208176

Please sign in to comment.