feat: add image publish function, ONLY published image show in image wall page

This commit is contained in:
RockYang
2024-01-19 06:52:23 +08:00
parent 6fa08861f8
commit 0c59503edb
20 changed files with 147 additions and 20 deletions

View File

@@ -424,6 +424,12 @@
<div class="remove">
<el-button type="danger" :icon="Delete" @click="removeImage(scope.item)" circle/>
<el-button type="warning" v-if="scope.item.publish" @click="publishImage(scope.item, false)" circle>
<i class="iconfont icon-cancel-share"></i>
</el-button>
<el-button type="success" v-else @click="publishImage(scope.item, true)" circle>
<i class="iconfont icon-share-bold"></i>
</el-button>
</div>
</div>
</template>
@@ -442,7 +448,8 @@
<script setup>
import {onMounted, ref} from "vue"
import {
ChromeFilled, Delete,
ChromeFilled,
Delete,
DeleteFilled,
DocumentCopy,
InfoFilled,
@@ -744,6 +751,20 @@ const removeImage = (item) => {
})
}
// 发布图片到作品墙
const publishImage = (item, action) => {
let text = "图片发布"
if (action === false) {
text = "取消发布"
}
httpPost("/api/mj/publish", {id: item.id, action: action}).then(() => {
ElMessage.success(text + "成功")
item.publish = action
}).catch(e => {
ElMessage.error(text + "失败:" + e.message)
})
}
</script>
<style lang="stylus">