Commit 8124c02c authored by Facius's avatar Facius

feat: 需求变更

parent 3776d164
<template> <template>
<view class="u-flex top"> <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" /> <image :src="tongzhiImage" class="notice-image" />
<view class="notice"> <view class="notice">
<u-notice-bar <u-notice-bar
mode="vertical" mode="vertical"
type="none" type="none"
font-size="24" font-size="24"
:list="[noticeText]" :list="list"
color="#FFFFFF" color="#FFFFFF"
:volume-icon="false" :volume-icon="false"
autoplay autoplay
...@@ -25,6 +20,9 @@ ...@@ -25,6 +20,9 @@
export default { export default {
data() { data() {
return { return {
times: [],
texts: ['', '', '', ''],
list: ['', '', '', ''],
avatars: [], avatars: [],
produceTime: 1000, produceTime: 1000,
duration: 60 * 1000, duration: 60 * 1000,
...@@ -102,52 +100,48 @@ export default { ...@@ -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() { tongzhiImage() {
return process.uniEnv.qn_base_url + 'tongzhi.png' return process.uniEnv.qn_base_url + 'tongzhi.png'
}, },
}, },
created() { created() {
this.initData() this.initData()
this.beginNotic(this.$u.random(1, 600) * 1000) this.beginNotic()
}, },
methods: { methods: {
initData() { initData() {
var a0 = this.$u.random(0, 49) var array = []
var a1 = this.$u.random(0, 49) for (var i = 0; i < 4; i++) {
if (a1 == a0) a0 = this.$u.random(0, 49) array.push(this.$u.random(1, 600) * 1000)
var a2 = this.$u.random(0, 49) this.texts[i] =
if ([a0, a1].indexOf(a2) != -1) a2 = this.$u.random(0, 49) '分钟前 ' +
var a3 = this.$u.random(0, 49) this.surnames[this.$u.random(0, 99)] +
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.courses[this.$u.random(0, 63)] +
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', array.sort((a, b) => {
] if (a > b) {
// this.list = [this.noticeText] return 1
} else if (a < b) {
return -1
} else {
return 0
}
})
this.times = array
this.changeList()
setInterval(() => { setInterval(() => {
this.produceTime += this.duration for (var i = 0; i < this.times.length; i++) {
this.times[i] += this.duration
}
this.changeList()
}, this.duration) }, this.duration)
}, },
beginNotic(time) { beginNotic() {
var after = this.$u.random(1, 600) * 1000 var after = this.$u.random(1, 600) * 1000
this.produceTime = time || 1000
setTimeout(() => { setTimeout(() => {
this.produceData() this.produceData()
...@@ -155,19 +149,26 @@ export default { ...@@ -155,19 +149,26 @@ export default {
}, after) }, after)
}, },
produceData() { produceData() {
var array = this.avatars.slice(1) var array = this.times.slice(0, 3)
var a0 = this.$u.random(0, 49) this.times = [this.$u.random(1, 600) * 1000, ...array]
var str = (a0 > 9 ? 'a' : 'a0') + String(a0) + '.jpeg' var arr = this.texts.slice(0, 3)
for (var item of this.avatars) { this.texts = [
if (item.indexOf(str) != -1) { '分钟前 ' +
a0 = this.$u.random(0, 49) this.surnames[this.$u.random(0, 99)] +
str = (a0 > 9 ? 'a' : 'a0') + String(a0) + '.jpeg' '**' +
break '完成了"' +
} 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 = array
// this.list = [this.noticeText]
}, },
}, },
} }
...@@ -181,22 +182,6 @@ export default { ...@@ -181,22 +182,6 @@ export default {
width: 48rpx; width: 48rpx;
height: 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 { .notice {
flex: 1; flex: 1;
width: 100%; width: 100%;
......
...@@ -39,9 +39,10 @@ ...@@ -39,9 +39,10 @@
> >
扫码自动绑定 扫码自动绑定
</u-button> </u-button>
<view class="change-button" @click="$u.throttle(handleChange, 500)" <!-- 暂时隐藏 -->
<!-- <view class="change-button" @click="$u.throttle(handleChange, 500)"
>手动输入卡号、密码绑定</view >手动输入卡号、密码绑定</view
> > -->
</view> </view>
<view> <view>
<u-toast ref="uToast" /> <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