cert.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <template>
  2. <view class="my-content">
  3. <view class="item" v-for="item in certsList">
  4. <view>{{item.certNumber}}</view>
  5. <image @click="showImg(item)" :src="it" mode="widthFix" v-for="it in imgList(item.certs)"></image>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. import {getConfigByKey} from '@/api/common'
  11. export default {
  12. data() {
  13. return {
  14. certsList:[]
  15. }
  16. },
  17. onLoad(val) {
  18. this.getConfigByKey();
  19. },
  20. methods: {
  21. imgList(imgs){
  22. return imgs ? imgs.split(','):[]
  23. },
  24. getConfigByKey(){
  25. var that=this;
  26. var data={key:"his.certs"}
  27. getConfigByKey(data).then(
  28. res => {
  29. if(res.code==200){
  30. console.log(JSON.parse(res.data))
  31. this.certsList=JSON.parse(res.data);
  32. }
  33. },
  34. rej => {}
  35. );
  36. },
  37. showImg(item) {
  38. //预览图片
  39. uni.previewImage({
  40. urls: item.certs ? item.certs.split(','):[],
  41. current: 0
  42. });
  43. },
  44. }
  45. }
  46. </script>
  47. <style scoped lang="scss">
  48. page{
  49. height: 100%;
  50. }
  51. .my-content{
  52. width: 100%;
  53. display: flex;
  54. flex-direction: column;
  55. justify-content: center;
  56. align-items: center;
  57. .item{
  58. image {
  59. margin: 30rpx;
  60. width: 100%;
  61. }
  62. }
  63. }
  64. </style>