Browse Source

views/disk DiskCam.vue 添加 cam 分享功能

reghao 6 months ago
parent
commit
b0e57c6d60
2 changed files with 64 additions and 4 deletions
  1. 3 2
      src/views/disk/DiskAlbumIndex.vue
  2. 61 2
      src/views/disk/DiskCam.vue

+ 3 - 2
src/views/disk/DiskAlbumIndex.vue

@@ -146,10 +146,11 @@ export default {
         albumName: null,
         fileType: 1001
       },
-      userContactList: [],
       // ****************************************************************************************************************
       showCreateShareDialog: false,
+      userContactList: [],
       createShareForm: {
+        albumType: 2,
         albumId: null,
         shareToList: []
       }
@@ -209,8 +210,8 @@ export default {
       }).finally(() => {
         this.showCreateShareDialog = false
         this.createShareForm = {
+          albumType: 2,
           albumId: null,
-          expireAt: null,
           shareToList: []
         }
       })

+ 61 - 2
src/views/disk/DiskCam.vue

@@ -5,6 +5,7 @@
         <el-card v-if="camDetail !== null" class="box-card">
           <div slot="header" class="clearfix">
             <span>{{ camDetail.camName }}</span>
+            <el-button style="float: right; padding: 3px 0" type="text" @click="onShareCam">分享</el-button>
           </div>
           <div class="text item">
             <span v-if="camDetail.onLive">
@@ -112,11 +113,38 @@
         </el-calendar>
       </div>
     </el-dialog>
+
+    <el-dialog
+      :visible.sync="showCreateShareDialog"
+      width="100%"
+      center
+    >
+      <div>
+        <el-form ref="createAlbumForm" :model="createShareForm">
+          <el-form-item label="选择用户" label-width="120px" prop="title">
+            <el-checkbox-group v-model="createShareForm.shareToList">
+              <el-checkbox v-for="user in userContactList" :key="user.userIdStr" :label="user.username" />
+            </el-checkbox-group>
+          </el-form-item>
+          <el-button
+            type="primary"
+            plain
+            size="small"
+            icon="el-icon-plus"
+            style="margin-left: 10px"
+            @click="createShare"
+          >
+            分享相册
+          </el-button>
+        </el-form>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import { getCamDetail, getCamKeyValue, getRecordByMonth, getRecordUrl, submitActivity } from '@/api/disk'
+import { createShare, getCamDetail, getCamKeyValue, getRecordByMonth, getRecordUrl, submitActivity } from '@/api/disk'
+import { getUserContact } from '@/api/user'
 
 export default {
   name: 'DiskCam',
@@ -134,7 +162,15 @@ export default {
       dataList: [],
       showCalenderDialog: false,
       camDetail: null,
-      camRecordDetail: null
+      camRecordDetail: null,
+      // ****************************************************************************************************************
+      showCreateShareDialog: false,
+      userContactList: [],
+      createShareForm: {
+        albumType: 1,
+        albumId: null,
+        shareToList: []
+      }
     }
   },
   watch: {
@@ -261,6 +297,29 @@ export default {
           message: '已取消'
         })
       })
+    },
+    onShareCam() {
+      this.createShareForm.albumId = this.camDetail.camId
+      getUserContact(1).then(resp => {
+        if (resp.code === 0) {
+          this.userContactList = resp.data
+          this.showCreateShareDialog = true
+        } else {
+          this.$message.error(resp.msg)
+        }
+      })
+    },
+    createShare() {
+      createShare(this.createShareForm).then(resp => {
+        this.$message.info(resp.msg)
+      }).finally(() => {
+        this.showCreateShareDialog = false
+        this.createShareForm = {
+          albumType: 1,
+          albumId: null,
+          shareToList: []
+        }
+      })
     }
   }
 }