Commit 8124c02c authored by Facius's avatar Facius

feat: 需求变更

parent 3776d164
<template>
<view class="u-flex top">
<!-- <view class="u-flex avatar">
<view class="avatar-list" v-for="(item, index) in avatars" :key="index">
<image :src="item" mode="aspectFill" />
</view>
</view> -->
<image :src="tongzhiImage" class="notice-image" />
<view class="notice">
<u-notice-bar
mode="vertical"
type="none"
font-size="24"
:list="[noticeText]"
:list="list"
color="#FFFFFF"
:volume-icon="false"
autoplay
......@@ -25,6 +20,9 @@
export default {
data() {
return {
times: [],
texts: ['', '', '', ''],
list: ['', '', '', ''],
avatars: [],
produceTime: 1000,
duration: 60 * 1000,
......@@ -102,52 +100,48 @@ export default {
'烟花爆竹产品涉药作业',
]
},
noticeText() {
return (
Math.ceil(this.produceTime / 1000 / 60) +
'分钟前 ' +
this.surnames[this.$u.random(0, 99)] +
'**' +
'完成了"' +
this.courses[this.$u.random(0, 63)] +
'习题"练习'
)
},
defaultUrl() {
return process.uniEnv.qn_base_url + 'heads/'
},
tongzhiImage() {
return process.uniEnv.qn_base_url + 'tongzhi.png'
},
},
created() {
this.initData()
this.beginNotic(this.$u.random(1, 600) * 1000)
this.beginNotic()
},
methods: {
initData() {
var a0 = this.$u.random(0, 49)
var a1 = this.$u.random(0, 49)
if (a1 == a0) a0 = this.$u.random(0, 49)
var a2 = this.$u.random(0, 49)
if ([a0, a1].indexOf(a2) != -1) a2 = this.$u.random(0, 49)
var a3 = this.$u.random(0, 49)
if ([a0, a1, a2].indexOf(a3) != -1) a3 = this.$u.random(0, 49)
this.avatars = [
this.defaultUrl + (a0 > 9 ? 'a' : 'a0') + String(a0) + '.jpeg',
this.defaultUrl + (a1 > 9 ? 'a' : 'a0') + String(a1) + '.jpeg',
this.defaultUrl + (a2 > 9 ? 'a' : 'a0') + String(a2) + '.jpeg',
this.defaultUrl + (a3 > 9 ? 'a' : 'a0') + String(a3) + '.jpeg',
]
// this.list = [this.noticeText]
var array = []
for (var i = 0; i < 4; i++) {
array.push(this.$u.random(1, 600) * 1000)
this.texts[i] =
'分钟前 ' +
this.surnames[this.$u.random(0, 99)] +
'**' +
'完成了"' +
this.courses[this.$u.random(0, 63)] +
'习题"练习'
}
array.sort((a, b) => {
if (a > b) {
return 1
} else if (a < b) {
return -1
} else {
return 0
}
})
this.times = array
this.changeList()
setInterval(() => {
this.produceTime += this.duration
for (var i = 0; i < this.times.length; i++) {
this.times[i] += this.duration
}
this.changeList()
}, this.duration)
},
beginNotic(time) {
beginNotic() {
var after = this.$u.random(1, 600) * 1000
this.produceTime = time || 1000
setTimeout(() => {
this.produceData()
......@@ -155,19 +149,26 @@ export default {
}, after)
},
produceData() {
var array = this.avatars.slice(1)
var a0 = this.$u.random(0, 49)
var str = (a0 > 9 ? 'a' : 'a0') + String(a0) + '.jpeg'
for (var item of this.avatars) {
if (item.indexOf(str) != -1) {
a0 = this.$u.random(0, 49)
str = (a0 > 9 ? 'a' : 'a0') + String(a0) + '.jpeg'
break
}
var array = this.times.slice(0, 3)
this.times = [this.$u.random(1, 600) * 1000, ...array]
var arr = this.texts.slice(0, 3)
this.texts = [
'分钟前 ' +
this.surnames[this.$u.random(0, 99)] +
'**' +
'完成了"' +
this.courses[this.$u.random(0, 63)] +
'习题"练习',
...arr,
]
this.changeList()
},
changeList() {
var array = ['', '', '', '']
for (var i = 0; i < this.times.length; i++) {
array[i] = Math.ceil(this.times[i] / 1000 / 60) + this.texts[i]
}
this.avatars = [...array, this.defaultUrl + str]
// this.list = [this.noticeText]
this.list = array
},
},
}
......@@ -181,22 +182,6 @@ export default {
width: 48rpx;
height: 48rpx;
}
// .avatar {
// .avatar-list {
// margin-left: -15rpx;
// display: flex;
// justify-content: flex-start;
// align-items: center;
// image {
// width: 44rpx;
// height: 44rpx;
// border: 2rpx solid #ccc;
// background: #fff;
// border-radius: 50%;
// margin-right: 1px;
// }
// }
// }
.notice {
flex: 1;
width: 100%;
......
......@@ -39,9 +39,10 @@
>
扫码自动绑定
</u-button>
<view class="change-button" @click="$u.throttle(handleChange, 500)"
<!-- 暂时隐藏 -->
<!-- <view class="change-button" @click="$u.throttle(handleChange, 500)"
>手动输入卡号、密码绑定</view
>
> -->
</view>
<view>
<u-toast ref="uToast" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment