123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <template>
- <div class="notice">
- <div class="title"><u-icon name="volume-up" size="46"></u-icon>恭喜</div>
- <!-- <scrollList :list="noticeList" :min="minScrollNum" :height="minScrollNum * 56" :time="4000">
- <template #default="{rows}">
- <div class="list">
- <div class="item" v-for="(item,index) in noticeList" :key="index">
- 【{{item.time}}】{{item.nickname}}获得{{item.xuefen}}学分
- </div>
- </div>
- </template>
- </scrollList> -->
- <view class="view_box">
- <view :style="transitionStyle">
- <template v-for="item in noticeList">
- <view class="item">
- <text class="item_time">{{item.time}}</text> {{item.nickname}}获得{{item.xuefen}}学分
- </view>
- </template>
- </view>
- </view>
- <image @click.stop="handleScreen" src="@/static/images/index/screen.png" mode="" class="amplify">
- </image>
- </div>
- </template>
- <script>
- import scrollList from '../components/zh-scrollList/scrollList/scrollList.vue'
- export default {
- components: {
- scrollList,
- },
- name: "ScrollNotice",
- props: {
- noticeList: {
- type: Array,
- default: []
- }
- },
- data() {
- return {
- minScrollNum: 10,
- };
- },
- created() {
- init()
- },
- onHide() {
- transitionStyle.value = ''
- clearInterval(timr.value)
- timr.value = null
- },
- methods: {
- init() {
- // 主要通过 transition 的过度时间 控制 滚动速度
- setTimeout(() => {
- transitionStyle.value = 'transition: all 8s linear 0s;transform: translateY(-50%);'
- if (timr.value) return
- timr.value = setInterval(() => {
- transitionStyle.value = ''
- setTimeout(() => {
- transitionStyle.value =
- 'transition: all 8s linear 0s;transform: translateY(-50%);'
- }, 20)
- }, 8000)
- }, 20)
- },
- handleScreen() {
- console.log(this.minScrollNum)
- if (this.minScrollNum == 3) {
- this.minScrollNum = 10
- } else if (this.minScrollNum == 10) {
- this.minScrollNum = 3
- }
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .notice {
- border-radius: 5px;
- border: 1px solid #CAC1C1;
- overflow: hidden;
- margin-top: 10px;
- position: relative;
- .amplify {
- position: absolute;
- bottom: 10px;
- right: 10px;
- width: 16px;
- height: 16px;
- }
- .title {
- border-radius: 5px 5px 0px 0px;
- padding: 6px 0;
- font-size: 18px;
- display: flex;
- justify-content: center;
- align-items: center;
- background: linear-gradient(90deg, #FB7B58 0%, #F5222D 97%);
- color: #fff;
- text-align: center;
- .u-icon {
- margin-right: 4px;
- }
- }
- .list {
- padding: 4px 16px;
- .item {
- height: 26px;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- line-height: 26px;
- .item_time {
- display: inline-block;
- margin-right: 4px;
- }
- }
- }
- }
- </style>
|