Przeglądaj źródła

新增功能:用户签名

chrislee 1 rok temu
rodzic
commit
4ed4c73077

+ 28 - 12
src/views/main-navbar-update-sign.vue

@@ -4,7 +4,7 @@
     :visible.sync="visible"
     :append-to-body="true">
     <el-form :model="dataForm" :rules="dataRule" ref="dataForm"  label-width="80px">
-      <upload-component :title="'个人签名'" :accept="'*'" :file-obj-list="fileList" @uploadSuccess="uploadSuccess"/>
+      <upload-component :title="'个人签名'" :accept="'.png,.jpeg,.jpg'" :file-obj-list="fileList" @uploadSuccess="uploadSuccess"/>
     </el-form>
     <span slot="footer">
       <el-button @click="visible = false">取消</el-button>
@@ -14,7 +14,6 @@
 </template>
 
 <script>
-  import { clearLoginInfo } from '@/utils'
   import { getMyInfo } from '@/api/my'
   import UploadComponent from './modules/common/upload-component'
   export default {
@@ -46,6 +45,14 @@
         getMyInfo().then(({data}) => {
           if (data && data.code === '200' && data.data) {
             this.dataForm = data.data
+            this.fileList = []
+            data.data.attachList.forEach((item) => {
+              this.fileList.push({
+                name: item.fileName,
+                url: item.url,
+                id: item.url
+              })
+            })
           }
         })
         this.visible = true
@@ -55,15 +62,29 @@
       },
       // 表单提交
       dataFormSubmit () {
+        let fList = this.fileList
+        if (!fList || fList.length === 0) {
+          this.$message.error('请上传文件')
+          return
+        }
+        if (fList.length > 1) {
+          this.$message.error('只能上传一个附件')
+          return
+        } else {
+          this.dataForm.attachList = []
+          for (let i = 0; i < fList.length; i++) {
+            this.dataForm.attachList.push({
+              fileName: fList[i].name,
+              url: fList[i].url
+            })
+          }
+        }
         this.$refs['dataForm'].validate((valid) => {
           if (valid) {
             this.$http({
-              url: this.$http.adornUrl('/biz-service/user/password'),
+              url: this.$http.adornUrl('/biz-service/personal/setSignInfo'),
               method: 'post',
-              data: this.$http.adornData({
-                'password': this.dataForm.password,
-                'newPassword': this.dataForm.newPassword
-              })
+              data: this.dataForm
             }).then(({data}) => {
               if (data && data.code === '200') {
                 this.$message({
@@ -72,11 +93,6 @@
                   duration: 1500,
                   onClose: () => {
                     this.visible = false
-                    this.$nextTick(() => {
-                      this.mainTabs = []
-                      clearLoginInfo()
-                      this.$router.replace({ name: 'login' })
-                    })
                   }
                 })
               } else {

+ 12 - 0
src/views/main-navbar.vue

@@ -45,6 +45,7 @@
             </span>
             <el-dropdown-menu slot="dropdown">
               <el-dropdown-item @click.native="updatePasswordHandle()">修改密码</el-dropdown-item>
+              <el-dropdown-item @click.native="updateSignHandle()">修改个人签名</el-dropdown-item>
               <el-dropdown-item @click.native="logoutHandle()">退出</el-dropdown-item>
             </el-dropdown-menu>
           </el-dropdown>
@@ -53,6 +54,7 @@
     </div>
     <!-- 弹窗, 修改密码 -->
     <update-password v-if="updatePasswordVisible" ref="updatePassowrd"></update-password>
+    <update-user-sign v-if="updateUserSignVisible" ref="updateUserSign"></update-user-sign>
     <Msg ref="msgDialog" @noticeAdded="noticeAdded"/>
     <youli-component v-if="previewVisible" ref="preview"/>
   </nav>
@@ -60,6 +62,7 @@
 
 <script>
   import UpdatePassword from './main-navbar-update-password'
+  import UpdateUserSign from './main-navbar-update-sign'
   import Msg from './common/msg'
   import { clearLoginInfo } from '@/utils'
   import PreviewComponent from '@/views/modules/common/preview-component'
@@ -69,6 +72,7 @@ export default {
     data () {
       return {
         updatePasswordVisible: false,
+        updateUserSignVisible: false,
         cnt: 0,
         previewVisible: false
       }
@@ -77,6 +81,7 @@ export default {
       YouliComponent,
       PreviewComponent,
       UpdatePassword,
+      UpdateUserSign,
       Msg
     },
     computed: {
@@ -106,6 +111,13 @@ export default {
           this.$refs.updatePassowrd.init()
         })
       },
+      // 修改个人签名
+      updateSignHandle () {
+        this.updateUserSignVisible = true
+        this.$nextTick(() => {
+          this.$refs.updateUserSign.init()
+        })
+      },
       // 退出
       logoutHandle () {
         this.$confirm(`确定进行[退出]操作?`, '提示', {

+ 24 - 4
src/views/modules/my/my-info.vue

@@ -11,6 +11,13 @@
         <e-desc-item label="权限角色">{{dataForm.userEntity?dataForm.userEntity.roleNames:''}}</e-desc-item>
 
         <e-desc-item label="状态" span="3">{{dataForm.userEntity?(Number(dataForm.userEntity.status) === 1?'正常':'禁用'):''}}</e-desc-item>
+
+        <e-desc-item v-if="dataForm.attachList" label="个人签名" span="3">
+          <div v-for="(item, index) in dataForm.attachList" style="display: inline">
+            <span v-if="index > 0">,</span>
+            <a :key="item.fileName + index" type="primary" href="#" @click="previewFile(item.fileName, item.url)">{{ item.fileName }}</a>
+          </div>
+        </e-desc-item>
       </e-desc>
       <e-desc title="掌握的工种" column="3">
         <el-table
@@ -118,6 +125,8 @@
           </el-table>
           </el-row>
       </div>
+      <!-- 文件预览 -->
+      <preview-component v-if="previewVisible" ref="preview"/>
     </div>
 </template>
 
@@ -125,11 +134,14 @@
   import EDesc from '../common/e-desc'
   import EDescItem from '../common/e-desc-item'
   import { getMyInfo, getPerformance } from '@/api/my'
+  import PreviewComponent from '@/views/modules/common/preview-component'
 
-  export default {
+export default {
     name: 'my-info',
     components: {
-      EDesc, EDescItem
+      PreviewComponent,
+      EDesc,
+      EDescItem
     },
     data () {
       return {
@@ -152,7 +164,8 @@
           'type': '合计金额',
           'count': '0',
           'amount': '0'
-        }]
+        }],
+        previewVisible: false
       }
     },
     created () {
@@ -165,7 +178,7 @@
             this.dataForm = data.data
           }
         })
-  
+
         let performanceParam = {
           startTime: this.performanceMonth + ' 00:00:00',
           endTime: this.performanceMonth + ' 23:59:59'
@@ -204,6 +217,13 @@
         } else if (val.typeIndex === 1) {
           this.$router.push('/production-damage')
         }
+      },
+      // 预览
+      previewFile (fileName, url) {
+        this.previewVisible = true
+        this.$nextTick(() => {
+          this.$refs.preview.init(fileName, url)
+        })
       }
     }
   }