本次提交主要包含以下内容: 1. 新增积分申请系统核心功能: - 添加登录页面及API接口 - 实现积分申请记录查看功能 - 集成微信小程序分享功能 - 添加请求管理工具类 2. 引入Tuniao UI组件库: - 添加时间线、折叠面板、表格等UI组件 - 集成头像组、单选框组等交互组件 - 配置全局样式和主题颜色 3. 基础架构搭建: - 配置项目manifest和pages.json路由 - 添加状态管理store - 实现自定义导航栏适配 - 添加工具函数(加解密、数字处理等) 4. 静态资源: - 添加项目logo和背景图片 - 配置uni.scss全局样式变量 本次提交为系统基础功能搭建,后续将进一步完善积分申请流程和审批功能。
172 lines
4.0 KiB
Vue
172 lines
4.0 KiB
Vue
<template>
|
|
<view class="tn-count-scroll-class tn-count-scroll">
|
|
<view
|
|
v-for="(item, index) in columns"
|
|
:key="index"
|
|
class="tn-count-scroll__box"
|
|
:style="{
|
|
width: $t.string.getLengthUnitValue(width),
|
|
height: heightPxValue + 'px'
|
|
}"
|
|
>
|
|
<view
|
|
class="tn-count-scroll__column"
|
|
:style="{
|
|
transform: `translate3d(0, -${keys[index] * heightPxValue}px, 0)`,
|
|
transitionDuration: `${duration}s`
|
|
}"
|
|
>
|
|
<view
|
|
v-for="(value, value_index) in item"
|
|
:key="value_index"
|
|
class="tn-count-scroll__column__item"
|
|
:class="[fontColorClass]"
|
|
:style="{
|
|
height: heightPxValue + 'px',
|
|
lineHeight: heightPxValue + 'px',
|
|
fontSize: fontSizeStyle || '32rpx',
|
|
fontWeight: bold ? 'bold': 'normal',
|
|
color: fontColorStyle || '#080808'
|
|
}"
|
|
>
|
|
{{ value }}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import componentsColorMixin from '../../libs/mixin/components_color.js'
|
|
export default {
|
|
name: 'tn-count-scroll',
|
|
mixins: [componentsColorMixin],
|
|
props: {
|
|
value: {
|
|
type: Number,
|
|
default: 0
|
|
},
|
|
// 行高
|
|
height: {
|
|
type: Number,
|
|
default: 32
|
|
},
|
|
// 单个字的宽度
|
|
width: {
|
|
type: [String, Number],
|
|
default: 'auto'
|
|
},
|
|
// 是否加粗
|
|
bold: {
|
|
type: Boolean,
|
|
default: false
|
|
},
|
|
// 持续时间
|
|
duration: {
|
|
type: Number,
|
|
default: 1.2
|
|
},
|
|
// 十分位分割符
|
|
decimalSeparator: {
|
|
type: String,
|
|
default: '.'
|
|
},
|
|
// 千分位分割符
|
|
thousandthsSeparator: {
|
|
type: String,
|
|
default: ''
|
|
}
|
|
},
|
|
computed: {
|
|
heightPxValue() {
|
|
return uni.upx2px(this.height || 0)
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
// 每列的数据
|
|
columns: [],
|
|
// 每列对应值所在的滚动位置
|
|
keys: []
|
|
}
|
|
},
|
|
watch: {
|
|
value(val) {
|
|
this.initColumn(val)
|
|
}
|
|
},
|
|
created() {
|
|
// 为了达到一进入就有滚动效果,延迟执行初始化
|
|
this.initColumn()
|
|
setTimeout(() => {
|
|
this.initColumn(this.value)
|
|
}, 20)
|
|
},
|
|
methods: {
|
|
// 初始化每一列的数据
|
|
initColumn(val) {
|
|
val = val + ''
|
|
let digit = val.length,
|
|
columnArray = [],
|
|
rows = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
|
for (let i = 0; i < digit; i++) {
|
|
if (val[i] === this.decimalSeparator || val[i] === this.thousandthsSeparator) {
|
|
columnArray.push(val[i])
|
|
} else {
|
|
columnArray.push(rows)
|
|
}
|
|
}
|
|
this.columns = columnArray
|
|
this.roll(val)
|
|
},
|
|
// 滚动处理
|
|
roll(value) {
|
|
let valueArray = value.toString().split(''),
|
|
lengths = this.columns.length,
|
|
indexs = [];
|
|
|
|
while (valueArray.length) {
|
|
let figure = valueArray.pop()
|
|
if (figure === this.decimalSeparator || figure === this.thousandthsSeparator) {
|
|
indexs.unshift(0)
|
|
} else {
|
|
indexs.unshift(Number(figure))
|
|
}
|
|
}
|
|
while(indexs.length < lengths) {
|
|
indexs.unshift(0)
|
|
}
|
|
this.keys = indexs
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.tn-count-scroll {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
|
|
&__box {
|
|
overflow: hidden;
|
|
}
|
|
|
|
&__column {
|
|
transform: translate3d(0, 0, 0);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
flex-direction: column;
|
|
transition-timing-function: cubic-bezier(0, 1, 0, 1);
|
|
|
|
&__item {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
}
|
|
}
|
|
</style>
|