暂存
This commit is contained in:
@@ -108,4 +108,20 @@ export const weekCardPage = query => {
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
};
|
||||
// 周卡激励配置-上下线
|
||||
export const updateEnabled = query => {
|
||||
return request({
|
||||
url: '/admin/weekCard/updateEnabled',
|
||||
method: 'get',
|
||||
params: query
|
||||
});
|
||||
};
|
||||
// 周卡激励配置-保存
|
||||
export const weekCardSave = query => {
|
||||
return request({
|
||||
url: '/admin/weekCard/save',
|
||||
method: 'post',
|
||||
data: query
|
||||
});
|
||||
};
|
@@ -102,8 +102,8 @@
|
||||
>
|
||||
<el-button
|
||||
@click="
|
||||
controlsDialog = true;
|
||||
controlsObjNew = scope.row;
|
||||
delDialog = true;
|
||||
delObj = scope.row;
|
||||
"
|
||||
class="danger"
|
||||
type="danger"
|
||||
@@ -126,10 +126,177 @@
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
|
||||
<!-- 添加和编辑弹窗 -->
|
||||
<el-dialog
|
||||
v-model="operationDialog"
|
||||
:title="operationTitle"
|
||||
width="30%"
|
||||
center
|
||||
>
|
||||
<!-- 输入日期 -->
|
||||
<div class="selectBox">
|
||||
<span class="left" style="margin-right: 20px">输入日期</span>
|
||||
<el-input
|
||||
v-model="operation.days"
|
||||
size="default"
|
||||
placeholder="例如:第一天、第二天..."
|
||||
class="right"
|
||||
style="width: 70%"
|
||||
></el-input>
|
||||
</div>
|
||||
<!-- 金币数量 -->
|
||||
<div class="selectBox">
|
||||
<span class="left" style="margin-right: 20px">金币数量</span>
|
||||
<el-input
|
||||
v-model="operation.gameName"
|
||||
size="default"
|
||||
placeholder="请输入游戏昵称..."
|
||||
class="right"
|
||||
style="width: 70%"
|
||||
></el-input>
|
||||
</div>
|
||||
<!-- 游戏icon -->
|
||||
<div class="selectBox selectBoxImg">
|
||||
<span class="left" style="margin-right: 20px">金币icon</span>
|
||||
<el-upload
|
||||
class="avatar-uploader"
|
||||
action="/admin/tencent/cos/upload/file"
|
||||
:show-file-list="false"
|
||||
:on-success="handleAvatarSuccess"
|
||||
:before-upload="beforeAvatarUpload"
|
||||
:on-error="handleAvatarError"
|
||||
>
|
||||
<img
|
||||
v-if="operation.imageUrl1"
|
||||
:src="operation.imageUrl1"
|
||||
class="avatar"
|
||||
/>
|
||||
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
|
||||
</el-upload>
|
||||
</div>
|
||||
<!-- 选择礼物类型 -->
|
||||
<div style="margin-bottom: 25px; margin-top: 10px; width: 134%">
|
||||
<span
|
||||
style="display: inline-block; margin-right: 20px"
|
||||
class="col-sm-2 control-label"
|
||||
>选择礼物类型</span
|
||||
>
|
||||
<el-select
|
||||
filterable
|
||||
v-model="operation.value"
|
||||
@change="optionsChange()"
|
||||
placeholder="请选择"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in operation.options"
|
||||
:key="item.id"
|
||||
:label="item.desc"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<!-- 奖励 -->
|
||||
<div
|
||||
v-show="operationIsShow"
|
||||
style="margin-bottom: 25px; margin-top: 10px; width: 134%"
|
||||
>
|
||||
<span
|
||||
style="display: inline-block; margin-right: 20px"
|
||||
class="col-sm-2 control-label"
|
||||
>奖励</span
|
||||
>
|
||||
<el-select filterable v-model="operation.value2" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in operation.options2"
|
||||
:key="item.id"
|
||||
:label="
|
||||
operation.value == 2
|
||||
? JsonFunc(item.giftName).zh
|
||||
: operation.value == 16 || operation.value == 17
|
||||
? JsonFunc(item.name).zh
|
||||
: item.name
|
||||
"
|
||||
:value="item.id"
|
||||
>
|
||||
<!-- item.name -->
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<!-- 奖励天数 -->
|
||||
<div v-show="operationIsShow" class="selectBox">
|
||||
<span class="left" style="margin-right: 20px">奖励天数</span>
|
||||
<el-input
|
||||
v-model="operation.rewardDays"
|
||||
size="default"
|
||||
placeholder="特权类奖励请输入天数,其他不需要填写"
|
||||
class="right"
|
||||
style="width: 70%"
|
||||
></el-input>
|
||||
</div>
|
||||
<!-- 奖励个数 -->
|
||||
<div v-show="!operationIsShow" class="selectBox">
|
||||
<span class="left" style="margin-right: 20px">奖励个数</span>
|
||||
<el-input
|
||||
v-model="operation.rewardGoldNum"
|
||||
size="default"
|
||||
placeholder="金币/金币礼物请输入数量"
|
||||
class="right"
|
||||
style="width: 70%"
|
||||
></el-input>
|
||||
</div>
|
||||
<!-- 排序 -->
|
||||
<div class="selectBox">
|
||||
<span class="left" style="margin-right: 20px">排序</span>
|
||||
<el-input
|
||||
v-model="operation.seqNo"
|
||||
size="default"
|
||||
placeholder="请输入排序,越小排序越前 "
|
||||
class="right"
|
||||
style="width: 70%"
|
||||
></el-input>
|
||||
</div>
|
||||
<!-- 操作 -->
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="operationDialog = false">取消</el-button>
|
||||
<el-button type="primary" @click="operationClick()"> 确认 </el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 二次确认弹窗 -->
|
||||
<el-dialog
|
||||
destroy-on-close
|
||||
v-model="delDialog"
|
||||
title="提示"
|
||||
width="30%"
|
||||
center
|
||||
>
|
||||
<span> 确定要进行该操作吗?</span>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="delDialog = false">取消</el-button>
|
||||
<el-button type="primary" @click="delClick()"> 确认 </el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listPartitionInfo, weekCardPage } from "@/api/weeklyCard/weeklyCard";
|
||||
import {
|
||||
listPartitionInfo,
|
||||
weekCardPage,
|
||||
getAll,
|
||||
carAll,
|
||||
headwearAll,
|
||||
nameplateAll,
|
||||
chatbubbleAll,
|
||||
infocard,
|
||||
weekCardSave,
|
||||
updateEnabled,
|
||||
} from "@/api/weeklyCard/weeklyCard";
|
||||
import { dateFormat } from "@/utils/system-helper";
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
@@ -147,6 +314,12 @@ export default {
|
||||
{ desc: "高级周卡", id: 3 },
|
||||
],
|
||||
},
|
||||
giftArr: [],
|
||||
carArr: [],
|
||||
headArr: [],
|
||||
nameplateArr: [],
|
||||
bubbleArr: [],
|
||||
cardArr: [],
|
||||
loading: false,
|
||||
// 表格数据
|
||||
tableData: [],
|
||||
@@ -155,13 +328,34 @@ export default {
|
||||
currentPage: 1, //页码
|
||||
pageSize: 10, //条数
|
||||
// 编辑
|
||||
controlsDialog: false,
|
||||
controlsObjNew: false,
|
||||
controlsObj: {
|
||||
operationDialog: false,
|
||||
operationType: 1, //1添加2编辑
|
||||
operationTitle: "编辑&添加",
|
||||
operatioObj: {},
|
||||
operation: {
|
||||
days: "",
|
||||
gameName: "",
|
||||
imageUrl1: "",
|
||||
value: "",
|
||||
options: [],
|
||||
num: "",
|
||||
options: [
|
||||
{ desc: "金币", id: 1 },
|
||||
{ desc: "礼物", id: 2 },
|
||||
{ desc: "铭牌", id: 14 },
|
||||
{ desc: "头饰", id: 4 },
|
||||
{ desc: "气泡", id: 16 },
|
||||
{ desc: "资料卡", id: 17 },
|
||||
{ desc: "座驾", id: 3 },
|
||||
],
|
||||
value2: "",
|
||||
options2: [],
|
||||
rewardDays: "",
|
||||
rewardGoldNum: "",
|
||||
seqNo: "",
|
||||
},
|
||||
operationIsShow: true,
|
||||
// 上下线
|
||||
delDialog: false,
|
||||
delObj: {},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@@ -169,6 +363,26 @@ export default {
|
||||
listPartitionInfo().then((res) => {
|
||||
this.inquire.options = res.data;
|
||||
});
|
||||
this.loading = true;
|
||||
getAll().then((res) => {
|
||||
this.giftArr = res.data;
|
||||
carAll().then((res) => {
|
||||
this.carArr = res.data;
|
||||
headwearAll().then((res) => {
|
||||
this.headArr = res.data;
|
||||
nameplateAll().then((res) => {
|
||||
this.nameplateArr = res.data;
|
||||
chatbubbleAll().then((res) => {
|
||||
this.bubbleArr = res.data;
|
||||
infocard().then((res) => {
|
||||
this.cardArr = res.data;
|
||||
this.loading = false;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
getData() {
|
||||
@@ -202,6 +416,114 @@ export default {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 监听礼物类型
|
||||
optionsChange() {
|
||||
let than = this;
|
||||
var type = than.operation.value;
|
||||
than.operation.value2 = "";
|
||||
if (type) {
|
||||
than.operationIsShow = true;
|
||||
if (type == 2) {
|
||||
//礼物
|
||||
than.operation.options2 = than.giftArr;
|
||||
} else if (type == 3) {
|
||||
//座驾
|
||||
than.operation.options2 = than.carArr;
|
||||
} else if (type == 4) {
|
||||
//头饰
|
||||
than.operation.options2 = than.headArr;
|
||||
} else if (type == 14) {
|
||||
//铭牌
|
||||
than.operation.options2 = than.nameplateArr;
|
||||
} else if (type == 16) {
|
||||
//气泡
|
||||
than.operation.options2 = than.bubbleArr;
|
||||
} else if (type == 17) {
|
||||
//资料卡
|
||||
than.operation.options2 = than.cardArr;
|
||||
} else if (type == 1) {
|
||||
//金币
|
||||
than.operationIsShow = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
// 新增
|
||||
add() {
|
||||
this.operation = {
|
||||
days: "",
|
||||
gameName: "",
|
||||
imageUrl1: "",
|
||||
value: "",
|
||||
options: [
|
||||
{ desc: "金币", id: 1 },
|
||||
{ desc: "礼物", id: 2 },
|
||||
{ desc: "铭牌", id: 14 },
|
||||
{ desc: "头饰", id: 4 },
|
||||
{ desc: "气泡", id: 16 },
|
||||
{ desc: "资料卡", id: 17 },
|
||||
{ desc: "座驾", id: 3 },
|
||||
],
|
||||
value2: "",
|
||||
options2: [],
|
||||
rewardDays: "",
|
||||
rewardGoldNum: "",
|
||||
seqNo: "",
|
||||
};
|
||||
this.operationType = 1;
|
||||
this.operationTitle = "添加";
|
||||
this.operationDialog = true;
|
||||
},
|
||||
// 确认按钮
|
||||
operationClick() {
|
||||
if (this.operationType == 1) {
|
||||
// 新增
|
||||
weekCardSave({})
|
||||
.then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.getData();
|
||||
this.loading = false;
|
||||
} else {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: res.message || "获取数据失败",
|
||||
type: "error",
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("请求出错:", error);
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: "请求出错,请稍后重试",
|
||||
type: "error",
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
beforeAvatarUpload() {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: "上传中~",
|
||||
type: "warning",
|
||||
});
|
||||
},
|
||||
handleAvatarError() {
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: "上传失败!",
|
||||
type: "error",
|
||||
});
|
||||
},
|
||||
handleAvatarSuccess(res, file) {
|
||||
console.log(file);
|
||||
// this.operation.imageUrl1 = URL.createObjectURL();
|
||||
this.operation.imageUrl1 = file.response.data;
|
||||
ElMessage({
|
||||
showClose: true,
|
||||
message: "上传成功!",
|
||||
type: "success",
|
||||
});
|
||||
},
|
||||
// 分页导航
|
||||
handleSizeChange(size) {
|
||||
this.pageSize = size;
|
||||
@@ -211,6 +533,10 @@ export default {
|
||||
this.currentPage = page;
|
||||
this.getData();
|
||||
},
|
||||
JsonFunc(val) {
|
||||
var res = JSON.parse(val);
|
||||
return res;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -234,4 +560,43 @@ export default {
|
||||
margin: 15px 0 5px 0px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style scoped>
|
||||
.avatar-uploader .avatar {
|
||||
width: 178px;
|
||||
height: 178px;
|
||||
display: block;
|
||||
}
|
||||
.selectBox {
|
||||
display: flex;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.selectBox span {
|
||||
min-width: 80px;
|
||||
}
|
||||
.selectBoxImg {
|
||||
height: 150px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
.avatar-uploader .el-upload {
|
||||
border: 1px dashed var(--el-border-color);
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
transition: var(--el-transition-duration-fast);
|
||||
width: 150px;
|
||||
height: 150px;
|
||||
}
|
||||
|
||||
.avatar-uploader .el-upload .el-upload__input {
|
||||
display: none;
|
||||
}
|
||||
.avatar-uploader .el-upload:hover {
|
||||
border-color: var(--el-color-primary);
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user