useimg.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <template>
  2. <div class="img-layout" :class="{agreement:$route.params.name==='agreement'}">
  3. <img :src="images" alt="">
  4. <!-- <img v-if="$route.params.name==='agreement'" :src="`${$cdn}images/agreement/eight/${language === 'en' ? 'en' : 'zh'}/2-more.jpg`" alt=""> -->
  5. </div>
  6. </template>
  7. <script>
  8. import data from './temp/config'
  9. import {mapState} from 'vuex'
  10. let current = {
  11. 0: 'eight',
  12. 1: 'binocular'
  13. }
  14. export default {
  15. data () {
  16. return {
  17. }
  18. },
  19. computed: {
  20. ...mapState({
  21. language: state => state.language.current
  22. }),
  23. images () {
  24. let use = parseInt(this.$route.params.type) === 0 ? data.use.data.pro : data.use.data.lite
  25. let name = this.$route.params.name
  26. let img = ''
  27. for (let i = 0; i < use.length; i++) {
  28. let item = use[i]
  29. if (!item.sub) {
  30. if (parseInt(item.img) === parseInt(this.$route.params.id)) {
  31. img = this.$cdn + `images/${name}/${current[this.$route.params.type]}/${this.language === 'en' ? 'en' : 'zh'}/${item.img}.jpg`
  32. return img
  33. }
  34. }
  35. if (item.sub) {
  36. for (let j = 0; j < item.sub.length; j++) {
  37. let sub = item.sub[j]
  38. if (parseInt(sub.img) === parseInt(this.$route.params.id)) {
  39. img = this.$cdn + `images/${name}/${current[this.$route.params.type]}/${this.language === 'en' ? 'en' : 'zh'}/${sub.img}.jpg`
  40. return img
  41. }
  42. }
  43. }
  44. }
  45. return img
  46. }
  47. }
  48. }
  49. </script>
  50. <style lang="scss" scoped>
  51. .img-layout{
  52. width: 100%;
  53. background-color: #fff;
  54. min-height: 400px;
  55. img{
  56. margin: 30px 0;
  57. width:100%;
  58. }
  59. }
  60. .agreement{
  61. img{
  62. margin: 0;
  63. }
  64. }
  65. </style>