更新证书
Showing
1 changed file
with
138 additions
and
21 deletions
| ... | @@ -10,8 +10,9 @@ | ... | @@ -10,8 +10,9 @@ |
| 10 | <view class="item" v-for="n in list" :key="n.id"> | 10 | <view class="item" v-for="n in list" :key="n.id"> |
| 11 | <view class="w100"> | 11 | <view class="w100"> |
| 12 | <view class="status"> | 12 | <view class="status"> |
| 13 | <text class="text-success" v-if="n.isCert == '1' ">已发送</text> | 13 | <text class="text-success" v-if="n.isCert == '1'">已发送</text> |
| 14 | <text class="text-warning" v-else>未发送</text> | 14 | <text class="text-warning" v-else-if="n.isCert == '0'">未发送</text> |
| 15 | <text class="text-primary" v-else>生成中</text> | ||
| 15 | </view> | 16 | </view> |
| 16 | <view class="name">{{n.realName}}</view> | 17 | <view class="name">{{n.realName}}</view> |
| 17 | <view class="date"> | 18 | <view class="date"> |
| ... | @@ -30,15 +31,36 @@ | ... | @@ -30,15 +31,36 @@ |
| 30 | </view> | 31 | </view> |
| 31 | </view> | 32 | </view> |
| 32 | 33 | ||
| 33 | <div class="func"> | 34 | <view class="func"> |
| 34 | <button @click="sendCert(n)">{{ ['发送证书','更新证书'][n.isCert] }}</button> | 35 | <button :disabled="!(n.isCert == '0' || n.isCert == '1')" @click="sendCert(n)">{{ n.isCert == '1' ? '更新证书' : '发送证书' }}</button> |
| 35 | </div> | 36 | </view> |
| 36 | </view> | 37 | </view> |
| 37 | </view> | 38 | </view> |
| 38 | </view> | 39 | </view> |
| 39 | 40 | ||
| 40 | </view> | 41 | </view> |
| 41 | 42 | ||
| 43 | <!-- 证书操作提示弹层 --> | ||
| 44 | <uni-popup ref="certPopup" type="center" :is-mask-click="false"> | ||
| 45 | <view class="cert-dialog"> | ||
| 46 | <view class="cert-dialog__head"> | ||
| 47 | <uni-icons type="info-filled" size="24" color="#FAAD14" /> | ||
| 48 | <view class="cert-dialog__title">{{ popupTitle }}</view> | ||
| 49 | </view> | ||
| 50 | <view class="cert-dialog__content">{{ popupContent }}</view> | ||
| 51 | <view class="cert-dialog__btns"> | ||
| 52 | <view | ||
| 53 | v-if="!popupIsAlert" | ||
| 54 | class="cert-dialog__btn cert-dialog__btn--cancel" | ||
| 55 | @click="onPopupCancel" | ||
| 56 | >取消</view> | ||
| 57 | <view | ||
| 58 | class="cert-dialog__btn cert-dialog__btn--sure" | ||
| 59 | @click="onPopupSure" | ||
| 60 | >{{ popupBtnText }}</view> | ||
| 61 | </view> | ||
| 62 | </view> | ||
| 63 | </uni-popup> | ||
| 42 | </view> | 64 | </view> |
| 43 | </template> | 65 | </template> |
| 44 | 66 | ||
| ... | @@ -63,6 +85,15 @@ | ... | @@ -63,6 +85,15 @@ |
| 63 | const list = ref([]) | 85 | const list = ref([]) |
| 64 | const total = ref(0) | 86 | const total = ref(0) |
| 65 | const userType = ref('') | 87 | const userType = ref('') |
| 88 | |||
| 89 | // 证书操作提示弹层 | ||
| 90 | const certPopup = ref(null) | ||
| 91 | const popupTitle = ref('提示') | ||
| 92 | const popupContent = ref('') | ||
| 93 | const popupIsAlert = ref(false) | ||
| 94 | const popupBtnText = ref('确认') | ||
| 95 | let popupSure = () => {} | ||
| 96 | |||
| 66 | onLoad((option) => { | 97 | onLoad((option) => { |
| 67 | queryParams.value.examId = option.examId | 98 | queryParams.value.examId = option.examId |
| 68 | queryParams.value.payId = option.payId | 99 | queryParams.value.payId = option.payId |
| ... | @@ -82,31 +113,31 @@ | ... | @@ -82,31 +113,31 @@ |
| 82 | uni.hideLoading() | 113 | uni.hideLoading() |
| 83 | }) | 114 | }) |
| 84 | } | 115 | } |
| 85 | function checkCert(row){ | 116 | |
| 117 | function checkCert(row) { | ||
| 86 | return api.checkPersonByPersonId(row.perId).then(res => { | 118 | return api.checkPersonByPersonId(row.perId).then(res => { |
| 87 | if (!res.data) { | 119 | if (!res.data) { |
| 88 | uni.showModal({ | 120 | openCertPopup({ |
| 89 | title: '提示', | 121 | title: '提示', |
| 90 | content:'该学员没有照片,无法生成证书!', | 122 | content: '该学员没有照片,无法生成证书!', |
| 91 | success: () => {} | 123 | isAlert: true, |
| 124 | btnText: '知道了', | ||
| 125 | sure: () => {} | ||
| 92 | }) | 126 | }) |
| 93 | return Promise.reject() | 127 | return Promise.reject() |
| 94 | } | 128 | } |
| 95 | }) | 129 | }) |
| 96 | } | 130 | } |
| 131 | |||
| 97 | function sendCert(row) { | 132 | function sendCert(row) { |
| 98 | let msg | 133 | let msg = row.isCert == 1 ? '更新' : '下发' |
| 99 | if (row.isCert == 1) { | ||
| 100 | msg = `更新` | ||
| 101 | } else { | ||
| 102 | msg = `下发` | ||
| 103 | } | ||
| 104 | checkCert(row).then(() => { | 134 | checkCert(row).then(() => { |
| 105 | uni.showModal({ | 135 | openCertPopup({ |
| 106 | title: '提示', | 136 | title: '提示', |
| 107 | content: `确定${msg}${row.realName}的证书吗`, | 137 | content: `确定${msg}${row.realName}的证书吗`, |
| 108 | success: function(res) { | 138 | isAlert: false, |
| 109 | if (res.confirm) { | 139 | btnText: `确认${msg}`, |
| 140 | sure: () => { | ||
| 110 | const params = [{ | 141 | const params = [{ |
| 111 | id: queryParams.value.payId, | 142 | id: queryParams.value.payId, |
| 112 | children: [{ | 143 | children: [{ |
| ... | @@ -115,18 +146,35 @@ | ... | @@ -115,18 +146,35 @@ |
| 115 | }] | 146 | }] |
| 116 | }] | 147 | }] |
| 117 | 148 | ||
| 118 | api.submitCert2(params).then(res => { | 149 | api.submitCert3(params).then(() => { |
| 119 | uni.showToast({ | 150 | uni.showToast({ |
| 120 | title: `下发成功` | 151 | title: `${msg}成功` |
| 121 | }) | 152 | }) |
| 122 | getList() | 153 | getList() |
| 123 | }) | 154 | }) |
| 124 | } | 155 | } |
| 125 | } | ||
| 126 | }) | 156 | }) |
| 127 | }) | 157 | }) |
| 128 | } | 158 | } |
| 129 | 159 | ||
| 160 | /** 打开自定义弹层 */ | ||
| 161 | function openCertPopup(opt) { | ||
| 162 | popupTitle.value = opt.title || '提示' | ||
| 163 | popupContent.value = opt.content | ||
| 164 | popupIsAlert.value = !!opt.isAlert | ||
| 165 | popupBtnText.value = opt.btnText || '确认' | ||
| 166 | popupSure = opt.sure || (() => {}) | ||
| 167 | certPopup.value.open() | ||
| 168 | } | ||
| 169 | |||
| 170 | function onPopupCancel() { | ||
| 171 | certPopup.value.close() | ||
| 172 | } | ||
| 173 | |||
| 174 | function onPopupSure() { | ||
| 175 | certPopup.value.close() | ||
| 176 | popupSure() | ||
| 177 | } | ||
| 130 | 178 | ||
| 131 | function handleImport() { | 179 | function handleImport() { |
| 132 | var arr = [] | 180 | var arr = [] |
| ... | @@ -185,4 +233,73 @@ | ... | @@ -185,4 +233,73 @@ |
| 185 | font-size: 26rpx; | 233 | font-size: 26rpx; |
| 186 | } | 234 | } |
| 187 | } | 235 | } |
| 236 | |||
| 237 | .func button[disabled] { | ||
| 238 | opacity: 0.4; | ||
| 239 | color: #999; | ||
| 240 | border-color: #ccc; | ||
| 241 | } | ||
| 242 | /* 证书操作提示弹层 */ | ||
| 243 | .cert-dialog { | ||
| 244 | width: 560rpx; | ||
| 245 | background: #fff; | ||
| 246 | border-radius: 24rpx; | ||
| 247 | padding: 40rpx 32rpx 28rpx; | ||
| 248 | display: flex; | ||
| 249 | flex-direction: column; | ||
| 250 | align-items: center; | ||
| 251 | |||
| 252 | &__head { | ||
| 253 | display: flex; | ||
| 254 | align-items: center; | ||
| 255 | justify-content: center; | ||
| 256 | margin-bottom: 16rpx; | ||
| 257 | } | ||
| 258 | |||
| 259 | &__title { | ||
| 260 | font-size: 32rpx; | ||
| 261 | font-weight: 600; | ||
| 262 | color: #303133; | ||
| 263 | margin-left: 10rpx; | ||
| 264 | } | ||
| 265 | |||
| 266 | &__content { | ||
| 267 | font-size: 28rpx; | ||
| 268 | color: #606266; | ||
| 269 | line-height: 1.6; | ||
| 270 | text-align: center; | ||
| 271 | margin-bottom: 36rpx; | ||
| 272 | } | ||
| 273 | |||
| 274 | &__btns { | ||
| 275 | width: 100%; | ||
| 276 | display: flex; | ||
| 277 | justify-content: center; | ||
| 278 | align-items: center; | ||
| 279 | } | ||
| 280 | |||
| 281 | &__btn { | ||
| 282 | flex: 1; | ||
| 283 | margin: 0 8rpx; | ||
| 284 | height: 76rpx; | ||
| 285 | line-height: 76rpx; | ||
| 286 | text-align: center; | ||
| 287 | font-size: 28rpx; | ||
| 288 | border-radius: 38rpx; | ||
| 289 | |||
| 290 | &--cancel { | ||
| 291 | background: #f4f4f5; | ||
| 292 | color: #909399; | ||
| 293 | } | ||
| 294 | |||
| 295 | &--sure { | ||
| 296 | background: #AD181F; | ||
| 297 | color: #fff; | ||
| 298 | } | ||
| 299 | |||
| 300 | &:active { | ||
| 301 | opacity: 0.85; | ||
| 302 | } | ||
| 303 | } | ||
| 304 | } | ||
| 188 | </style> | 305 | </style> | ... | ... |
-
Please register or sign in to post a comment