证书
Showing
6 changed files
with
206 additions
and
29 deletions
| ... | @@ -1272,3 +1272,17 @@ export function checkPersonByPersonId(perId) { | ... | @@ -1272,3 +1272,17 @@ export function checkPersonByPersonId(perId) { |
| 1272 | method: 'get' | 1272 | method: 'get' |
| 1273 | }) | 1273 | }) |
| 1274 | } | 1274 | } |
| 1275 | export function checkCertCode(params) { | ||
| 1276 | return request({ | ||
| 1277 | url: `/person/info/checkCertCode`, | ||
| 1278 | method: 'get', | ||
| 1279 | params: params | ||
| 1280 | }) | ||
| 1281 | } | ||
| 1282 | export function submitCert3(data) { | ||
| 1283 | return request({ | ||
| 1284 | url: `/exam/payment/submitCerts/issueAndUpdateCerts`, | ||
| 1285 | method: 'put', | ||
| 1286 | data: data | ||
| 1287 | }) | ||
| 1288 | } | ... | ... |
| ... | @@ -55,10 +55,17 @@ const request = function(req) { | ... | @@ -55,10 +55,17 @@ const request = function(req) { |
| 55 | // } | 55 | // } |
| 56 | 56 | ||
| 57 | return new Promise((resolve, reject) => { | 57 | return new Promise((resolve, reject) => { |
| 58 | // 支持 @RequestBody 接口:传 data 则序列化为 JSON 放进请求体 | ||
| 59 | let reqData = req.data | ||
| 60 | if (reqData !== undefined && reqData !== null) { | ||
| 61 | reqData = JSON.stringify(reqData) | ||
| 62 | } else { | ||
| 63 | reqData = req.params | ||
| 64 | } | ||
| 58 | uni.request({ | 65 | uni.request({ |
| 59 | url: config.baseUrl_api + req.url, | 66 | url: config.baseUrl_api + req.url, |
| 60 | method: req.method, | 67 | method: req.method, |
| 61 | data: req.params, | 68 | data: reqData, |
| 62 | header: getHeaders() | 69 | header: getHeaders() |
| 63 | }).then(res => { | 70 | }).then(res => { |
| 64 | switch (res.statusCode) { | 71 | switch (res.statusCode) { | ... | ... |
| ... | @@ -7,8 +7,8 @@ | ... | @@ -7,8 +7,8 @@ |
| 7 | // const baseUrl_api = "https://ztx.itechtop.cn:8443/stage-api"; | 7 | // const baseUrl_api = "https://ztx.itechtop.cn:8443/stage-api"; |
| 8 | // const baseUrl_api = 'http://192.168.1.132:8787' | 8 | // const baseUrl_api = 'http://192.168.1.132:8787' |
| 9 | // const baseUrl_api = 'https://tkcn.19wk.cn:8443/stage-api' | 9 | // const baseUrl_api = 'https://tkcn.19wk.cn:8443/stage-api' |
| 10 | // const baseUrl_api = 'https://tk001.wxjylt.com/stage-api' //测试环境 | 10 | const baseUrl_api = 'https://tk001.wxjylt.com/stage-api' //测试环境 |
| 11 | const baseUrl_api = 'https://system.taekwondo.org.cn/stage-api' //会员生产 | 11 | // const baseUrl_api = 'https://system.taekwondo.org.cn/stage-api' //会员生产 |
| 12 | // const baseUrl_api = 'https://system.taekwondo.org.cn/stage-api' | 12 | // const baseUrl_api = 'https://system.taekwondo.org.cn/stage-api' |
| 13 | export default { | 13 | export default { |
| 14 | baseUrl_api | 14 | baseUrl_api | ... | ... |
| ... | @@ -34,7 +34,8 @@ | ... | @@ -34,7 +34,8 @@ |
| 34 | </view> | 34 | </view> |
| 35 | <!-- v-if="item.certStatus != '2'" --> | 35 | <!-- v-if="item.certStatus != '2'" --> |
| 36 | <view class="func"> | 36 | <view class="func"> |
| 37 | <button @click="send(item)">更新证书</button> | 37 | <button @click="goDetail(item)">查看</button> |
| 38 | <button @click="handleSend(item)">下发并生成证书</button> | ||
| 38 | </view> | 39 | </view> |
| 39 | </view> | 40 | </view> |
| 40 | </view> | 41 | </view> |
| ... | @@ -43,6 +44,25 @@ | ... | @@ -43,6 +44,25 @@ |
| 43 | <image mode="aspectFit" src="/static/nodata.png"></image> | 44 | <image mode="aspectFit" src="/static/nodata.png"></image> |
| 44 | <text>暂无数据</text> | 45 | <text>暂无数据</text> |
| 45 | </view> --> | 46 | </view> --> |
| 47 | |||
| 48 | <!-- 下发证书确认弹层 --> | ||
| 49 | <uni-popup ref="certPopup" type="center" :is-mask-click="false"> | ||
| 50 | <view class="cert-dialog"> | ||
| 51 | <view class="cert-dialog__head"> | ||
| 52 | <uni-icons type="info-filled" size="24" color="#FAAD14" /> | ||
| 53 | <view class="cert-dialog__title">提示</view> | ||
| 54 | </view> | ||
| 55 | <view class="cert-dialog__content">{{ popupContent }}</view> | ||
| 56 | <view class="cert-dialog__btns"> | ||
| 57 | <view class="cert-dialog__btn cert-dialog__btn--cancel" @click="onPopupCancel">取消</view> | ||
| 58 | <view | ||
| 59 | v-if="showDownload" class="cert-dialog__btn cert-dialog__btn--download" | ||
| 60 | @click="onPopupDownload" | ||
| 61 | >下载名单</view> | ||
| 62 | <view class="cert-dialog__btn cert-dialog__btn--sure" @click="onPopupSure">确认下发</view> | ||
| 63 | </view> | ||
| 64 | </view> | ||
| 65 | </uni-popup> | ||
| 46 | </view> | 66 | </view> |
| 47 | </template> | 67 | </template> |
| 48 | 68 | ||
| ... | @@ -72,6 +92,12 @@ | ... | @@ -72,6 +92,12 @@ |
| 72 | const deptType = ref('') | 92 | const deptType = ref('') |
| 73 | const userType = ref('') | 93 | const userType = ref('') |
| 74 | const paging = ref(null) | 94 | const paging = ref(null) |
| 95 | // 下发证书确认弹层 | ||
| 96 | const certPopup = ref(null) | ||
| 97 | const popupContent = ref('') | ||
| 98 | const showDownload = ref(false) | ||
| 99 | let popupSure = () => {} | ||
| 100 | let popupDownload = () => {} | ||
| 75 | onLoad((option) => { | 101 | onLoad((option) => { |
| 76 | queryParams.value.type = option.type | 102 | queryParams.value.type = option.type |
| 77 | if (option.type == 2) { | 103 | if (option.type == 2) { |
| ... | @@ -96,6 +122,20 @@ | ... | @@ -96,6 +122,20 @@ |
| 96 | } | 122 | } |
| 97 | }) | 123 | }) |
| 98 | 124 | ||
| 125 | function handleSend(row) { | ||
| 126 | checkCert(row.payId, () => { | ||
| 127 | api.submitCert3([{ | ||
| 128 | id: row.payId | ||
| 129 | }]).then(() => { | ||
| 130 | uni.showToast({ | ||
| 131 | title: `下发成功` | ||
| 132 | }) | ||
| 133 | getList() | ||
| 134 | }) | ||
| 135 | }, () => { | ||
| 136 | return `确定下发 ${row.name} 的证书吗` | ||
| 137 | }) | ||
| 138 | } | ||
| 99 | function init() { | 139 | function init() { |
| 100 | deptType.value = app.globalData.deptType | 140 | deptType.value = app.globalData.deptType |
| 101 | userType.value = app.globalData.userType | 141 | userType.value = app.globalData.userType |
| ... | @@ -132,40 +172,86 @@ | ... | @@ -132,40 +172,86 @@ |
| 132 | function checkCert(payIds, sureFunc, confirmFunc) { | 172 | function checkCert(payIds, sureFunc, confirmFunc) { |
| 133 | return api.checkPersonByPayIds(payIds).then(res => { | 173 | return api.checkPersonByPayIds(payIds).then(res => { |
| 134 | if (res.data == 1) { | 174 | if (res.data == 1) { |
| 135 | confirmFunc().then((kk)=>{ | 175 | // 照片齐全:弹自定义确认框,确认后执行下发 |
| 136 | if(kk.confirm){ | 176 | openCertPopup({ |
| 137 | sureFunc() | 177 | content: confirmFunc(), |
| 138 | } | 178 | showDownload: false, |
| 179 | sure: sureFunc | ||
| 139 | }) | 180 | }) |
| 140 | } else if (res.data == 2 || res.data == 3) { | 181 | } else if (res.data == 2 || res.data == 3) { |
| 141 | uni.showModal({ | 182 | // 部分或全部学员没有照片:弹三按钮框,可下载名单 |
| 142 | title: '提示', | 183 | openCertPopup({ |
| 143 | content:`存在学员没有照片,是否继续生成?`, | 184 | content: '存在学员没有照片,是否继续生成?', |
| 144 | success: (rr) => { | 185 | showDownload: true, |
| 145 | if(rr.confirm){ | 186 | sure: sureFunc, |
| 146 | sureFunc() | 187 | download: () => downloadNoPhotoList(payIds) |
| 147 | } | ||
| 148 | } | ||
| 149 | }) | 188 | }) |
| 150 | } | 189 | } |
| 151 | }) | 190 | }) |
| 152 | } | 191 | } |
| 153 | 192 | ||
| 154 | function send(row) { | 193 | /** 打开自定义确认弹层 */ |
| 155 | checkCert(row.payId, () => { | 194 | function openCertPopup(opt) { |
| 156 | api.submitCert2([{ | 195 | popupContent.value = opt.content |
| 157 | id: row.payId | 196 | showDownload.value = !!opt.showDownload |
| 158 | }]).then(res => { | 197 | popupSure = opt.sure || (() => {}) |
| 198 | popupDownload = opt.download || (() => {}) | ||
| 199 | certPopup.value.open() | ||
| 200 | } | ||
| 201 | |||
| 202 | function onPopupCancel() { | ||
| 203 | certPopup.value.close() | ||
| 204 | } | ||
| 205 | |||
| 206 | function onPopupSure() { | ||
| 207 | certPopup.value.close() | ||
| 208 | popupSure() | ||
| 209 | } | ||
| 210 | |||
| 211 | function onPopupDownload() { | ||
| 212 | popupDownload() | ||
| 213 | } | ||
| 214 | |||
| 215 | /** 下载没有照片的学员名单(Excel) */ | ||
| 216 | function downloadNoPhotoList(payIds) { | ||
| 217 | uni.showLoading({ | ||
| 218 | title: '下载中' | ||
| 219 | }) | ||
| 220 | uni.downloadFile({ | ||
| 221 | url: config.baseUrl_api + '/person/info/checkPersonByPayIdsAndExport/' + payIds, | ||
| 222 | header: { | ||
| 223 | 'Authorization': uni.getStorageSync('token') | ||
| 224 | }, | ||
| 225 | success: function(res) { | ||
| 226 | uni.hideLoading() | ||
| 227 | uni.showLoading({ | ||
| 228 | title: '正在打开' | ||
| 229 | }) | ||
| 230 | uni.openDocument({ | ||
| 231 | filePath: res.tempFilePath, | ||
| 232 | fileType: 'xlsx', | ||
| 233 | showMenu: true, | ||
| 234 | success: function() { | ||
| 235 | uni.hideLoading() | ||
| 236 | }, | ||
| 237 | fail: function() { | ||
| 238 | uni.hideLoading() | ||
| 159 | uni.showToast({ | 239 | uni.showToast({ |
| 160 | title: `下发成功` | 240 | title: '打开失败', |
| 241 | icon: 'none', | ||
| 242 | duration: 2000 | ||
| 161 | }) | 243 | }) |
| 162 | getList() | 244 | } |
| 163 | }) | 245 | }) |
| 164 | },()=>{ | 246 | }, |
| 165 | return uni.showModal({ | 247 | fail: function() { |
| 166 | title: '提示', | 248 | uni.hideLoading() |
| 167 | content:`确定下发 ${row.name} 的证书吗` | 249 | uni.showToast({ |
| 250 | title: '下载失败', | ||
| 251 | icon: 'none', | ||
| 252 | duration: 2000 | ||
| 168 | }) | 253 | }) |
| 254 | } | ||
| 169 | }) | 255 | }) |
| 170 | } | 256 | } |
| 171 | </script> | 257 | </script> |
| ... | @@ -180,4 +266,74 @@ | ... | @@ -180,4 +266,74 @@ |
| 180 | width: 80%; | 266 | width: 80%; |
| 181 | word-break: break-all; | 267 | word-break: break-all; |
| 182 | } | 268 | } |
| 269 | |||
| 270 | /* 下发证书确认弹层 */ | ||
| 271 | .cert-dialog { | ||
| 272 | width: 560rpx; | ||
| 273 | background: #fff; | ||
| 274 | border-radius: 24rpx; | ||
| 275 | padding: 40rpx 32rpx 28rpx; | ||
| 276 | display: flex; | ||
| 277 | flex-direction: column; | ||
| 278 | align-items: center; | ||
| 279 | |||
| 280 | &__head { | ||
| 281 | display: flex; | ||
| 282 | align-items: center; | ||
| 283 | justify-content: center; | ||
| 284 | margin-bottom: 16rpx; | ||
| 285 | } | ||
| 286 | |||
| 287 | &__title { | ||
| 288 | font-size: 32rpx; | ||
| 289 | font-weight: 600; | ||
| 290 | color: #303133; | ||
| 291 | margin-left: 10rpx; | ||
| 292 | } | ||
| 293 | |||
| 294 | &__content { | ||
| 295 | font-size: 28rpx; | ||
| 296 | color: #606266; | ||
| 297 | line-height: 1.6; | ||
| 298 | text-align: center; | ||
| 299 | margin-bottom: 36rpx; | ||
| 300 | } | ||
| 301 | |||
| 302 | &__btns { | ||
| 303 | width: 100%; | ||
| 304 | display: flex; | ||
| 305 | justify-content: center; | ||
| 306 | align-items: center; | ||
| 307 | } | ||
| 308 | |||
| 309 | &__btn { | ||
| 310 | flex: 1; | ||
| 311 | margin: 0 8rpx; | ||
| 312 | height: 76rpx; | ||
| 313 | line-height: 76rpx; | ||
| 314 | text-align: center; | ||
| 315 | font-size: 28rpx; | ||
| 316 | border-radius: 38rpx; | ||
| 317 | |||
| 318 | &--cancel { | ||
| 319 | background: #f4f4f5; | ||
| 320 | color: #909399; | ||
| 321 | } | ||
| 322 | |||
| 323 | &--download { | ||
| 324 | background: #fff; | ||
| 325 | color: #13B5B1; | ||
| 326 | border: 1rpx solid #13B5B1; | ||
| 327 | } | ||
| 328 | |||
| 329 | &--sure { | ||
| 330 | background: #AD181F; | ||
| 331 | color: #fff; | ||
| 332 | } | ||
| 333 | |||
| 334 | &:active { | ||
| 335 | opacity: 0.85; | ||
| 336 | } | ||
| 337 | } | ||
| 338 | } | ||
| 183 | </style> | 339 | </style> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -29,9 +29,9 @@ | ... | @@ -29,9 +29,9 @@ |
| 29 | </view> | 29 | </view> |
| 30 | </view> | 30 | </view> |
| 31 | <!-- v-if="item.isCert != '2'" --> | 31 | <!-- v-if="item.isCert != '2'" --> |
| 32 | <view class="func"> | 32 | <!-- <view class="func"> |
| 33 | <button @click="send(item)">更新证书</button> | 33 | <button @click="send(item)">更新证书</button> |
| 34 | </view> | 34 | </view> --> |
| 35 | </view> | 35 | </view> |
| 36 | </view> | 36 | </view> |
| 37 | 37 | ... | ... |
-
Please register or sign in to post a comment