index.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <view class="zs-dialog" v-if="showDialog">
  3. <view class="dialog-content">
  4. <image class="adv" :src="currentAdv" mode="widthFix" @click="jump"></image>
  5. <image class="close" src="@/static/close.png" mode="" @click="handleClose"></image>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. props: {
  12. list: {
  13. type: Array,
  14. default: ()=>{
  15. return []
  16. }
  17. },
  18. },
  19. data() {
  20. return {
  21. current: 0,
  22. show:true,
  23. }
  24. },
  25. computed: {
  26. currentAdv() {
  27. if(this.list.length){
  28. return this.list[this.current].advertsImg
  29. }else{
  30. return ''
  31. }
  32. },
  33. showDialog(){
  34. if(this.list.length &&this.show){
  35. if((this.current+1) > this.list.length){
  36. return false
  37. }else{
  38. return true
  39. }
  40. }else{
  41. return false
  42. }
  43. }
  44. },
  45. methods: {
  46. handleClose() {
  47. if((this.current+1)== this.list.length){
  48. this.show = false
  49. }else{
  50. this.current++
  51. }
  52. },
  53. jump(){
  54. if(this.list[this.current].loginLimit == 1){
  55. if(!uni.getStorageSync('token')){
  56. let that = this
  57. return uni.showModal({
  58. title: "请登录",
  59. confirmText: "去登录",
  60. success(res) {
  61. if (res.confirm) {
  62. let redirect = that.list[that.current].jumpUrl.split('?')[0]
  63. let params = that.list[that.current].jumpUrl.split('?')[1]
  64. console.log(`../../login/login/login?redirect=${redirect}&${params}`);
  65. uni.navigateTo({
  66. url: `../../login/login/login?redirect=${redirect}&${params}`,
  67. });
  68. }
  69. },
  70. });
  71. }
  72. }
  73. this.show = false
  74. uni.navigateTo({
  75. url: this.list[this.current].jumpUrl
  76. })
  77. }
  78. },
  79. }
  80. </script>
  81. <style lang="scss" scoped>
  82. .zs-dialog{
  83. position: fixed;
  84. top: 0%;
  85. left: 0%;
  86. width: 750rpx;
  87. height: 100vh;
  88. z-index: 2;
  89. background: rgba(0, 0, 0, .4);
  90. .dialog-content{
  91. position: absolute;
  92. top: 50%;
  93. left: 50%;
  94. transform: translate(-50%,-50%);
  95. width: 552rpx;
  96. .adv{
  97. width: 100%;
  98. }
  99. .close{
  100. width: 40rpx;
  101. height: 40rpx;
  102. position: absolute;
  103. bottom: -52rpx;
  104. left: 50%;
  105. transform: translateX(-50%);
  106. }
  107. }
  108. }
  109. </style>