fix
This commit is contained in:
parent
bb0b33a830
commit
0c6859987f
@ -15,6 +15,12 @@ export default {
|
||||
return fetch('/badge/list', params,'post','json')
|
||||
},
|
||||
|
||||
addCategory(params){
|
||||
return fetch('/badge/class/add',params,'post','json')
|
||||
},
|
||||
|
||||
listCategory(params){
|
||||
return fetch('/badge/class/list',params,'post','json')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -26,6 +26,17 @@ export default {
|
||||
|
||||
inviteList(params){
|
||||
return fetch('/personal/inviteCode/records',params,'post','json')
|
||||
},
|
||||
|
||||
wechat(params){
|
||||
return fetch('/config/qrcode/add',params,'post','json')
|
||||
},
|
||||
wechatUpdate(params){
|
||||
return fetch('/config/qrcode/update',params,'post','json')
|
||||
},
|
||||
|
||||
wechatList(params){
|
||||
return fetch('/config/qrcode/list',params,'post','json')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
<icon-loading v-if="loading" />
|
||||
<icon-upload v-else />
|
||||
</template>
|
||||
<template #default> 上传文件</template>
|
||||
<template #default>{{title}}</template>
|
||||
</a-button>
|
||||
</template>
|
||||
</a-upload>
|
||||
@ -25,6 +25,10 @@
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
title : {
|
||||
type:String,
|
||||
default:'上传文件'
|
||||
},
|
||||
action: {
|
||||
type: String,
|
||||
default: '/api/oss/upload'
|
||||
|
||||
@ -101,13 +101,12 @@ export default {
|
||||
fetchMenu() {
|
||||
this.$api.sys.menus().then(res => {
|
||||
if (res.code === 200) {
|
||||
this.list = res.data.reverse()
|
||||
this.list = res.data
|
||||
if (this.list.length > 0) {
|
||||
const path = this.list[0]
|
||||
this.keys[0] = path.id + "@" + path.permission
|
||||
}
|
||||
}
|
||||
if (this.list.length > 0) {
|
||||
const path = this.list[0]
|
||||
this.keys[0] = path.id + "@" + path.permission
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
goPath(res) {
|
||||
|
||||
45
src/views/flower/badge/components/category.vue
Normal file
45
src/views/flower/badge/components/category.vue
Normal file
@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-button type="text" @click="show = true">添加分类</a-button>
|
||||
<a-modal v-model:visible="show" title="添加徽章分类" @before-ok="submit">
|
||||
<a-textarea v-model="from" :auto-size="{minRows:6}"></a-textarea>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
from:{
|
||||
desc:'',
|
||||
name:''
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.from = JSON.stringify(this.from, null, 4)
|
||||
},
|
||||
methods: {
|
||||
submit(done) {
|
||||
const data = JSON.parse(this.from)
|
||||
this.$api.badge.addCategory(data).then((res) => {
|
||||
if (res.code === 200){
|
||||
this.$message.success(res.msg)
|
||||
this.$emit('ok')
|
||||
done()
|
||||
} else {
|
||||
this.$message.error(res.msg)
|
||||
done(false)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
||||
@ -1,112 +1,140 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-button type="text" @click="show = true">{{ type === 'add' ? '新增':'编辑'}}</a-button>
|
||||
<a-modal v-model:visible="show" @before-ok="submit">
|
||||
<a-form :model="form" auto-label-width ref="form">
|
||||
<a-form-item label="徽章类别" field="category" required>
|
||||
<a-select placeholder="请选择徽章类型" v-model="form.category">
|
||||
<a-option>养护徽章</a-option>
|
||||
<a-option>成长徽章</a-option>
|
||||
<a-option>收藏徽章</a-option>
|
||||
<a-option>挑战徽章</a-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item label="徽章名称" field="name" required>
|
||||
<a-input placeholder="请输入徽章名称" v-model="form.name"></a-input>
|
||||
</a-form-item>
|
||||
<a-form-item label="徽章说明" field="desc" required>
|
||||
<a-textarea placeholder="请输入徽章名称" v-model="form.desc"></a-textarea>
|
||||
</a-form-item>
|
||||
<a-form-item label="上传徽章" field="ossId" required>
|
||||
<div class="">
|
||||
<a-image class="mb-10" v-if="form.ossId" :src="form.oss.url" width="160" height="160" ></a-image>
|
||||
<upload @ok="upload"/>
|
||||
<div class="font-14 primary mt-10">徽章大小为 400* 400</div>
|
||||
</div>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
</div>
|
||||
<div>
|
||||
<a-button type="text" @click="show = true">{{
|
||||
type === 'add' ? '新增' : '编辑'
|
||||
}}</a-button>
|
||||
<a-modal v-model:visible="show" @before-ok="submit" @close="this.$refs.form.resetFields()">
|
||||
<a-form :model="form" auto-label-width ref="form">
|
||||
<a-form-item label="徽章类别" field="categoryId" required>
|
||||
<a-select
|
||||
placeholder="请选择徽章类型"
|
||||
v-model="form.categoryId"
|
||||
>
|
||||
<a-option v-for="item in options" :value="item.id">{{
|
||||
item.name
|
||||
}}</a-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item label="徽章名称" field="name" required>
|
||||
<a-input
|
||||
placeholder="请输入徽章名称"
|
||||
v-model="form.name"
|
||||
></a-input>
|
||||
</a-form-item>
|
||||
<a-form-item label="徽章获取条件" field="countLimit" required>
|
||||
<a-input-number
|
||||
placeholder="请输入徽章获取的条件"
|
||||
v-model="form.countLimit"
|
||||
></a-input-number>
|
||||
</a-form-item>
|
||||
<a-form-item label="徽章说明" field="desc" required>
|
||||
<a-textarea
|
||||
placeholder="请输入徽章名称"
|
||||
v-model="form.desc"
|
||||
></a-textarea>
|
||||
</a-form-item>
|
||||
<a-form-item label="上传徽章" field="ossId" required>
|
||||
<div class="">
|
||||
<a-image
|
||||
class="mb-10"
|
||||
v-if="form.oss"
|
||||
:src="form.oss.url"
|
||||
width="160"
|
||||
height="160"
|
||||
></a-image>
|
||||
<upload @ok="upload" />
|
||||
<div class="font-14 primary mt-10">
|
||||
徽章大小为 400* 400
|
||||
</div>
|
||||
</div>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-modal>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import upload from '@/components/upload/index.vue'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
upload,
|
||||
},
|
||||
props: {
|
||||
type: {
|
||||
type: String,
|
||||
default: "add"
|
||||
components: {
|
||||
upload
|
||||
},
|
||||
info:{
|
||||
type:Object,
|
||||
default:null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
info:{
|
||||
handler(val){
|
||||
this.form = {...val}
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
form:{
|
||||
"category": "",
|
||||
"desc": "",
|
||||
"name": "",
|
||||
"ossId": "",
|
||||
ossUrl:''
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
upload(file) {
|
||||
this.form.ossId = file.id
|
||||
this.form.ossUrl = file.url
|
||||
},
|
||||
submit(done){
|
||||
this.$refs.form.validate(err => {
|
||||
if (err === undefined) {
|
||||
if (this.form.id ){
|
||||
this.$api.badge.update(this.form).then(res => {
|
||||
if (res.code === 200){
|
||||
this.$emit('ok')
|
||||
this.$message.success(res.msg)
|
||||
done()
|
||||
} else {
|
||||
this.$message.error(res.msg)
|
||||
done(false)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$api.badge.save(this.form).then(res => {
|
||||
if (res.code === 200){
|
||||
this.$emit('ok')
|
||||
this.$message.success(res.msg)
|
||||
done()
|
||||
} else {
|
||||
this.$message.error(res.msg)
|
||||
done(false)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
} else {
|
||||
done(false)
|
||||
props: {
|
||||
type: {
|
||||
type: String,
|
||||
default: 'add'
|
||||
},
|
||||
options: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
info: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
info: {
|
||||
handler(val) {
|
||||
this.form = { ...val }
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
show: false,
|
||||
form: {
|
||||
categoryId: '',
|
||||
countLimit:0,
|
||||
desc: '',
|
||||
keyword:'',
|
||||
name: '',
|
||||
ossId: '',
|
||||
ossUrl: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
upload(file) {
|
||||
this.form.oss = file
|
||||
this.form.ossId = file.id
|
||||
this.form.ossUrl = file.url
|
||||
},
|
||||
submit(done) {
|
||||
this.$refs.form.validate(err => {
|
||||
if (err === undefined) {
|
||||
if (this.form.id) {
|
||||
this.$api.badge.update(this.form).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.$emit('ok')
|
||||
this.$message.success(res.msg)
|
||||
done()
|
||||
} else {
|
||||
this.$message.error(res.msg)
|
||||
done(false)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$api.badge.save(this.form).then(res => {
|
||||
if (res.code === 200) {
|
||||
this.$emit('ok')
|
||||
this.$message.success(res.msg)
|
||||
done()
|
||||
} else {
|
||||
this.$message.error(res.msg)
|
||||
done(false)
|
||||
}
|
||||
})
|
||||
}
|
||||
} else {
|
||||
done(false)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
@ -4,18 +4,19 @@
|
||||
<a-card>
|
||||
<div >
|
||||
<div class="flex flex-center flex-justify-start">
|
||||
<edit @ok="fetchList"/>
|
||||
<edit :options="categoryList" @ok="fetchList"/>
|
||||
<category @ok="fetchCategory"/>
|
||||
</div>
|
||||
<div class="mt-20">
|
||||
<a-table :data="list" :columns="columns" :pagination="page">
|
||||
<template #name="{record}">
|
||||
<div class="flex flex-center flex-justify-start">
|
||||
<a-image :src="record.oss.url" width="40px"></a-image>
|
||||
<a-image v-if="record.oss" :src="record.oss.url" width="40px"></a-image>
|
||||
<div class="ml-10">{{record.name}}</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #category="{record}">
|
||||
<a-tag color="blue">{{record.category}}</a-tag>
|
||||
<a-tag color="blue">{{record.category.name}}</a-tag>
|
||||
</template>
|
||||
<template #menu="{record}">
|
||||
<div class="flex flex-center flex-justify-start">
|
||||
@ -35,10 +36,12 @@
|
||||
<script>
|
||||
import navbar from '@/components/navbar/index.vue'
|
||||
import edit from './components/edit.vue'
|
||||
import category from "./components/category.vue";
|
||||
export default {
|
||||
components: {
|
||||
navbar,
|
||||
edit
|
||||
edit,
|
||||
category
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -47,6 +50,7 @@ export default {
|
||||
pageSize:10,
|
||||
total:0,
|
||||
},
|
||||
categoryList:[],
|
||||
list: [],
|
||||
columns: [
|
||||
{
|
||||
@ -70,6 +74,7 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.fetchList();
|
||||
this.fetchCategory()
|
||||
},
|
||||
methods: {
|
||||
fetchList() {
|
||||
@ -79,6 +84,18 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
fetchCategory(){
|
||||
const data = {
|
||||
current:0,
|
||||
pageSize:999,
|
||||
total:0,
|
||||
}
|
||||
this.$api.badge.listCategory(data).then(res=>{
|
||||
if (res.code === 200){
|
||||
this.categoryList = res.data.list
|
||||
}
|
||||
})
|
||||
},
|
||||
remove(id){
|
||||
this.$api.badge.delete({ ids: [id] }).then(res=>{
|
||||
if (res.code === 200){
|
||||
|
||||
@ -89,6 +89,7 @@ export default {
|
||||
const ids = {ids:[item.id],isHot: item.isHot === 0 ? 1 :0}
|
||||
this.$api.flower.changeHot(ids).then(res => {
|
||||
if(res.code === 200){
|
||||
this.$message.success(res.msg)
|
||||
this.fetchList()
|
||||
}else {
|
||||
this.$message.error(res.msg);
|
||||
|
||||
@ -1,17 +1,72 @@
|
||||
<template>
|
||||
<div>
|
||||
<navbar title="植趣微信群"/>
|
||||
<a-card>
|
||||
|
||||
<a-card >
|
||||
<div class="flex flex-center flex-justify-start font-18 bold">植趣微信群,需要每7天更新一次</div>
|
||||
<div v-if="from.id === ''" style="height: 300px" class="flex flex-center">
|
||||
<a-empty >
|
||||
</a-empty>
|
||||
</div>
|
||||
<a-image v-else :src="from.url" width="380"></a-image>
|
||||
<upload class="mt-20" @ok="upload" title="配置二维码"/>
|
||||
</a-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import navbar from '@/components/navbar/index.vue'
|
||||
import upload from "../../../components/upload/index.vue";
|
||||
|
||||
export default {
|
||||
|
||||
components: {
|
||||
navbar,
|
||||
upload
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
from: {
|
||||
id:'',
|
||||
name:'植趣群二维码',
|
||||
ossId:'',
|
||||
url:''
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.fetchList();
|
||||
},
|
||||
methods: {
|
||||
fetchList(){
|
||||
this.$api.flower.wechatList().then(res => {
|
||||
if (res.code === 200){
|
||||
console.log(res)
|
||||
const tmps = res.data
|
||||
if (tmps.length > 0) {
|
||||
this.from = tmps[0]
|
||||
}
|
||||
console.log(this.from)
|
||||
}
|
||||
})
|
||||
},
|
||||
upload(file) {
|
||||
this.from.url = file.url
|
||||
this.from.ossId = file.id
|
||||
|
||||
if (this.from.id === ''){
|
||||
this.$api.flower.wechat(this.from).then(res => {
|
||||
if (res.code === 200){
|
||||
this.$message.success(res.msg)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$api.flower.wechatUpdate(this.from).then(res => {
|
||||
if (res.code === 200){
|
||||
this.$message.success(res.msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user