fix perm-bug ,add share-lib
This commit is contained in:
parent
f603906409
commit
4c9c3523a5
@ -221,7 +221,7 @@ export default {
|
||||
texts: []
|
||||
},
|
||||
// share_img
|
||||
imgAdminText: '管理',
|
||||
imgAdminText: '批量操作',
|
||||
imgAdmin: false,
|
||||
imgList: [],
|
||||
imgsNum: 0,
|
||||
@ -247,11 +247,11 @@ export default {
|
||||
],
|
||||
textsNum: 0,
|
||||
textAdmin: false,
|
||||
textAdminText: '管理',
|
||||
textAdminText: '批量操作',
|
||||
tempText: '',
|
||||
textsSelected: [],
|
||||
textCurrentPage: 1,
|
||||
textPageSize: 20
|
||||
textPageSize: 10
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
@ -259,10 +259,21 @@ export default {
|
||||
this.getImgs()
|
||||
this.getTexts()
|
||||
},
|
||||
watch: {
|
||||
selectedData: {
|
||||
handler: function(nVal) {
|
||||
this.exportData()
|
||||
},
|
||||
immediate: true,
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
//common
|
||||
exportData() {
|
||||
// TODO: $emit 传出选中数据
|
||||
this.$emit('selectMaterial', this.selectedData)
|
||||
console.log('传递')
|
||||
console.log(this.selectedData)
|
||||
},
|
||||
getMaterials(data) {
|
||||
return new Promise((resolve, reject) => {
|
||||
@ -300,6 +311,14 @@ export default {
|
||||
})
|
||||
})
|
||||
},
|
||||
clearSelections() {
|
||||
this.imgsSelected = []
|
||||
this.textsSelected = []
|
||||
this.selectedData = {
|
||||
imgs: [],
|
||||
texts: []
|
||||
}
|
||||
},
|
||||
// share_img
|
||||
getImgs() {
|
||||
this.getMaterials({
|
||||
@ -337,6 +356,8 @@ export default {
|
||||
imgSizeChange(val) {},
|
||||
imgPageChange(val) {
|
||||
this.imgCurrentPage = val
|
||||
this.selectedData.imgs = []
|
||||
this.imgsSelected = []
|
||||
this.getImgs()
|
||||
},
|
||||
clickImg(index) {
|
||||
@ -356,7 +377,7 @@ export default {
|
||||
adminImgs() {
|
||||
if (this.imgAdmin) {
|
||||
this.imgAdmin = false
|
||||
this.imgAdminText = '管理'
|
||||
this.imgAdminText = '批量操作'
|
||||
} else {
|
||||
this.imgAdmin = true
|
||||
this.imgAdminText = '关闭'
|
||||
@ -431,11 +452,12 @@ export default {
|
||||
getTexts() {
|
||||
this.getMaterials({
|
||||
type: 'text',
|
||||
currentPage: this.imgCurrentPage,
|
||||
pageSize: this.imgPageSize
|
||||
currentPage: this.textCurrentPage,
|
||||
pageSize: this.textPageSize
|
||||
})
|
||||
.then(data => {
|
||||
this.textList = data.records
|
||||
this.textsNum = data.total
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err)
|
||||
@ -444,7 +466,7 @@ export default {
|
||||
adminText() {
|
||||
if (this.textAdmin) {
|
||||
this.textAdmin = false
|
||||
this.textAdminText = '管理'
|
||||
this.textAdminText = '批量操作'
|
||||
} else {
|
||||
this.textAdmin = true
|
||||
this.textAdminText = '关闭'
|
||||
@ -452,8 +474,7 @@ export default {
|
||||
},
|
||||
textTableSelectionChange(val) {
|
||||
this.textsSelected = val
|
||||
this.selectedData.text = val
|
||||
console.log('change')
|
||||
this.selectedData.texts = val
|
||||
},
|
||||
textRowClick(row, column, event) {
|
||||
this.$refs.textTable.toggleRowSelection(row)
|
||||
@ -507,8 +528,8 @@ export default {
|
||||
console.log(err)
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
.catch(err => {
|
||||
console.log(err)
|
||||
this.$message.info('已取消删除!')
|
||||
})
|
||||
},
|
||||
|
1146
src/views/games/details/share/edit.1.vue
Normal file
1146
src/views/games/details/share/edit.1.vue
Normal file
File diff suppressed because it is too large
Load Diff
@ -455,6 +455,12 @@
|
||||
>
|
||||
<el-input v-model="shareGroupForm.share_word" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button
|
||||
class="w100"
|
||||
@click="openLib"
|
||||
>从素材库中选择</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer">
|
||||
<el-button @click="closeModalShareGroup">取 消</el-button>
|
||||
@ -465,6 +471,33 @@
|
||||
>确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
title="素材库"
|
||||
:visible.sync="modalLibVisible"
|
||||
width="700px"
|
||||
append-to-body
|
||||
top="3vh"
|
||||
:before-close="closeLib"
|
||||
>
|
||||
<el-alert
|
||||
title="最多只能选择【1】张图片和【1】句分享语,多选则取第一组!"
|
||||
type="warning"
|
||||
class="mgb-20"
|
||||
/>
|
||||
<share-lib
|
||||
@selectMaterial="getMaterial"
|
||||
ref="shareLib"
|
||||
/>
|
||||
<span slot="footer">
|
||||
<el-button @click="closeLib">取 消</el-button>
|
||||
<el-button
|
||||
v-if="permEdit"
|
||||
type="primary"
|
||||
@click="saveTempShare"
|
||||
>确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -484,6 +517,7 @@ import { getToken } from '@/utils/auth'
|
||||
import { mapGetters } from 'vuex'
|
||||
import getPageTitle from '@/utils/get-page-title'
|
||||
import { Promise, reject } from 'q'
|
||||
import ShareLib from '@/components/ShareLib'
|
||||
|
||||
export default {
|
||||
name: 'GameDetailsShareEdit',
|
||||
@ -597,12 +631,18 @@ export default {
|
||||
]
|
||||
},
|
||||
isNewGroup: true,
|
||||
groupIndex: 0
|
||||
groupIndex: 0,
|
||||
// modal - shareLib
|
||||
modalLibVisible: false,
|
||||
tempShareGroup: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['userInfo'])
|
||||
},
|
||||
components: {
|
||||
ShareLib
|
||||
},
|
||||
mounted() {
|
||||
this.uid = this.$route.params.uid
|
||||
this.isDev = this.$route.query.data_type === 'dev' ? true : false
|
||||
@ -850,6 +890,7 @@ export default {
|
||||
const data = this.shareForm
|
||||
data.isDev = true
|
||||
data.published = false
|
||||
data.uid = this.gameInfo._id
|
||||
this.saveShare(data)
|
||||
.then(data => {
|
||||
const shareId =
|
||||
@ -881,9 +922,11 @@ export default {
|
||||
const proData = JSON.parse(JSON.stringify(this.shareForm))
|
||||
devData.isDev = true
|
||||
devData.published = true
|
||||
devData.uid = this.gameInfo._id
|
||||
|
||||
proData.isDev = false
|
||||
proData.published = true
|
||||
proData.uid = this.gameInfo._id
|
||||
|
||||
submitArr.push(this.saveShare(devData))
|
||||
submitArr.push(this.saveShare(proData))
|
||||
@ -1121,6 +1164,28 @@ export default {
|
||||
closeModalShareGroup() {
|
||||
this.$refs['shareGroupForm'].clearValidate()
|
||||
this.modalShareGroupVisible = false
|
||||
},
|
||||
// modal - lib
|
||||
openLib() {
|
||||
this.modalLibVisible = true
|
||||
},
|
||||
closeLib() {
|
||||
this.modalLibVisible = false
|
||||
this.tempShareGroup = {}
|
||||
this.$refs.shareLib.clearSelections()
|
||||
},
|
||||
getMaterial(data) {
|
||||
this.tempShareGroup = data
|
||||
},
|
||||
saveTempShare() {
|
||||
const data = this.tempShareGroup
|
||||
if (data.texts.length > 0) {
|
||||
this.shareGroupForm.share_word = data.texts[0].text
|
||||
}
|
||||
if (data.imgs.length > 0) {
|
||||
this.shareGroupForm.share_image = data.imgs[0].url
|
||||
}
|
||||
this.closeLib()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -354,7 +354,8 @@ export default {
|
||||
|
||||
delShares({
|
||||
ids: ids,
|
||||
isDev: this.isDev
|
||||
isDev: this.isDev,
|
||||
uid: this.gameInfo._id
|
||||
}).then(res => {
|
||||
const { data } = res
|
||||
if (data.errcode === 0) {
|
||||
|
@ -15,7 +15,8 @@ export default {
|
||||
},
|
||||
components: {
|
||||
ShareLib
|
||||
}
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user