|
|
@ -4,7 +4,7 @@ |
|
|
|
<view class="achievement-card"> |
|
|
|
<view class="card-title-row"> |
|
|
|
<view class="card-title">阅读成就设置</view> |
|
|
|
<view v-if="isPending" class="pending-tag">设置审核中</view> |
|
|
|
<view v-if="statusText" class="status-tag" :class="statusClass">{{ statusText }}</view> |
|
|
|
</view> |
|
|
|
<view class="achievement-list"> |
|
|
|
<view class="achievement-item" |
|
|
@ -22,7 +22,8 @@ |
|
|
|
<input class="input" |
|
|
|
v-model="form[keys[index] + 'Name']" |
|
|
|
placeholder="请输入" |
|
|
|
placeholder-class="input-placeholder" /> |
|
|
|
placeholder-class="input-placeholder" |
|
|
|
:disabled="!canEdit" /> |
|
|
|
</view> |
|
|
|
<view class="input-area" v-if="form[keys[index] + 'Num']"> |
|
|
|
<view class="label-row"> |
|
|
@ -63,10 +64,10 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="bottom-btn-area"> |
|
|
|
<button class="submit-btn" :disabled="isPending" |
|
|
|
:class="{disabled: isPending}" |
|
|
|
<button class="submit-btn" :disabled="!canEdit" |
|
|
|
:class="{disabled: !canEdit}" |
|
|
|
@click="submit"> |
|
|
|
{{ form.id ? '设置' : '提交申请' }} |
|
|
|
{{ submitButtonText }} |
|
|
|
</button> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -79,45 +80,52 @@ |
|
|
|
data() { |
|
|
|
return { |
|
|
|
mixinsListApi : 'getAchievementList', |
|
|
|
isPending: false, |
|
|
|
keys : ['one', 'two', 'three'], |
|
|
|
form : {}, |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
// 判断是否可以编辑 |
|
|
|
canEdit() { |
|
|
|
// status=0(审核中)不能编辑,status=1(已通过)、status=2(不通过)和第一次提交(没有form.id)可以编辑 |
|
|
|
return this.form.status != 0 |
|
|
|
}, |
|
|
|
// 状态文本 |
|
|
|
statusText() { |
|
|
|
// 第一次提交时不显示状态标签 |
|
|
|
if (!this.form.id) return '' |
|
|
|
|
|
|
|
// 根据状态返回文本 |
|
|
|
if (this.form.status == 0) return '审核中' |
|
|
|
if (this.form.status == 1) return '已通过' |
|
|
|
if (this.form.status == 2) return '不通过' |
|
|
|
|
|
|
|
return '' |
|
|
|
}, |
|
|
|
// 状态样式类 |
|
|
|
statusClass() { |
|
|
|
if (this.form.status == 0) return 'status-pending' |
|
|
|
if (this.form.status == 1) return 'status-approved' |
|
|
|
if (this.form.status == 2) return 'status-rejected' |
|
|
|
return '' |
|
|
|
}, |
|
|
|
// 提交按钮文本 |
|
|
|
submitButtonText() { |
|
|
|
if (!this.form.id) return '提交申请' |
|
|
|
if (this.form.status == 2) return '重新提交' |
|
|
|
return '设置' |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
this.getDetail() |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
async getDetail(){ |
|
|
|
this.form = await this.$fetch('getAchievement') || {} |
|
|
|
this.isPending = this.form.status == 0 |
|
|
|
const data = await this.$fetch('getAchievement') || {} |
|
|
|
// 使用展开运算符确保响应式更新 |
|
|
|
this.form = { ...data } |
|
|
|
}, |
|
|
|
async submit() { |
|
|
|
// for (var index = 0; index < this.list.length; index++) { |
|
|
|
// var element = this.list[index]; |
|
|
|
// if (!element.levelName) { |
|
|
|
// uni.showToast({ |
|
|
|
// title: '请填写所有成就名称', |
|
|
|
// icon: 'none' |
|
|
|
// }) |
|
|
|
// return |
|
|
|
// } |
|
|
|
// } |
|
|
|
|
|
|
|
// this.isPending = true |
|
|
|
|
|
|
|
// let arr = [] |
|
|
|
|
|
|
|
// for (var index = 0; index < this.list.length; index++) { |
|
|
|
// var element = this.list[index]; |
|
|
|
|
|
|
|
// arr.push(this.$fetch('setAchievementName', { |
|
|
|
// name : element.levelName |
|
|
|
// })) |
|
|
|
// } |
|
|
|
|
|
|
|
// await Promise.all(arr) |
|
|
|
|
|
|
|
if(this.$utils.verificationAll(this.form, { |
|
|
|
oneName : '请填写' + this.list[0].title, |
|
|
|
twoName : '请填写' + this.list[1].title, |
|
|
@ -179,6 +187,29 @@ |
|
|
|
margin-bottom: 32rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.status-tag { |
|
|
|
font-size: 24rpx; |
|
|
|
border-radius: 10rpx; |
|
|
|
padding: 6rpx 24rpx; |
|
|
|
margin-left: 20rpx; |
|
|
|
margin-bottom: 32rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.status-pending { |
|
|
|
background: #ff9500; |
|
|
|
color: #fff; |
|
|
|
} |
|
|
|
|
|
|
|
.status-approved { |
|
|
|
background: #07c160; |
|
|
|
color: #fff; |
|
|
|
} |
|
|
|
|
|
|
|
.status-rejected { |
|
|
|
background: #e23d3d; |
|
|
|
color: #fff; |
|
|
|
} |
|
|
|
|
|
|
|
.achievement-list { |
|
|
|
display: flex; |
|
|
|
flex-direction: column; |
|
|
@ -241,6 +272,11 @@ |
|
|
|
margin-bottom: 2rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.input:disabled { |
|
|
|
background: #f5f5f5; |
|
|
|
color: #999; |
|
|
|
} |
|
|
|
|
|
|
|
.input-placeholder { |
|
|
|
color: #d2d2d2; |
|
|
|
font-size: 26rpx; |
|
|
@ -279,14 +315,4 @@ |
|
|
|
background: #0a226d; |
|
|
|
color: #fff; |
|
|
|
} |
|
|
|
|
|
|
|
.pending-tag { |
|
|
|
background: #807a7a; |
|
|
|
color: #fff; |
|
|
|
font-size: 24rpx; |
|
|
|
border-radius: 10rpx; |
|
|
|
padding: 6rpx 24rpx; |
|
|
|
margin-left: 20rpx; |
|
|
|
margin-bottom: 32rpx; |
|
|
|
} |
|
|
|
</style> |