瀏覽代碼

添加购买前简介

HW 4 年之前
父節點
當前提交
2078f8234f

+ 39 - 5
js/component/administration/weapp/product/add.jsx

@@ -66,7 +66,7 @@ const PicturesWall = React.createClass({
                             this.props.type ==='video' ?
                                 "video/mp4,video/rmvb,video/mkv,video/avi,audio/mp3" : ''}
                     beforeUpload={beforeUploadFile}
-                    action={globalConfig.context + "/api/admin/customerCase/uploadFile"}
+                    action={globalConfig.context + "/api/admin/project/uploadFile"}
                     data={{ sign: "purchase_picture" }}
                     listType="picture-card"
                     fileList={fileList}
@@ -108,9 +108,11 @@ class Add extends Component{
             pictureVideoUrl: '',
             pictureImgUrl: '',
             content: '',
+            commodityContent: '',
             amount: '',
             projectList: [],
             host: 0,
+            commodityType: '',
         }
         this.getOrgCodeUrl = this.getOrgCodeUrl.bind(this);
         this.getVideoOrgCodeUrl = this.getVideoOrgCodeUrl.bind(this);
@@ -127,7 +129,14 @@ class Add extends Component{
     }
 
     getVideoOrgCodeUrl(e) {
-        this.setState({ pictureVideoUrl: e });
+        let str = e[0].type;
+        let index = str.indexOf("/");
+        let type =str.substring(0,index);
+        console.log(type)
+        this.setState({
+            pictureVideoUrl: e,
+            commodityType: type === 'video' ? 1 : type === 'audio' ? 2 : 0,
+        });
     }
 
     onOk(releaseStatus = 0){
@@ -151,8 +160,12 @@ class Add extends Component{
             message.warning('请上传略缩图');
             return false;
         }
+        if(!this.state.commodityContent){
+            message.warning('请输入未购买简介');
+            return false;
+        }
         if(!this.state.content){
-            message.warning('请输入简介');
+            message.warning('请输入已购买简介');
             return false;
         }
         this.setState({
@@ -168,10 +181,12 @@ class Add extends Component{
                 name: this.state.name || undefined,
                 sort:this.state.sort || undefined,
                 content: this.state.content || undefined,
+                commodityContent: this.state.commodityContent || undefined,
                 id: this.props.id || undefined,
                 type: this.state.projectType,
                 amount: this.state.amount || undefined,
                 commodityUrl: this.state.pictureVideoUrl[0].response.data || undefined,
+                commodityType: this.state.commodityType,
                 thumbnailUrl: this.state.pictureImgUrl[0].response.data || undefined,
                 host: this.state.host,
                 releaseStatus,
@@ -201,7 +216,7 @@ class Add extends Component{
             method: "get",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context + "/open/projectList",
+            url: globalConfig.context + "/open/projectTypeList",
             data: {}
         }).done((data1) => {
             if (data1.error.length !== 0) {
@@ -215,11 +230,13 @@ class Add extends Component{
                             name: this.props.infor.name,
                             sort:this.props.infor.sort,
                             content: this.props.infor.content,
+                            commodityContent: this.props.infor.commodityContent,
                             projectType: this.props.infor.type,
                             amount: this.props.infor.amount,
                             pictureVideoUrl: this.props.infor.commodityUrl ? splitUrl(this.props.infor.commodityUrl, ',', globalConfig.avatarHost + '/upload') : [],
                             pictureImgUrl: this.props.infor.thumbnailUrl ? splitUrl(this.props.infor.thumbnailUrl, ',', globalConfig.avatarHost + '/upload') : [],
                             host: this.props.infor.host,
+                            commodityType:this.props.infor.commodityType
                         })
                     }
                 });
@@ -368,7 +385,7 @@ class Add extends Component{
                                 <FormItem
                                     labelCol={{ span: 4 }}
                                     wrapperCol={{ span: 18 }}
-                                    label="简介"
+                                    label="未购买简介"
                                 >
                                     <Editors
                                         textContent={this.state.content}
@@ -381,6 +398,23 @@ class Add extends Component{
                                     />
                                 </FormItem>
                             </div>
+                            <div className="clearfix">
+                                <FormItem
+                                    labelCol={{ span: 4 }}
+                                    wrapperCol={{ span: 18 }}
+                                    label="已购买简介"
+                                >
+                                    <Editors
+                                        textContent={this.state.commodityContent}
+                                        uploadUrl={"/api/admin/news/uploadFile"}
+                                        globalConfig={globalConfig.uploadPath}
+                                        placeholder="内容(编辑器,支持图文音频等)"
+                                        handleRichText={value => {
+                                            this.setState({ commodityContent: value });
+                                        }}
+                                    />
+                                </FormItem>
+                            </div>
                         </div>
                         <div style={{display:'flex',justifyContent: 'center'}}>
                             <Button

+ 1 - 1
js/component/administration/weapp/productSort/index.jsx

@@ -116,7 +116,7 @@ class ProductSort extends Component{
             method: "get",
             dataType: "json",
             crossDomain: false,
-            url: globalConfig.context + "/open/projectList",
+            url: globalConfig.context + "/open/projectTypeList",
             data: {
                 pageNo: pageNo || 1,
                 pageSize: 10,