7 Commits

Author SHA1 Message Date
xuli
59485ce24c Merge branch 'develop' into test 2025-12-31 14:15:42 +08:00
jiangyanshan
a97fabbef8 请假修改 2025-12-29 14:31:38 +08:00
PC-202311141343\Administrator
9f12490fb5 提交CRM模块中任务功能初始化 2025-12-24 10:29:39 +08:00
xuli
05df7bff69 增加新 选择视频和图片的插件 2025-12-23 18:11:40 +08:00
xuli
485a9511a1 Merge branch 'develop' of http://123.57.20.168:4000/admin/ys-app into develop 2025-12-23 18:11:12 +08:00
xuli
eddd2a4bf7 增加新 选择视频和图片的插件 2025-12-23 18:10:37 +08:00
jiangyanshan
dbe7effec5 新增请假模块 2025-11-17 16:01:15 +08:00
9 changed files with 1150 additions and 84 deletions

View File

@@ -0,0 +1,221 @@
<template>
<!-- 自定义底部弹窗选择器 -->
<view class="picker-model" v-if="showPicker">
<view class="picker-content">
<view class="picker-item" @click="takePhoto">
<text>拍照</text>
</view>
<view class="picker-item" @click="choosePhoto">
<text>选择照片</text>
</view>
<view class="picker-item" @click="takeVideo">
<text>拍摄视频</text>
</view>
<view class="picker-item" @click="chooseVideoFromAlbum">
<text>选择视频</text>
</view>
<view class="picker-item" @click="closePicker">
<text>取消</text>
</view>
</view>
</view>
</template>
<script setup>
import { ref, watch } from "vue";
import {compressImageUni} from '@/utils/common.js'
import { minioUpload } from '@/api/polling.js'
let showPicker = ref(false);
const openPicker = () => {
showPicker.value = true;
}
const closePicker = () => {
showPicker.value = false;
emit("closeMedia")
}
const takePhoto = () => {
captureMedia("image", "camera");
}
const choosePhoto = () => {
captureMedia("image", "album");
}
const takeVideo = () => {
captureMedia("video", "camera");
}
const chooseVideoFromAlbum = () => {
captureMedia("video", "album");
}
const captureMedia = async (type, source) => {
showPicker.value = false;
try {
if (type === "image") {
const res = await uni.chooseImage({
count: 1,
sourceType: [source],
});
processMedia(res.tempFilePaths, "image", source);
} else {
const res = await uni.chooseVideo({
sourceType: [source],
// sourceType: ['album', 'camera'], // 来源:相册和相机
maxDuration: 60, // 最大时长(秒)
camera: 'back', // 使用后置摄像头
compressed: true, // 压缩视频
});
processMedia([res.tempFilePath], "video", source);
}
} catch (error) {
emit("closeMedia")
}
}
// 调用父组件的方法
const emit = defineEmits(['getMediaArr','closeMedia']);
// 执行压缩并上传
const processMedia = async(files, type, source) => {
let returnArr = [];
let res = files.map(async file=>{
return new Promise(async(resolve, reject) => {
try {
const info = {
path: file,
type: type,
source: source,
timestamp: Date.now(),
}
// #ifdef APP-PLUS
// 进行压缩图片
if(type=="image"){
info.path = await compressImageUni(file);
}
// #endif
// 保存选择记录
let data = await saveSelectionRecord(info);
returnArr.push({
fileName:data.fileName,
fileType:type
})
resolve(returnArr)
} catch (error) {
reject(error)
}
});
})
await Promise.all(res);
// console.log("returnArr=>",returnArr)
showPicker.value = false;
emit('getMediaArr',returnArr);
// 根据来源做不同处理
// if (source === "camera") {
// handleCameraMedia(info);
// } else {
// handleAlbumMedia(info);
// }
}
// 保存到云
const saveSelectionRecord = (info) => {
return new Promise(async (resolve, reject) => {
try {
// 执行上传
let param = {
filePath: info.path,
name: 'file',
formData: {
directory:'polling'
},
}
let res = await minioUpload(param);
resolve(res.data);
} catch (error) {
resolve(error);
}
// 保存到本地存储
// const records = uni.getStorageSync("mediaRecords") || [];
// records.unshift(info);
// uni.setStorageSync("mediaRecords", records.slice(0, 10)); // 只保留最近10条
})
}
const handleCameraMedia = (info) => {
// 从相机拍摄的媒体文件处理
if (info.type === "image") {
// 相机拍摄的照片可能有地理位置信息
extractImageMetadata(info.path);
} else {
// 相机拍摄的视频
uni.showToast({
title: "已保存拍摄的视频",
icon: "success",
});
}
}
const handleAlbumMedia = (info) => {
// 从相册选择的媒体文件处理
console.log("从相册选择:", info);
}
const extractImageMetadata = (filePath) => {
// 获取图片元数据(部分平台支持)
uni.getImageInfo({
src: filePath,
success: (res) => {
console.log("图片元数据:", res);
},
});
}
// 暴露方法给父组件
defineExpose({
openPicker
});
</script>
<style lang="scss" scoped>
.picker-model{
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, 0.4);
z-index: 9999;
.picker-content{
width:100%;
position: absolute;
bottom:0;
left:0;
background-color: #fff;
border-radius: 10rpx 10rpx 0 0;
.picker-item{
border-bottom:1px solid #E7E7E7;
text-align: center;
height:90rpx;
line-height: 90rpx;
// #ifdef APP-PLUS
height:120rpx;
line-height: 120rpx;
// #endif
&:last-child{
border-bottom: none;
}
text{
text-align: center;
}
}
}
}
</style>

View File

@@ -730,6 +730,28 @@
{ {
"path": "pages/business/CRM/leave/reviewDetail", "path": "pages/business/CRM/leave/reviewDetail",
"style": {
"navigationBarTitleText": ""
}
},
//************************任务板块页面
{
"path": "pages/business/CRM/scheduler/index",
"style": {
"navigationBarTitleText": ""
}
},
{
"path": "pages/business/CRM/scheduler/taskPlanAdded",
"style": {
"navigationBarTitleText": ""
}
},
{
"path": "pages/business/CRM/scheduler/taskListViewing",
"style": { "style": {
"navigationBarTitleText": "" "navigationBarTitleText": ""
} }

View File

@@ -111,23 +111,17 @@ onMounted(() => {
onShow(() => { onShow(() => {
uni.$on('isRefresh', function () { uni.$on('isRefresh', function () {
isRefresh.value = true isRefresh.value = true
getApplyList(); getlist();
}) })
}) })
function getApplyList() {
getlist({
applyUserName: searchValue.value
})
}
let isRefresh = ref(false) let isRefresh = ref(false)
let searchValue = ref(null) let searchValue = ref(null)
// 查询搜索跳转 // 查询搜索跳转
let handleSearch = () => { let handleSearch = () => {
isRefresh.value = true isRefresh.value = true
getApplyList(); getlist();
} }
const pageSize = ref(4); const pageSize = ref(4);
@@ -162,10 +156,12 @@ let passList = ref([])
//已审批 //已审批
let reviewList = ref([]) let reviewList = ref([])
const getlist = async (param) => { const getlist = async () => {
loading.value = true loading.value = true
let res = await getMyReviewList(param); let res = await getMyReviewList({
applyUserName: searchValue.value
});
detailLists.value = res.rows; detailLists.value = res.rows;
reviewListA.value = res.rows.filter(t => (t.status == '待审批' || t.status == '审批中') && t reviewListA.value = res.rows.filter(t => (t.status == '待审批' || t.status == '审批中') && t
.applyType == '请假' && t.reviewerIdR == null) .applyType == '请假' && t.reviewerIdR == null)

View File

@@ -0,0 +1,118 @@
<template>
<view class="con-body">
<view class="con-bg">
<customHeader ref="customHeaderRef" :title="'任务版块'" :leftFlag="true">
</customHeader>
<!-- #ifdef H5 -->
<view style="height:50rpx"></view>
<!-- #endif -->
<!-- 高度来避免头部遮挡 -->
<view class="top-height"></view>
<view class="white-bg">
<navigator url="/pages/business/CRM/scheduler/taskListViewing">
<view class="list-item item-padding">
<img class="l-icon" :src="'static/images/business/icon-zfsp.png'"/>
<text>任务清单查看</text>
<view class="list-right">
<uni-icons type="right" size="20" color="#A0A0A0"></uni-icons>
</view>
</view>
</navigator>
<view class="item-border"></view>
<navigator url="/pages/business/CRM/scheduler/taskPlanAdded">
<view class="list-item item-padding">
<img class="l-icon" :src="'static/images/business/icon-khryss.png'"/>
<text>任务计划新增</text>
<view class="list-right">
<uni-icons type="right" size="20" color="#A0A0A0"></uni-icons>
</view>
</view>
</navigator>
<view class="item-border"></view>
<navigator url="/pages/business/CRM/plan/planView">
<view class="list-item item-padding">
<img class="l-icon" :src="'static/images/business/icon-jhck.png'"/>
<text>任务计划查看</text>
<view class="list-right">
<uni-icons type="right" size="20" color="#A0A0A0"></uni-icons>
</view>
</view>
</navigator>
</view>
</view>
</view>
</template>
<script setup>
import {ref, onMounted} from 'vue'
import customHeader from '@/components/customHeader.vue'
import {getNavBarPaddingTop} from '@/utils/system.js'
// 获取导航栏高度用于内容区域padding
const navBarPaddingTop = ref(0);
onMounted(() => {
navBarPaddingTop.value = getNavBarPaddingTop() * 2;
})
</script>
<style scoped>
.head-pic .head-right img {
display: block;
width: 28rpx;
height: 25rpx;
margin-left: auto;
margin-top: 2px;
}
.backlog-b-item img {
width: 90rpx;
height: 90rpx;
margin: 0 auto 10rpx;
display: block;
}
.white-bg {
width: 590rpx; /*690*/
padding: 30rpx 50rpx;
}
.list-item {
display: flex;
align-items: center;
font-size: 32rpx;
border-radius: 8rpx;
}
.list-item.item-padding {
padding: 45rpx 0;
}
.list-item.item-padding:first-child {
padding-top: 20rpx;
}
.list-item.item-padding:last-child {
padding-bottom: 20rpx;
}
.item-border {
height: 1px;
background-color: #E7E7E7;
width: 640rpx;
}
.list-item .l-icon {
width: 90rpx;
height: 90rpx;
margin-right: 20rpx;
}
.list-item .list-right {
margin-left: auto;
display: flex;
align-items: center;
}
</style>

View File

@@ -0,0 +1,219 @@
<template>
<view class="con-body">
<view class="con-bg">
<!-- 头部 -->
<customHeader ref="customHeaderRef" :title="'任务清单查看'" :leftFlag="true" :rightFlag="true">
<template #right>
<view class="head-right">
</view>
</template>
</customHeader>
<!-- 高度来避免头部遮挡 -->
<view class="top-height" :style="{ paddingTop: navBarPaddingTop + 'px' }"></view>
<!-- 正文内容 -->
<view class="all-body">
<!-- 搜索 @blur="blur" @focus="focus" @input="input" @cancel="cancel" @clear="clear"-->
<!-- <view class="search">
<uni-search-bar class="custom-search" radius="28" placeholder="请输入客户名称" clearButton="auto"
cancelButton="none" bgColor="#6FA2F8" textColor="#ffffff"
v-model="searchValue"
/>
<button type="default" @click="handleSearch" size="mini" class="btn-search">查询</button>
</view> -->
<!-- 分页部分 -->
<mescroll-uni ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
:up="upOption" :down="downOption" :fixed="false" textColor="#ffffff" bgColor="#ffffff"
class="scroll-h" :class="{'loading-scroll':cssFlag}"
>
<view class="white-bg margin-bottom20" v-for="(item, index) in list" :key="index" @click="handleDetail(item)">
<view class="report-list">
<view class="title">{{ item.title }}</view>
<view class="r-list">
<view class="r-name">{{ item.name }}</view>
<view class="r-right btn-orange" size="mini">{{ item.statusName }}</view>
</view>
<view class="border-bottom"></view>
<view class="r-list">
<view class="r-left">报告类型</view>
<view class="r-right">{{ item.reportTypeName }}</view>
</view>
<view class="border-bottom"></view>
<view class="r-list">
<view class="r-left">报告人</view>
<view class="r-right">{{ item.reportPeople }}</view>
</view>
<view class="border-bottom"></view>
<view class="r-list">
<view class="r-left">报告日期</view>
<view class="r-right">{{ item.dateStr }}</view>
</view>
</view>
</view>
</mescroll-uni>
</view>
</view>
</view>
</template>
<script setup>
import { ref, onMounted } from 'vue'
import customHeader from '@/components/customHeader.vue'
import MescrollUni from 'mescroll-uni/mescroll-uni.vue';
import { getNavBarPaddingTop } from '@/utils/system.js'
import { SalesManTaskList } from '@/api/crm/api_ys.js'
// 获取导航栏高度用于内容区域padding
const navBarPaddingTop = ref(0);
onMounted(() => {
navBarPaddingTop.value = getNavBarPaddingTop() * 2;
})
let searchValue = ref(null)
// 查询搜索跳转
let handleSearch = () => {
console.log(searchValue.value)
}
// 新增
let handleAdd = ()=>{
uni.navigateTo({ url:'/pages/business/CRM/visitorReportAdd' })
}
// 查询列表
let list = ref([]);
const mescrollRef = ref(null);
const upOption = ref({
page: { num: 0, size: 10 },
noMoreSize: 5,
empty: {
tip: '~ 空空如也 ~',
icon: "../../static/images/mescroll-empty.png"
},
textLoading: '加载中...',
textNoMore: '已经到底了'
});
const downOption = ref({
auto: true,
textInOffset: '下拉刷新',
textOutOffset: '释放更新',
textLoading: '刷新中...'
});
let cssFlag=ref(false);//控制样式
const mescrollInit = (mescroll) => {
cssFlag.value = true;
mescrollRef.value = mescroll;
};
// 下拉刷新
const downCallback = async (mescroll) => {
try {
setTimeout(async ()=>{
const res = await getSalesManTaskList(1, upOption.value.page.size);
cssFlag.value = false;
list.value = res.list;
mescroll.resetUpScroll();
},500);
} catch (error) {
mescroll.endErr();
} finally {
setTimeout(async ()=>{
mescroll.endSuccess();
},500);
}
}
// 上拉加载更多
const upCallback = async (mescroll) => {
try {
setTimeout(async ()=>{
const res = await getSalesManTaskList(mescroll.num, mescroll.size);
if (mescroll.num === 1) {
list.value = res.list;
} else {
list.value.push(...res.list);
}
mescroll.endBySize(res.list.length, res.total);
},500);
} catch (error) {
mescroll.endErr();
}
}
// 获取数据列表
const getSalesManTaskList = (pageIndex, pageSize) => {
return new Promise(async (resolve) => {
let param = {
pageIndex,
pageSize
}
let res = await SalesManTaskList(param);
resolve({
list: res.list,
total: res.totalCount
});
});
}
// 跳转到详情
let handleDetail=(item)=>{
uni.navigateTo({
url: "/pages/business/CRM/visitorReportDetail?id="+item.id
})
}
</script>
<style scoped>
.all-body {
/* #ifdef APP-PLUS */
top: 150rpx;
height: calc(100vh - 75px);
/* #endif */
/* #ifndef APP-PLUS */
top:120rpx;
height: calc(100vh);
/* #endif */
}
.search{
display: flex;
}
.search .btn-search{
border:none;
background: none;
line-height: normal;
color:#fff;
line-height: 56rpx !important;
padding:10rpx 0 0;
text-align: left;
cursor: pointer;
}
.search .btn-search::after{
display: none;
}
.search .custom-search{
width:80%;
}
.search .custom-search.uni-searchbar{
padding-right:0 !important;
}
.scroll-h{
/* #ifdef APP-PLUS */
height: calc(100vh - 120px);
/* #endif */
/* #ifndef APP-PLUS */
height: calc(100vh - 110px);
/* #endif */
}
.white-bg{
padding-bottom:10rpx;
}
</style>

View File

@@ -0,0 +1,388 @@
<template>
<view class="con-body">
<view class="con-bg">
<!-- 头部 -->
<customHeader ref="customHeaderRef" :title="'任务计划新增'" :leftFlag="true" :rightFlag="true">
<template #right>
<view class="head-right" @click="submitForm">
<uni-icons custom-prefix="iconfont" type="icon-phonebaocun" size="22"
color="#B7D2FF"></uni-icons>保存
</view>
</template>
</customHeader>
<!-- 高度来避免头部遮挡 -->
<view class="top-height"></view>
<!-- 正文内容 -->
<view class="white-bg">
<view class="form-con">
<uni-forms ref="formRef" :model="formData" :rules="rules" label-width="100px">
<uni-forms-item label="标签属性" name="cusName" class="f-c-right">
<view
@click="chooseCustomer"
class="form-item-container"
>
<text class="name">{{ formData.cusName || '点击选择主线任务' }}</text>
</view>
</uni-forms-item>
<uni-forms-item label="计划内容" name="opportunityType" class="f-c-right">
<picker @change="onOpportunityTypeChange" :value="opportunityTypeIndex" :range="array"
:range-key="'name'">
<view class="picker">
{{ array[opportunityTypeIndex]?.name || '请选择计划内容' }}
<uni-icons type="right" size="20" color="#A0A0A0"></uni-icons>
</view>
</picker>
</uni-forms-item>
<uni-forms-item label="计划开始时间" name="plannedStartTime" class="f-c-right">
<picker mode="date" :value="formData.plannedStartTime" @change="onStartTimeChange">
<view class="picker">
{{ formData.plannedStartTime || '请选择计划开始时间' }}
<uni-icons type="right" size="20" color="#A0A0A0"></uni-icons>
</view>
</picker>
</uni-forms-item>
<uni-forms-item label="计划完成时间" name="plannedCompTime" class="f-c-right">
<picker mode="date" :value="formData.plannedCompTime" @change="onCompTimeChange">
<view class="picker">
{{ formData.plannedCompTime || '请选择计划完成时间' }}
<uni-icons type="right" size="20" color="#A0A0A0"></uni-icons>
</view>
</picker>
</uni-forms-item>
<uni-forms-item label="内容描述" name="understandTheWay"
class="uni-forms-item is-direction-top is-top">
<uni-easyinput type="textarea" autoHeight v-model="formData.understandTheWay"
placeholder="请输入内容描述" class="form-texarea" />
</uni-forms-item>
</uni-forms>
</view>
</view>
</view>
</view>
</template>
<script setup>
import {
ref, onMounted, reactive, onUnmounted, computed
} from 'vue'
import customHeader from '@/components/customHeader.vue'
import {
getGuestList
} from '@/api/business.js'
import { isEmpty } from '@/utils/validate.js'
import {crmMarketInformationAdd } from '@/api/crm/api_ys.js'
let customerUser = reactive({})
// 客户相关
const guestList = ref([])
// 表单数据
const formData = ref({
cusId: null,
cusName: null,
opportunityType: "", // 机会类型
plannedStartTime: "", // 计划开始时间
plannedCompTime: "", // 计划完成时间
understandTheWay: "", // 了解途径
opportunityDescription: "", // 机会描述
opportunityStatus: "", // 机会所处状态
predictedAmount: "", // 预测金额或情况
competitionSituation: "", // 竞争情况
remark: "", // 备注
picture: "", // 图片
informationType: "市场机会" // 信息类型
})
// 表单验证规则
const rules = {
cusName: {
rules: [{
required: true,
errorMessage: '请选择主线任务'
}]
},
opportunityType: {
rules: [{
required: true,
errorMessage: '请选择计划内容'
}]
},
plannedStartTime: {
rules: [{
required: true,
errorMessage: '请选择计划开始时间'
}]
},
plannedCompTime: {
rules: [
{
required: true,
errorMessage: '请选择计划完成时间'
},
{
validateFunction: function(rule, value, data, callback) {
if (value && data.plannedStartTime) {
if (new Date(value) < new Date(data.plannedStartTime)) {
callback('计划完成时间不能早于计划开始时间')
return
}
}
callback()
}
}
]
},
understandTheWay: {
rules: [{
required: true,
errorMessage: '请输入内容描述'
}]
},
opportunityDescription: {
rules: [{
required: true,
errorMessage: '请输入机会描述'
}]
},
opportunityStatus: {
rules: [{
required: true,
errorMessage: '请输入机会所处状态'
}]
},
predictedAmount: {
rules: [{
required: true,
errorMessage: '请输入预测金额或情况'
}]
},
competitionSituation: {
rules: [{
required: true,
errorMessage: '请输入竞争情况'
}]
},
}
const imgList = ref([])
// picker 相关
const index = ref(0)
const array = ref([{
id: 0,
name: '日常走访'
},
{
id: 1,
name: '业务招待'
},
{
id: 2,
name: '技术交流'
},
{
id: 3,
name: '来厂参观'
},
{
id: 4,
name: '党建活动'
},
{
id: 5,
name: '文体活动'
},
{
id: 6,
name: '联谊活动'
},
{
id: 7,
name: '礼尚往来'
},
{
id: 8,
name: '高层交流'
},
{
id: 9,
name: '组合拳服务活动'
}
])
const form = ref({
cusId: null,
cusName: null,
opportunityType: array.value[0].name, // 机会类型
understandTheWay: "", // 了解途径
opportunityDescription: "", // 机会描述
opportunityStatus: "", // 机会所处状态
predictedAmount: "", // 预测金额或情况
competitionSituation: "", // 竞争情况
remark: "", // 备注
picture: "", // 图片
informationType: "市场机会" // 信息类型
})
// picker 选项
const opportunityTypeOptions = ref([{
id: 0,
name: '新产品需求'
},
{
id: 1,
name: '新客户开发'
},
{
id: 2,
name: '批产任务'
},
{
id: 3,
name: '新研任务'
},
{
id: 4,
name: '二筛服务'
},
{
id: 5,
name: '对手失利'
},
{
id: 6,
name: '其它'
}
])
const opportunityTypeIndex = ref(0)
// 表单引用 & 客户选择器引用
const formRef = ref(null)
const customHeaderRef = ref(null)
// 选择客户页面跳转
function chooseCustomer(){
uni.navigateTo({
url: '/pages/business/CRM/marketActivity/chooseCus'
})
}
//定义数据接收的值
let selectedCustomer = reactive(null)
//监听时间
onMounted(() => {
// 设置机会类型的默认值
formData.value.opportunityType = array.value[0].name;
opportunityTypeIndex.value = 0;
// 原有的监听客户选择事件
uni.$on('onCustomerSelected', handleCustomerSelected);
})
//取消监听
onUnmounted(() => {
uni.$off('onCustomerSelected', handleCustomerSelected)
})
//处理 接收数据
const handleCustomerSelected = (data) => {
formData.value.cusName = data.cusName
formData.value.cusId = data.cusId
console.log("收到客户数据的值:", customerUser)
}
// 提交表单
const submitForm = async () => {
try {
// 表单校验
await formRef.value.validate()
const res = await crmMarketInformationAdd(formData.value);
console.log(res)
uni.showToast({
title: '提交成功',
icon: 'success'
})
uni.$emit('refreshMarketList');
setTimeout(() => {
uni.navigateBack(1);
}, 1500);
console.log('表单数据:', formData.value)
} catch (err) {
console.log('表单验证失败:', err)
}
}
const onOpportunityTypeChange = (e) => {
opportunityTypeIndex.value = e.detail.value
console.log('opportunityTypeIndex:', array.value[e.detail.value]?.name)
formData.value.opportunityType = array.value[e.detail.value]?.name || ''
}
// 计划开始时间变化事件
const onStartTimeChange = (e) => {
formData.value.plannedStartTime = e.detail.value
// 如果已选择完成时间,重新校验完成时间
if (formData.value.plannedCompTime) {
formRef.value.validateField('plannedCompTime')
}
}
// 计划完成时间变化事件
const onCompTimeChange = (e) => {
formData.value.plannedCompTime = e.detail.value
// 校验完成时间
formRef.value.validateField('plannedCompTime')
}
// 如果你原来在 onShow 中做了类似这样:
// let res = currPage.data.cusData; 判断是否传入了客户信息
// 那么在 Vue3 中通常是通过路由参数或者 Vuex/Pinia 等状态管理获取
// 暂时不做,如你后续需要可继续补充
</script>
<style scoped>
.white-bg {
width: 750rpx;
padding: 30rpx 0 0;
margin-bottom: 0;
border-radius: 8px 8px 0 0;
}
.form-con {
/* #ifdef APP-PLUS */
min-height: calc(100vh - 100px);
/* #endif */
/* #ifndef APP-PLUS */
min-height: calc(100vh - 80px);
/* #endif */
}
:deep(.uni-date-x) {
display: block;
}
:deep(.uni-date-x .icon-calendar) {
float: right;
margin-top: 15rpx;
margin-right: 20rpx;
background: url('../../../static/images/business/icon-date.png') no-repeat;
background-size: 32rpx 35rpx;
width: 32rpx;
height: 35rpx;
}
:deep(.uni-date-x .icon-calendar::before) {
display: none;
}
:deep(.uni-date-x .uni-date__x-input) {
padding-left: 20rpx;
color: #919191;
}
</style>

View File

@@ -288,6 +288,10 @@ onLoad(option => {
}) })
onShow(()=>{
})
// 下拉刷新 // 下拉刷新
const mescrollRef = ref(null); const mescrollRef = ref(null);
const mescrollInit = (mescroll) => { const mescrollInit = (mescroll) => {

View File

@@ -58,20 +58,24 @@
<!-- <video :src="item" controls></video> --> <!-- <video :src="item" controls></video> -->
<DomVideoPlayer :src="item2.url" objectFit="cover" /> <DomVideoPlayer :src="item2.url" objectFit="cover" />
</view> </view>
<!-- #ifdef APP-PLUS -->
<view class="img-con" @click="chooseMedia"> <!-- loading -->
<img :src="'static/images/polling/icon-AddPorV.png'" class="img-pic" /> <view class="img-con" v-if="imgLoading">
<!-- loading --> <view class="upload-loading">
<view class="upload-loading" v-if="imgLoading">
<uni-icons type="refreshempty" size="30" color="#C9C9C9"></uni-icons> <uni-icons type="refreshempty" size="30" color="#C9C9C9"></uni-icons>
<view>上传中....</view> <view>上传中....</view>
</view> </view>
</view> </view>
<!-- #endif --> <view class="img-con" @click="chooseMedia" v-else>
<!-- #ifndef APP-PLUS -->
<view class="img-con">
<img :src="'static/images/polling/icon-AddPorV.png'" class="img-pic" /> <img :src="'static/images/polling/icon-AddPorV.png'" class="img-pic" />
</view> </view>
<!-- #ifdef APP-PLUS -->
<!-- #endif -->
<!-- #ifndef APP-PLUS -->
<!-- <view class="img-con">
<img :src="'static/images/polling/icon-AddPorV.png'" class="img-pic" />
</view> -->
<!-- #endif --> <!-- #endif -->
</view> </view>
</view> </view>
@@ -84,21 +88,26 @@
<!-- 图片放大 --> <!-- 图片放大 -->
<mediaPreview :visible="isVisible" :url="mediaUrl" @close="handlePreviewClose"></mediaPreview> <mediaPreview :visible="isVisible" :url="mediaUrl" @close="handlePreviewClose"></mediaPreview>
<!-- 选择图片或者视频 -->
<chooseMediaVue ref="chooseMediaRef" @getMediaArr="getMediaArr" @closeMedia="closeMedia"></chooseMediaVue>
</view> </view>
</template> </template>
<script setup> <script setup>
import { ref,onMounted,onUnmounted,nextTick,computed,reactive } from 'vue' import { ref,onMounted,onUnmounted,nextTick,computed,reactive,getCurrentInstance } from 'vue'
import { onLoad,onHide, onShow} from '@dcloudio/uni-app'; import { onLoad,onHide, onShow} from '@dcloudio/uni-app';
import customHeader from '@/components/customHeader.vue'; import customHeader from '@/components/customHeader.vue';
import MescrollUni from 'mescroll-uni/mescroll-uni.vue'; import MescrollUni from 'mescroll-uni/mescroll-uni.vue';
import mediaPreview from "@/components/mediaPreview.vue" import mediaPreview from "@/components/mediaPreview.vue"
import chooseMediaVue from '@/components/chooseMedia.vue'
import DomVideoPlayer from 'uniapp-video-player' import DomVideoPlayer from 'uniapp-video-player'
import { getUserInfo } from '@/api/auth.js' import { getUserInfo } from '@/api/auth.js'
import { problemDetail,problemAddLog,minioUpload } from '@/api/polling.js' import { problemDetail,problemAddLog,minioUpload } from '@/api/polling.js'
import { MINIO_KEY } from '@/enums/cacheEnums'; import { MINIO_KEY } from '@/enums/cacheEnums';
import {showAlert,showLoading,hideLoading} from '@/utils/message.js' import {showAlert,showLoading,hideLoading} from '@/utils/message.js'
import {compressImageUni} from '@/utils/common.js' import {compressImageUni} from '@/utils/common.js'
const { proxy } = getCurrentInstance();
let problemId = ref(''); let problemId = ref('');
let realname = ref(''); let realname = ref('');
@@ -114,6 +123,9 @@ onLoad(async option => {
getList(); getList();
}) })
onShow(()=>{
imgLoading.value=false;
})
// 查询列表 // 查询列表
let list = ref([]); let list = ref([]);
@@ -156,7 +168,9 @@ let imgArr=ref([]);//图片 后台返回的
let videoArr = ref([]);//视频 后台返回的 let videoArr = ref([]);//视频 后台返回的
let imgLoading = ref(false) let imgLoading = ref(false)
const chooseMedia = () => { const chooseMedia = () => {
uni.chooseMedia({ proxy.$refs["chooseMediaRef"].openPicker();
imgLoading.value=true;
/* uni.chooseMedia({
count: 9, count: 9,
mediaType: ['image', 'video'], // 指定可选择图片和视频 mediaType: ['image', 'video'], // 指定可选择图片和视频
sourceType: ['album', 'camera'], sourceType: ['album', 'camera'],
@@ -204,7 +218,40 @@ const chooseMedia = () => {
}) })
}); });
} }
}); });*/
}
const closeMedia = ()=>{
imgLoading.value=false;
}
// 插件回调
const getMediaArr=(arr)=>{
// console.log("插件回调=>",arr)
try {
arr.forEach(data=>{
mediaArr.value.push(data.fileName);
if(data.fileType=="image"){
imgArr.value.push({
shortUrl:minioObj.minioThumbUrl +"/"+data.fileName,
url:minioObj.minioUrl +"/"+data.fileName,
name:data.fileName
})
}else if(data.fileType == "video"){
videoArr.value.push({
shortUrl:minioObj.minioThumbUrl +"/"+data.fileName,
url:minioObj.minioUrl +"/"+data.fileName,
name:data.fileName
})
}
})
// console.log(imgArr.value,videoArr.value)
imgLoading.value=false;
} catch (error) {
console.error(error)
imgLoading.value=false;
}
} }
// 视频或图片删除 根据数组下标删除数组里的某个图片或视频 // 视频或图片删除 根据数组下标删除数组里的某个图片或视频

View File

@@ -62,21 +62,23 @@
<!-- <video :src="item.url" controls></video> --> <!-- <video :src="item.url" controls></video> -->
<DomVideoPlayer :src="item2.url" objectFit="cover" /> <DomVideoPlayer :src="item2.url" objectFit="cover" />
</view> </view>
<!-- #ifdef APP-PLUS -->
<view class="img-con" @click="chooseMedia"> <!-- loading -->
<img :src="'static/images/polling/icon-AddPorV.png'" class="img-pic" /> <view class="img-con" v-if="imgLoading">
<view class="upload-loading">
<!-- loading -->
<view class="upload-loading" v-if="imgLoading">
<uni-icons type="refreshempty" size="30" color="#C9C9C9"></uni-icons> <uni-icons type="refreshempty" size="30" color="#C9C9C9"></uni-icons>
<view>上传中....</view> <view>上传中....</view>
</view> </view>
</view> </view>
<!-- #endif --> <view class="img-con" @click="chooseMedia" v-else>
<!-- #ifndef APP-PLUS -->
<view class="img-con">
<img :src="'static/images/polling/icon-AddPorV.png'" class="img-pic" /> <img :src="'static/images/polling/icon-AddPorV.png'" class="img-pic" />
</view> </view>
<!-- #ifdef APP-PLUS -->
<!-- #endif -->
<!-- #ifndef APP-PLUS -->
<!-- <view class="img-con">
<img :src="'static/images/polling/icon-AddPorV.png'" class="img-pic" />
</view> -->
<!-- #endif --> <!-- #endif -->
</view> </view>
</view> </view>
@@ -89,14 +91,18 @@
<!-- 图片放大 --> <!-- 图片放大 -->
<mediaPreview :visible="isVisible" :url="mediaUrl" @close="handlePreviewClose"></mediaPreview> <mediaPreview :visible="isVisible" :url="mediaUrl" @close="handlePreviewClose"></mediaPreview>
<!-- 选择图片或者视频 -->
<chooseMediaVue ref="chooseMediaRef" @getMediaArr="getMediaArr" @closeMedia="closeMedia"></chooseMediaVue>
</view> </view>
</template> </template>
<script setup> <script setup>
import { ref,onMounted,onUnmounted,nextTick,computed,reactive, watch } from 'vue' import { ref,onMounted,onUnmounted,nextTick,computed,reactive, watch,getCurrentInstance } from 'vue'
import { onLoad,onShow,onHide} from '@dcloudio/uni-app'; import { onLoad,onShow,onHide} from '@dcloudio/uni-app';
import customHeader from '@/components/customHeader.vue'; import customHeader from '@/components/customHeader.vue';
import MescrollUni from 'mescroll-uni/mescroll-uni.vue'; import MescrollUni from 'mescroll-uni/mescroll-uni.vue';
import chooseMediaVue from '@/components/chooseMedia.vue'
import mediaPreview from "@/components/mediaPreview.vue" import mediaPreview from "@/components/mediaPreview.vue"
import DomVideoPlayer from 'uniapp-video-player' import DomVideoPlayer from 'uniapp-video-player'
import { getUserInfo } from '@/api/auth.js' import { getUserInfo } from '@/api/auth.js'
@@ -104,6 +110,7 @@ import { problemDetail,problemAdd,problemEdit,minioUpload } from '@/api/polling.
import {compressImageUni,getFileType} from '@/utils/common.js' import {compressImageUni,getFileType} from '@/utils/common.js'
import {showAlert,showLoading,hideLoading} from '@/utils/message.js' import {showAlert,showLoading,hideLoading} from '@/utils/message.js'
import { MINIO_KEY } from '@/enums/cacheEnums'; import { MINIO_KEY } from '@/enums/cacheEnums';
const { proxy } = getCurrentInstance();
let taskId = ref('');//任务id let taskId = ref('');//任务id
let groupId = ref('');//组id let groupId = ref('');//组id
@@ -124,6 +131,10 @@ onLoad(async option => {
getList(); getList();
}) })
onShow(()=>{
imgLoading.value=false;
})
// 查询列表 // 查询列表
let list = ref([]); let list = ref([]);
let optionObj = ref({}) let optionObj = ref({})
@@ -202,63 +213,98 @@ let imgArr=ref([]);//图片 后台返回的
let videoArr = ref([]);//视频 后台返回的 let videoArr = ref([]);//视频 后台返回的
let imgLoading = ref(false) let imgLoading = ref(false)
const chooseMedia = () => { const chooseMedia = () => {
uni.chooseMedia({ // console.log("chooseMedia=>")
count: 9, proxy.$refs["chooseMediaRef"].openPicker();
mediaType: ['image', 'video'], // 指定可选择图片和视频 imgLoading.value=true;
sourceType: ['album', 'camera'], // uni.chooseMedia({
maxDuration: 60, // 拍摄视频最长拍摄时间 // count: 9,
camera: 'back', // mediaType: ['image', 'video'], // 指定可选择图片和视频
success: (res) => { // sourceType: ['album', 'camera'],
// console.log("chooseMedia=>",res) // maxDuration: 60, // 拍摄视频最长拍摄时间
res.tempFiles.forEach(async file => { // camera: 'back',
// console.log(`文件类型: ${file.fileType}, 文件路径: ${file.tempFilePath}`); // success: (res) => {
let compressImg = file.tempFilePath; // // console.log("chooseMedia=>",res)
// 图片进行压缩 // res.tempFiles.forEach(async file => {
if (file.fileType === 'image') { // // console.log(`文件类型: ${file.fileType}, 文件路径: ${file.tempFilePath}`);
// #ifdef APP-PLUS // let compressImg = file.tempFilePath;
// 压缩图片 // // 图片进行压缩
compressImg = await compressImageUni(file.tempFilePath); // if (file.fileType === 'image') {
// #endif // // #ifdef APP-PLUS
} // // 压缩图片
// compressImg = await compressImageUni(file.tempFilePath);
// // #endif
// }
// 执行上传 // // 执行上传
let param = { // let param = {
filePath: compressImg, // filePath: compressImg,
name: 'file', // name: 'file',
formData: { // formData: {
directory:'polling' // directory:'polling'
}, // },
} // }
imgLoading.value=true; // imgLoading.value=true;
minioUpload(param).then(res=>{ // minioUpload(param).then(res=>{
let data = res.data;//console.log("上传成功后=>",res) // let data = res.data;//console.log("上传成功后=>",res)
mediaArr.value.push(data.fileName); // mediaArr.value.push(data.fileName);
if (file.fileType === 'image') {// 图片 // if (file.fileType === 'image') {// 图片
imgArr.value.push({ // imgArr.value.push({
shortUrl:minioObj.minioThumbUrl +"/"+data.fileName, // shortUrl:minioObj.minioThumbUrl +"/"+data.fileName,
url:minioObj.minioUrl +"/"+data.fileName, // url:minioObj.minioUrl +"/"+data.fileName,
name:data.fileName // name:data.fileName
}) // })
} else if (file.fileType === 'video') {// 视频 // } else if (file.fileType === 'video') {// 视频
videoArr.value.push({ // videoArr.value.push({
shortUrl:minioObj.minioThumbUrl +"/"+data.fileName, // shortUrl:minioObj.minioThumbUrl +"/"+data.fileName,
url:minioObj.minioUrl +"/"+data.fileName, // url:minioObj.minioUrl +"/"+data.fileName,
name:data.fileName // name:data.fileName
}) // })
} // }
}).finally(()=>{ // }).finally(()=>{
imgLoading.value=false; // imgLoading.value=false;
}) // })
}); // });
} // }
}); // });
}
const closeMedia = ()=>{
imgLoading.value=false;
}
// 插件回调
const getMediaArr=(arr)=>{
// console.log("插件回调=>",arr)
try {
arr.forEach(data=>{
mediaArr.value.push(data.fileName);
if(data.fileType=="image"){
imgArr.value.push({
shortUrl:minioObj.minioThumbUrl +"/"+data.fileName,
url:minioObj.minioUrl +"/"+data.fileName,
name:data.fileName
})
}else if(data.fileType == "video"){
videoArr.value.push({
shortUrl:minioObj.minioThumbUrl +"/"+data.fileName,
url:minioObj.minioUrl +"/"+data.fileName,
name:data.fileName
})
}
})
// console.log(imgArr.value,videoArr.value)
imgLoading.value=false;
} catch (error) {
console.error(error)
imgLoading.value=false;
}
} }
// 视频或图片删除 根据数组下标删除数组里的某个图片或视频 // 视频或图片删除 根据数组下标删除数组里的某个图片或视频
const handleDelete=(arr,index2)=>{ const handleDelete=(arr,index2)=>{
arr.splice(index2, 1);
let item = arr[index2]; let item = arr[index2];
arr.splice(index2, 1);
mediaArr.value = mediaArr.value.filter(item2=>item2!=item.name); mediaArr.value = mediaArr.value.filter(item2=>item2!=item.name);
console.log("删除后=>",mediaArr.value) console.log("删除后=>",mediaArr.value)
} }
@@ -303,7 +349,10 @@ const handleSubmit=()=>{
} }
// console.log("problemEdit=>",param) // console.log("problemEdit=>",param)
problemEdit(param).then(res=>{ problemEdit(param).then(res=>{
showAlert("修改问题上报成功!") // showAlert = (content, title = '提示',showCancel=false,succFun)
showAlert("修改问题上报成功!","提示",false,()=>{
uni.navigateBack()
})
}).finally(()=>{ }).finally(()=>{
hideLoading(); hideLoading();
}) })
@@ -317,8 +366,10 @@ const handleSubmit=()=>{
} }
// console.log("problemAdd=>",param) // console.log("problemAdd=>",param)
problemAdd(param).then(res=>{ problemAdd(param).then(res=>{
showAlert("新建问题上报成功!"); showAlert("新建问题上报成功!","提示",false,()=>{
problemId.value = res; problemId.value = res;
uni.navigateBack()
})
}).finally(()=>{ }).finally(()=>{
hideLoading(); hideLoading();
}) })