|
|
@@ -0,0 +1,130 @@
|
|
|
+/**
|
|
|
+ * Created by Hujs on 2020/12/25
|
|
|
+ * Desc: 用户反馈
|
|
|
+ */
|
|
|
+
|
|
|
+import React, { Component } from 'react'
|
|
|
+import { connect } from 'react-redux'
|
|
|
+import { Toast, List, Modal, Button, TextareaItem } from 'antd-mobile'
|
|
|
+import { Upload, message } from 'antd'
|
|
|
+import {
|
|
|
+ EditOutlined,
|
|
|
+ LoadingOutlined,
|
|
|
+ PlusOutlined,
|
|
|
+} from '@ant-design/icons'
|
|
|
+import { _baseURL, _host, API } from '../../../configs/api.config'
|
|
|
+import './user-feedback.less'
|
|
|
+
|
|
|
+class UserFeedback extends Component {
|
|
|
+
|
|
|
+ constructor () {
|
|
|
+ super()
|
|
|
+
|
|
|
+ this.state = {
|
|
|
+ inputValue: '',
|
|
|
+ loading: false,
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ componentDidMount () {
|
|
|
+ document.title = this.title || '用户反馈'
|
|
|
+ }
|
|
|
+
|
|
|
+ componentWillUnmount () {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ render () {
|
|
|
+ const { loading, imageUrl } = this.state
|
|
|
+ const uploadButton = (
|
|
|
+ <div>
|
|
|
+ {loading ? <LoadingOutlined/> : <PlusOutlined/>}
|
|
|
+ <div style={{ marginTop: 8 }}>上传图片</div>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ return (
|
|
|
+ <div className="user-feedback">
|
|
|
+ <div className="feedback-input-panel">
|
|
|
+ <EditOutlined/> 反馈信息
|
|
|
+ <TextareaItem
|
|
|
+ rows={4}
|
|
|
+ placeholder="请输入您的问题...(400字以内)"
|
|
|
+ onChange={this.onTextChange}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div className="upload-panel">
|
|
|
+ <Upload
|
|
|
+ name="avatar"
|
|
|
+ listType="picture-card"
|
|
|
+ className="avatar-uploader"
|
|
|
+ showUploadList={false}
|
|
|
+ action={_baseURL + '/mobile/uploadAttachs.action'}
|
|
|
+ beforeUpload={this.beforeUpload}
|
|
|
+ onChange={this.handleChange}
|
|
|
+ >
|
|
|
+ {imageUrl ? <img src={imageUrl} alt="avatar" style={{ width: '100%' }}/> : uploadButton}
|
|
|
+ </Upload>
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
+ <div className="feedback-btn-panel">
|
|
|
+ <Button
|
|
|
+ className='feedback-btn-panel-button'
|
|
|
+ type="primary"
|
|
|
+ onClick={this.onCommit}
|
|
|
+ inline>提交</Button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ //提交
|
|
|
+ onCommit = () => {
|
|
|
+ }
|
|
|
+
|
|
|
+ //反馈内容
|
|
|
+ onTextChange = (val) => {
|
|
|
+ this.setState({
|
|
|
+ inputValue: val,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ getBase64 = (img, callback) => {
|
|
|
+ const reader = new FileReader()
|
|
|
+ reader.addEventListener('load', () => callback(reader.result))
|
|
|
+ reader.readAsDataURL(img)
|
|
|
+ }
|
|
|
+
|
|
|
+ beforeUpload = (file) => {
|
|
|
+ const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png'
|
|
|
+ if (!isJpgOrPng) {
|
|
|
+ Toast.fail('请只上传JPG/PNG文件!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (file.size && file.size > 100 * 1024 * 1024) {
|
|
|
+ Toast.fail('文件大小不能超过100M')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ handleChange = info => {
|
|
|
+ if (info.file.status === 'uploading') {
|
|
|
+ this.setState({ loading: true })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (info.file.status === 'done') {
|
|
|
+ // Get this url from response in real world.
|
|
|
+ this.getBase64(info.file.originFileObj, imageUrl =>
|
|
|
+ this.setState({
|
|
|
+ imageUrl,
|
|
|
+ loading: false,
|
|
|
+ }),
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+let mapStateToProps = (state) => ({})
|
|
|
+
|
|
|
+export default connect(mapStateToProps)(UserFeedback)
|