修改设置显示百禄名称

This commit is contained in:
田岩
2025-09-19 17:04:02 +08:00
21 changed files with 1000 additions and 145 deletions
+18
View File
@@ -3,4 +3,22 @@ ENV = 'development'
# 'development'
VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001'
# UAT
# VITE_APP_BASE_API_Url = 'http://25.18.122.78:9786'
# DEV
# app入口
# VITE_APP_BASE_API_Url = 'http://25.16.122.65:7001'
# VITE_APP_BASE_API_Url = 'http://25.16.122.92:9786'
# VITE_APP_BASE_API_Url = 'http://25.18.122.66:9786'
# h5专用地址x2
# VITE_APP_BASE_H5_API_Url = 'http://25.18.122.65:7001'
# VITE_APP_BASE_H5_API_Url = 'http://25.18.122.21:9786'
+1 -1
View File
@@ -1,7 +1,7 @@
<template>
<view class="course-item-box" @click="clickItem">
<view class="img-box-view">
<ImagePreview class="img-box" :imgId="itemInfo.imgId" :isCache="true" width="225" height="170" mode="aspectFill"></ImagePreview>
<ImagePreview class="img-box" :imgId="itemInfo.imgId" :isCache="true" width="225" height="170" mode="scaleToFill"></ImagePreview>
<view class="item-grade">{{itemInfo.evalGrade}}</view>
<!-- <image class="item-grade" mode="aspectFill"></view> -->
</view>
@@ -1,6 +1,6 @@
<template>
<view v-bind="$attrs">
<image :src="imgUrlShow" fit="cover" :mode="mode" @click="showDetail" style="width: 100%;height: 100%;"></image>
<image :src="imgUrlShow" :mode="mode" @click="showDetail" style="width: 100%;height: 100%;"></image>
<!-- <uv-overlay :show="showModel" opacity=".6" @click="showModel = false"> -->
<uni-popup ref="PopupRef" class="popup" mask-background-color="rgba(0,0,0,.2)">
<view class="overlay-box" @click="closePopup">
@@ -1,5 +1,5 @@
<template>
<view class="video-view-box" @click="showModelNow">
<view v-bind="$attrs" class="video-view-box" @click="showModelNow">
<imagePreviewVue :imgId="picId" class="preview-pic" v-if="picId"/>
<imagePreviewVue :src="picSrc" class="preview-pic" v-if="picSrc"/>
<view class="img-box">
@@ -165,11 +165,10 @@
height: 100rpx;
transform: translate(-50%, -50%);
}
.preview-pic{
width: 100%;
height: 100%;
position: absolute;
}
.preview-pic{
width: 100%;
height: 100%;
}
.overlay-box .video-cont-center{
width: 100vw;
max-height: 100%;
-3
View File
@@ -75,10 +75,7 @@
// 获取屏幕尺寸(App端兼容方式)
this.getWindowInfo();
const userInfo = getUserInfo();
this.textValue = (userInfo?.userName??'') + ' ' + (userInfo?.loginName??'');
console.log('userInfo', userInfo, this.textValue);
console.log('textValue', this.textValue);
},
methods: {
getWindowInfo() {
+2 -2
View File
@@ -436,12 +436,12 @@ onShow(() => {
.top-bg {
background: linear-gradient(16deg, rgba(234, 246, 255, 0) 0%, #c3e6ff 100%);
height: 480rpx;
width: 750rpx;
width: 100%;
}
.bot-bg {
// background-color: #F6F8FF;
background: linear-gradient(136deg, rgba(234, 246, 255, 0) 0%, #c3e6ff 100%);
width: 750rpx;
width: 100%;
flex: 1;
}
.course-center-body {
+21 -11
View File
@@ -750,7 +750,9 @@ const closeStudy = () => {
}
onHide(() => {
changePlayItemId('')
closeStudy()
if(isPreview.value === 'S'){
closeStudy()
}
// socketStore.closeSocket()
//#ifdef APP-PLUS
uni.offKeyboardHeightChange(setHeight)
@@ -767,21 +769,29 @@ onShow(() => {
if (watchFlag.value === 1) return
// getData('2');
// initsocketTask()
sendMessage({
commond: 'STDY',
body: {
crsId: crsId.value,
teacherNo: choiceTeacher.value,
studyType: isPreview.value ? 'P' : 'S',
isContinue: isContinue.value,
if(isPreview.value === 'S'){
studyStartApi({
crsId: crsId.value,
teacherNo: choiceTeacher.value,
studyType: isPreview.value ? 'P' : 'S',
isContinue: isContinue.value,
stdyId: stdyId.value
}
})
}).then(res=>{
const { body } = res
stdyId.value = body.stdyId || ''
stdyBatch.value = body.stdyBatch || ''
oldStdyId.value = body.oldStdyId || ''
logId.value = body.logId || ''
step.value = 2
}).catch(err=>{})
}
})
const watchFlag = ref(1)
onUnload(() => {
console.log('onUnload')
closeStudy()
if(isPreview.value === 'S'){
closeStudy()
}
// socketStore.closeSocket()
changePlayItemId('')
console.log(typeof teacherVoiceObj)
+4 -4
View File
@@ -157,14 +157,14 @@
};
const toStudyPrgh = (info) => {
common.navigateTo(
'/pages/course/study?crsNum=' +
form.value.crsNum +
'&crsId=' +
'/pages/course/study?crsId=' +
crsId.value +
'&pgrphId=' +
info.pgrphId +
'&imgId=' +
form.imgId
form.imgId +
'&isPreview=' +
isPreview.value
);
};
+2 -1
View File
@@ -41,7 +41,8 @@
</view>
<view class="ranking-self">
<view class="list-header list-item">
<view class="rank-column">我的排名</view>
<view class="rank-column">我的排名
</view>
</view>
<view class="list-item item-me">
<view class="rank-column">
+108 -115
View File
@@ -14,25 +14,33 @@
<view class="font_pf">头像</view>
</template>
<template #value>
<view style="width: 42rpx; height: 42rpx;border-radius: 100%; overflow: hidden">
<view style="width: 42rpx; height: 42rpx; border-radius: 100%; overflow: hidden">
<image v-if="userInfo.imagePath" class="img_100" :src="userInfo.imagePath"></image>
<image-preview v-else class="img_100" :src="userInfo.imageAddr"></image-preview>
</view>
</template>
</uv-cell>
<uv-cell name="sex" isLink title="性别">
<!-- <uv-cell name="sex" isLink title="性别">
<template #title>
<text class="font_pf">性别</text>
</template>
<template #value>
<picker mode="selector" :value="index" range-key="label" style="width: 100%" :range="sexOptions"
@change="sexChange">
<view style="text-align: right">{{showGenderText}}</view>
<picker
mode="selector"
:value="index"
range-key="label"
style="width: 100%"
:range="sexOptions"
@change="sexChange"
>
<view style="text-align: right">{{ showGenderText }}</view>
</picker>
</template>
</uv-cell>
<uv-cell title="百禄形象" @click="gotoMascot()" :isLink="true" :border="false"></uv-cell>
<!-- <uv-cell :isLink="true" :border="false">
</uv-cell> -->
<uv-cell title="性别" @click="sexPicker.open()" :isLink="true" :value="showGenderText"></uv-cell>
<uv-cell title="百禄形象" @click="gotoMascot()" :isLink="true" :border="false" :value="mascotName"></uv-cell>
<!-- <uv-cell :isLink="true" :border="false">
<template #title>
<text class="font_pf">竞赛是否匿名</text>
</template>
@@ -45,113 +53,79 @@
</uv-cell> -->
</uv-cell-group>
</view>
<avatar-cropper v-if="avatarCropperStatus" mode="ratio" :imageUrl="avatarCropperUrl" :width="500" :height="500"
:delay="150" @cancel="onCancel" @confirm="onConfirm"></avatar-cropper>
<avatar-cropper
v-if="avatarCropperStatus"
mode="ratio"
:imageUrl="avatarCropperUrl"
:width="500"
:height="500"
:delay="150"
@cancel="onCancel"
@confirm="onConfirm"
></avatar-cropper>
<uv-picker ref="sexPicker" :columns="[sexOptions]" keyName="label" @confirm="sexConfirm"></uv-picker>
</view>
</template>
<script setup>
import {
reactive,
ref,
computed,
nextTick
} from 'vue';
import {
onLoad
} from '@dcloudio/uni-app';
import {
uploadFile
} from '@/api/common'
import {
queryCurrentUser
} from '@/api/login.js';
import { reactive, ref, computed, nextTick } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { uploadFile } from '@/api/common';
import { queryCurrentUser } from '@/api/login.js';
import common from '@/common/common';
import {
getUserInfo
} from '@/common/common';
import {
GENDER
} from '@/enum.js';
import {
updateDfSysUserExtandInfoGender,
updateDfSysUserExtandInfoImageAddr
} from "@/api/user.js"
import {
queryValidTraMascotInfo
} from "@/api/mascot.js"
import {
get_base_url
} from '@/api/request.js'
import { getUserInfo } from '@/common/common';
import { GENDER } from '@/enum.js';
import { updateDfSysUserExtandInfoGender, updateDfSysUserExtandInfoImageAddr } from '@/api/user.js';
import { queryValidTraMascotInfo } from '@/api/mascot.js';
import { get_base_url } from '@/api/request.js';
const index = ref(0);
const sexPicker = ref(null);
const avatarCropperUrl = ref('');
const aaa = ref('');
const userInfo = ref({
gender: '',
imagePath: '',
imageAddr: ''
imageAddr: '',
mascotInfo: null
});
const avatarCropperStatus = ref(true)
const sexOptions = GENDER
const anonymousOptions = [{
value: "y",
label: "是",
const avatarCropperStatus = ref(true);
const mascotName = computed(() => userInfo.value.mascotInfo?.mascotName || '');
const sexOptions = GENDER;
const anonymousOptions = [
{
value: 'y',
label: '是'
},
{
value: "n",
label: "否",
value: 'n',
label: '否'
}
] // 性别
]; // 性别
// 去选择百禄
const gotoMascot = () => {
common.navigateTo('/pages/mascot/mascot_select_list?from=setting')
// common.loading()
// queryValidTraMascotInfo().then(({body}) => {
// console.log(body);
// common.setPageCache('mascotList', body)
// body.map(({imgAddr}) => {
// const url = imgAddr
// if (imgAddr){
// const img = new Image();
// img.onload = () => {
// console.log(`图片缓存成功: ${url}`);
// // resolve(img);
// };
// img.onerror = () => {
// console.error(`图片缓存失败: ${url}`);
// // reject(new Error(`Failed to load image: ${url}`));
// };
// img.src = base_url + url;
// }
// })
// common.hideLoading()
// common.navigateTo('/pages/mascot/mascot_select_list')
// })
}
common.navigateTo('/pages/mascot/mascot_select_list?from=setting');
};
// 显示性别的计算属性
const showGenderText = computed(() => {
const item = sexOptions.find((item) => item.value === userInfo.value.gender)
const item = sexOptions.find((item) => item.value === userInfo.value.gender);
if (item) {
return item.label
return item.label;
} else {
return '未填写'
return '未填写';
}
})
});
// 显示是否匿名的计算属性
const showAnonymousText = computed(() => {
const item = anonymousOptions.find((item) => item.value === userInfo.value?.anonymous)
const item = anonymousOptions.find((item) => item.value === userInfo.value?.anonymous);
if (item) {
return item.label
return item.label;
} else {
return '否'
return '否';
}
})
});
// 点击修改头像
const click_update_avatar = () => {
uni.chooseImage({
@@ -174,57 +148,76 @@
};
// 选择头像取消
const onCancel = (value) => {
avatarCropperStatus.value = false
}
avatarCropperStatus.value = false;
};
// 选择头像确定
const onConfirm = (file) => {
avatarCropperStatus.value = false
avatarCropperStatus.value = false;
nextTick(async () => {
common.loading('更新头像中')
common.loading('更新头像中');
try {
const data = {
bizScen: 'S3007',
thumbnailFlag: true,
thumbImgSize: 100
}
};
// 上传图片
const res = await uploadFile(file.tempFilePath, data)
const res = await uploadFile(file.tempFilePath, data);
// 更新个人信息
await updateDfSysUserExtandInfoImageAddr({
imageAddr: res.thumbFileId
})
});
// 更新个人信息
const userData = await queryCurrentUser()
common.msg('修改成功')
userInfo.value.imageAddr = userData.imageAddr
userInfo.value.imagePath = ''
const userData = await queryCurrentUser();
common.msg('修改成功');
userInfo.value.imageAddr = userData.imageAddr;
userInfo.value.imagePath = '';
} catch {
common.msg('修改失败')
common.msg('修改失败');
}
common.hideLoading()
})
}
common.hideLoading();
});
};
// 修改性别
const sexChange = (e) => {
userInfo.value.gender = sexOptions[e.detail.value].value;
common.loading("修改中")
const sexConfirm = (e) => {
userInfo.value.gender = e.value[0].value;
common.loading('修改中');
updateDfSysUserExtandInfoGender({
gender: userInfo.value.gender
}).then(async () => {
await queryCurrentUser()
common.msg('修改成功')
}).finally(() => {
common.hideLoading()
})
.then(async () => {
await queryCurrentUser();
common.msg('修改成功');
})
.finally(() => {
common.hideLoading();
});
};
// const sexChange = (e) => {
// userInfo.value.gender = sexOptions[e.detail.value].value;
// console.log('userInfo.value.gender', userInfo.value.gender);
// common.loading('修改中');
// updateDfSysUserExtandInfoGender({
// gender: userInfo.value.gender
// })
// .then(async () => {
// await queryCurrentUser();
// common.msg('修改成功');
// })
// .finally(() => {
// common.hideLoading();
// });
// };
const anonymousChange = (e) => {
userInfo.value.anonymous = anonymousOptions[e.detail.value].value;
// common.loading("修改中")
common.msg('修改成功')
common.msg('修改成功');
};
onLoad((params) => {
userInfo.value = getUserInfo()
userInfo.value = getUserInfo();
console.log('userInfo.value', userInfo.value);
});
</script>
@@ -255,7 +248,7 @@
}
.detail-main {
background-color: #F6F8FF;
background-color: #f6f8ff;
}
.title {
@@ -303,4 +296,4 @@
}
}
}
</style>
</style>
-1
View File
@@ -29,7 +29,6 @@
const url = get_base_url();
const ENV = import.meta.env
const appBaseInfo = uni.getAppBaseInfo()
console.log('appBaseInfo', appBaseInfo);
import showDialog from '@/common/dialogMessage'
const bbbb = () => {
+33
View File
@@ -0,0 +1,33 @@
## 1.0.142023-12-29
1. 修复上个版本引出的BUG
## 1.0.132023-12-26
1. 修复抖音小程序滚到底不触发change的BUG
## 1.0.122023-11-20
1. 修复issues反馈的问题uv-picker在组合式API的自定义组件中,columns动态赋值无法显示选项:https://gitee.com/climblee/uv-ui/issues/I8H0GQ
## 1.0.112023-10-11
1. 将immediate-change默认值改为true,该值在于change回调的及时性,微信小程序生效
## 1.0.102023-08-25
1. 增加round属性设置弹窗圆角,默认为0
## 1.0.92023-08-24
1. 修复cli项目不返回值的问题
## 1.0.82023-08-04
1. 优化
## 1.0.72023-08-02
1. 改组件中删除uv-toolbar组件,请单独下载uv-toolbar组件
## 1.0.62023-07-02
uv-picker 由于弹出层uv-popup的修改,打开和关闭方法更改,详情参考文档:https://www.uvui.cn/components/picker.html
## 1.0.52023-06-26
1. 增加color参数
2. 增加activeColor参数
## 1.0.42023-06-15
1. 修改支付宝报错的BUG
## 1.0.32023-06-12
1. setColumnValues的使用统一化,避免某些平台报错
2. 取消change回调回传的组件实例,直接统一通过ref的方式调取setColumnValues方法
## 1.0.22023-05-23
1. uv-toolbar组件新增下边框属性
## 1.0.12023-05-16
1. 优化组件依赖,修改后无需全局引入,组件导入即可使用
2. 优化部分功能
## 1.0.02023-05-10
uv-picker 选择器
@@ -0,0 +1,95 @@
export default {
props: {
// 是否展示顶部的操作栏
showToolbar: {
type: Boolean,
default: true
},
// 顶部标题
title: {
type: String,
default: ''
},
// 弹窗圆角
round: {
type: [String, Number],
default: 0
},
// 对象数组,设置每一列的数据
columns: {
type: Array,
default: () => []
},
// 是否显示加载中状态
loading: {
type: Boolean,
default: false
},
// 各列中,单个选项的高度
itemHeight: {
type: [String, Number],
default: 44
},
// 取消按钮的文字
cancelText: {
type: String,
default: '取消'
},
// 确认按钮的文字
confirmText: {
type: String,
default: '确定'
},
// 取消按钮的颜色
cancelColor: {
type: String,
default: '#909193'
},
// 确认按钮的颜色
confirmColor: {
type: String,
default: '#3c9cff'
},
// 文字颜色
color: {
type: String,
default: ''
},
// 选中文字的颜色
activeColor: {
type: String,
default: ''
},
// 每列中可见选项的数量
visibleItemCount: {
type: [String, Number],
default: 5
},
// 选项对象中,需要展示的属性键名
keyName: {
type: String,
default: 'text'
},
// 是否允许点击遮罩关闭选择器
closeOnClickOverlay: {
type: Boolean,
default: true
},
// 是否允许点击确认关闭选择器
closeOnClickConfirm: {
type: Boolean,
default: true
},
// 各列的默认索引
defaultIndex: {
type: Array,
default: () => [],
},
// 是否在手指松开时立即触发 change 事件。若不开启则会在滚动动画结束后触发 change 事件,只在微信2.21.1及以上有效
immediateChange: {
type: Boolean,
default: true
},
...uni.$uv?.props?.picker
}
}
@@ -0,0 +1,330 @@
<template>
<uv-popup
ref="pickerPopup"
mode="bottom"
:round="round"
:close-on-click-overlay="closeOnClickOverlay"
@change="popupChange"
>
<view class="uv-picker">
<uv-toolbar
v-if="showToolbar"
:cancelColor="cancelColor"
:confirmColor="confirmColor"
:cancelText="cancelText"
:confirmText="confirmText"
:title="title"
@cancel="cancel"
@confirm="confirm"
></uv-toolbar>
<!-- #ifdef MP-TOUTIAO -->
<picker-view
class="uv-picker__view"
:indicatorStyle="`height: ${$uv.addUnit(itemHeight)}`"
:value="innerIndex"
:immediateChange="immediateChange"
:style="{
height: `${$uv.addUnit(visibleItemCount * itemHeight)}`
}"
@pickend="changeHandler"
>
<!-- #endif -->
<!-- #ifndef MP-TOUTIAO -->
<picker-view
class="uv-picker__view"
:indicatorStyle="`height: ${$uv.addUnit(itemHeight)}`"
:value="innerIndex"
:immediateChange="immediateChange"
:style="{
height: `${$uv.addUnit(visibleItemCount * itemHeight)}`
}"
@change="changeHandler"
>
<!-- #endif -->
<!-- @pickend在这里为了解决抖音等滚到底不触发change兼容性问题 -->
<picker-view-column
v-for="(item, index) in innerColumns"
:key="index"
class="uv-picker__view__column"
>
<text
v-if="$uv.test.array(item)"
class="uv-picker__view__column__item uv-line-1"
v-for="(item1, index1) in item"
:key="index1"
:style="[{
height: $uv.addUnit(itemHeight),
lineHeight: $uv.addUnit(itemHeight),
fontWeight: index1 === innerIndex[index] ? 'bold' : 'normal'
},textStyle(index,index1)]"
>{{ getItemText(item1) }}</text>
</picker-view-column>
</picker-view>
<view
v-if="loading"
class="uv-picker--loading"
>
<uv-loading-icon mode="circle"></uv-loading-icon>
</view>
</view>
</uv-popup>
</template>
<script>
/**
* uv-picker
* @description 选择器
* @property {Boolean} showToolbar 是否显示顶部的操作栏(默认 true )
* @property {String} title 顶部标题
* @property {Array} columns 对象数组,设置每一列的数据
* @property {Boolean} loading 是否显示加载中状态(默认 false )
* @property {String | Number} itemHeight 各列中,单个选项的高度(默认 44 )
* @property {String} cancelText 取消按钮的文字(默认 '取消'
* @property {String} confirmText 确认按钮的文字(默认 '确定'
* @property {String} cancelColor 取消按钮的颜色(默认 '#909193'
* @property {String} confirmColor 确认按钮的颜色(默认 '#3c9cff'
* @property {String} color 文字颜色(默认 ''
* @property {String} activeColor 选中文字的颜色(默认 ''
* @property {String | Number} visibleItemCount 每列中可见选项的数量(默认 5 )
* @property {String} keyName 选项对象中,需要展示的属性键名(默认 'text'
* @property {Boolean} closeOnClickOverlay 是否允许点击遮罩关闭选择器(默认 false )
* @property {Array} defaultIndex 各列的默认索引
* @property {Boolean} immediateChange 是否在手指松开时立即触发change事件(默认 false
* @event {Function} close 关闭选择器时触发
* @event {Function} cancel 点击取消按钮触发
* @event {Function} change 当选择值变化时触发
* @event {Function} confirm 点击确定按钮,返回当前选择的值
*/
import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js'
import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js'
import props from './props.js';
export default {
name: 'uv-picker',
emits: ['confirm','cancel','close','change'],
mixins: [mpMixin, mixin, props],
computed: {
// 为了解决支付宝不生效
textStyle(){
return (index,index1) => {
const style = {};
// #ifndef APP-NVUE
style.display = 'block';
// #endif
if(this.color) {
style.color = this.color;
}
if(this.activeColor && index1 === this.innerIndex[index]) {
style.color = this.activeColor;
}
return style;
}
}
},
data() {
return {
// 上一次选择的列索引
lastIndex: [],
// 索引值 ,对应picker-view的value
innerIndex: [],
// 各列的值
innerColumns: [],
// 上一次的变化列索引
columnIndex: 0,
}
},
watch: {
// 监听默认索引的变化,重新设置对应的值
defaultIndex: {
immediate: true,
handler(n) {
this.setIndexs(n, true)
}
},
// 监听columns参数的变化
columns: {
deep: true,
immediate: true,
handler(n) {
this.setColumns(n)
}
},
},
methods: {
open() {
this.$refs.pickerPopup.open();
},
close() {
this.$refs.pickerPopup.close();
},
popupChange(e) {
if(!e.show) this.$emit('close');
},
// 获取item需要显示的文字,判别为对象还是文本
getItemText(item) {
if (this.$uv.test.object(item)) {
return item[this.keyName]
} else {
return item
}
},
// 点击工具栏的取消按钮
cancel() {
this.$emit('cancel');
this.close();
},
// 点击工具栏的确定按钮
confirm() {
// 在这里使用deepClone拷贝后,vue3会自动转换成原始对象,这样处理是因为cli项目可能出现不返回值的情况
this.$emit('confirm', this.$uv.deepClone({
indexs: this.innerIndex,
value: this.innerColumns.map((item, index) => item[this.innerIndex[index]]),
values: this.innerColumns
}));
if(this.closeOnClickConfirm) {
this.close();
}
},
// 选择器某一列的数据发生变化时触发
changeHandler(e) {
const {
value
} = e.detail
let index = 0,
columnIndex = 0
// 通过对比前后两次的列索引,得出当前变化的是哪一列
for (let i = 0; i < value.length; i++) {
let item = value[i]
if (item !== (this.lastIndex[i] || 0)) { // 把undefined转为合法假值0
// 设置columnIndex为当前变化列的索引
columnIndex = i
// index则为变化列中的变化项的索引
index = item
break // 终止循环,即使少一次循环,也是性能的提升
}
}
this.columnIndex = columnIndex
const values = this.innerColumns
// 将当前的各项变化索引,设置为"上一次"的索引变化值
this.setLastIndex(value)
this.setIndexs(value)
this.$emit('change', {
value: this.innerColumns.map((item, index) => item[value[index]]),
index,
indexs: value,
// values为当前变化列的数组内容
values,
columnIndex
})
},
// 设置index索引,此方法可被外部调用设置
setIndexs(index, setLastIndex) {
this.innerIndex = this.$uv.deepClone(index)
if (setLastIndex) {
this.setLastIndex(index)
}
},
// 记录上一次的各列索引位置
setLastIndex(index) {
// 当能进入此方法,意味着当前设置的各列默认索引,即为“上一次”的选中值,需要记录,是因为changeHandler中
// 需要拿前后的变化值进行对比,得出当前发生改变的是哪一列
this.lastIndex = this.$uv.deepClone(index)
},
// 设置对应列选项的所有值
setColumnValues(columnIndex, values) {
// 替换innerColumns数组中columnIndex索引的值为values,使用的是数组的splice方法
this.innerColumns.splice(columnIndex, 1, values)
// 拷贝一份原有的innerIndex做临时变量,将大于当前变化列的所有的列的默认索引设置为0
let tmpIndex = this.$uv.deepClone(this.innerIndex)
for (let i = 0; i < this.innerColumns.length; i++) {
if (i > this.columnIndex) {
tmpIndex[i] = 0
}
}
// 一次性赋值,不能单个修改,否则无效
this.setIndexs(tmpIndex)
},
// 获取对应列的所有选项
getColumnValues(columnIndex) {
// 进行同步阻塞,因为外部得到change事件之后,可能需要执行setColumnValues更新列的值
// 索引如果在外部change的回调中调用getColumnValues的话,可能无法得到变更后的列值,这里进行一定延时,保证值的准确性
(async () => {
await this.$uv.sleep()
})()
return this.innerColumns[columnIndex]
},
// 设置整体各列的columns的值
setColumns(columns) {
this.innerColumns = this.$uv.deepClone(columns)
// 如果在设置各列数据时,没有被设置默认的各列索引defaultIndex,那么用0去填充它,数组长度为列的数量
if (this.innerIndex.length === 0) {
this.innerIndex = new Array(columns.length).fill(0)
}
},
// 获取各列选中值对应的索引
getIndexs() {
return this.innerIndex
},
// 获取各列选中的值
getValues() {
// 进行同步阻塞,因为外部得到change事件之后,可能需要执行setColumnValues更新列的值
// 索引如果在外部change的回调中调用getValues的话,可能无法得到变更后的列值,这里进行一定延时,保证值的准确性
(async () => {
await this.$uv.sleep()
})()
return this.innerColumns.map((item, index) => item[this.innerIndex[index]])
}
},
}
</script>
<style lang="scss" scoped>
$show-lines: 1;
@import '@/uni_modules/uv-ui-tools/libs/css/variable.scss';
@import '@/uni_modules/uv-ui-tools/libs/css/components.scss';
@import '@/uni_modules/uv-ui-tools/libs/css/color.scss';
.uv-picker {
position: relative;
&__view {
&__column {
@include flex;
flex: 1;
justify-content: center;
&__item {
@include flex;
justify-content: center;
align-items: center;
font-size: 16px;
text-align: center;
/* #ifndef APP-NVUE */
display: block;
/* #endif */
color: $uv-main-color;
&--disabled {
/* #ifndef APP-NVUE */
cursor: not-allowed;
/* #endif */
opacity: 0.35;
}
}
}
}
&--loading {
position: absolute;
top: 0;
right: 0;
left: 0;
bottom: 0;
@include flex;
justify-content: center;
align-items: center;
background-color: rgba(255, 255, 255, 0.87);
z-index: 1000;
}
}
</style>
+90
View File
@@ -0,0 +1,90 @@
{
"id": "uv-picker",
"displayName": "uv-picker 选择器 全面兼容vue3+2、app、h5、小程序等多端",
"version": "1.0.14",
"description": "uv-picker 此选择器用于单列,多列,多列联动的选择场景...",
"keywords": [
"uv-picker",
"uvui",
"uv-ui",
"picker",
"联动选择"
],
"repository": "",
"engines": {
"HBuilderX": "^3.1.0"
},
"dcloudext": {
"type": "component-vue",
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "插件不采集任何数据",
"permissions": "无"
},
"npmurl": ""
},
"uni_modules": {
"dependencies": [
"uv-ui-tools",
"uv-popup",
"uv-loading-icon",
"uv-toolbar"
],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"Vue": {
"vue2": "y",
"vue3": "y"
},
"App": {
"app-vue": "y",
"app-nvue": "y"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "y",
"百度": "y",
"字节跳动": "y",
"QQ": "y",
"钉钉": "u",
"快手": "u",
"飞书": "u",
"京东": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
}
}
}
}
}
+21
View File
@@ -0,0 +1,21 @@
## Picker 选择器
> **组件名:uv-picker**
此选择器用于单列,多列,多列联动的选择场景。
`uv-datetime-picker`等组件也用到了该组件,功能完善,需要特别注意的是`columns`参数的形式是数组嵌套。
# <a href="https://www.uvui.cn/components/picker.html" target="_blank">查看文档</a>
## [下载完整示例项目](https://ext.dcloud.net.cn/plugin?name=uv-ui) <small>(请不要 下载插件ZIP</small>
### [更多插件,请关注uv-ui组件库](https://ext.dcloud.net.cn/plugin?name=uv-ui)
<a href="https://ext.dcloud.net.cn/plugin?name=uv-ui" target="_blank">
![image](https://mp-a667b617-c5f1-4a2d-9a54-683a67cff588.cdn.bspapp.com/uv-ui/banner.png)
</a>
#### 如使用过程中有任何问题反馈,或者您对uv-ui有一些好的建议,欢迎加入uv-ui官方交流群:<a href="https://www.uvui.cn/components/addQQGroup.html" target="_blank">官方QQ群</a>
+2
View File
@@ -0,0 +1,2 @@
## 1.0.02023-08-02
1. 新增工具条组件
@@ -0,0 +1,40 @@
export default {
props: {
// 是否展示工具条
show: {
type: Boolean,
default: true
},
// 是否显示下边框
showBorder: {
type: Boolean,
default: false
},
// 取消按钮的文字
cancelText: {
type: String,
default: '取消'
},
// 确认按钮的文字
confirmText: {
type: String,
default: '确认'
},
// 取消按钮的颜色
cancelColor: {
type: String,
default: '#909193'
},
// 确认按钮的颜色
confirmColor: {
type: String,
default: '#3c9cff'
},
// 标题文字
title: {
type: String,
default: ''
},
...uni.$uv?.props?.toolbar
}
}
@@ -0,0 +1,109 @@
<template>
<view
:class="['uv-toolbar',{'uv-border-bottom':showBorder}]"
@touchmove.stop.prevent="noop"
v-if="show"
>
<view
class="uv-toolbar__cancel__wrapper"
hover-class="uv-hover-class"
>
<text
class="uv-toolbar__wrapper__cancel"
@tap="cancel"
:style="{
color: cancelColor
}"
>{{ cancelText }}</text>
</view>
<text
class="uv-toolbar__title uv-line-1"
v-if="title"
>{{ title }}</text>
<view
class="uv-toolbar__confirm__wrapper"
hover-class="uv-hover-class"
>
<text
class="uv-toolbar__wrapper__confirm"
@tap="confirm"
:style="{
color: confirmColor
}"
>{{ confirmText }}</text>
</view>
</view>
</template>
<script>
import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js'
import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js'
import props from './props.js';
/**
* Toolbar 工具条
* @description
* @tutorial https://www.uvui.cn/components/toolbar.html
* @property {Boolean} show 是否展示工具条(默认 true )
* @property {Boolean} showBorder 是否展示工具条下方边框(默认 false )
* @property {String} cancelText 取消按钮的文字(默认 '取消'
* @property {String} confirmText 确认按钮的文字(默认 '确认'
* @property {String} cancelColor 取消按钮的颜色(默认 '#909193'
* @property {String} confirmColor 确认按钮的颜色(默认 '#3c9cff'
* @property {String} title 标题文字
* @event {Function}
* @example
*/
export default {
name: 'uv-toolbar',
emits: ['confirm', 'cancel'],
mixins: [mpMixin, mixin, props],
methods: {
// 点击取消按钮
cancel() {
this.$emit('cancel')
},
// 点击确定按钮
confirm() {
this.$emit('confirm')
}
}
}
</script>
<style lang="scss" scoped>
$show-lines: 1;
$show-hover: 1;
$show-border: 1;
$show-border-bottom: 1;
@import '@/uni_modules/uv-ui-tools/libs/css/variable.scss';
@import '@/uni_modules/uv-ui-tools/libs/css/components.scss';
$uv-tips-color: #909193 !default;
$uv-main-color: #303133 !default;
$uv-primary: #3c9cff !default;
.uv-toolbar {
height: 42px;
@include flex;
justify-content: space-between;
align-items: center;
&__wrapper {
&__cancel {
color: $uv-tips-color;
font-size: 15px;
padding: 0 15px;
}
}
&__title {
color: $uv-main-color;
padding: 0 60rpx;
font-size: 16px;
flex: 1;
text-align: center;
}
&__wrapper {
&__confirm {
color: $uv-primary;
font-size: 15px;
padding: 0 15px;
}
}
}
</style>
+87
View File
@@ -0,0 +1,87 @@
{
"id": "uv-toolbar",
"displayName": "uv-toolbar 工具条",
"version": "1.0.0",
"description": "该组价是仅用于uv-ui中一个公共小工具,提供一个取消和确定的样式,可以设置标题,主要用于弹窗顶部的选择确定工具条",
"keywords": [
"uv-toolbar",
"uvui",
"uv-ui",
"工具条",
"工具"
],
"repository": "",
"engines": {
"HBuilderX": "^3.1.0"
},
"dcloudext": {
"type": "component-vue",
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "插件不采集任何数据",
"permissions": "无"
},
"npmurl": ""
},
"uni_modules": {
"dependencies": [
"uv-ui-tools"
],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"Vue": {
"vue2": "y",
"vue3": "y"
},
"App": {
"app-vue": "y",
"app-nvue": "y"
},
"H5-mobile": {
"Safari": "y",
"Android Browser": "y",
"微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y"
},
"H5-pc": {
"Chrome": "y",
"IE": "y",
"Edge": "y",
"Firefox": "y",
"Safari": "y"
},
"小程序": {
"微信": "y",
"阿里": "y",
"百度": "y",
"字节跳动": "y",
"QQ": "y",
"钉钉": "u",
"快手": "u",
"飞书": "u",
"京东": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
}
}
}
}
}
+31
View File
@@ -0,0 +1,31 @@
## Toolbar 工具条
> **组件名:uv-toolbar**
该组价是仅用于uv-ui中一个公共小工具,提供一个取消和确定的样式,可以设置标题,主要用于弹窗顶部的选择确定工具条。
### 基本使用
```vue
<uv-toolbar title="标题文字"></uv-toolbar>
```
### Toolbar Props
| 属性名 | 类型 | 默认值 | 说明 |
|:-|:-|:-|:-|
| show | Boolean | true | 是否展示工具条 |
| showBorder | Boolean | false | 是否显示下边框 |
| cancelText | String | '取消' | 取消按钮的文字 |
| confirmText | String | '确定' | 确定按钮的文字 |
| cancelColor | String | '#909193' | 取消按钮的颜色 |
| confirmColor | String | '#3c9cff' | 确认按钮的颜色 |
| title | String | - | 标题文字 |
## [下载完整示例项目](https://ext.dcloud.net.cn/plugin?name=uv-ui)
### [更多插件,请关注uv-ui组件库](https://ext.dcloud.net.cn/plugin?name=uv-ui)
![image](https://mp-a667b617-c5f1-4a2d-9a54-683a67cff588.cdn.bspapp.com/uv-ui/banner.png)
#### 如使用过程中有任何问题反馈,或者您对uv-ui有一些好的建议,欢迎加入uv-ui官方交流群:<a href="https://www.uvui.cn/components/addQQGroup.html" target="_blank">官方QQ群</a>