fix some error and warning
This commit is contained in:
parent
fe5c9fd1a9
commit
8db8241295
@ -6,7 +6,7 @@ export interface IRewardData {
|
|||||||
rank?: number,
|
rank?: number,
|
||||||
rankEnd?: number,
|
rankEnd?: number,
|
||||||
coupon?: string,
|
coupon?: string,
|
||||||
count: number
|
count?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IActivityData {
|
export interface IActivityData {
|
||||||
@ -22,7 +22,7 @@ export interface IActivityData {
|
|||||||
beginTime: number[]
|
beginTime: number[]
|
||||||
prepareTime: number
|
prepareTime: number
|
||||||
active: number,
|
active: number,
|
||||||
beginDays?: number[],
|
beginDays: number[],
|
||||||
beginDay?: number,
|
beginDay?: number,
|
||||||
endDay?: number,
|
endDay?: number,
|
||||||
rewardInfo: IRewardData[]
|
rewardInfo: IRewardData[]
|
||||||
@ -33,6 +33,7 @@ export const defaultRewardData: IRewardData = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const defaultActivityData: IActivityData = {
|
export const defaultActivityData: IActivityData = {
|
||||||
|
beginDays: [],
|
||||||
active: 0,
|
active: 0,
|
||||||
beginTime: [],
|
beginTime: [],
|
||||||
monthDays: [],
|
monthDays: [],
|
||||||
|
@ -18,6 +18,7 @@ export interface IAreaData {
|
|||||||
adcode: string
|
adcode: string
|
||||||
type: number
|
type: number
|
||||||
location: ILocation
|
location: ILocation
|
||||||
|
showStr?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function queryArea(str: string, region: string) {
|
export async function queryArea(str: string, region: string) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
export const getPermissions = (params: any) =>
|
export const getPermissions = (params?: any) =>
|
||||||
request({
|
request({
|
||||||
url: '/permissions',
|
url: '/permissions',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
|
@ -4,7 +4,8 @@ import { IShopData } from './types'
|
|||||||
export const defaultShopData: IShopData = {
|
export const defaultShopData: IShopData = {
|
||||||
name: '',
|
name: '',
|
||||||
address: '',
|
address: '',
|
||||||
logo: ''
|
logo: '',
|
||||||
|
qtypes: []
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getShops = (params: any) =>
|
export const getShops = (params: any) =>
|
||||||
|
3
src/api/types.d.ts
vendored
3
src/api/types.d.ts
vendored
@ -26,5 +26,6 @@ export interface IShopData {
|
|||||||
lat?: number
|
lat?: number
|
||||||
showName?: string
|
showName?: string
|
||||||
extData?: string
|
extData?: string
|
||||||
category?: string
|
category?: string,
|
||||||
|
qtypes: string[]
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
|
|
||||||
|
|
||||||
<el-form
|
<el-form
|
||||||
ref="postForm"
|
ref="postForm"
|
||||||
:model="postForm"
|
:model="postForm"
|
||||||
@ -216,7 +215,7 @@
|
|||||||
show-checkbox
|
show-checkbox
|
||||||
accordion
|
accordion
|
||||||
node-key="id"
|
node-key="id"
|
||||||
ref="tree"
|
ref="typeTree"
|
||||||
highlight-current
|
highlight-current
|
||||||
:default-checked-keys="typeSelected"
|
:default-checked-keys="typeSelected"
|
||||||
:props="defaultProps">
|
:props="defaultProps">
|
||||||
@ -367,11 +366,11 @@ import MaterialInput from '@/components/MaterialInput/index.vue'
|
|||||||
import Sticky from '@/components/Sticky/index.vue'
|
import Sticky from '@/components/Sticky/index.vue'
|
||||||
import UploadImage from '@/components/UploadImage/index.vue'
|
import UploadImage from '@/components/UploadImage/index.vue'
|
||||||
import RegionPicker from '@/components/RegionPicker/index.vue'
|
import RegionPicker from '@/components/RegionPicker/index.vue'
|
||||||
import { Form } from 'element-ui'
|
|
||||||
import Tinymce from '@/components/Tinymce/index.vue'
|
import Tinymce from '@/components/Tinymce/index.vue'
|
||||||
import { getShops } from '@/api/shop'
|
import { getShops } from '@/api/shop'
|
||||||
import {
|
import {
|
||||||
defaultActivityData, defaultRewardData,
|
defaultActivityData,
|
||||||
|
defaultRewardData,
|
||||||
getActivity,
|
getActivity,
|
||||||
IRewardData,
|
IRewardData,
|
||||||
saveActivity
|
saveActivity
|
||||||
@ -379,8 +378,9 @@ import {
|
|||||||
import { sec2TimeStr, timeStr2Sec } from '@/utils'
|
import { sec2TimeStr, timeStr2Sec } from '@/utils'
|
||||||
import { getAllCategory } from '@/api/question'
|
import { getAllCategory } from '@/api/question'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
import { getCoupons } from '@/api/coupon'
|
import { getCoupons, ICouponData } from '@/api/coupon'
|
||||||
import { deleteAdmin } from '@/api/admins'
|
import { IShopData } from '@/api/types'
|
||||||
|
import { ElTree } from 'element-ui/types/tree'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
name: 'ActivityEditor',
|
name: 'ActivityEditor',
|
||||||
@ -393,7 +393,6 @@ import { deleteAdmin } from '@/api/admins'
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
export default class extends Vue {
|
export default class extends Vue {
|
||||||
|
|
||||||
private validateRequire = (rule: any, value: string, callback: Function) => {
|
private validateRequire = (rule: any, value: string, callback: Function) => {
|
||||||
if (value === '') {
|
if (value === '') {
|
||||||
if (rule.field === 'imageURL') {
|
if (rule.field === 'imageURL') {
|
||||||
@ -412,8 +411,9 @@ export default class extends Vue {
|
|||||||
callback()
|
callback()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private activeName = 'first'
|
private activeName = 'first'
|
||||||
private monthDays = []
|
private monthDays: {id: number, label: string}[] = []
|
||||||
private repeatTypes = [
|
private repeatTypes = [
|
||||||
{ id: 0, label: '指定日期' },
|
{ id: 0, label: '指定日期' },
|
||||||
{ id: 1, label: '每日' },
|
{ id: 1, label: '每日' },
|
||||||
@ -421,6 +421,7 @@ export default class extends Vue {
|
|||||||
{ id: 3, label: '每月' },
|
{ id: 3, label: '每月' },
|
||||||
{ id: 9, label: '随时(一般测试用)' }
|
{ id: 9, label: '随时(一般测试用)' }
|
||||||
]
|
]
|
||||||
|
|
||||||
private weekDays = [
|
private weekDays = [
|
||||||
{ id: 0, label: '周日' },
|
{ id: 0, label: '周日' },
|
||||||
{ id: 1, label: '周一' },
|
{ id: 1, label: '周一' },
|
||||||
@ -430,16 +431,17 @@ export default class extends Vue {
|
|||||||
{ id: 5, label: '周五' },
|
{ id: 5, label: '周五' },
|
||||||
{ id: 6, label: '周六' }
|
{ id: 6, label: '周六' }
|
||||||
]
|
]
|
||||||
|
|
||||||
private dataRange: Date[] = []
|
private dataRange: Date[] = []
|
||||||
private selectDate: Date[] = []
|
private selectDate: Date[] = []
|
||||||
private times = []
|
private times: string[] = []
|
||||||
private selectTime: string[] = []
|
private selectTime: string[] = []
|
||||||
|
|
||||||
private postForm = Object.assign({}, defaultActivityData)
|
private postForm = Object.assign({}, defaultActivityData)
|
||||||
private loading = false
|
private loading = false
|
||||||
private allDepts = []
|
private allDepts: IShopData[] = []
|
||||||
private typeOptions: {id: string, label: string, children?: any[]}[] = []
|
private typeOptions: {id: string, label: string, children?: any[]}[] = []
|
||||||
private typeSelected = []
|
private typeSelected: string[] = []
|
||||||
private defaultProps = {
|
private defaultProps = {
|
||||||
children: 'children',
|
children: 'children',
|
||||||
label: 'label'
|
label: 'label'
|
||||||
@ -451,22 +453,26 @@ export default class extends Vue {
|
|||||||
|
|
||||||
private tempTagView?: ITagView
|
private tempTagView?: ITagView
|
||||||
|
|
||||||
|
|
||||||
private dialogType = 'new'
|
private dialogType = 'new'
|
||||||
private record: IRewardData = {}
|
private record: IRewardData = {}
|
||||||
private dialogVisible = false
|
private dialogVisible = false
|
||||||
private modalRules = {
|
private modalRules = {
|
||||||
rank: [{ required: true, message: '请输入排名', trigger: 'blur' },
|
rank: [{ required: true, message: '请输入排名', trigger: 'blur' }
|
||||||
],
|
]
|
||||||
}
|
}
|
||||||
private coupons = []
|
|
||||||
|
|
||||||
|
private coupons: ICouponData[] = []
|
||||||
|
|
||||||
|
$refs!: {
|
||||||
|
modalForm: HTMLFormElement
|
||||||
|
postForm: HTMLFormElement
|
||||||
|
typeTree: ElTree<any, any>
|
||||||
|
}
|
||||||
|
|
||||||
get lang() {
|
get lang() {
|
||||||
return AppModule.language
|
return AppModule.language
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async created() {
|
async created() {
|
||||||
this.initTimes()
|
this.initTimes()
|
||||||
const id = this.$route.params?.id
|
const id = this.$route.params?.id
|
||||||
@ -478,12 +484,6 @@ export default class extends Vue {
|
|||||||
this.tempTagView = Object.assign({}, this.$route)
|
this.tempTagView = Object.assign({}, this.$route)
|
||||||
}
|
}
|
||||||
|
|
||||||
deactivated() {
|
|
||||||
}
|
|
||||||
|
|
||||||
activated() {
|
|
||||||
}
|
|
||||||
|
|
||||||
private async fetchData(id: string) {
|
private async fetchData(id: string) {
|
||||||
try {
|
try {
|
||||||
const { data } = await getActivity(id, { /* Your params here */ })
|
const { data } = await getActivity(id, { /* Your params here */ })
|
||||||
@ -491,13 +491,13 @@ export default class extends Vue {
|
|||||||
this.postForm = data
|
this.postForm = data
|
||||||
this.selectTime = []
|
this.selectTime = []
|
||||||
if (data.beginTime) {
|
if (data.beginTime) {
|
||||||
for (let str of data.beginTime) {
|
for (const str of data.beginTime) {
|
||||||
this.selectTime.push(sec2TimeStr(str, false))
|
this.selectTime.push(sec2TimeStr(str, false))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.selectDate = []
|
this.selectDate = []
|
||||||
if (data.beginDays) {
|
if (data.beginDays) {
|
||||||
for (let sub of data.beginDays) {
|
for (const sub of data.beginDays) {
|
||||||
this.selectDate.push(new Date(sub))
|
this.selectDate.push(new Date(sub))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -520,33 +520,32 @@ export default class extends Vue {
|
|||||||
private setTagsViewTitle(title: string) {
|
private setTagsViewTitle(title: string) {
|
||||||
const tagView = this.tempTagView
|
const tagView = this.tempTagView
|
||||||
if (tagView) {
|
if (tagView) {
|
||||||
tagView.title = `${ title }-${ this.postForm._id }`
|
tagView.title = `${title}-${this.postForm._id}`
|
||||||
TagsViewModule.updateVisitedView(tagView)
|
TagsViewModule.updateVisitedView(tagView)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private setPageTitle(title: string) {
|
private setPageTitle(title: string) {
|
||||||
document.title = `${ title } - ${ this.postForm._id }`
|
document.title = `${title} - ${this.postForm._id}`
|
||||||
}
|
}
|
||||||
|
|
||||||
private async submitForm() {
|
private async submitForm() {
|
||||||
const form = <Form>this.$refs.postForm
|
|
||||||
try {
|
try {
|
||||||
await form.validate()
|
await this.$refs.postForm.validate()
|
||||||
let times = []
|
const times = []
|
||||||
for (let str of this.selectTime) {
|
for (const str of this.selectTime) {
|
||||||
times.push(timeStr2Sec(str))
|
times.push(timeStr2Sec(str))
|
||||||
}
|
}
|
||||||
this.postForm.beginTime = times
|
this.postForm.beginTime = times
|
||||||
this.postForm.beginDays.length = 0
|
this.postForm.beginDays.length = 0
|
||||||
for (let d of this.selectDate) {
|
for (const d of this.selectDate) {
|
||||||
this.postForm.beginDays.push(d.getTime())
|
this.postForm.beginDays.push(d.getTime())
|
||||||
}
|
}
|
||||||
if (this.dataRange.length > 1) {
|
if (this.dataRange.length > 1) {
|
||||||
this.postForm.beginDay = this.dataRange[0].getTime()
|
this.postForm.beginDay = this.dataRange[0].getTime()
|
||||||
this.postForm.endDay = this.dataRange[1].getTime()
|
this.postForm.endDay = this.dataRange[1].getTime()
|
||||||
}
|
}
|
||||||
this.postForm.qtypes = this.$refs.tree.getCheckedKeys()
|
this.postForm.qtypes = this.$refs.typeTree.getCheckedKeys()
|
||||||
this.loading = true
|
this.loading = true
|
||||||
const { data } = await saveActivity(this.postForm)
|
const { data } = await saveActivity(this.postForm)
|
||||||
this.postForm = data
|
this.postForm = data
|
||||||
@ -575,7 +574,6 @@ export default class extends Vue {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getRemoteDeptList() {
|
private async getRemoteDeptList() {
|
||||||
@ -584,21 +582,21 @@ export default class extends Vue {
|
|||||||
this.allDepts = data.records
|
this.allDepts = data.records
|
||||||
}
|
}
|
||||||
|
|
||||||
private dataChange(val: any) {
|
private dataChange(_: any) {
|
||||||
console.log(this.selectDate)
|
console.log(this.selectDate)
|
||||||
}
|
}
|
||||||
|
|
||||||
private initTimes() {
|
private initTimes() {
|
||||||
for (let i = 0; i < 24; i++) {
|
for (let i = 0; i < 24; i++) {
|
||||||
for (let j = 0; j < 4; j++) {
|
for (let j = 0; j < 4; j++) {
|
||||||
let secs = i * 3600 + j * 15 * 60
|
const secs = i * 3600 + j * 15 * 60
|
||||||
let label = sec2TimeStr(secs, false)
|
const label = sec2TimeStr(secs, false)
|
||||||
this.times.push(label)
|
this.times.push(label)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.monthDays.push({ id: 0, label: '全选' })
|
this.monthDays.push({ id: 0, label: '全选' })
|
||||||
for (let i = 1; i < 32; i++) {
|
for (let i = 1; i < 32; i++) {
|
||||||
this.monthDays.push({ id: i, label: i })
|
this.monthDays.push({ id: i, label: i + '' })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -612,7 +610,6 @@ export default class extends Vue {
|
|||||||
this.selectTime.splice(this.selectTime.length - 1, 1, lastVal)
|
this.selectTime.splice(this.selectTime.length - 1, 1, lastVal)
|
||||||
console.log(this.selectTime)
|
console.log(this.selectTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private monthDaysChange(days: number[]) {
|
private monthDaysChange(days: number[]) {
|
||||||
@ -636,8 +633,8 @@ export default class extends Vue {
|
|||||||
}
|
}
|
||||||
if (this.postForm.shop) {
|
if (this.postForm.shop) {
|
||||||
let currentShop
|
let currentShop
|
||||||
for (let p of this.allDepts) {
|
for (const p of this.allDepts) {
|
||||||
if (p._id == this.postForm.shop) {
|
if (p._id === this.postForm.shop) {
|
||||||
currentShop = p
|
currentShop = p
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -647,7 +644,7 @@ export default class extends Vue {
|
|||||||
} else {
|
} else {
|
||||||
this.typeSelected = []
|
this.typeSelected = []
|
||||||
}
|
}
|
||||||
this.$refs.tree.setCheckedKeys(this.typeSelected)
|
this.$refs.typeTree.setCheckedKeys(this.typeSelected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -669,32 +666,36 @@ export default class extends Vue {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// begin of award list
|
// begin of award list
|
||||||
private async getCouponList(shop: string) {
|
private async getCouponList(shop: string) {
|
||||||
const { data } = await getCoupons({shop})
|
const { data } = await getCoupons({ shop })
|
||||||
this.coupons = data.records
|
this.coupons = data.records
|
||||||
}
|
}
|
||||||
|
|
||||||
private formatCoupon(row: number, column: number, cellValue: string, index: number) {
|
private formatCoupon(row: number, column: number, cellValue: string, index: number) {
|
||||||
let result = `未知(${cellValue})`
|
let result = `未知(${cellValue})`
|
||||||
let data = this.postForm.rewardInfo[index]
|
const data = this.postForm.rewardInfo[index]
|
||||||
for (const dep of this.coupons) {
|
for (const dep of this.coupons) {
|
||||||
if (dep._id == cellValue) {
|
if (dep._id === cellValue) {
|
||||||
result = dep.name
|
result = dep.name
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return `${result} x ${data.count}`
|
return `${result} x ${data.count}`
|
||||||
}
|
}
|
||||||
|
|
||||||
private formatRank(row: number, column: number, cellValue: string, index: number) {
|
private formatRank(row: number, column: number, cellValue: string, index: number) {
|
||||||
let data = this.postForm.rewardInfo[index]
|
const data = this.postForm.rewardInfo[index]
|
||||||
let result = `第 ${data.rank} 名`
|
let result = `第 ${data.rank} 名`
|
||||||
if (data.rankEnd) {
|
if (data.rankEnd) {
|
||||||
result = `第 ${data.rank} 至 ${data.rankEnd} 名`
|
result = `第 ${data.rank} 至 ${data.rankEnd} 名`
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
private async deleteRank(scope: any) {
|
private async deleteRank(scope: any) {
|
||||||
const { $index, row } = scope
|
const { $index } = scope
|
||||||
try {
|
try {
|
||||||
await this.$confirm('Confirm to remove the record?', 'Warning', {
|
await this.$confirm('Confirm to remove the record?', 'Warning', {
|
||||||
confirmButtonText: 'Confirm',
|
confirmButtonText: 'Confirm',
|
||||||
@ -709,8 +710,8 @@ export default class extends Vue {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleCreateReward() {
|
private handleCreateReward() {
|
||||||
this.record = Object.assign({}, defaultRewardData)
|
this.record = Object.assign({}, defaultRewardData)
|
||||||
this.record.id = this.postForm.rewardInfo.length
|
this.record.id = this.postForm.rewardInfo.length
|
||||||
@ -721,16 +722,17 @@ export default class extends Vue {
|
|||||||
private handleEdit(scope: any) {
|
private handleEdit(scope: any) {
|
||||||
this.dialogType = 'edit'
|
this.dialogType = 'edit'
|
||||||
this.dialogVisible = true
|
this.dialogVisible = true
|
||||||
this.checkStrictly = true
|
|
||||||
this.record = cloneDeep(scope.row)
|
this.record = cloneDeep(scope.row)
|
||||||
}
|
}
|
||||||
|
|
||||||
private closeModal() {
|
private closeModal() {
|
||||||
this.dialogVisible = false
|
this.dialogVisible = false
|
||||||
this.$refs.modalForm.clearValidate()
|
this.$refs.modalForm.clearValidate()
|
||||||
}
|
}
|
||||||
|
|
||||||
private saveReward() {
|
private saveReward() {
|
||||||
const isEdit = this.dialogType === 'edit'
|
const isEdit = this.dialogType === 'edit';
|
||||||
this.$refs.modalForm.validate(async(valid: boolean) => {
|
(this.$refs.modalForm as HTMLFormElement).validate(async(valid: boolean) => {
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
this.$message.error('请按要求填写表单')
|
this.$message.error('请按要求填写表单')
|
||||||
return false
|
return false
|
||||||
@ -760,28 +762,4 @@ export default class extends Vue {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.createPost-container {
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
.createPost-main-container {
|
|
||||||
padding: 40px 45px 20px 50px;
|
|
||||||
|
|
||||||
.postInfo-container {
|
|
||||||
position: relative;
|
|
||||||
@include clearfix;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
|
|
||||||
.postInfo-container-item {
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.word-counter {
|
|
||||||
width: 40px;
|
|
||||||
position: absolute;
|
|
||||||
right: 10px;
|
|
||||||
top: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -159,7 +159,7 @@ export default class extends Vue {
|
|||||||
private total = 0
|
private total = 0
|
||||||
private list: IQuestionData[] = []
|
private list: IQuestionData[] = []
|
||||||
private listLoading = true
|
private listLoading = true
|
||||||
private allDepts = []
|
private allDepts: IShopData[] = []
|
||||||
private listQuery = {
|
private listQuery = {
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 20,
|
limit: 20,
|
||||||
|
@ -94,12 +94,9 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Vue } from 'vue-property-decorator'
|
import { Component, Vue } from 'vue-property-decorator'
|
||||||
import { IShopData } from '@/api/types'
|
|
||||||
import Pagination from '@/components/Pagination/index.vue'
|
import Pagination from '@/components/Pagination/index.vue'
|
||||||
import { deleteShop, getShops } from '@/api/shop'
|
|
||||||
import { parseTime } from '@/utils'
|
import { parseTime } from '@/utils'
|
||||||
import { Form } from 'element-ui'
|
import { Form } from 'element-ui'
|
||||||
import { deleteCoupon, getCoupons } from '@/api/coupon'
|
|
||||||
import { deleteGame, getGames, IGameData } from '@/api/game'
|
import { deleteGame, getGames, IGameData } from '@/api/game'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -86,7 +86,6 @@ export default class extends Vue {
|
|||||||
private total = 0
|
private total = 0
|
||||||
private list: IGameData[] = []
|
private list: IGameData[] = []
|
||||||
private listLoading = true
|
private listLoading = true
|
||||||
private loading = false
|
|
||||||
private shop = ''
|
private shop = ''
|
||||||
private allDepts = []
|
private allDepts = []
|
||||||
private gameid = ''
|
private gameid = ''
|
||||||
@ -98,7 +97,6 @@ export default class extends Vue {
|
|||||||
hasVersion: 1
|
hasVersion: 1
|
||||||
}
|
}
|
||||||
|
|
||||||
private value1 = true
|
|
||||||
|
|
||||||
async created() {
|
async created() {
|
||||||
await this.getList()
|
await this.getList()
|
||||||
|
@ -121,7 +121,7 @@
|
|||||||
import { Component, Vue } from 'vue-property-decorator'
|
import { Component, Vue } from 'vue-property-decorator'
|
||||||
import { IShopData } from '@/api/types'
|
import { IShopData } from '@/api/types'
|
||||||
import Pagination from '@/components/Pagination/index.vue'
|
import Pagination from '@/components/Pagination/index.vue'
|
||||||
import { deleteShop, getShops } from '@/api/shop'
|
import { getShops } from '@/api/shop'
|
||||||
import { parseTime } from '@/utils'
|
import { parseTime } from '@/utils'
|
||||||
import { Form } from 'element-ui'
|
import { Form } from 'element-ui'
|
||||||
import { deleteCoupon, getCoupons } from '@/api/coupon'
|
import { deleteCoupon, getCoupons } from '@/api/coupon'
|
||||||
|
@ -134,7 +134,7 @@ import Sticky from '@/components/Sticky/index.vue'
|
|||||||
import UploadImage from '@/components/UploadImage/index.vue'
|
import UploadImage from '@/components/UploadImage/index.vue'
|
||||||
import Tinymce from '@/components/Tinymce/index.vue'
|
import Tinymce from '@/components/Tinymce/index.vue'
|
||||||
import { Form } from 'element-ui'
|
import { Form } from 'element-ui'
|
||||||
import { getShop, getShops } from '@/api/shop'
|
import { getShops } from '@/api/shop'
|
||||||
import { defaultCouponData, getCoupon, saveCoupon } from '@/api/coupon'
|
import { defaultCouponData, getCoupon, saveCoupon } from '@/api/coupon'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -195,11 +195,6 @@ export default class extends Vue {
|
|||||||
this.tempTagView = Object.assign({}, this.$route)
|
this.tempTagView = Object.assign({}, this.$route)
|
||||||
}
|
}
|
||||||
|
|
||||||
deactivated() {
|
|
||||||
}
|
|
||||||
|
|
||||||
activated() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Watch('dataRange')
|
@Watch('dataRange')
|
||||||
private onDataRangeChange(val: Date[]) {
|
private onDataRangeChange(val: Date[]) {
|
||||||
|
@ -106,7 +106,7 @@
|
|||||||
filterable
|
filterable
|
||||||
size="medium"
|
size="medium"
|
||||||
style="width: 50%"
|
style="width: 50%"
|
||||||
v-on:change="typechange">
|
v-on:change="typeChange">
|
||||||
</el-cascader-panel>
|
</el-cascader-panel>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -182,10 +182,14 @@ import Tinymce from '@/components/Tinymce/index.vue'
|
|||||||
import UploadImage from '@/components/UploadImage/index.vue'
|
import UploadImage from '@/components/UploadImage/index.vue'
|
||||||
import { Form } from 'element-ui'
|
import { Form } from 'element-ui'
|
||||||
import {
|
import {
|
||||||
defaultQuestionData, deleteQuestion, getAllCategory,
|
defaultQuestionData,
|
||||||
|
deleteQuestion,
|
||||||
|
getAllCategory,
|
||||||
getAllTags,
|
getAllTags,
|
||||||
getQuestion, nextQuestion,
|
getQuestion,
|
||||||
saveQuestion, saveTag
|
nextQuestion,
|
||||||
|
saveQuestion,
|
||||||
|
saveTag
|
||||||
} from '@/api/question'
|
} from '@/api/question'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -248,12 +252,6 @@ export default class extends Vue {
|
|||||||
this.getRemoteCategory()
|
this.getRemoteCategory()
|
||||||
}
|
}
|
||||||
|
|
||||||
deactivated() {
|
|
||||||
}
|
|
||||||
|
|
||||||
activated() {
|
|
||||||
}
|
|
||||||
|
|
||||||
private async fetchData(id: string) {
|
private async fetchData(id: string) {
|
||||||
try {
|
try {
|
||||||
const { data } = await getQuestion(id, { /* Your params here */ })
|
const { data } = await getQuestion(id, { /* Your params here */ })
|
||||||
@ -282,7 +280,7 @@ export default class extends Vue {
|
|||||||
document.title = `${title} - ${this.postForm._id}`
|
document.title = `${title} - ${this.postForm._id}`
|
||||||
}
|
}
|
||||||
|
|
||||||
private typechange(val: string[]) {
|
private typeChange(_: string[]) {
|
||||||
this.postForm.tag = this.typeSelect[0]
|
this.postForm.tag = this.typeSelect[0]
|
||||||
this.postForm.sub_tag = this.typeSelect[1]
|
this.postForm.sub_tag = this.typeSelect[1]
|
||||||
}
|
}
|
||||||
|
@ -131,13 +131,13 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Vue } from 'vue-property-decorator'
|
import { Component, Vue } from 'vue-property-decorator'
|
||||||
import { IShopData } from '@/api/types'
|
|
||||||
import Pagination from '@/components/Pagination/index.vue'
|
import Pagination from '@/components/Pagination/index.vue'
|
||||||
import { deleteShop, getShops } from '@/api/shop'
|
import { getShops } from '@/api/shop'
|
||||||
import { parseTime } from '@/utils'
|
import { parseTime } from '@/utils'
|
||||||
import { Form } from 'element-ui'
|
import { Form } from 'element-ui'
|
||||||
import {
|
import {
|
||||||
deleteQuestion, getAllCategory,
|
deleteQuestion,
|
||||||
|
getAllCategory,
|
||||||
getAllTags,
|
getAllTags,
|
||||||
getQuestions,
|
getQuestions,
|
||||||
IQuestionData
|
IQuestionData
|
||||||
|
@ -40,7 +40,6 @@
|
|||||||
ref="tree"
|
ref="tree"
|
||||||
highlight-current
|
highlight-current
|
||||||
:default-checked-keys="typeSelected"
|
:default-checked-keys="typeSelected"
|
||||||
@node-click="nodeClickButton"
|
|
||||||
:props="defaultProps">
|
:props="defaultProps">
|
||||||
</el-tree>
|
</el-tree>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -52,13 +51,10 @@
|
|||||||
import { Component, Vue, Watch } from 'vue-property-decorator'
|
import { Component, Vue, Watch } from 'vue-property-decorator'
|
||||||
import { getGames, IGameData } from '@/api/game'
|
import { getGames, IGameData } from '@/api/game'
|
||||||
import Sticky from '@/components/Sticky/index.vue'
|
import Sticky from '@/components/Sticky/index.vue'
|
||||||
import {
|
import { getShopGameInfo, getShops, updateShopQtypes } from '@/api/shop'
|
||||||
getShopGameInfo,
|
|
||||||
getShops,
|
|
||||||
saveShopGameInfo,
|
|
||||||
updateShopQtypes
|
|
||||||
} from '@/api/shop'
|
|
||||||
import { getAllCategory } from '@/api/question'
|
import { getAllCategory } from '@/api/question'
|
||||||
|
import { ElTree } from 'element-ui/types/tree'
|
||||||
|
import { IShopData } from '@/api/types'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
name: 'QuestionSetting',
|
name: 'QuestionSetting',
|
||||||
@ -76,7 +72,7 @@ export default class extends Vue {
|
|||||||
private list: IGameData[] = []
|
private list: IGameData[] = []
|
||||||
private loading = true
|
private loading = true
|
||||||
private shop = ''
|
private shop = ''
|
||||||
private allDepts = []
|
private allDepts: IShopData[] = []
|
||||||
private gameid = ''
|
private gameid = ''
|
||||||
private versionid = ''
|
private versionid = ''
|
||||||
private listQuery = {
|
private listQuery = {
|
||||||
@ -86,13 +82,17 @@ export default class extends Vue {
|
|||||||
hasVersion: 1
|
hasVersion: 1
|
||||||
}
|
}
|
||||||
|
|
||||||
private typeSelected = []
|
private typeSelected: string[] = []
|
||||||
private typeOptions: {id: string, label: string, children?: any[]}[] = []
|
private typeOptions: {id: string, label: string, children?: any[]}[] = []
|
||||||
private defaultProps = {
|
private defaultProps = {
|
||||||
children: 'children',
|
children: 'children',
|
||||||
label: 'label'
|
label: 'label'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$refs!: {
|
||||||
|
tree: ElTree<any, any>
|
||||||
|
}
|
||||||
|
|
||||||
async created() {
|
async created() {
|
||||||
await this.getList()
|
await this.getList()
|
||||||
await this.getRemoteDeptList('')
|
await this.getRemoteDeptList('')
|
||||||
@ -103,8 +103,8 @@ export default class extends Vue {
|
|||||||
private onShopChange() {
|
private onShopChange() {
|
||||||
if (this.shop) {
|
if (this.shop) {
|
||||||
let currentShop
|
let currentShop
|
||||||
for (let p of this.allDepts) {
|
for (const p of this.allDepts) {
|
||||||
if (p._id == this.shop) {
|
if (p._id === this.shop) {
|
||||||
currentShop = p
|
currentShop = p
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -191,11 +191,9 @@ export default class extends Vue {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private nodeClickButton(data) {
|
|
||||||
console.log(data);
|
|
||||||
}
|
|
||||||
private async saveVal() {
|
private async saveVal() {
|
||||||
if (!this.shop ) {
|
if (!this.shop) {
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '选择需要保存的店铺信息',
|
message: '选择需要保存的店铺信息',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
@ -203,7 +201,7 @@ export default class extends Vue {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
let types = this.$refs.tree.getCheckedKeys()
|
const types = this.$refs.tree.getCheckedKeys()
|
||||||
const data = {
|
const data = {
|
||||||
shopid: this.shop,
|
shopid: this.shop,
|
||||||
qtypes: types
|
qtypes: types
|
||||||
|
@ -170,11 +170,6 @@ export default class extends Vue {
|
|||||||
this.tempTagView = Object.assign({}, this.$route)
|
this.tempTagView = Object.assign({}, this.$route)
|
||||||
}
|
}
|
||||||
|
|
||||||
deactivated() {
|
|
||||||
}
|
|
||||||
|
|
||||||
activated() {
|
|
||||||
}
|
|
||||||
|
|
||||||
private async fetchData(id: string) {
|
private async fetchData(id: string) {
|
||||||
try {
|
try {
|
||||||
|
@ -259,6 +259,7 @@ import {
|
|||||||
} from '@/api/admins'
|
} from '@/api/admins'
|
||||||
import { IRole } from '@/views/system/role.vue'
|
import { IRole } from '@/views/system/role.vue'
|
||||||
import { getShops } from '@/api/shop'
|
import { getShops } from '@/api/shop'
|
||||||
|
import { IShopData } from '@/api/types'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -281,11 +282,8 @@ export default class extends Vue {
|
|||||||
private pageSize = 5
|
private pageSize = 5
|
||||||
private dataCount = 0
|
private dataCount = 0
|
||||||
private deptListOptions = []
|
private deptListOptions = []
|
||||||
private allDepts = []
|
private allDepts: IShopData[] = []
|
||||||
private defaultProps = {
|
|
||||||
children: 'children',
|
|
||||||
label: 'title'
|
|
||||||
}
|
|
||||||
|
|
||||||
private filterForm = {
|
private filterForm = {
|
||||||
key: '',
|
key: '',
|
||||||
|
@ -259,6 +259,7 @@ import {
|
|||||||
} from '@/api/admins'
|
} from '@/api/admins'
|
||||||
import { IRole } from '@/views/system/role.vue'
|
import { IRole } from '@/views/system/role.vue'
|
||||||
import { getShops } from '@/api/shop'
|
import { getShops } from '@/api/shop'
|
||||||
|
import { IShopData } from '@/api/types'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -281,7 +282,7 @@ export default class extends Vue {
|
|||||||
private pageSize = 5
|
private pageSize = 5
|
||||||
private dataCount = 0
|
private dataCount = 0
|
||||||
private deptListOptions = []
|
private deptListOptions = []
|
||||||
private allDepts = []
|
private allDepts: IShopData[] = []
|
||||||
private defaultProps = {
|
private defaultProps = {
|
||||||
children: 'children',
|
children: 'children',
|
||||||
label: 'title'
|
label: 'title'
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
default-expand-all
|
default-expand-all
|
||||||
:expand-on-click-node="false"
|
:expand-on-click-node="false"
|
||||||
>
|
>
|
||||||
<template #default="{ node, data }">
|
<template #default="{node, data}">
|
||||||
<span class="custom-tree-node">
|
<span class="custom-tree-node">
|
||||||
<span>{{ node.label }}</span>
|
<span>{{ node.label }}</span>
|
||||||
<span class="action">
|
<span class="action">
|
||||||
@ -109,18 +109,19 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Vue, Watch } from 'vue-property-decorator'
|
import { Component, Vue } from 'vue-property-decorator'
|
||||||
import { getGames, IGameData } from '@/api/game'
|
|
||||||
import Sticky from '@/components/Sticky/index.vue'
|
import Sticky from '@/components/Sticky/index.vue'
|
||||||
import {
|
|
||||||
getShopGameInfo,
|
|
||||||
getShops,
|
|
||||||
saveShopGameInfo,
|
|
||||||
updateShopQtypes
|
|
||||||
} from '@/api/shop'
|
|
||||||
import { getAllCategory } from '@/api/question'
|
|
||||||
import { getPermissions, savePermission } from '@/api/permissions'
|
import { getPermissions, savePermission } from '@/api/permissions'
|
||||||
import { Form } from 'element-ui'
|
import { TreeNode } from 'element-ui/types/tree'
|
||||||
|
|
||||||
|
export interface ITreeData{
|
||||||
|
idx?: number
|
||||||
|
parent?: any
|
||||||
|
id: string
|
||||||
|
label: string
|
||||||
|
actions?: string[]
|
||||||
|
children?: ITreeData[]
|
||||||
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
name: 'PermissionSetting',
|
name: 'PermissionSetting',
|
||||||
@ -133,19 +134,21 @@ import { Form } from 'element-ui'
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
export default class extends Vue {
|
export default class extends Vue {
|
||||||
private loading = true
|
private loading = true
|
||||||
private shop = ''
|
|
||||||
private dialogType = 'new'
|
private dialogType = 'new'
|
||||||
private dialogVisible = false
|
private dialogVisible = false
|
||||||
private record = {actions: []}
|
private record: ITreeData = { actions: [], id: '', label: '' }
|
||||||
private actions = [
|
private actions = [
|
||||||
'read', 'edit', 'delete'
|
'read', 'edit', 'delete'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
$refs!: {
|
||||||
|
modalForm: HTMLFormElement
|
||||||
|
}
|
||||||
|
|
||||||
private typeSelected = []
|
private typeOptions: ITreeData[] = []
|
||||||
private typeOptions: {id: string, label: string, children?: any[]}[] = []
|
|
||||||
private initAdmin() {
|
private initAdmin() {
|
||||||
return {
|
return {
|
||||||
id: '',
|
id: '',
|
||||||
@ -153,6 +156,7 @@ export default class extends Vue {
|
|||||||
actions: []
|
actions: []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private modalRules = {
|
private modalRules = {
|
||||||
id: [{ required: true, message: '请输入权限id', trigger: 'blur' },
|
id: [{ required: true, message: '请输入权限id', trigger: 'blur' },
|
||||||
{ min: 2, max: 10, message: '长度在 2 到 10 个字符', trigger: 'blur' },
|
{ min: 2, max: 10, message: '长度在 2 到 10 个字符', trigger: 'blur' },
|
||||||
@ -170,15 +174,15 @@ export default class extends Vue {
|
|||||||
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
|
pattern: /^[\u4e00-\u9fa5_a-zA-Z0-9.·-]+$/,
|
||||||
message: '权限名不支持特殊字符',
|
message: '权限名不支持特殊字符',
|
||||||
trigger: 'blur'
|
trigger: 'blur'
|
||||||
}],
|
}]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async created() {
|
async created() {
|
||||||
await this.getRemoteCategory()
|
await this.getRemoteCategory()
|
||||||
this.loading = false
|
this.loading = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private async onCancel() {
|
private async onCancel() {
|
||||||
try {
|
try {
|
||||||
await this.$confirm('确认不保存当前信息?', 'Warning', {
|
await this.$confirm('确认不保存当前信息?', 'Warning', {
|
||||||
@ -193,28 +197,30 @@ export default class extends Vue {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private append(data) {
|
private append(data: ITreeData) {
|
||||||
this.record = this.initAdmin()
|
this.record = this.initAdmin()
|
||||||
this.dialogType = 'new'
|
this.dialogType = 'new'
|
||||||
this.dialogVisible = true
|
this.dialogVisible = true
|
||||||
this.record.actions = this.actions
|
this.record.actions = this.actions
|
||||||
this.record.parent = data
|
this.record.parent = data
|
||||||
}
|
}
|
||||||
private edit(node, data) {
|
|
||||||
|
private edit(node: TreeNode<any, any>, data: ITreeData) {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
this.record = this.initAdmin()
|
this.record = this.initAdmin()
|
||||||
this.record.idx = node.parent.data.children.indexOf(data)
|
this.record.idx = node.parent?.data.children.indexOf(data)
|
||||||
this.record.actions = data.children.map(o=>o.label)
|
this.record.actions = data.children?.map(o => o.label)
|
||||||
this.record.parent = node.parent.data
|
this.record.parent = node.parent?.data
|
||||||
this.dialogType = 'edit'
|
this.dialogType = 'edit'
|
||||||
this.dialogVisible = true
|
this.dialogVisible = true
|
||||||
this.record.id = data.id
|
this.record.id = data.id
|
||||||
this.record.label = data.label
|
this.record.label = data.label
|
||||||
}
|
}
|
||||||
private async remove(node, data) {
|
|
||||||
const parent = node.parent.data;
|
private async remove(node: TreeNode<any, any>, data: ITreeData) {
|
||||||
const children = parent.children || parent.data;
|
const parent = node.parent?.data
|
||||||
const index = children.findIndex(d => d.id === data.id);
|
const children: ITreeData[] = parent.children || parent.data
|
||||||
|
const index = children.findIndex(d => d.id === data.id)
|
||||||
console.log(node, data)
|
console.log(node, data)
|
||||||
try {
|
try {
|
||||||
await this.$confirm('确认删除此权限?', 'Warning', {
|
await this.$confirm('确认删除此权限?', 'Warning', {
|
||||||
@ -222,23 +228,23 @@ export default class extends Vue {
|
|||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
})
|
})
|
||||||
children.splice(index, 1);
|
children.splice(index, 1)
|
||||||
} catch(err) {
|
} catch (err) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async saveVal() {
|
private async saveVal() {
|
||||||
try {
|
try {
|
||||||
let records = []
|
const records = []
|
||||||
for (let data of this.typeOptions[0].children) {
|
for (const data of this.typeOptions[0].children!) {
|
||||||
records.push({
|
records.push({
|
||||||
_id: data.id,
|
_id: data.id,
|
||||||
name: data.label,
|
name: data.label,
|
||||||
actions: data.children.map(o => o.label)
|
actions: data.children?.map(o => o.label)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
await savePermission({datas: records})
|
await savePermission({ datas: records })
|
||||||
console.log(records)
|
console.log(records)
|
||||||
this.$notify({
|
this.$notify({
|
||||||
title: 'Success',
|
title: 'Success',
|
||||||
@ -260,27 +266,28 @@ export default class extends Vue {
|
|||||||
children: data
|
children: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private closeModal() {
|
private closeModal() {
|
||||||
this.dialogVisible = false
|
this.dialogVisible = false
|
||||||
this.$refs.modalForm.clearValidate()
|
this.$refs.modalForm.clearValidate()
|
||||||
}
|
}
|
||||||
|
|
||||||
private async savePermission() {
|
private async savePermission() {
|
||||||
const form = <Form>this.$refs.modalForm
|
|
||||||
try {
|
try {
|
||||||
await form.validate()
|
await this.$refs.modalForm.validate()
|
||||||
const subArr = []
|
const subArr = []
|
||||||
for (const s of this.record.actions) {
|
for (const s of this.record.actions!) {
|
||||||
subArr.push({
|
subArr.push({
|
||||||
id: `${this.record.id}:${s}`,
|
id: `${this.record.id}:${s}`,
|
||||||
label: s
|
label: s
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
let data = {
|
const data = {
|
||||||
id: this.record.id,
|
id: this.record.id,
|
||||||
label: this.record.label,
|
label: this.record.label,
|
||||||
children: subArr
|
children: subArr
|
||||||
}
|
}
|
||||||
if (this.dialogType == 'new') {
|
if (this.dialogType === 'new') {
|
||||||
this.record.parent.children.push(data)
|
this.record.parent.children.push(data)
|
||||||
} else {
|
} else {
|
||||||
this.record.parent.children.splice(this.record.idx, 1, data)
|
this.record.parent.children.splice(this.record.idx, 1, data)
|
||||||
@ -291,8 +298,6 @@ export default class extends Vue {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user