Commit 851dbac8 by 李伟康

Merge branch 'SAAS+V5.0.0-1014' of http://192.168.3.233:8090/glsx/gl_tape into SAAS+V5.0.0-1014

2 parents 4bf15c61 76b266a5
No preview for this file type
......@@ -42,7 +42,7 @@
.icon-change-account { width: calc(100vmin * (1173 / 768) * 0.013640238704177323); height: calc(100vmin * (1173 / 768) * 0.013640238704177323);
background-position: calc(100vmin * (1173 / 768) * -0.44714407502131287) calc(100vmin * (1173 / 768) * -0.4113384484228474);}
.icon-clone { width: calc(100vmin * (1173 / 768) * 0.010230179028132993); height: calc(100vmin * (1173 / 768) * 0.010230179028132993);
background-position: calc(100vmin * (1173 / 768) * -0.5473145780051151) calc(100vmin * (1173 / 768) * -0.4113384484228474);}
background-position: calc(100vmin * (1173 / 768) * -0.5341005967604433) calc(100vmin * (1173 / 768) * -0.6717817561807332);}
.icon-coupon-arrow { width: calc(100vmin * (1173 / 768) * 0.013640238704177323); height: calc(100vmin * (1173 / 768) * 0.013640238704177323);
background-position: calc(100vmin * (1173 / 768) * -0.46717817561807334) calc(100vmin * (1173 / 768) * -0.4113384484228474);}
.icon-coupon { width: calc(100vmin * (1173 / 768) * 0.04092071611253197); height: calc(100vmin * (1173 / 768) * 0.015345268542199489);
......@@ -109,6 +109,8 @@
background-position: calc(100vmin * (1173 / 768) * -0.578005115089514) calc(100vmin * (1173 / 768) * -0.5400682011935208);}
.icon-feedback { width: calc(100vmin * (1173 / 768) * 0.027280477408354646); height: calc(100vmin * (1173 / 768) * 0.027280477408354646);
background-position: calc(100vmin * (1173 / 768) * -0.6547314578005116) calc(100vmin * (1173 / 768) * -0.526001705029838);}
.icon-feedbackIcon { width: calc(100vmin * (1173 / 768) * 0.011082693947144074); height: calc(100vmin * (1173 / 768) * 0.011082693947144074);
background-position: calc(100vmin * (1173 / 768) * -0.5473145780051151) calc(100vmin * (1173 / 768) * -0.4113384484228474);}
.icon-ffdyj-icon { width: calc(100vmin * (1173 / 768) * 0.017050298380221655); height: calc(100vmin * (1173 / 768) * 0.017050298380221655);
background-position: calc(100vmin * (1173 / 768) * -0.6952259164535379) calc(100vmin * (1173 / 768) * -0.3034953111679454);}
.icon-filter { width: calc(100vmin * (1173 / 768) * 0.013640238704177323); height: calc(100vmin * (1173 / 768) * 0.013640238704177323);
......

2.79 MB | W: | H:

2.79 MB | W: | H:

assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
assets/images/sprite.png
  • 2-up
  • Swipe
  • Onion skin
<template>
<view class="date-list">
<picker-view
class="picker picker_max"
:value="dateValues"
indicator-class="indicator"
@change="changeDate"
>
<picker-view class="picker picker_max" :value="dateValues" indicator-class="indicator" @change="changeDate">
<picker-view-column>
<template v-for="(item,index) in days">
<view
class="view"
:key="index"
>{{item}}</view>
<template v-for="(item, index) in days">
<view class="view" :key="index">{{ item }}</view>
</template>
</picker-view-column>
</picker-view>
<picker-view
class="picker"
:value="hourValues"
indicator-class="indicator"
@change="changeHour"
>
<picker-view class="picker" :value="hourValues" indicator-class="indicator" @change="changeHour">
<picker-view-column>
<template v-for="(item,index) in hours">
<view
class="view"
:key="index"
>{{item}}</view>
<template v-for="(item, index) in hours">
<view class="view" :key="index">{{ item }}</view>
</template>
</picker-view-column>
</picker-view>
<picker-view
class="picker"
:value="minuteValues"
indicator-class="indicator"
@change="changeMinutes"
>
<picker-view class="picker" :value="minuteValues" indicator-class="indicator" @change="changeMinutes">
<picker-view-column>
<template v-for="(item,index) in minutes">
<view
class="view"
:key="index"
>{{item}}</view>
<template v-for="(item, index) in minutes">
<view class="view" :key="index">{{ item }}</view>
</template>
</picker-view-column>
</picker-view>
</view>
</template>
<script type='text/ecmascript-6'>
<script type="text/ecmascript-6">
import dayjs from 'dayjs'
export default {
name: 'DateTime',
......@@ -208,7 +184,7 @@ export default {
}
</script>
<style scoped lang='scss'>
<style scoped lang="scss">
.date-list {
height: 100%;
display: grid;
......@@ -224,8 +200,8 @@ export default {
height: toRpx(72);
}
}
/deep/.indicator{
/deep/.indicator {
height: toRpx(72);
}
}
</style>
\ No newline at end of file
</style>
<template>
<view class="date-list">
<picker-view class="picker picker_max" :value="dateValues" indicator-class="indicator" @change="changeDate">
<picker-view-column>
<template v-for="(item, index) in days">
<view class="view" :key="index">{{ item }}</view>
</template>
</picker-view-column>
</picker-view>
<picker-view class="picker" :value="hourValues" indicator-class="indicator" @change="changeHour">
<picker-view-column>
<template v-for="(item, index) in hours">
<view class="view" :key="index">{{ item }}</view>
</template>
</picker-view-column>
</picker-view>
<picker-view class="picker" :value="minuteValues" indicator-class="indicator" @change="changeMinutes">
<picker-view-column>
<template v-for="(item, index) in minutes">
<view class="view" :key="index">{{ item }}</view>
</template>
</picker-view-column>
</picker-view>
</view>
</template>
<script type="text/ecmascript-6">
import dayjs from 'dayjs'
export default {
name: 'DateTimeChange',
inject: ['userInfo'],
data () {
return {
hours: [],
days: [],
minutes: [],
dateValues: [],
hourValues: [],
minuteValues: [],
loading: true
}
},
props: {
},
mounted () {
this.initDate()
},
methods: {
initDate () {
console.log('initDate')
this.dateValues = []
this.hourValues = []
this.minuteValues = []
const today = new Date()
this.getDateList('2019/01/01','2029/01/01')
},
getDateList (starDay, endDay) {
const arr = [];
const dates = [];
// 设置两个日期UTC时间
const db = new Date(starDay);
const de = new Date(endDay);
// 获取两个日期GTM时间
const s = db.getTime() - 24 * 60 * 60 * 1000;
const d = de.getTime() - 24 * 60 * 60 * 1000;
console.log(db,de)
// 获取到两个日期之间的每一天的毫秒数
for (let i = s; i <= d;) {
i = i + 24 * 60 * 60 * 1000;
arr.push(parseInt(String(i)));
}
// 获取每一天的时间 YY-MM-DD
for (const j in arr) {
const time = new Date(arr[j]);
const year = time.getFullYear();
const mouth = time.getMonth() + 1 >= 10 ? time.getMonth() + 1 : '0' + (time.getMonth() + 1);
const day = time.getDate() >= 10 ? time.getDate() : '0' + time.getDate();
const YYMMDD = year + '/' + mouth + '/' + day;
dates.push(YYMMDD);
}
this.getHourList(dates)
},
getHourList (days) {
const hours = [], today = new Date();
for (let hour = 0; hour < today.getHours() + 1; hour++) {
hours.push(hour.toString().padStart(2, '0'));
}
this.getMinuteList(days, hours)
},
getMinuteList (days, hours) {
const minutes = [];
const today = new Date()
for (let minute = 0; minute < today.getMinutes() + 1; minute++) {
minutes.push(minute.toString().padStart(2, '0'));
}
// 设置默认时间
let { dateValues, hourValues, minuteValues } = this
const HOUR_STR = today.getHours().toString().padStart(2, '0')
const MUNTUE_STR = today.getMinutes().toString().padStart(2, '0')
// const defalutHIndex = hours.indexOf(HOUR_STR)
// const defalutMIndex = minutes.indexOf(MUNTUE_STR)
dateValues.push(days.length + 1)
hourValues.push(hours.length + 1)
minuteValues.push(minutes.length + 1)
this.currentDate = dayjs().format('YYYY/MM/DD')
this.currentHour = HOUR_STR
this.currentMinute = MUNTUE_STR
this.hours = hours
this.days = days
this.minutes = minutes
this.dateValues = dateValues
this.hourValues = hourValues
this.minuteValues = minuteValues
this.loading = false
setTimeout(() => {
this.minuteValues = minuteValues
this.loading = false
}, 100)
this.$emit('onComplete')
},
changeDate (e) {
const { days } = this
const { value } = e.detail
const index = value[0]
this.currentDate = days[index]
// 选择过去时间需要重新初始化时分
const today = dayjs().format('YYYY/MM/DD')
const timeType = this.currentDate != today ? 1 : 0
this.getAllTimeOrPartTime(timeType)
},
changeHour (e) {
const { hours, days, dateValues } = this
const { value } = e.detail
const index = value[0]
this.currentHour = hours[index]
// 处理当前天切换别的小时,别的分不能选后面分到60的问题
// const dayIndex = dateValues[0]
// this.currentDate = days[dayIndex]
const today = dayjs().format('YYYY/MM/DD')
const timeType = this.currentDate != today ? 1 : 0
this.getAllTimeOrPartTimeMinute(timeType)
},
changeMinutes (e) {
const { minutes } = this
const { value } = e.detail
const index = value[0]
this.currentMinute = minutes[index]
},
getAllTimeOrPartTime (type) {
const today = new Date()
const hours = [], minutes = [], hour_len = type == 1 ? 24 : today.getHours() + 1, minute_len = type == 1 ? 60 : today.getMinutes() + 1;
for (let hour = 0; hour < hour_len; hour++) {
hours.push(hour.toString().padStart(2, '0'));
}
for (let minute = 0; minute < minute_len; minute++) {
minutes.push(minute.toString().padStart(2, '0'));
}
this.hours = hours
this.minutes = minutes
},
getAllTimeOrPartTimeMinute (type) {
const today = new Date()
const currentHour = today.getHours()
const timeType = this.currentHour != currentHour ? 1 : 0
const minutes = [], minute_len = type == 1 || timeType == 1 ? 60 : today.getMinutes() + 1;
for (let minute = 0; minute < minute_len; minute++) {
minutes.push(minute.toString().padStart(2, '0'));
}
this.minutes = minutes
},
getResult () {
let str = ''
str = this.currentDate + ' ' + this.currentHour + ':' + this.currentMinute + ":00"
const result = dayjs(str).format('YYYY/MM/DD HH:mm:ss')
return result
}
}
}
</script>
<style scoped lang="scss">
.date-list {
height: 100%;
display: grid;
grid-template-columns: repeat(3, 1fr);
.picker {
height: 100%;
text-align: center;
.view {
display: flex;
align-items: center;
justify-content: center;
font-size: toRpx(32);
height: toRpx(72);
}
}
/deep/.indicator {
height: toRpx(72);
}
}
</style>
......@@ -173,6 +173,12 @@ const componentConfig = {
loadComplete: false,
hideSearch: true,
noData: false
},
15: {
name: 'DateTimeChange',
title: '选择时间',
hideSearch: true,
loadComplete: false
}
}
export default { componentConfig }
......@@ -41,6 +41,7 @@ import PackageList from './components/PackageList.vue'
import SkuGoodsList from './components/SkuGoodsList.vue'
import SkuPopup from './components/SkuPopup.vue'
import DateTime from './components/DateTime.vue'
import DateTimeChange from './components/DateTimeChange.vue'
import AgreementList from './components/AgreementList.vue'
export default {
components: {
......@@ -54,7 +55,8 @@ export default {
SkuGoodsList,
SkuPopup,
DateTime,
AgreementList
AgreementList,
DateTimeChange
},
name: '',
props: {
......@@ -167,7 +169,7 @@ export default {
confirm () {
try {
let { chooseContent, popupType, componentObject } = this
if (popupType == 13) {
if (popupType == 13 || popupType == 15) {
chooseContent = this.componentRef().getResult()
}
if (chooseContent) {
......
<template>
<div class="button-module flex">
<view class="common-btn" @click.stop="handleClick('details')">详情</view>
<view v-if="!subStatus && status != 100" class="common-btn ml-24" @click.stop="handleClick('edit')">编辑</view>
<view v-if="status == 20 && !subStatus" class="common-btn ml-24" @click.stop="handleClick('requote','app_evaluate_requote')">重新报价</view>
<view v-if="status == 20 && !subStatus" class="common-btn blue-btn ml-24" @click.stop="handleClick('sign','app_evaluate_sign')">客户签约</view>
<view v-if="!subStatus && status != 100 && status != '-1'" class="common-btn ml-24" @click.stop="handleClick('edit')">编辑</view>
<view v-if="status == 20 && !subStatus" class="common-btn ml-24" @click.stop="handleClick('requote', 'app_evaluate_requote')">重新报价</view>
<view v-if="status == 20 && !subStatus" class="common-btn blue-btn ml-24" @click.stop="handleClick('sign', 'app_evaluate_sign')">客户签约</view>
<view v-if="status == 20 && subStatus == 1" class="common-btn gray-btn ml-24" @click.stop="handleClick('signing')">签约中</view>
<view v-if="status == 30 && !subStatus" class="common-btn ml-24" @click.stop="handleClick('cancelSign','app_evaluate_cancel_sign')">取消签约</view>
<view v-if="status == 30 && !subStatus && paymentType == 1" class="common-btn blue-btn ml-24" @click.stop="handleClick('payDeposit','app_evaluate_pay_deposit')">支付定金</view>
<view v-if="status == 30 && !subStatus && paymentType == 2" class="common-btn blue-btn ml-24" @click.stop="handleClick('payFull','app_evaluate_pay_full')">支付全款</view>
<view v-if="status == 30 && !subStatus" class="common-btn ml-24" @click.stop="handleClick('cancelSign', 'app_evaluate_cancel_sign')">取消签约</view>
<view v-if="status == 30 && !subStatus && paymentType == 1" class="common-btn blue-btn ml-24" @click.stop="handleClick('payDeposit', 'app_evaluate_pay_deposit')">支付定金</view>
<view v-if="status == 30 && !subStatus && paymentType == 2" class="common-btn blue-btn ml-24" @click.stop="handleClick('payFull', 'app_evaluate_pay_full')">支付全款</view>
<view v-if="subStatus == 2 || subStatus == 3" class="common-btn gray-btn ml-24" @click.stop="handleClick('paying')">支付中</view>
<view v-if="status == 40 && !subStatus && paymentType == 1" class="common-btn blue-btn ml-24" @click.stop="handleClick('payFull','app_evaluate_pay_final')">支付尾款</view>
<view v-if="status == 50 && !subStatus" class="common-btn blue-btn ml-24" @click.stop="handleClick('confirmDelivery','app_evaluate_confirm_delivery')">确认交车</view>
<view v-if="status == '-1'" class="common-btn blue-btn ml-24" @click.stop="handleClick('reSubmit','app_evaluate_re_submit')">重新提交</view>
<view v-if="status == 40 && !subStatus && paymentType == 1" class="common-btn blue-btn ml-24" @click.stop="handleClick('payFull', 'app_evaluate_pay_final')">支付尾款</view>
<view v-if="status == 50 && !subStatus" class="common-btn blue-btn ml-24" @click.stop="handleClick('confirmDelivery', 'app_evaluate_confirm_delivery')">确认交车</view>
<view v-if="status == '-1'" class="common-btn blue-btn ml-24" @click.stop="handleClick('reSubmit', 'app_evaluate_re_submit')">重新提交</view>
</div>
</template>
......@@ -38,13 +38,14 @@ export default {
}
},
methods: {
handleClick(buttonType ,eventCode) {
handleClick(buttonType, eventCode) {
this.$emit('button-click', {
type: buttonType
})
if(eventCode) uni.$track.add({
eventCode
}) //点击埋点
if (eventCode)
uni.$track.add({
eventCode
}) //点击埋点
}
}
}
......
......@@ -11,7 +11,7 @@
<view v-if="field.isScan" class="flex align-center scanBtn justify-center" @click.stop="scan('vinOcr')">
<view class="sprite-icon icon-scanIconX"></view>
</view>
<text v-if="field.isCell" class="ml-12 cellLabel">{{ field.cell }}</text>
<text v-if="field.isCell" class="ml-12 cellLabel" :class="{ disabled: field.disabled }">{{ field.cell }}</text>
</template>
<template v-if="field.type === 'select'">
<view class="flex align-center from-value">
......@@ -53,14 +53,13 @@
<template v-if="field.type === 'radio'">
<radio-group class="radio-group flex align-center" @change="e => radioChange(e, field)">
<label class="uni-list-cell uni-list-cell-pd align-center flex ml-48" v-for="(item, index) in field.radioList" :key="item.value">
<radio style="transform: scale(0.7)" :value="item.value" :checked="index === current" />
<radio style="transform: scale(0.7)" :value="item.value" :checked="getRadioChecked(item.value, field)" />
<view class="radio-name">{{ item.name }}</view>
</label>
</radio-group>
</template>
<template v-if="field.type === 'pricek'">
<picker @change="e => bindPickerChange(e, field)" range-key="name" :value="field.value" :range="field.fieldPickerArray">
<picker @change="e => bindPickerChange(e, field)" range-key="name" :value="getPickerValue(field)" :range="field.fieldPickerArray">
<view class="flex align-center from-value">
<template v-if="field.targetObj ? formData[field.targetObj][field.targetNameKey] : formData[field.targetKey]">
{{ field.targetObj ? formData[field.targetObj][field.targetNameKey] : formData[field.targetNameKey] }}
......@@ -93,7 +92,7 @@
<view class="pdf-box flex align-center justify-between" v-if="field.isShowPreview">
<view class="flex align-center">
<view class="sprite-icon icon-pdf"></view>
<text>二手车买卖补充协议</text>
<text>二手车补充协议</text>
</view>
<view class="flex align-center">
<view class="btn" @click.stop="previewPdf(field)">预览</view>
......@@ -172,6 +171,14 @@ export default {
// 验证通过,触发输入事件
this.$emit('inputChange', e, field)
},
getRadioChecked(value, field) {
if (field.targetObj && this.formData[field.targetObj] && this.formData[field.targetObj][field.targetKey] !== undefined) {
return this.formData[field.targetObj][field.targetKey] === value
} else if (this.formData[field.targetKey] !== undefined) {
return this.formData[field.targetKey] === value
}
return false
},
handleBlur(e, field) {
console.log('handleBlur', e, field)
let value = e.target?._value?.trim() || e.target?.value?.trim()
......@@ -185,6 +192,20 @@ export default {
this.$emit('blurChange', value, field)
}
},
getPickerValue(field) {
if (field.index !== undefined) {
return field.index
}
if (field.fieldPickerArray && field.fieldPickerArray.length > 0) {
const currentValue = field.targetObj ? this.formData[field.targetObj][field.targetKey] : this.formData[field.targetKey]
if (currentValue) {
const index = field.fieldPickerArray.findIndex(item => item.value === currentValue || item.name === currentValue)
return index >= 0 ? index : 0
}
}
return 0
},
scan(type) {
this.$emit('scan', type)
},
......@@ -272,10 +293,18 @@ export default {
text-align: right;
outline: none;
}
.formInput:disabled {
color: #999999;
}
.cellLabel {
color: #333333;
font-size: toRpx(28);
}
.cellLabel.disabled {
color: #999999;
font-size: toRpx(28);
font-weight: 400;
}
.form-item-textarea {
flex-direction: column;
align-items: start;
......
......@@ -91,7 +91,7 @@ export default {
methods: {
open() {
this.$nextTick(() => {
console.log(this.$refs)
console.log(this.$refs.publishPopup)
if (this.$refs.publishPopup) {
this.$refs.publishPopup.open()
}
......@@ -112,6 +112,7 @@ export default {
this.$emit('close')
},
confirm() {
console.log('confirm', this.autoClose)
if (this.resolve) {
if (this.autoClose) {
this.$refs.publishPopup.close()
......@@ -148,6 +149,9 @@ export default {
width: 100%;
height: toRpx(164);
background-color: #fff;
.btn {
width: toRpx(720);
}
}
}
//小弹窗
......@@ -220,7 +224,7 @@ export default {
width: 100%;
}
.btn {
flex: 1;
width: toRpx(720);
height: toRpx(76);
border-radius: toRpx(48);
opacity: 1;
......
......@@ -19,8 +19,9 @@
</view>
<!-- 右侧名称和内容区域 -->
<view class="step-right-area">
<view class="step-name" :class="{ active: currentStep >= index + 1 }">
{{ step.roundNo ? `第${step.roundNo}轮报价` : '编辑记录' }}
<view class="step-name flex align-center justify-between" :class="{ active: currentStep >= index + 1 }">
<view>{{ step.roundNo ? `第${step.roundNo}轮报价` : index == steps.length - 1 ? '首次提交' : '编辑记录' }}</view>
<view class="step-time">{{ step.quoteTime || step.operateTime }}</view>
</view>
<!-- 可自定义添加其他内容 -->
<slot :step="step" :indexContent="index"></slot>
......@@ -171,6 +172,11 @@ export default {
white-space: normal;
margin-bottom: toRpx(20);
}
.step-time {
color: #999999;
font-size: toRpx(28);
font-weight: 400;
}
/* 连接线容器 */
.dash-line-wrapper {
......
......@@ -33,7 +33,7 @@
</view>
<view class="info-item flex align-center">
<text class="common-label flex-shrink-0">工单时间</text>
<view class="common-value text-ellipsis ml-16">{{ carInfo.createdDate }}</view>
<view class="common-value text-ellipsis ml-16">{{ carInfo.evalOrderTime }}</view>
</view>
<view class="info-item flex align-center" v-if="carInfo.status != 10 && carInfo.status != 20">
<text class="common-label flex-shrink-0">签约时间</text>
......@@ -51,10 +51,17 @@
</view>
<ButtonModule @button-click="$emit('button-click', { ...$event, ...carInfo })" :status="carInfo.status" :subStatus="carInfo.subStatus" :paymentType="carInfo.paymentType"></ButtonModule>
</view>
<view v-if="carInfo.status == -1">
<view class="tips px-20">
<view class="sprite-icon icon-study-tips"></view>
<view class="text-ellipsis">驳回原因:{{ carInfo.rejectReason }}</view>
<view class="text-ellipsis tips px-20 justify-between">
<view class="flex-1 flex align-center">
<view class="sprite-icon icon-study-tips"></view>
驳回原因:{{ carInfo.rejectReason }}
</view>
<view class="flex-1 flex align-center">
<view class="sprite-icon icon-feedbackIcon"></view>
驳回意见:{{ carInfo.rejectSuggestion }}
</view>
</view>
</view>
</view>
......@@ -237,6 +244,9 @@ export default {
.icon-study-tips {
margin-right: toRpx(8);
}
.icon-feedbackIcon {
margin-right: toRpx(8);
}
.waitinputorder-btn {
width: toRpx(136);
height: toRpx(50);
......
......@@ -19,7 +19,7 @@
<template>
<view class="form-btn flex align-center">
<view class="btn search mr-12" @click.stop="search">查询</view>
<view class="btn" @click.stop="$emit('reset')">重置</view>
<view class="btn" @click.stop="resetForm">重置</view>
</view>
</template>
</view>
......@@ -28,6 +28,14 @@
<script>
export default {
name: 'searchBox',
watch: {
searchValue: {
handler(newVal) {
this.customerInfo = { ...newVal }
},
immediate: true
}
},
data() {
return {
focusIndex: -1,
......@@ -51,7 +59,7 @@ export default {
popKey: 'licensePlate'
},
{
placeholder: '评估单号',
placeholder: '工单编号',
key: 'carModel',
type: 'input',
popKey: 'evalOrderNo'
......@@ -81,6 +89,16 @@ export default {
resetFocusIndex() {
this.focusIndex = -1
this.errorTip = false
},
resetForm() {
this.customerInfo = {
previousOwnerName: '',
previousOwnerPhone: '',
licensePlate: '',
evalOrderNo: ''
}
this.$emit('update:searchValue', this.customerInfo)
this.$emit('reset')
}
}
}
......
......@@ -35,7 +35,9 @@
</view>
</template>
<script>
import { uploadFile } from '@/utils/ossUploadFile/uploadFile.js'
// import { uploadFile } from '@/utils/ossUploadFile/uploadFile.js'
import { uploadFile } from '@/utils/ossUpload.js'
import permision from '@/js_sdk/wa-permission/permission.js'
export default {
name: 'UploadMedia',
......@@ -72,7 +74,22 @@ export default {
},
methods: {
// 处理媒体上传
handleMediaUpload(field) {
async handleMediaUpload(field) {
const photoLibrary = await permision.requestAndroidPermission('android.permission.READ_EXTERNAL_STORAGE')
const camera = await permision.requestAndroidPermission('android.permission.CAMERA')
const isOnline = await uni.$isNetWork()
if (photoLibrary != 1) {
uni.showToast({ title: '您的设备不支持相册功能或未授权访问,请前往设置中开启相册权限', icon: 'none' })
return
}
if (camera != 1) {
uni.showToast({ title: '您的设备不支持摄像头功能或未授权访问,请前往设置中开启摄像头权限', icon: 'none' })
return
}
if (!isOnline) {
uni.showToast({ title: '当前无网络连接,请连接网络后重试', icon: 'none' })
return
}
// 根据字段类型显示不同的操作菜单
const itemList = []
if (field.accept === 'image' || !field.accept) {
......@@ -117,6 +134,13 @@ export default {
sourceType: ['camera'],
success: async res => {
try {
const MAX_IMAGE_SIZE = 10 * 1024 * 1024 // 10MB
for (const file of res.tempFiles) {
if (file.size > MAX_IMAGE_SIZE) {
uni.showToast({ title: '图片上传最大10MB', icon: 'none' })
return
}
}
uni.showLoading({ title: '上传中...' })
// 上传所有选择的图片
for (const tempFilePath of res.tempFilePaths) {
......@@ -129,7 +153,7 @@ export default {
}
} catch (error) {
console.log('上传图片失败', error)
uni.showToast({ title: '上传图片失败', icon: 'none' })
uni.showToast({ title: '图片上传失败,请重试', icon: 'none' })
}
},
fail: err => {
......@@ -149,12 +173,19 @@ export default {
sizeType: ['compressed'],
sourceType: ['album'],
success: async res => {
console.log(res, '选择图片')
try {
const MAX_IMAGE_SIZE = 10 * 1024 * 1024 // 10MB
for (const file of res.tempFiles) {
if (file.size > MAX_IMAGE_SIZE) {
uni.showToast({ title: '图片上传最大10MB', icon: 'none' })
return
}
}
uni.showLoading({ title: '上传中...' })
// 上传所有选择的图片
for (const tempFilePath of res.tempFilePaths) {
console.log(res, '上传所有选择的图片')
const url = await uploadFile(tempFilePath)
for (let i = 0; i < res.tempFilePaths.length; i++) {
const url = await uploadFile(res.tempFiles[i], res.tempFilePaths[i])
console.log('上传图片成功', url)
uni.hideLoading()
// const fileExtension = res.tempFiles[0]?.name ? res.tempFiles[0]?.name.split('.').pop().toLowerCase() : res.tempFiles[0]?.path.split('.').pop().toLowerCase()
......@@ -162,7 +193,7 @@ export default {
}
} catch (error) {
console.log('上传图片失败', error)
uni.showToast({ title: '上传图片失败', icon: 'none' })
uni.showToast({ title: '图片上传失败,请重试', icon: 'none' })
}
},
fail: err => {
......@@ -184,8 +215,18 @@ export default {
success: async res => {
console.log('拍摄视频成功', res)
try {
const MAX_VIDEO_SIZE = 100 * 1024 * 1024 // 100MB
if (res.size > MAX_VIDEO_SIZE) {
uni.showToast({ title: '视频上传最大100MB', icon: 'none' })
return
}
uni.showLoading({ title: '上传中...' })
const url = await uploadFile(res.tempFilePath)
// #ifdef H5
const url = await uploadFile(res.tempFile, res.tempFilePath)
// #endif
// #ifdef APP-PLUS
const url = await uploadFile(null, res.tempFilePath)
// #endif
console.log('上传视频成功', url)
// const fileExtension = res.name ? res.name.split('.').pop().toLowerCase() : res.tempFilePath.split('.').pop().toLowerCase()
this.addMedia(field, {
......@@ -200,7 +241,7 @@ export default {
} catch (error) {
console.log('上传视频失败', error)
uni.hideLoading()
uni.showToast({ title: '上传视频失败', icon: 'none' })
uni.showToast({ title: '视频上传失败,请重试', icon: 'none' })
}
},
fail: err => {
......@@ -221,8 +262,19 @@ export default {
success: async res => {
console.log('选择视频成功', res)
try {
const MAX_VIDEO_SIZE = 100 * 1024 * 1024 // 100MB
if (res.size > MAX_VIDEO_SIZE) {
uni.showToast({ title: '视频上传最大100MB', icon: 'none' })
return
}
uni.showLoading({ title: '上传中...' })
const url = await uploadFile(res.tempFilePath)
// #ifdef H5
const url = await uploadFile(res.tempFile, res.tempFilePath)
// #endif
// #ifdef APP-PLUS
const url = await uploadFile(null, res.tempFilePath)
// #endif
console.log('上传视频成功', url)
// const fileExtension = res.name ? res.name.split('.').pop().toLowerCase() : res.tempFilePath.split('.').pop().toLowerCase()
this.addMedia(field, {
......@@ -237,7 +289,7 @@ export default {
} catch (error) {
console.log('上传视频失败', error)
uni.hideLoading()
uni.showToast({ title: '上传视频失败', icon: 'none' })
uni.showToast({ title: '视频上传失败,请重试', icon: 'none' })
}
},
fail: err => {
......
......@@ -114,6 +114,7 @@ import OrderPopup from '@/components/OrderPopup/index.vue'
import dayjs from 'dayjs'
import NoticePopup from '@/components/NoticePopup.vue'
import { debounce } from 'lodash'
import permision from '@/js_sdk/wa-permission/permission.js'
export default {
components: {
FormCell,
......@@ -220,6 +221,16 @@ export default {
onLoad(options) {
this.init(options)
},
onBackPress(options) {
if (options.from === 'backbutton') {
// 物理返回按钮触发
// 阻止默认行为,即不执行页面返回
this.backPage()
return true
}
// 其他情况允许正常返回
return false
},
methods: {
init(options) {
this.query = options
......@@ -364,7 +375,22 @@ export default {
})
}
},
handleImageUpload(field) {
async handleImageUpload(field) {
const photoLibrary = await permision.requestAndroidPermission('android.permission.READ_EXTERNAL_STORAGE')
const camera = await permision.requestAndroidPermission('android.permission.CAMERA')
const isOnline = await uni.$isNetWork()
if (photoLibrary != 1) {
uni.showToast({ title: '您的设备不支持相册功能或未授权访问,请前往设置中开启相册权限', icon: 'none' })
return
}
if (camera != 1) {
uni.showToast({ title: '您的设备不支持摄像头功能或未授权访问,请前往设置中开启摄像头权限', icon: 'none' })
return
}
if (!isOnline) {
uni.showToast({ title: '当前无网络连接,请连接网络后重试', icon: 'none' })
return
}
// 显示操作菜单,让用户选择拍照或从相册选择
uni.showActionSheet({
itemList: ['拍照', '从相册选择'],
......@@ -489,7 +515,7 @@ export default {
},
// 预览PDF
previewPdf(field) {
const url = `/pages/evaluationForm/components/pdfPreView?fileUrl=${this.pdfUrl}&title=pdf&fileUrltype=pdf`
const url = `/pages/evaluationForm/components/pdfPreView?fileUrl=${this.pdfUrl}&title=pdf&fileUrltype=pdf&Signature=true`
uni.navigateTo({
url: `${url}`
})
......
......@@ -129,7 +129,8 @@ export const sunroofMap = {
export const emissionStandardMap = {
3: '国3',
4: '国4',
5: '国5'
5: '国5',
6: '国6'
}
export const buyNewCarMap = {
0: '是',
......
import config from './ossUploadFile/config.js'
import base64 from './ossUploadFile/base64.js'
import Hmac from './ossUploadFile/hmac.js'
import Sha1 from './ossUploadFile/sha1.js'
import Crypto from './ossUploadFile/crypto.js'
/**
* 上传文件到阿里云oss
* @param {string} file 图片信息
* @param {string} dir 表示要传到哪个目录下
* @return 完整的图片地址
*/
const uploadFile = function (file, filePath) {
console.log('上传文件到阿里云oss', file, filePath)
return new Promise(async (resolve, reject) => {
// 添加文件大小限制检查
if (file && file.size) {
// 定义文件类型和大小限制
const imageTypes = ['jpg', 'jpeg', 'png', 'gif', 'bmp']
const videoTypes = ['mp4', 'avi', 'mov', 'wmv', 'flv', 'mkv']
// 提取文件后缀
const fileExtension = file ? (file.name ? file.name.split('.').pop().toLowerCase() : file.path.split('.').pop().toLowerCase()) : filePath.split('.').pop().toLowerCase()
// 检查文件大小
const fileSizeMB = file.size / (1024 * 1024) // 转换为MB
// 图片文件大小限制10MB
if (imageTypes.includes(fileExtension) && fileSizeMB > 10) {
uni.showToast({
title: '图片上传最大10MB',
icon: 'none'
})
reject(new Error('图片上传最大10MB'))
return
}
// 视频文件大小限制100MB
if (videoTypes.includes(fileExtension) && fileSizeMB > 100) {
uni.showToast({
title: '视频上传最大100MB',
icon: 'none'
})
reject(new Error('视频上传最大100MB'))
return
}
}
// 提取文件后缀
const fileExtension = file ? (file.name ? file.name.split('.').pop().toLowerCase() : file.path.split('.').pop().toLowerCase()) : filePath.split('.').pop().toLowerCase()
// 生成随机数(使用时间戳+随机字符串)
const timestamp = Date.now()
const randomStr = Math.random().toString(36).substring(2, 10)
const randomNum = timestamp + '_' + randomStr
let aliyunFileKey = config.folder + randomNum + '.' + fileExtension
console.log(aliyunFileKey, 'aliyunFileKey')
const aliyunServerURL = config.uploadUrl // OSS地址
const policyBase64 = getPolicyBase64()
const { signature, securityToken, lsaccessKeyId } = await getSignature(policyBase64) // 获取签名
uni.uploadFile({
url: aliyunServerURL, // 开发者服务器url
filePath: filePath, // 要上传文件资源的路径
name: 'file', // 必须填file
formData: {
key: aliyunFileKey,
policy: policyBase64,
OSSAccessKeyId: lsaccessKeyId,
success_action_status: '200', // 让服务端返回200, 不然默认会返回204
signature: signature,
'x-oss-security-token': securityToken // 使用STS签名时必传。
},
success: function (res) {
console.log(res, 444)
if (res.statusCode != 200) {
reject(
new Error(
'上传错误:' +
JSON.stringify({
statusCode: res.statusCode,
file: file,
key: aliyunFileKey,
policy: policyBase64,
OSSAccessKeyId: lsaccessKeyId,
signature: signature,
'x-oss-security-token': securityToken
})
)
)
} else {
uni.removeSavedFile({
file: file,
complete: function (res) {
console.log(res)
}
})
}
resolve(aliyunServerURL + aliyunFileKey)
},
fail: function (err) {
console.log(err, 555)
err.domainName = aliyunServerURL
reject(err)
}
})
})
}
const getPolicyBase64 = function () {
let date = new Date()
date.setHours(date.getHours() + config.timeout)
let srcT = date.toISOString()
const policyText = {
expiration: srcT, //设置该Policy的失效时间,超过这个失效时间之后,就没有办法通过这个policy上传文件了
conditions: [
['content-length-range', 0, 1024 * 1024 * 1024] // 设置上传文件的大小限制(5m)
]
}
const policyBase64 = base64.encode(JSON.stringify(policyText))
return policyBase64
}
const getOssToken = async function () {
console.log('getOssToken')
const { lsaccessKeySecret, securityToken, lsaccessKeyId } = await uni.$api.commonApi.getToken({})
return {
lsaccessKeySecret,
securityToken,
lsaccessKeyId
}
}
// 生成签名
const getSignature = function (policyBase64) {
return new Promise(async reslove => {
const result = uni.$api.commonApi.getToken({}).then(res => {
const { lsaccessKeySecret, securityToken, lsaccessKeyId } = res
const bytes = Crypto.HmacSHA1(policyBase64, lsaccessKeySecret)
const signature = Crypto.enc.Base64.stringify(bytes)
reslove({
signature,
securityToken,
lsaccessKeyId
})
})
})
}
module.exports = { uploadFile }
......@@ -7,11 +7,11 @@
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
// base64,Hmac,Sha1,Crypto 相关算法
import config from "./config.js";
import base64 from "./base64.js";
import Hmac from "./hmac.js";
import Sha1 from "./sha1.js";
import Crypto from "./crypto.js";
import config from './config.js'
import base64 from './base64.js'
import Hmac from './hmac.js'
import Sha1 from './sha1.js'
import Crypto from './crypto.js'
/**
* 上传文件到阿里云oss
* @param {string} filePath 图片的本地资源路径
......@@ -19,44 +19,44 @@ import Crypto from "./crypto.js";
* @return 完整的图片地址
*/
const uploadFile = function (filePath) {
console.log('上传文件到阿里云oss', filePath)
return new Promise(async (resolve, reject) => {
if (!filePath || filePath.length < 9) {
uni.showModal({
title: "文件错误",
content: "请重试",
showCancel: false,
});
reject("文件错误");
title: '文件错误',
content: '请重试',
showCancel: false
})
reject('文件错误')
}
// 获取上传的文件类型
let fileTypeIndex = filePath.lastIndexOf("/");
let fileType = filePath.substring(fileTypeIndex + 1);
let aliyunFileKey = config.folder + fileType;
const aliyunServerURL = config.uploadUrl; // OSS地址
const accessid = config.OSSAccessKeyId;
const policyBase64 = getPolicyBase64();
const { signature, securityToken, lsaccessKeyId } = await getSignature(
policyBase64
); // 获取签名
let fileTypeIndex = filePath.lastIndexOf('/')
let fileType = filePath.substring(fileTypeIndex + 1)
console.log(fileType, '获取上传的文件类型')
let aliyunFileKey = config.folder + fileType
const aliyunServerURL = config.uploadUrl // OSS地址
const accessid = config.OSSAccessKeyId
const policyBase64 = getPolicyBase64()
const { signature, securityToken, lsaccessKeyId } = await getSignature(policyBase64) // 获取签名
uni.uploadFile({
url: aliyunServerURL, // 开发者服务器url
filePath: filePath, // 要上传文件资源的路径
name: "file", // 必须填file
name: 'file', // 必须填file
formData: {
key: aliyunFileKey,
policy: policyBase64,
OSSAccessKeyId: lsaccessKeyId,
success_action_status: "200", // 让服务端返回200, 不然默认会返回204
success_action_status: '200', // 让服务端返回200, 不然默认会返回204
signature: signature,
"x-oss-security-token": securityToken, // 使用STS签名时必传。
'x-oss-security-token': securityToken // 使用STS签名时必传。
},
success: function (res) {
console.log(res, 444);
console.log(res, 444)
if (res.statusCode != 200) {
reject(
new Error(
"上传错误:" +
'上传错误:' +
JSON.stringify({
statusCode: res.statusCode,
filePath,
......@@ -64,65 +64,64 @@ const uploadFile = function (filePath) {
policy: policyBase64,
OSSAccessKeyId: lsaccessKeyId,
signature: signature,
"x-oss-security-token": securityToken,
'x-oss-security-token': securityToken
})
)
);
)
} else {
uni.removeSavedFile({
filePath,
complete: function (res) {
console.log(res);
},
});
console.log(res)
}
})
}
resolve(aliyunServerURL + aliyunFileKey);
resolve(aliyunServerURL + aliyunFileKey)
},
fail: function (err) {
err.domainName = aliyunServerURL;
reject(err);
},
});
});
};
err.domainName = aliyunServerURL
reject(err)
}
})
})
}
const getPolicyBase64 = function () {
let date = new Date();
date.setHours(date.getHours() + config.timeout);
let srcT = date.toISOString();
let date = new Date()
date.setHours(date.getHours() + config.timeout)
let srcT = date.toISOString()
const policyText = {
expiration: srcT, //设置该Policy的失效时间,超过这个失效时间之后,就没有办法通过这个policy上传文件了
conditions: [
["content-length-range", 0, 1024 * 1024 * 1024], // 设置上传文件的大小限制(5m)
],
};
const policyBase64 = base64.encode(JSON.stringify(policyText));
return policyBase64;
};
['content-length-range', 0, 1024 * 1024 * 1024] // 设置上传文件的大小限制(5m)
]
}
const policyBase64 = base64.encode(JSON.stringify(policyText))
return policyBase64
}
const getOssToken = async function () {
console.log("getOssToken");
const { lsaccessKeySecret, securityToken, lsaccessKeyId } =
await uni.$api.commonApi.getToken({});
console.log('getOssToken')
const { lsaccessKeySecret, securityToken, lsaccessKeyId } = await uni.$api.commonApi.getToken({})
return {
lsaccessKeySecret,
securityToken,
lsaccessKeyId,
};
};
lsaccessKeyId
}
}
// 生成签名
const getSignature = function (policyBase64) {
return new Promise(async (reslove) => {
const result = uni.$api.commonApi.getToken({}).then((res) => {
const { lsaccessKeySecret, securityToken, lsaccessKeyId } = res;
const bytes = Crypto.HmacSHA1(policyBase64, lsaccessKeySecret);
const signature = Crypto.enc.Base64.stringify(bytes);
return new Promise(async reslove => {
const result = uni.$api.commonApi.getToken({}).then(res => {
const { lsaccessKeySecret, securityToken, lsaccessKeyId } = res
const bytes = Crypto.HmacSHA1(policyBase64, lsaccessKeySecret)
const signature = Crypto.enc.Base64.stringify(bytes)
reslove({
signature,
securityToken,
lsaccessKeyId,
});
});
lsaccessKeyId
})
})
// const result = await uni.request({
// url: 'https://dj.test.glsx.com.cn/rop-dj-smartcarlife/router',
// data: {
......@@ -150,7 +149,7 @@ const getSignature = function (policyBase64) {
// })
// }
// })
});
};
})
}
module.exports = { uploadFile, getOssToken };
module.exports = { uploadFile, getOssToken }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!