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