榆钱落尽槿花稀 448712ece5 feat: 添加积分申请系统基础功能与UI组件
本次提交主要包含以下内容:

1. 新增积分申请系统核心功能:
   - 添加登录页面及API接口
   - 实现积分申请记录查看功能
   - 集成微信小程序分享功能
   - 添加请求管理工具类

2. 引入Tuniao UI组件库:
   - 添加时间线、折叠面板、表格等UI组件
   - 集成头像组、单选框组等交互组件
   - 配置全局样式和主题颜色

3. 基础架构搭建:
   - 配置项目manifest和pages.json路由
   - 添加状态管理store
   - 实现自定义导航栏适配
   - 添加工具函数(加解密、数字处理等)

4. 静态资源:
   - 添加项目logo和背景图片
   - 配置uni.scss全局样式变量

本次提交为系统基础功能搭建,后续将进一步完善积分申请流程和审批功能。
2025-05-27 16:40:02 +08:00

242 lines
5.4 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view
class="tn-switch-class tn-switch"
:class="[
value ? 'tn-switch--on' : '',
disabled ? 'tn-switch--disabled' : '',
`tn-switch--${shape}`
]"
:style="[switchStyle]"
@tap="click"
>
<view
class="tn-switch__node"
:class="[`tn-switch__node--${shape}`]"
:style="[switchNodeStyle]"
>
<tn-loading class="tn-switch__node__loading" :show="loading" mode="flower" :size="size * 0.6" :color="loadingColor"></tn-loading>
</view>
<!-- 左图标 -->
<view
v-if="leftIcon !== ''"
class="tn-switch__icon tn-switch__icon--left"
:class="[
`tn-icon-${leftIcon}`,
value ? 'tn-switch__icon--show' : ''
]"
:style="[iconStyle]"></view>
<!-- 右图标 -->
<view
v-if="rightIcon !== ''"
class="tn-switch__icon tn-switch__icon--right"
:class="[
`tn-icon-${rightIcon}`,
!value ? 'tn-switch__icon--show' : ''
]"
:style="[iconStyle]"></view>
</view>
</template>
<script>
export default {
name: 'tn-switch',
props: {
value: {
type: Boolean,
default: false
},
// 按钮的样式
// circle 圆角 square 方形
shape: {
type: String,
default: 'circle'
},
// 是否禁用
disabled: {
type: Boolean,
default: false
},
// 尺寸
size: {
type: Number,
default: 50
},
// 打开时的背景颜色
activeColor: {
type: String,
default: ''
},
// 关闭时的背景颜色
inactiveColor: {
type: String,
default: ''
},
// 激活时的值
activeValue: {
type: [Number, String, Boolean],
default: true
},
// 关闭时的值
inactiveValue: {
type: [Number, String, Boolean],
default: false
},
// 左图标
leftIcon: {
type: String,
default: ''
},
// 右图标
rightIcon: {
type: String,
default: ''
},
// 是否为加载状态
loading: {
type: Boolean,
default: false
},
// 点击手机是否震动
vibrateShort: {
type: Boolean,
default: false
}
},
computed: {
switchStyle() {
let style = {}
style.fontSize = this.$t.string.getLengthUnitValue(this.size)
style.backgroundColor = this.value ?
this.activeColor ? this.activeColor : '#01BEFF' :
this.inactiveColor ? this.inactiveColor : '#AAAAAA'
return style
},
switchNodeStyle() {
let style = {}
style.width = this.$t.string.getLengthUnitValue(this.size)
style.height = style.width
return style
},
iconStyle() {
let style = {}
style.fontSize = this.$t.string.getLengthUnitValue(this.size - 20)
style.lineHeight = this.$t.string.getLengthUnitValue(this.size)
return style
},
loadingColor() {
return this.value ? this.activeColor : ''
}
},
data() {
return {
}
},
methods: {
click() {
if (!this.disabled && !this.loading) {
if (this.vibrateShort) uni.vibrateShort()
this.$emit('input', !this.value)
// 放到下一个生命周期因为双向绑定的value修改父组件状态需要时间且是异步的
this.$nextTick(() => {
this.$emit('change', this.value ? this.activeValue : this.inactiveValue);
})
}
}
}
}
</script>
<style lang="scss" scoped>
.tn-switch {
/* #ifndef APP-NVUE */
display: inline-block;
/* #endif */
position: relative;
box-sizing: initial;
width: 2em;
height: 1em;
font-size: 50rpx;
background-color: #AAAAAA;
transition: background-color 0.3s;
&__node {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
position: absolute;
top: 0;
left: 0;
z-index: 1;
background-color: #FFFFFF;
transform: scale(0.9);
box-shadow: 0 6rpx 2rpx 0 rgba(0, 0, 0, 0.05), 0 4rpx 4rpx 0 rgba(0, 0, 0, 0.1), 0 6rpx 6rpx 0 rgba(0, 0, 0, 0.05);
transition: transform 0.3s cubic-bezier(0.3, 1.05, 0.4, 1.05);
-webkit-transition: transform 0.3s cubic-bezier(0.3, 1.05, 0.4, 1.05);
&__loading {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
&--circle {
border-radius: 100%;
}
&--square {
border-radius: 15%;
}
}
&__icon {
color: #FFFFFF;
font-size: 30rpx;
line-height: 50rpx;
height: 100%;
vertical-align: middle;
position: absolute;
transform: scale(0);
transform-origin: 50% 50%;
transition: transform 0.3s ease-in-out;
&--left {
top: 0;
left: 10rpx;
}
&--right {
top: 0;
right: 10rpx;
}
&--show {
transform: scale(1);
}
}
&--circle {
border-radius: 1em;
}
&--square {
border-radius: 0.1em;
}
&--on {
background-color: $tn-main-color;
.tn-switch__node {
transform: translateX(100%) scale(0.9);
}
}
&--disabled {
opacity: 0.4;
}
}
</style>