Browse Source

iconfont本地替换

yee 7 years ago
parent
commit
7ad5345ea8
3 changed files with 71 additions and 35 deletions
  1. 8 1
      css/base.less
  2. 53 30
      js/component/manageCenter/achievement/techAchievementDesc.jsx
  3. 10 4
      webpack.config.js

+ 8 - 1
css/base.less

@@ -46,4 +46,11 @@ body {
 //            } 
 //         }
 //     }
-// }
+// }
+@font-face {font-family: 'myiconfont';
+    src: url('./iconfont/iconfont.eot');
+    src: url('./iconfont/iconfont.eot?#iefix') format('embedded-opentype'),
+    url('./iconfont/iconfont.woff') format('woff'),
+    url('./iconfont/iconfont.ttf') format('truetype'),
+    url('./iconfont/iconfont.svg#myiconfont') format('svg');
+}

+ 53 - 30
js/component/manageCenter/achievement/techAchievementDesc.jsx

@@ -229,13 +229,21 @@ const AchievementDetailForm = Form.create()(React.createClass({
                 message.warning('关键词数量不能小于3个!');
             };
             //url转化
-            let thePictureUrl = [];
-            if (this.state.pictureUrl.length) {
+            let theTechnicalPictureUrl = [];
+            if (this.state.technicalPictureUrl.length) {
                 let picArr = [];
-                this.state.pictureUrl.map(function (item) {
+                this.state.technicalPictureUrl.map(function (item) {
                     picArr.push(item.response.data);
                 });
-                thePictureUrl = picArr.join(",");
+                theTechnicalPictureUrl = picArr.join(",");
+            };
+            let theMaturityPictureUrl = [];
+            if (this.state.maturityPictureUrl.length) {
+                let picArr = [];
+                this.state.maturityPictureUrl.map(function (item) {
+                    picArr.push(item.response.data);
+                });
+                theMaturityPictureUrl = picArr.join(",");
             };
             if (!err) {
                 this.setState({
@@ -245,35 +253,49 @@ const AchievementDetailForm = Form.create()(React.createClass({
                     method: "POST",
                     dataType: "json",
                     crossDomain: false,
-                    url: this.props.data.id ? globalConfig.context + '/api/admin/demand/update' : globalConfig.context + '/api/admin/demand/apply',
+                    url: this.props.data.id ? globalConfig.context + '/api/admin/achievement/update' : globalConfig.context + '/api/admin/achievement/apply',
                     data: {
                         id: this.props.data.id,
-                        dataCategory: this.props.detailApiUrl.indexOf('org') >= 0 ? 1 : 0,
+                        dataCategory: values.dataCategory,
                         serialNumber: this.props.data.serialNumber,
                         name: values.name,
                         keyword: this.state.tags ? this.state.tags.join(",") : [],
-                        infoSources: values.infoSources,
-                        industryCategoryA: values.industryCategory ? values.industryCategory[0] : undefined,
-                        industryCategoryB: values.industryCategory ? values.industryCategory[1] : undefined,
-                        demandType: values.demandType,
-                        problemDes: values.problemDes,
-                        technicalRequirements: values.technicalRequirements,
-                        pictureUrl: thePictureUrl,
-                        textFileUrl: this.state.textFileUrl,
-                        videoUrl: values.videoUrl,
-                        fixedBudget: values.fixedBudget,
-                        fixedCycle: values.fixedCycle,
-                        peopleNumber: values.peopleNumber,
-                        fixedScheme: values.fixedScheme,
-                        costEscrow: values.costEscrow,
-                        budgetCost: values.budgetCost,
-                        employerId: values.employerId || this.state.data.employerId,
+                        category: values.category,
+                        summary: values.summary,
+                        introduction: values.introduction,
+                        technicalPictureUrl: theTechnicalPictureUrl,
+                        fieldA: values.field ? values.field[0] : undefined,
+                        fieldB: values.field ? values.field[1] : undefined,
+                        maturity: values.maturity,
+                        maturityPictureUrl: theMaturityPictureUrl,
+                        maturityTextFileUrl: this.state.maturityTextFileUrl,
+                        maturityVideoUrl: values.maturityVideoUrl,
+                        innovation: values.innovation,
+                        ownerName: values.ownerName,
+                        ownerType: values.ownerType,
+                        ownerIdNumber: values.ownerIdNumber,
+                        ownerMobile: values.ownerMobile,
+                        ownerEmail: values.ownerEmail,
+                        ownerPostalAddress: values.ownerPostalAddress,
+                        cooperationMode: values.cooperationMode,
+                        transferMode: values.transferMode,
+                        bargainingMode: values.bargainingMode,
+                        transferPrice: values.transferPrice,
+                        technicalScene: values.technicalScene,
+                        breakthrough: values.breakthrough,
+                        patentCase: values.patentCase,
+                        awards: values.awards,
+                        teamDes: values.teamDes,
+                        parameter: values.parameter,
+                        orgId: values.orgId,
+                        orgName: values.orgName,
+                        orgAddress: values.orgAddress,
+                        orgEmail: values.orgEmail,
+                        orgContacts: values.orgContacts,
+                        orgContactsMobile: values.orgContactsMobile,
                         releaseStatus: values.releaseStatus,
-                        principalId: values.principalId,
-                        validityPeriodFormattedDate: values.validityPeriod ? values.validityPeriod.format('YYYY-MM-DD') : undefined,
-                        //
-                        contacts: values.contacts,
-                        status: this.state.status
+                        techPlanUrl: this.state.techPlanUrl,
+                        businessPlanUrl: this.state.businessPlanUrl
                     }
                 }).done(function (data) {
                     if (!data.error.length) {
@@ -499,7 +521,8 @@ const AchievementDetailForm = Form.create()(React.createClass({
                                     message.warning(info.file.response.error[0].message);
                                     return;
                                 };
-                                this.state.maturityTextFileUrl = info.file.response.data;
+                                this.state.maturityTextFileUrl,
+                                    maturity_video_url = info.file.response.data;
                             } else if (info.file.status === 'error') {
                                 message.error(`${info.file.name} 文件上传失败。`);
                             };
@@ -594,8 +617,8 @@ const AchievementDetailForm = Form.create()(React.createClass({
                     <FormItem className="half-item"
                         {...formItemLayout}
                         label="所属组织名称" >
-                        {getFieldDecorator('releaseStatus', {
-                            initialValue: theData.releaseStatus
+                        {getFieldDecorator('orgName', {
+                            initialValue: theData.orgName
                         })(
                             <Input />
                             )}

+ 10 - 4
webpack.config.js

@@ -9,8 +9,7 @@ const argv = require('yargs').argv;
 
 let theme = {
     '@primary-color': '#58a3ff',
-    '@link-color': '#58a3ff',
-    //'@icon-url':"'/css/iconfont/iconfont'"
+    '@link-color': '#58a3ff'
 };
 let isWatch = argv.env.deploy == 'watch';
 let isDev = isWatch || argv.env.deploy == 'dev';
@@ -182,6 +181,7 @@ module.exports = (function () {
             break;
     }
     staticHost = staticHost + '/' + version + '/';
+    theme['@icon-url'] = '"' + staticHost + 'css/iconfont/iconfont"'
     return {
         entry: isWatch ? entries.watch : entries.prod,
         output: {
@@ -232,8 +232,14 @@ module.exports = (function () {
                         }
                     }]
                 }, {
-                    test: /\.(woff|svg|eot|ttf)\??.*$/,
-                    loader: 'url-loader?name=fonts/[name].[md5:hash:hex:7].[ext]'
+                    test: /\.(woff|svg|eot|ttf)$/,
+                    use: [{
+                        loader: 'url-loader',
+                        options: {
+                            limit: 1,
+                            name: '[path][name].[ext]'
+                        }
+                    }]
                 }
             ]
         },