2
3
Prechádzať zdrojové kódy

修改支持内外网文件服务器

yuedefeng 6 rokov pred
rodič
commit
783bf5b2d9

+ 13 - 4
src/dashoo.cn/frontend_web/src/components/oilsupplier/auditfilelist.vue

@@ -12,7 +12,7 @@
       <!-- <el-table-column prop="NeedFileCode" label="分类编码" show-overflow-tooltip></el-table-column> -->
       <el-table-column prop="FileName" label="文件名称" show-overflow-tooltip>
         <template slot-scope="scope">
-            <a :href="'http://'+fileurlcut(scope.row.FileUrl)" target="_blank" class="buttonText">{{scope.row.FileName}}</a>
+            <el-link :href="'http://'+fileurlcut(scope.row.FileUrl)" target="_blank" type="primary">{{scope.row.FileName}}</el-link>
           </template>
       </el-table-column>
       <el-table-column prop="EffectDate" label="有效日期" show-overflow-tooltip>
@@ -368,7 +368,13 @@
       fileurlcut(val) {
         let fileurlall = val
         let fileurl = fileurlall.split("|")
-        return fileurl[0]
+        let retUrl = fileurl[0]
+        //内网服务器专用
+        if (process.client && retUrl.indexOf('/upfile') === 0) {
+          const myDomain = window.location.host
+          retUrl = myDomain + '/' + retUrl
+        }
+        return retUrl
       },
 
       beforeAvatarUpload(file) {
@@ -386,8 +392,11 @@
           axios.post(process.env.upfilehost, {})
             .then(function (res) {
               if (res.data && res.data.fid && res.data.fid !== '') {
-                option.action = `http://${myDomain}/${res.data.publicUrl}/${res.data.fid}`
-                //option.action = `http://${res.data.publicUrl}/${res.data.fid}`
+                if ( res.data.publicUrl.indexOf('/upfile') === 0 ) {
+                  option.action = `http://${myDomain}/${res.data.publicUrl}/${res.data.fid}`
+                } else {
+                  option.action = `http://${res.data.publicUrl}/${res.data.fid}`
+                }
                 _this.waituploads.push({
                   uid: option.file.uid,
                   url: res.data.publicUrl,

+ 14 - 4
src/dashoo.cn/frontend_web/src/components/oilsupplier/subfilelist.vue

@@ -35,7 +35,7 @@
         <el-table-column prop="FileUrlList" label="资质文件" show-overflow-tooltip>
           <template slot-scope="scope">
             <div v-for="(tmpUrl, index) in scope.row.FileUrlList">
-              <a :href="'http://'+fileurlcut(scope.row.FileUrl, index)" target="_blank" class="buttonText"  >{{scope.row.FileName.split('$')[index]}}</a>
+              <el-link :href="'http://'+fileurlcut(scope.row.FileUrl, index)" target="_blank" type="primary">{{scope.row.FileName.split('$')[index]}}</el-link>
             </div>
           </template>
         </el-table-column>
@@ -475,8 +475,12 @@
           axios.post(process.env.upfilehost, {})
             .then(function (res) {
               if (res.data && res.data.fid && res.data.fid !== '') {
-                option.action = `http://${myDomain}/${res.data.publicUrl}/${res.data.fid}`
-                //option.action = `http://${res.data.publicUrl}/${res.data.fid}`
+                  if ( res.data.publicUrl.indexOf('/upfile') === 0 ) {
+                    option.action = `http://${myDomain}/${res.data.publicUrl}/${res.data.fid}`
+                  } else {
+                    option.action = `http://${res.data.publicUrl}/${res.data.fid}`
+                  }
+
                 _this.waituploads.push({
                   uid: option.file.uid,
                   url: res.data.publicUrl,
@@ -548,7 +552,13 @@
       fileurlcut(val, index) {
         let fileurlall = val.split('$')[index]
         let fileurl = fileurlall.split("|")
-        return fileurl[0]
+        let retUrl = fileurl[0]
+        //内网服务器专用
+        if (process.client && retUrl.indexOf('/upfile') === 0) {
+          const myDomain = window.location.host
+          retUrl = myDomain + '/' + retUrl
+        }
+        return retUrl
       },
       jstimehandle(val) {
         if (val === '') {

+ 30 - 23
src/dashoo.cn/frontend_web/src/pages/documentmanage/_opera/edit.vue

@@ -368,34 +368,41 @@
       },
       uploadrequest(option) {
         let _this = this
-        axios.post(process.env.upfilehost, {})
-          .then(function (res) {
-            if (res.data && res.data.fid && res.data.fid !== '') {
-              option.action = `http://${res.data.publicUrl}/${res.data.fid}`
-              _this.waituploads.push({
-                uid: option.file.uid,
-                url: res.data.publicUrl,
-                fid: res.data.fid
-              })
-              //显示文档名称
-              if (_this.uploadform.Name == '') {
-                _this.uploadform.Name = _this.$refs.refuploadattach.uploadFiles[0].name
+        if (process.client) {
+          const myDomain = window.location.host
+          axios.post(process.env.upfilehost, {})
+            .then(function (res) {
+              if (res.data && res.data.fid && res.data.fid !== '') {
+                if (res.data.publicUrl.indexOf('/upfile') === 0) {
+                  option.action = `http://${myDomain}/${res.data.publicUrl}/${res.data.fid}`
+                } else {
+                  option.action = `http://${res.data.publicUrl}/${res.data.fid}`
+                }
+                _this.waituploads.push({
+                  uid: option.file.uid,
+                  url: res.data.publicUrl,
+                  fid: res.data.fid
+                })
+                //显示文档名称
+                if (_this.uploadform.Name == '') {
+                  _this.uploadform.Name = _this.$refs.refuploadattach.uploadFiles[0].name
+                }
+                uploadajax(option)
+              } else {
+                _this.$message({
+                  type: 'warning',
+                  message: '未上传成功!请刷新界面重新上传!'
+                })
               }
-              uploadajax(option)
-            } else {
+            })
+            .catch(function (error) {
+              console.log(error)
               _this.$message({
                 type: 'warning',
-                message: '未上传成功!请刷新界面重新上传!'
+                message: '未上传成功!请重新上传!'
               })
-            }
-          })
-          .catch(function (error) {
-            console.log(error)
-            _this.$message({
-              type: 'warning',
-              message: '未上传成功!请重新上传!'
             })
-          })
+        }
       },
       getattachissuccess() {
         this.uploadform.FileURL = ''

+ 28 - 21
src/dashoo.cn/frontend_web/src/pages/documentmanage/add.vue

@@ -336,31 +336,38 @@
       },
       uploadrequest(option) {
         let _this = this
-        axios.post(process.env.upfilehost, {})
-          .then(function (res) {
-            if (res.data && res.data.fid && res.data.fid !== '') {
-              option.action = `http://${res.data.publicUrl}/${res.data.fid}`
-              _this.waituploads.push({
-                uid: option.file.uid,
-                url: res.data.publicUrl,
-                fid: res.data.fid
-              })
-              // _this.uploadform.Name = _this.$refs.refuploadattach.uploadFiles[0].name //获取上传文件的文件名,并赋值给uploadform.Name
-              uploadajax(option)
-            } else {
+        if (process.client) {
+          const myDomain = window.location.host
+          axios.post(process.env.upfilehost, {})
+            .then(function (res) {
+              if (res.data && res.data.fid && res.data.fid !== '') {
+                if (res.data.publicUrl.indexOf('/upfile') === 0) {
+                  option.action = `http://${myDomain}/${res.data.publicUrl}/${res.data.fid}`
+                } else {
+                  option.action = `http://${res.data.publicUrl}/${res.data.fid}`
+                }
+                _this.waituploads.push({
+                  uid: option.file.uid,
+                  url: res.data.publicUrl,
+                  fid: res.data.fid
+                })
+                // _this.uploadform.Name = _this.$refs.refuploadattach.uploadFiles[0].name //获取上传文件的文件名,并赋值给uploadform.Name
+                uploadajax(option)
+              } else {
+                _this.$message({
+                  type: 'warning',
+                  message: '未上传成功!请刷新界面重新上传!'
+                })
+              }
+            })
+            .catch(function (error) {
+              console.log(error)
               _this.$message({
                 type: 'warning',
-                message: '未上传成功!请刷新界面重新上传!'
+                message: '未上传成功!请重新上传!'
               })
-            }
-          })
-          .catch(function (error) {
-            console.log(error)
-            _this.$message({
-              type: 'warning',
-              message: '未上传成功!请重新上传!'
             })
-          })
+        }
       },
       getattachissuccess() {
         this.uploadform.FileURL = ''

+ 14 - 6
src/dashoo.cn/frontend_web/src/pages/login.vue

@@ -231,12 +231,11 @@
           :data="noticeList"
           height="50%"
           style="width: 100%; height: 100vh;"
-          @row-click="DownloadFile"
         >
           <el-table-column prop="Name" label="通知标题">
             <template slot-scope="scope">
-              <i class="el-icon-caret-right"></i>
-              <a style="margin-left: 5px">{{ scope.row.Name }}</a>
+              <!--<i class="el-icon-caret-right"></i>-->
+              <el-link :href="getDownloadFile(scope.row.FileURL)"  target="_blank" type="primary">{{ scope.row.Name }}</el-link>
             </template>
           </el-table-column>
           <el-table-column prop="CreateOn" label="时间" width="141">
@@ -254,12 +253,11 @@
           :data="fileList"
           height="50%"
           style="width: 100%;  height: 100vh;"
-          @row-click="DownloadFile"
         >
           <el-table-column prop="Name" label="文件名">
             <template slot-scope="scope">
-              <i class="el-icon-caret-right"></i>
-              <a style="margin-left: 5px">{{ scope.row.Name }}</a>
+              <!--<i class="el-icon-caret-right"></i>-->
+              <el-link :href="getDownloadFile(scope.row.FileURL)"  target="_blank" type="primary">{{ scope.row.Name }}</el-link>
             </template>
           </el-table-column>
           <el-table-column prop="CreateOn" label="时间" width="141">
@@ -424,6 +422,16 @@ import api from "@/api/rtxservice/rtx";
       let urlArr = val.split("|");
       location.href = "http://" + urlArr[0];
     },
+    getDownloadFile(val) {
+      let urlArr = val.split("|")
+      let retUrl = urlArr[0]
+      //内网服务器专用
+      if (process.client && retUrl.indexOf('/upfile') === 0) {
+        const myDomain = window.location.host
+        retUrl = myDomain + '/' + retUrl
+      }
+      return "http://" + retUrl
+    },
     //格式化时间
     jstimehandle(val) {
       if (val === "") {

+ 16 - 5
src/dashoo.cn/frontend_web/src/pages/oilsupplier/companyaudit/index.vue

@@ -80,7 +80,7 @@
           </el-col>
           <el-col :span="24">
             <el-form-item label="法定代表人身份证号" label-width="150px" style="width: 100%" prop="LegalPersonId">
-              <el-input v-model="formData.LegalPersonId"  disabled></el-input>           
+              <el-input v-model="formData.LegalPersonId"  disabled></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="24">
@@ -100,12 +100,12 @@
           </el-col>
           <el-col :span="24">
             <el-form-item label="联系人姓名" label-width="150px" style="width: 100%" prop="ContactName">
-              <el-input v-model="formData.ContactName" disabled></el-input>           
+              <el-input v-model="formData.ContactName" disabled></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="24">
             <el-form-item label="联系人身份证号" label-width="150px" style="width: 100%" prop="ContactId">
-              <el-input v-model="formData.ContactId" disabled></el-input>           
+              <el-input v-model="formData.ContactId" disabled></el-input>
             </el-form-item>
           </el-col>
           <el-col :span="24">
@@ -261,7 +261,13 @@
         if (urlArr) {
           for (let i = 0; i < urlArr.length; i++) {
             let tempURL = urlArr[i].split('|')
-            _this.urlList.push('http://' + tempURL[0])
+            if (tempURL[0].indexOf('/upfile') === 0) {
+              const myDomain = window.location.host
+              _this.urlList.push('http://' + myDomain + tempURL[0])
+            } else {
+              _this.urlList.push('http://' + tempURL[0])
+            }
+
           }
         }
         _this.urlList2 = []
@@ -269,7 +275,12 @@
         if (urlArr2) {
           for (let i = 0; i < urlArr2.length; i++) {
             let tempURL = urlArr2[i].split('|')
-            _this.urlList2.push('http://' + tempURL[0])
+            if (tempURL[0].indexOf('/upfile') === 0) {
+              const myDomain = window.location.host
+              _this.urlList2.push('http://' + myDomain + tempURL[0])
+            } else {
+              _this.urlList2.push('http://' + tempURL[0])
+            }
           }
         }
       },

+ 27 - 19
src/dashoo.cn/frontend_web/src/pages/signup.vue

@@ -498,30 +498,38 @@
       //上传请求
       uploadRequest(option) {
         let _this = this
-        axios.post(process.env.upfilehost, {})
-          .then(function (res) {
-            if (res.data && res.data.fid && res.data.fid !== '') {
-              option.action = `http://${res.data.publicUrl}/${res.data.fid}`
-              _this.waituploads.push({
-                uid: option.file.uid,
-                url: res.data.publicUrl,
-                fid: res.data.fid
-              })
-              uploadajax(option)
-            } else {
+        if (process.client) {
+          const myDomain = window.location.host
+          axios.post(process.env.upfilehost, {})
+            .then(function (res) {
+              if (res.data && res.data.fid && res.data.fid !== '') {
+                if (res.data.publicUrl.indexOf('/upfile') === 0) {
+                  option.action = `http://${myDomain}/${res.data.publicUrl}/${res.data.fid}`
+                } else {
+                  option.action = `http://${res.data.publicUrl}/${res.data.fid}`
+                }
+
+                _this.waituploads.push({
+                  uid: option.file.uid,
+                  url: res.data.publicUrl,
+                  fid: res.data.fid
+                })
+                uploadajax(option)
+              } else {
+                _this.$message({
+                  type: 'warning',
+                  message: '未上传成功!请重新上传!'
+                })
+              }
+            })
+            .catch(function (error) {
+              console.log(error)
               _this.$message({
                 type: 'warning',
                 message: '未上传成功!请重新上传!'
               })
-            }
-          })
-          .catch(function (error) {
-            console.log(error)
-            _this.$message({
-              type: 'warning',
-              message: '未上传成功!请重新上传!'
             })
-          })
+        }
       },
 
       //获取上传文件的路径

+ 3 - 0
src/dashoo.cn/frontend_web/src/pages/system/usersetting.vue

@@ -135,6 +135,9 @@
       this.form.Email = this.authUser.Profile.Email
       this.form.Description = this.authUser.Profile.Description
       this.form.Photo = this.authUser.Profile.Photo
+      if (process.client) {
+        this.authUser.Profile.Host = window.location.host
+      }
       this.host = this.authUser.Profile.Host
       if (this.form.Photo !== '') {
         this.imageUrl = `http://${this.host}${this.form.Photo}`