Browse Source

更新字段

HW 4 years ago
parent
commit
0398d1f399

+ 5 - 0
js/component/administration/weapp/pay/index.jsx

@@ -41,6 +41,11 @@ class Pay extends Component{
                     key: 'createTimes'
                 },
                 {
+                    title: '支付产品',
+                    dataIndex: 'projectName',
+                    key: 'projectName'
+                },
+                {
                     title: '金额',
                     dataIndex: 'projectAmount',
                     key: 'projectAmount'

+ 17 - 13
js/component/administration/weapp/product/add.jsx

@@ -27,14 +27,16 @@ const PicturesWall = React.createClass({
     },
     handlePreview(file) {
         let type = '';
+
         if(file.type){
             let str = file.type;
             let index = str.indexOf("/");
-            type =str.substring(0,index);
+            type =str.substring(0,index) === 'video' ? 1 : str.substring(0,index) === 'audio' ? 2 : 0;
         }else{
-            let str = file.url || file.thumbUrl;
-            let index = str.indexOf(".");
-            type =str.substring(index+1);
+            // let str = file.url || file.thumbUrl;
+            // let index = str.lastIndexOf(".");
+            // type = str.substring(index+1);
+            type = this.props.type;
         }
         this.setState({
             type,
@@ -62,9 +64,11 @@ const PicturesWall = React.createClass({
             <div style={{ display: "inline-block" }}>
                 <Upload
                     accept={
-                        this.props.type ==='img' ? "image/*" :
-                            this.props.type ==='video' ?
-                                "video/mp4,video/rmvb,video/mkv,video/avi,audio/mp3" : ''}
+                        this.props.type === 0 ? "image/*" :
+                            this.props.type === 1 ?
+                                'video/mp4,video/rmvb,video/mkv,video/avi' :
+                                this.props.type === 2 ?
+                                "audio/mp3" : '*'}
                     beforeUpload={beforeUploadFile}
                     action={globalConfig.context + "/api/admin/project/uploadFile"}
                     data={{ sign: "purchase_picture" }}
@@ -82,13 +86,13 @@ const PicturesWall = React.createClass({
                     onCancel={this.handleCancel}
                 >
                     {
-                        this.state.type=== 'image' ?
+                        this.state.type=== 0 ?
                             <img alt="" style={{ width: "100%" }} src={previewImage} /> :
-                            this.state.type=== 'video' ?
+                            this.state.type=== 1 ?
                                 <video style={{width:'100%'}} controls="controls" autoPlay="" name="media">
                                     <source src={previewImage} type="video/mp4"/>
                                 </video>:
-                                this.state.type=== 'audio' ?
+                                this.state.type=== 2 ?
                                     <audio src={previewImage} controls="controls">Your browser does not support the audio element.</audio>: ''
                     }
                 </Modal>
@@ -133,7 +137,7 @@ class Add extends Component{
         if(e.length === 0){
             this.setState({
                 pictureVideoUrl: '',
-                commodityType: 0,
+                commodityType: '',
             });
         }else{
             let str = e[0].type;
@@ -386,7 +390,7 @@ class Add extends Component{
                                     label="缩略图"
                                 >
                                     <PicturesWall
-                                        type={'img'}
+                                        type={0}
                                         fileList={this.getOrgCodeUrl}
                                         pictureUrl={this.state.pictureImgUrl}
                                     />
@@ -400,7 +404,7 @@ class Add extends Component{
                                     label="视频/音频"
                                 >
                                     <PicturesWall
-                                        type={'video'}
+                                        type={this.state.commodityType}
                                         fileList={this.getVideoOrgCodeUrl}
                                         pictureUrl={this.state.pictureVideoUrl}
                                     />

+ 2 - 2
js/component/administration/weapp/user/index.jsx

@@ -22,8 +22,8 @@ class User extends Component{
                 },
                 {
                     title: '用户呢称',
-                    dataIndex: 'userName',
-                    key: 'userName'
+                    dataIndex: 'nickname',
+                    key: 'nickname'
                 },
                 {
                     title: '电话',

+ 18 - 10
js/component/richTextEditors.jsx

@@ -4,6 +4,7 @@ import { message } from 'antd';
 import ReactQuill,{Quill} from 'react-quill';
 import ajax from 'jquery/src/ajax/xhr.js';
 import $ from 'jquery/src/ajax';
+import audioIcon from '../../image/audio.png';
 
 
 let BlockEmbed = Quill.import('blots/block/embed');
@@ -41,7 +42,7 @@ var RichTextUploadUrl, RichTextUploadSign;
 //上传图片
 function uploadImg(s) {
     let myform = new FormData()
-    let file = document.getElementById("fileToUpload").files[0]
+    let file = document.getElementById("fileToUpload").files[0];
     if (!file) { return; };
     myform.append('file', file);
     myform.append('sign', RichTextUploadSign);
@@ -55,20 +56,22 @@ function uploadImg(s) {
         success: function (data) {
             if (data.error && data.error.length) {
                 message.warning(data.error[0].message);
+                document.getElementById("fileToUpload").value = ''
             } else {
                 const cursorPosition = s.quill.getSelection().index
-                // s.quill.insertEmbed(
-                //     cursorPosition,
-                //     "image",
-                //     globalConfig.avatarUploadHost + data.data
-                // );
                 s.quill.insertEmbed(
                     cursorPosition,
                     'AppPanelEmbed',
                     `<img style="width: 100%" src="${globalConfig.avatarUploadHost + data.data}"/>`
                 );
-                s.quill.setSelection(cursorPosition + 1)
+                s.quill.setSelection(cursorPosition + 1);
+                document.getElementById("fileToUpload").value = ''
             };
+        },
+        error: function(XMLHttpRequest, textStatus, errorThrown){
+            //查看错误信息
+            message("上传失败");
+            document.getElementById("fileToUpload").value = ''
         }
     })
 }
@@ -109,6 +112,7 @@ function uploadAudio(s) {
         success: function (data) {
             if (data.error && data.error.length) {
                 message.warning(data.error[0].message);
+                document.getElementById("fileToUploadAudio").value = ''
             } else {
                 const cursorPosition = s.quill.getSelection().index
                 s.quill.insertEmbed(
@@ -117,10 +121,12 @@ function uploadAudio(s) {
                     `<audio src="${globalConfig.avatarUploadHost + data.data}" controls="controls">Your browser does not support the audio element.</audio>`
                 );
                 s.quill.setSelection(cursorPosition + 1)
+                document.getElementById("fileToUploadAudio").value = ''
             };
 
         },
         error: function(XMLHttpRequest, textStatus, errorThrown){
+            document.getElementById("fileToUploadAudio").value = ''
             //查看错误信息
             message("上传失败");
         }
@@ -153,6 +159,7 @@ function uploadVideo(s) {
         success: function (data) {
             if (data.error && data.error.length) {
                 message.warning(data.error[0].message);
+                document.getElementById("fileToUploadVideo").value = ''
             } else {
                 const cursorPosition = s.quill.getSelection().index
                 s.quill.insertEmbed(
@@ -162,13 +169,14 @@ function uploadVideo(s) {
                             <source src=${globalConfig.avatarUploadHost + data.data} type="video/mp4">
                     </video>`
                 );
-                s.quill.setSelection(cursorPosition + 1)
+                s.quill.setSelection(cursorPosition + 1);
+                document.getElementById("fileToUploadVideo").value = ''
             };
 
         },
         error: function(XMLHttpRequest, textStatus, errorThrown){
+            document.getElementById("fileToUploadVideo").value = ''
             //查看错误信息
-            message("上传失败");
         }
     })
 }
@@ -186,7 +194,7 @@ const Editors = React.createClass({
         // this.props.handleRichText(value.replace(/iframe/g, 'video'));
     },
     componentDidMount() {
-        document.getElementsByClassName('ql-audio')[0].style = 'background: url("../../image/audio.png") no-repeat;background-size: contain;'
+        document.getElementsByClassName('ql-audio')[0].style = `background: url(${audioIcon}) no-repeat;background-size: contain;`
     },
     componentWillMount() {
         RichTextUploadUrl = this.props.uploadUrl;