From 3ba473d1c7d430a54a1a67b079138aecc7fb388b Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Fri, 30 Sep 2022 11:02:34 +0800
Subject: [PATCH] 事件上报视频上传
---
/dev/null | 1
components/evan-upload/evan-iconfont.css | 35 +
components/evan-upload/evan-utils.js | 68 +++
components/evan-upload/evan-upload.vue | 1051 ++++++++++++++++++++++++++++++++++++++++++++++++++
pages/taskinfo/eventsReported.vue | 57 ++
5 files changed, 1,202 insertions(+), 10 deletions(-)
diff --git a/FETCH_HEAD b/FETCH_HEAD
deleted file mode 100644
index a134557..0000000
--- a/FETCH_HEAD
+++ /dev/null
@@ -1 +0,0 @@
-8fe8a906a5a5cc31c8aee6953db98ab275def06d not-for-merge branch 'master' of http://192.168.0.105:10010/r/Inspection-uniapp
diff --git a/HEAD b/HEAD
deleted file mode 100644
index cb089cd..0000000
--- a/HEAD
+++ /dev/null
@@ -1 +0,0 @@
-ref: refs/heads/master
diff --git a/components/evan-upload/evan-iconfont.css b/components/evan-upload/evan-iconfont.css
new file mode 100644
index 0000000..e7e6935
--- /dev/null
+++ b/components/evan-upload/evan-iconfont.css
@@ -0,0 +1,35 @@
+@font-face {
+ font-family: "e-icon"; /* Project id 2811366 */
+ /* Color fonts */
+ src:
+ url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAYsAAwAAAAACrwAAAXeAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAImQjHgZgAFwKjUyKLgE2AiQDLgssAAQgBYFsByAbHwjIxuf/3bL7kpBC3hhBR5VxRqwyLFNTpGqclqqG1mHXkZrZl7ktw9/PdBsNh9MkGdDAJ/Kj3iLKIhsHNOABZVw2RtOp6EaKqVxsLAAZgDAA2aGfAcC60Qw4yEBIyuNhIWBQC4AcgAKAAIACCAEQOtsbDoIImaMEgTheBUANAOBAeHQENdthBg8yg6cYwXOA40D+hgwcM4fpDaBZPAzpDSMxAiIkAidp3qJ5DQ4h4cVdVgpKACsh3AUCAAyYUwASUL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k9pvwtPYE1XZkebfG3JnOWniHMyH5lvhDVGlVpdH9np36lo4mTpVideT5rXRbvR7Ron2pOTfOOW7Ru/rx1KO6qJtHiycePT4qDxH3HVWwetVdsqzyxr9WUKY7SosV9J0SDcmYdbjwuWjvIJXHfPpFTzhAvY5XDZrWus9qDaBR3zyP7nqzwM1+LM8QnKJhPyiJ1cY60GAeJURgLVphi+sT2Ma2IgDHaDIW2Bi1WFLdLDY9VqrWtSpsm5SSpk9Wds5u2b5JbmI5qfbG92NiuJK1NwaZDZ5K+JYHalF0nLeNhmW7o5MFle+PNyidXnzrrmUzELPvGmZGsclY/ufJUac5MN1dnZI7KJAi2zJqs0nESb0/WlDbsNmxI9qgSW5GxXWlNCa2xFZegy4PIjs66z0tKnomjrj8vlkqeN9XT0OXkckZFO1Eyrr8zWopyLmeAqD9j0rbU6i7hVZ/k7O84cKvX27R4TPACB9YEgNfxGRhrx0b258CA0TFoz/S/ALRHGyjIVsZYAi9ksNqltXEzZkJaMfYf1qAn+BPV5PfxaA4WhFOAIATIzQzCZAwCFoWIEnCIQVOBDFHoexIeMZiEXsiBAz0wEAPQGtv6YDj6oxuGoAC5yHe9lWiOFj6oSavG9sqRq9qFJQCbbB6CoTKGipUbXk3LwhEX3AojAAA=') format('woff2');
+}
+
+.e-icon {
+ font-family: "e-icon" !important;
+ font-size: 16px;
+ font-style: normal;
+ -webkit-font-smoothing: antialiased;
+ -moz-osx-font-smoothing: grayscale;
+}
+
+.e-icon-shipin6:before {
+ content: "\e600";
+}
+
+.e-icon-shipin5:before {
+ content: "\e621";
+}
+
+.e-icon-shipin:before {
+ content: "\e618";
+}
+
+.e-icon-shipin2:before {
+ content: "\ebe0";
+}
+
+.e-icon-MP4:before {
+ content: "\e679";
+}
+
diff --git a/components/evan-upload/evan-upload.vue b/components/evan-upload/evan-upload.vue
new file mode 100644
index 0000000..0c5f377
--- /dev/null
+++ b/components/evan-upload/evan-upload.vue
@@ -0,0 +1,1051 @@
+<template>
+ <view class="upload-wrap">
+ <view class="preview-wrap">
+ <!-- 预览 -->
+ <block v-if="usePreview">
+ <view class="image" v-for="(item, index) in tempImgArr" :key="item[imgCoverKey]" :style="{ borderRadius: radius + 'rpx' }">
+ <u-image
+ width="100%"
+ height="152rpx"
+ :border-radius="radius"
+ @click="fnPreviewImage(index, tempImgArr)"
+ :lazy-load="true"
+ :src="item[imgCoverKey]"
+ mode="aspectFill"
+ ></u-image>
+ <u-icon v-if="!disabled" class="delete-icon" name="close" color="#fff" size="24" @click="deleteImageOrVideo(index, true)"></u-icon>
+ </view>
+ <view
+ class="video"
+ :class="{ 'no-mask': !item[videoCoverKey] }"
+ :style="{ borderRadius: radius + 'rpx', '--radius': radius + 'px' }"
+ v-for="(item, index) in tempVideoArr"
+ :key="item[videoCoverKey]"
+ >
+ <block v-if="item[videoCoverKey]">
+ <u-image
+ width="152rpx"
+ height="152rpx"
+ :border-radius="radius"
+ :lazy-load="false"
+ :src="item[videoCoverKey]"
+ mode="aspectFill"
+ @click="fnPreviewVideo(item)"
+ ></u-image>
+ <view class="video-play"><u-icon class="video-play-icon" name="play-right-fill" color="#fff" size="30" @click="fnPreviewVideo(item)"></u-icon></view>
+ <u-icon v-if="!disabled" class="delete-icon" name="close" color="#fff" size="24" @click="deleteImageOrVideo(index, false)"></u-icon>
+ </block>
+ <block v-else>
+ <view class="video-play-cover" :style="{ borderRadius: radius + 'rpx' }" >
+ <u-image
+ class="video-play-cover-image"
+ width="100%"
+ height="100%"
+ :border-radius="radius"
+ :lazy-load="false"
+ :src="videoDefaultCover"
+ mode="scaleToFill"
+ @click="fnPreviewVideo(item)"
+ ></u-image>
+ </view>
+ <!-- <text class="video-play"><u-icon class="video-play-icon" name="play-right-fill" color="#fff" size="30" @click="fnPreviewVideo(item)"></u-icon></text> -->
+ <u-icon v-if="!disabled" class="delete-icon" name="close" color="#fff" size="24" @click="deleteImageOrVideo(index, false)"></u-icon>
+ </block>
+ </view>
+ </block>
+ <!-- 选择 -->
+ <block>
+ <view class="select-item" :style="{ borderRadius: radius + 'rpx' }" v-if="useImage && imgArr.length < imgLimit" @click="chooseImage">
+ <u-icon class="icon" name="camera" color="#999" size="40"></u-icon>
+ <view class="text">{{ selectImageText }}</view>
+ </view>
+ <view class="select-item" :style="{ borderRadius: radius + 'rpx' }" v-if="useVideo && videoArr.length < videoLimit" @click="chooseVideo">
+ <text class="icon e-icon-video e-icon e-icon-shipin"></text>
+ <view class="text">{{ selectVideoText }}</view>
+ </view>
+ </block>
+ </view>
+ <!-- 超出的图片大小展示 -->
+ <view class="over-size-wrapper" v-if="showOverLimitTip && !useOverLimitTipModal && overSizeImgArr.length != 0">
+ <view class="over-size-wrapper-title">
+ <text class="over-size-wrapper-title-tip">以下图片超出限制上传失败,限制为{{ fileUnitConversion(imgSizeLimit, 'KB', 'M') }}M</text>
+ <text class="over-size-wrapper-title-clear" @click="fnClearOverSizeArr('image')" :style="{ color: color }">
+ <u-icon class="over-size-wrapper-title-clear-icon" name="close" size="20" :color="color"></u-icon>
+ 关闭提示
+ </text>
+ </view>
+ <view class="over-size-wrapper-list">
+ <block v-for="(img, index) in overSizeImgArr" :key="index">
+ <view class="over-size-wrapper-list-item">
+ <image class="over-size-wrapper-list-item-image" :src="img.url" mode="aspectFill"></image>
+ <view class="over-size-wrapper-list-item-name">{{ img.fileName }}</view>
+ <view class="over-size-wrapper-list-item-size">{{ img.size }}</view>
+ </view>
+ </block>
+ </view>
+ </view>
+ <u-popup v-model="isShowOverLimitModal" mode="center" :z-index="9999" border-radius="20">
+ <view class="modal-content padding-15">
+ <view class="over-size-wrapper in-modal" v-if="showOverLimitTip && overSizeImgArr.length != 0">
+ <view class="over-size-wrapper-title">
+ <text class="over-size-wrapper-title-tip">以下图片超出限制上传失败,限制为{{ fileUnitConversion(imgSizeLimit, 'KB', 'M') }}M</text>
+ <text class="over-size-wrapper-title-clear" @click="fnClearOverSizeArr('image')" :style="{ color: color }">
+ <u-icon class="over-size-wrapper-title-clear-icon" name="close" size="20" :color="color"></u-icon>
+ 关闭提示
+ </text>
+ </view>
+ <view class="over-size-wrapper-list">
+ <block v-for="(img, index) in overSizeImgArr" :key="index">
+ <view class="over-size-wrapper-list-item">
+ <image class="over-size-wrapper-list-item-image" :src="img.url" mode="aspectFill"></image>
+ <view class="over-size-wrapper-list-item-name">{{ img.fileName }}</view>
+ <view class="over-size-wrapper-list-item-size">{{ img.size }}</view>
+ </view>
+ </block>
+ </view>
+ </view>
+ </view>
+ </u-popup>
+ <u-modal
+ :show-cancel-button="true"
+ :confirm-color="color"
+ v-model="uploadFileDeleteModal.show"
+ @confirm="uploadFileDeleteConfirm"
+ @cancel="uploadFileDeleteModal.show = false"
+ :content="uploadFileDeleteModal.tip"
+ ></u-modal>
+ <u-modal z-index="10076" v-model="uploadFileTip.show" title="提示" :confirm-text="cancelText" :confirm-color="cancelColor" @confirm="uploadFileTipDestroy()">
+ <view class="slot-content">
+ <view class="progress-wrapper">
+ <u-line-progress :active-color="color" :striped="true" :striped-active="true" :percent="uploadFileTip.progress"></u-line-progress>
+ <view class="progress-tip">文件上传中,请稍等({{ uploadFileTip.totalBytesSent }}/{{ uploadFileTip.totalBytesExpectedToSend }}M)</view>
+ </view>
+ </view>
+ </u-modal>
+ </view>
+</template>
+
+<script>
+import { getFileSuffix, getFileUnitConversion, previewImages } from './evan-utils.js';
+export default {
+ name: 'evan-upload',
+ props: {
+ debug: {
+ type: Boolean,
+ default: false
+ },
+ // 主色调
+ color: {
+ type: String,
+ default: '#ddb880'
+ },
+ radius: {
+ type: Number,
+ default: 6
+ },
+ cancelColor: {
+ type: String,
+ default: '#ddb880'
+ },
+ cancelText: {
+ type: String,
+ default: '取消上传'
+ },
+ selectImageText: {
+ type: String,
+ default: '选择图片'
+ },
+ selectVideoText: {
+ type: String,
+ default: '选择视频'
+ },
+ /**
+ * 是否自动切换数据配置,用于独立配置的情况
+ * 注意:如果独立使用组件,且单独配置上传地址的情况下,
+ * 如 v-if 显示图片选择 或者 视频选择的情况下 需要手动调用 fnChangeOptions()
+ * */
+ autoChangeOptions: {
+ type: Boolean,
+ default: true
+ },
+ // 文件的扩展名字段,用于( loadAllPreview)手动初始化默认的数据时候的判断
+ fileSuffix: {
+ type: String,
+ default: 'fileType'
+ },
+ // 通用上传配置
+ options: {
+ type: Object,
+ default: null
+ },
+ // 图片上传配置
+ imageOptions: {
+ type: Object,
+ default: null
+ },
+ // 视频上传配置
+ videoOptions: {
+ type: Object,
+ default: null
+ },
+ // 数据通用的格式化(默认是响应的格式)
+ format: {
+ type: Function,
+ default: null
+ },
+ // 图片格式化(默认是响应的格式)
+ imgFormat: {
+ type: Function,
+ default: null
+ },
+ // 视频格式化(默认是响应的格式)
+ videoFormat: {
+ type: Function,
+ default: null
+ },
+ // 是否禁用上传
+ disabled: {
+ type: Boolean,
+ default: false
+ },
+ // 是否显示超出上传大小限制的图片
+ showOverLimitTip: {
+ type: Boolean,
+ default: true
+ },
+ // 超出限制的使用是否启用弹窗效果
+ useOverLimitTipModal: {
+ type: Boolean,
+ default: false
+ },
+ // 是否启用预览功能
+ usePreview: {
+ type: Boolean,
+ default: true
+ },
+ // 是否使用图片上传
+ useImage: {
+ type: Boolean,
+ default: true
+ },
+ // 是否使用视频上传
+ useVideo: {
+ type: Boolean,
+ default: true
+ },
+ // 图片过滤
+ imgExtension: {
+ type: Array,
+ default() {
+ return ['jpg', 'jpeg', 'png'];
+ }
+ },
+ // 图片的预览的键(默认 thumbnail)
+ imgCoverKey: {
+ type: String,
+ default: 'thumbnail'
+ },
+ // 图片限制
+ imgLimit: {
+ type: Number,
+ default: 9
+ },
+ // 图片单张大小限制(默认2048k = 2M)
+ imgSizeLimit: {
+ type: Number,
+ default: 2048
+ },
+ // 图片压缩配置,默认原图和压缩
+ imgSizeType: {
+ type: Array,
+ default() {
+ return ['original', 'compressed'];
+ }
+ },
+ // 图片来源,默认相册和相机
+ imgSourceType: {
+ type: Array,
+ default() {
+ return ['album', 'camera'];
+ }
+ },
+
+ // 视频封面图的key (默认是 thumbnail )
+ videoCoverKey: {
+ type: String,
+ default: 'thumbnail'
+ },
+ // 视频限制
+ videoLimit: {
+ type: Number,
+ default: 1
+ },
+ // 视频大小限制(默认102400kb = 100M)
+ videoSizeLimit: {
+ type: Number,
+ default: 102400
+ },
+ // 是否启用视频压缩
+ useVideoCompressed: {
+ type: Boolean,
+ default: true
+ },
+ // 视频来源,默认相册和相机
+ videoSourceType: {
+ type: Array,
+ default() {
+ return ['album', 'camera'];
+ }
+ },
+
+ // 表单模块名称
+ moduleName: {
+ type: String,
+ default: ''
+ },
+ // 默认预览的图片或者视频
+ defaultImageOrVideoList: {
+ type: Array,
+ default() {
+ return [];
+ }
+ },
+ // 默认预览的图片
+ defaultImageList: {
+ type: Array,
+ default() {
+ return [];
+ }
+ },
+ // 默认预览的视频
+ defaultVideoList: {
+ type: Array,
+ default() {
+ return [];
+ }
+ }
+ },
+ data() {
+ return {
+ // 文件上传提示
+ uploadFileTip: {
+ task: null, // 文件上传Task
+ show: false, // 是否显示
+ totalBytesExpectedToSend: 0,
+ totalBytesSent: 0, // 已经上传的数据长度,单位 Bytes
+ progress: 0 // 上传进度百分比
+ },
+ uploadFileDeleteModal: {
+ show: false,
+ isImage: true,
+ tip: ''
+ },
+ videoDefaultCover:'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAS/UlEQVR4Xu2de5QkVX3Hf7/qZrLG1/gKJkuiHPHEB+YYNcny8AjxRKKCCTNZ8CRKYAkYYHvq1sywG4mJTeJjd9np+tX0LhIP6p6oUdgEPUTYKEcXOGCCTyTGJwkGDXEVT8aYNXGZrl/OxR7t6anqR3U97q369Tnzz1Tde7+/7/19+v6q64UgH3FAHIh1AMUbcUAciHdAAJHsEAcGOCCASHqIAwKI5IA4kMwBWUGS+SatKuKAAFKRiZYwkzkggCTzTVpVxAEBpCITLWEmc0AASeabtKqIAwJIRSZawkzmgACSzLdKtFpYWHje0tLSlyoRbEyQxgAyNzd3quM4r2Dm4wHgeER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AFJgOSWAlCsdzYtmUkAKLqfKC4jrur+CiF8wL2WqpSgpIIaUUxsmi5k/FATBTNaziFkP4Lru8Yj47azHkf4HOzAuIIaVU1GAXBcEwWVZz3vmgOgAlFKcdSDSf3qAGFhORQV3NRE1s573XABxXbeFiF7WwUj/Ax14FREdGrSHqeVUlOYwDF+yvLz82aznPBdAlFKnAcBdWQcj/Q90IPYb1/RyKiKqLxPR8/KY71wA0YG4rvu3iDibR1AyRqwDGyCxpJxaFxAi/qnv+2/LY55zA8TzvJcy8515BCVjDHTgXgC4HRE3M/MpAHCCZX59sV6vb9m7d+/RPHTnBkj3YH0ZABp5BCZjlNaBC4jovXlFlysgXUi+DgAn5RWgjFMqB3L55arXsdwBEUhKlbB5BjNHRO08B9RjFQKIHtjzvBuZeWveAct49jnAzOcFQXCwCOWFAdKFxA3D0EXEE4sIXsY03oEPMHMQBME9RSktFBAd9OLi4s+trq6eDwCv7P4V5YWMa4YD9wOAPqF5aNiJzTzkFg5If5D62i0A0NdvPTkPA2SM4h0Iw/AYMx/pdDpHrr322v8pXtFPFRgHiEnmiBZxQACRHBAHBjgggEh6iAMCiOSAOJDMAVlBkvkmrSrigABSkYmWMJM5IIAk801aVcQBAaQiEy1hJnNAAEnmm7SqiAMCSEUmWsJM5oAAksw3aVURBwSQiky0hJnMAQEkmW/SqiIO/D8andFQmnVovQAAAABJRU5ErkJggg==',
+ Options: { url: '', name: 'file', moduleName: '', header: {}, formData: {} },
+ ImageOptions: { url: '', name: 'file', moduleName: '', header: {}, formData: {} },
+ VideoOptions: { url: '', name: 'file', moduleName: '', header: {}, formData: {} },
+ isShowOverLimitModal: false,
+ tempImgArr: [], // 用于展示的图片
+ tempVideoArr: [], // 用于展示的视频
+ imgArr: [], //图片数组
+ videoArr: [], //视频数组
+ overSizeImgArr: [], // 超出大小的图片
+ overSizeVideoArr: [] // 超出大小的视频
+ };
+ },
+ beforeUpdate() {
+ if (this.autoChangeOptions) {
+ if (this.useImage && this.useVideo) return;
+ // 组件更新之前切换配置
+ this.fnChangeOptions();
+ }
+ },
+ mounted() {
+ // 在小程序中存在数据无法回显的问题,改为手动触发
+ // #ifndef MP-WEIXIN
+ this.handleDefaultPrivew();
+ // #endif
+ // 初始化配置
+ this.fnChangeOptions();
+ },
+ methods: {
+ // 配置
+ fnChangeOptions() {
+ if (this.options) {
+ this.ImageOptions = Object.assign({}, this.ImageOptions, this.options);
+ this.VideoOptions = Object.assign({}, this.VideoOptions, this.options);
+ }
+ if (this.imageOptions) {
+ this.ImageOptions = Object.assign({}, this.ImageOptions, this.imageOptions);
+ }
+ if (this.videoOptions) {
+ this.VideoOptions = Object.assign({}, this.VideoOptions, this.videoOptions);
+ }
+ },
+ loadAllPreview(list) {
+ this.clear();
+ if (!list) return;
+ list.forEach((item, index) => {
+ this.handlePreviewData(item, item[this.fileSuffix] !== 'mp4', true);
+ });
+ },
+ loadImagePreview(list) {
+ this.clear();
+ if (!list) return;
+ list.forEach((item, index) => {
+ this.handlePreviewData(item, true);
+ });
+ },
+ loadVideoPreview(list) {
+ this.clear();
+ if (!list) return;
+ list.forEach((item, index) => {
+ this.handlePreviewData(item, false);
+ });
+ },
+ chooseImage() {
+ if (this.disabled) return;
+ if (!this.ImageOptions.url) {
+ return uni.showToast({
+ icon: 'none',
+ title: '未配置上传地址'
+ });
+ }
+ const _this = this;
+ this.overSizeImgArr = [];
+ uni.chooseImage({
+ count: this.imgLimit,
+ extension: this.imgExtension,
+ crop: this.crop,
+ sourceType: this.imgSourceType,
+ sizeType: this.imgSizeType, //可以指定是原图还是压缩图,默认二者都有
+ success: function(res) {
+ uni.showLoading({
+ title: '上传中...',
+ mask: true
+ });
+ _this.$emit('on-loading', true);
+ for (var i = 0; i < res.tempFilePaths.length; i++) {
+ if (_this.fileUnitConversion(res.tempFiles[i].size, 'B', 'KB') > _this.imgSizeLimit) {
+ _this.overSizeImgArr.push({
+ url: res.tempFilePaths[i],
+ fileName: res.tempFiles[i].name,
+ size: _this.fileUnitConversion(res.tempFiles[i].size) + 'M'
+ });
+ } else {
+ uni.uploadFile({
+ url: _this.ImageOptions.url,
+ filePath: res.tempFilePaths[i],
+ name: _this.ImageOptions.name,
+ header: _this.ImageOptions.header,
+ formData: {
+ ..._this.ImageOptions.formData,
+ moduleName: _this.moduleName
+ },
+ success: uploadFileRes => {
+ if (uploadFileRes.statusCode != 200) {
+ uni.showToast({
+ icon: 'none',
+ title: '上传失败,服务器异常!'
+ });
+ _this.$emit('on-error', uploadFileRes);
+ } else {
+ _this.handleUploadRes(uploadFileRes, true);
+ }
+ },
+ fail(err) {
+ uni.showToast({
+ icon: 'none',
+ title: '上传出错了'
+ });
+ _this.debug && console.error(err);
+ // uni.hideLoading();
+ _this.$emit('on-error', err);
+ }
+ });
+ }
+ // 执行回调显示超出限制的图片
+ if (i + 1 == res.tempFilePaths.length) {
+ if (_this.overSizeImgArr.length == res.tempFilePaths.length) {
+ uni.hideLoading();
+ }
+ _this.fnEmitOverSize();
+ _this.$emit('on-success', true);
+ }
+ }
+ }
+ });
+ },
+ chooseVideo() {
+ if (this.disabled) return;
+ if (!this.VideoOptions.url) {
+ return uni.showToast({
+ icon: 'none',
+ title: '未配置上传地址'
+ });
+ }
+ const _this = this;
+ uni.chooseVideo({
+ sourceType: this.videoSourceType,
+ compressed: this.useVideoCompressed,
+ success: function(res) {
+ _this.uploadFileTip.show = true;
+ // 上传视频
+ _this.uploadFileTip.task = uni.uploadFile({
+ url: _this.VideoOptions.url,
+ filePath: res.tempFilePath,
+ name: _this.VideoOptions.name,
+ header: _this.VideoOptions.header,
+ formData: {
+ ..._this.VideoOptions.formData,
+ moduleName: _this.moduleName
+ },
+ success: uploadFileRes => {
+ if (uploadFileRes.statusCode != 200) {
+ uni.showToast({
+ icon: 'none',
+ title: '上传失败,服务器异常!'
+ });
+ _this.$emit('on-error', uploadFileRes);
+ } else {
+ _this.handleUploadRes(uploadFileRes, false);
+ }
+ },
+ fail(err) {
+ uni.showToast({
+ icon: 'none',
+ title: '上传出错了'
+ });
+ _this.debug && console.error(err);
+ _this.uploadFileTipDestroy();
+ _this.$emit('on-error', err);
+ }
+ });
+ _this.uploadFileTask();
+ }
+ });
+ },
+ // 处理回调的数据
+ handleUploadRes(res, isImage = true) {
+ uni.hideLoading();
+ const _this = this;
+ if (res.statusCode != 200) {
+ _this.$emit('on-error', res);
+ _this.$u.toast(res.msg || '上传失败,请重试!');
+ _this.uploadFileTipDestroy();
+ return;
+ }
+ // 后台返回数组的形式
+ if (res['code'] != undefined && res.code === 200) {
+ if (Object.prototype.toString.call(res.data) === '[object Array]') {
+ res.data.forEach(item => {
+ _this.handlePreviewData(item, isImage);
+ });
+ // 后台返回对象形式
+ } else if (Object.prototype.toString.call(res.data) === '[object Object]') {
+ // 返回对象的形式
+ _this.handlePreviewData(res.data, isImage);
+ } else {
+ // 后台返回直接返回图片
+ _this.handleRes(res.data, isImage);
+ }
+ _this.handleCallback(res);
+ // 校验是否有状态码的情况(直接返回图片地址)
+ } else if (Object.prototype.toString.call(res.data) == '[object String]') {
+ _this.handleRes(res.data, isImage, true);
+ _this.handleCallback(res);
+ } else {
+ _this.$emit('on-error', res);
+ _this.$u.toast(res.msg || '上传失败,请重试!');
+ _this.uploadFileTipDestroy();
+ }
+ },
+ handleRes(res, isImage, isString = false) {
+ const _this = this;
+ let _fileNameOrUrl = isString ? res : res.data;
+ let _fileSuffix = getFileSuffix(_fileNameOrUrl);
+ if (isImage) {
+ if (this.imgCoverKey == 'url') {
+ _this.handlePreviewData(
+ {
+ url: _fileNameOrUrl,
+ [this.fileSuffix]: _fileSuffix
+ },
+ true
+ );
+ } else {
+ _this.handlePreviewData(
+ {
+ [this.imgCoverKey]: _fileNameOrUrl,
+ url: _fileNameOrUrl,
+ [this.fileSuffix]: _fileSuffix
+ },
+ true
+ );
+ }
+ } else {
+ _this.handlePreviewData(
+ {
+ url: _fileNameOrUrl,
+ [this.fileSuffix]: _fileSuffix
+ },
+ false
+ );
+ }
+ },
+ handleCallback(res) {
+ this.sendData();
+ this.uploadFileTipDestroy();
+ this.$emit('on-success', res);
+ },
+ uploadFileTask() {
+ this.uploadFileTip.task.onProgressUpdate(res => {
+ this.uploadFileTip.progress = res.progress;
+ this.uploadFileTip.totalBytesSent = this.fileUnitConversion(res.totalBytesSent);
+ this.uploadFileTip.totalBytesExpectedToSend = this.fileUnitConversion(res.totalBytesExpectedToSend);
+ });
+ },
+ // 销毁上传任务
+ uploadFileTipDestroy() {
+ this.uploadFileTip.show = false;
+ if (this.uploadFileTip.task) {
+ this.uploadFileTip.task.abort(); // 终止上传
+ }
+ const _setTimeout = setTimeout(() => {
+ this.uploadFileTip.task = null;
+ this.uploadFileTip.progress = 0;
+ this.uploadFileTip.totalBytesSent = 0;
+ this.uploadFileTip.totalBytesExpectedToSend = 0;
+ clearTimeout(_setTimeout);
+ }, 200);
+ },
+ fileUnitConversion(byte, from = 'B', to = 'M') {
+ return getFileUnitConversion(byte, from, to);
+ },
+ /**
+ * 超出大小限制的图片或者视频
+ * */
+ fnEmitOverSize() {
+ if (this.showOverLimitTip && this.useOverLimitTipModal && this.overSizeImgArr.length != 0) {
+ this.isShowOverLimitModal = true;
+ }
+ this.$emit('on-over-list', {
+ images: this.overSizeImgArr,
+ videos: this.overSizeVideoArr
+ });
+ },
+ fnClearOverSizeArr(type) {
+ this.isShowOverLimitModal = false;
+ if (type == 'image') {
+ this.overSizeImgArr = [];
+ } else {
+ this.overSizeVideoArr = [];
+ }
+ },
+ // 更新文件上传对象字段
+ updateFileDataObject(key, val) {
+ this.$set(this.uploadFileTip, key, val);
+ },
+ // 回调发送数据
+ sendData() {
+ let _data = [],
+ _type = 'all';
+ if (this.useImage && this.useVideo) {
+ // 都使用
+ if (this.imgArr.length !== 0) {
+ _data.push(...this.imgArr);
+ }
+ if (this.videoArr.length !== 0) {
+ _data.push(...this.videoArr);
+ }
+ _type = 'all';
+ } else if (this.useImage) {
+ // 使用图片
+ if (this.imgArr.length !== 0) {
+ _data.push(...this.imgArr);
+ }
+ _type = 'image';
+ } else if (this.useVideo) {
+ if (this.videoArr.length !== 0) {
+ _data.push(...this.videoArr);
+ }
+ _type = 'video';
+ }
+ this.$emit('on-upload', {
+ type: _type,
+ data: _data
+ });
+ },
+ // 图片预览
+ fnPreviewImage(current, images) {
+ previewImages(current, images);
+ },
+ // 删除图片或视频
+ deleteImageOrVideo(index, isImage = true) {
+ this.uploadFileDeleteModal.tip = `您确定要删除该${isImage ? '图片' : '视频'}吗?`;
+ this.uploadFileDeleteModal.show = true;
+ this.uploadFileDeleteModal.isImage = isImage;
+ this.uploadFileDeleteModal.index = index;
+ },
+ // 确认删除
+ uploadFileDeleteConfirm() {
+ let index = this.uploadFileDeleteModal.index;
+ if (this.uploadFileDeleteModal.isImage) {
+ this.tempImgArr.splice(index, 1);
+ this.imgArr.splice(index, 1);
+ } else {
+ this.tempVideoArr.splice(index, 1);
+ this.videoArr.splice(index, 1);
+ }
+ this.sendData();
+ },
+ // 处理图片数据
+ handlePushImage(dataItem) {
+ // 支持自定义格式化
+ if (this.imgFormat && typeof this.imgFormat === 'function') {
+ this.imgArr.push(this.imgFormat(dataItem));
+ this.tempImgArr.push(this.imgFormat(dataItem));
+ } else if (this.format && typeof this.format === 'function') {
+ this.imgArr.push(this.format(dataItem));
+ this.tempImgArr.push(this.format(dataItem));
+ } else {
+ this.imgArr.push(dataItem);
+ this.tempImgArr.push(dataItem);
+ }
+ },
+ // 处理视频数据
+ handlePushVideo(dataItem) {
+ if (this.videoFormat && typeof this.videoFormat === 'function') {
+ this.videoArr.push(this.videoFormat(dataItem));
+ this.tempVideoArr.push(this.videoFormat(dataItem));
+ } else if (this.format && typeof this.format === 'function') {
+ this.videoArr.push(this.format(dataItem));
+ this.tempVideoArr.push(this.format(dataItem));
+ } else {
+ this.videoArr.push(dataItem);
+ this.tempVideoArr.push(dataItem);
+ }
+ },
+ handlePreviewData(dataItem, isImage = true, isAll = false) {
+ if (isAll) {
+ if (isImage) {
+ this.handlePushImage(dataItem);
+ } else {
+ this.handlePushVideo(dataItem);
+ }
+ return;
+ }
+ if (isImage) {
+ this.handlePushImage(dataItem);
+ } else {
+ this.handlePushVideo(dataItem);
+ }
+ },
+ /**
+ * 处理传入的文件
+ * 注意:传入的文件名称 的key是 name 而不是fileName
+ * */
+ handleDefaultPrivew() {
+ this.clear();
+ if (this.useImage && this.useVideo) {
+ // 都使用
+ this.defaultImageOrVideoList.forEach((item, index) => {
+ this.handlePreviewData(item, item[this.fileSuffix] !== 'mp4', true);
+ });
+ } else if (this.useImage) {
+ this.defaultImageList.forEach((item, index) => {
+ this.handlePreviewData(item, true);
+ });
+ } else {
+ this.defaultVideoList.forEach((item, index) => {
+ this.handlePreviewData(item, false);
+ });
+ }
+ // #ifndef MP-WEIXIN
+ this.$forceUpdate();
+ // #endif
+ },
+ // 预览视频
+ fnPreviewVideo(video) {
+ this.$emit('on-pre-video', video);
+ },
+ // 重置相关变量
+ clear() {
+ this.tempImgArr = [];
+ this.tempVideoArr = [];
+ this.imgArr = [];
+ this.videoArr = [];
+ this.overSizeImgArr = [];
+ this.overSizeVideoArr = [];
+ }
+ }
+};
+</script>
+
+<style lang="scss" scoped>
+@import './evan-iconfont.css';
+.upload-wrap {
+ display: flex;
+ flex-wrap: wrap;
+}
+.progress-wrapper {
+ padding: 30rpx;
+ padding-bottom: 16rpx;
+}
+.progress-tip {
+ font-size: 28rpx;
+ text-align: center;
+}
+.preview-wrap {
+ display: inline-flex;
+ flex-wrap: wrap;
+ .image,
+ .video {
+ position: relative;
+ margin: 8rpx;
+ box-sizing: border-box;
+ width: 156rpx;
+ height: 152rpx;
+ video {
+ width: 100%;
+ height: 100%;
+ }
+
+ .cover {
+ position: relative;
+ width: 100%;
+ height: 100%;
+ // background-color: #000000;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ border-radius: 6rpx;
+ .icon {
+ position: absolute;
+ top: 10rpx;
+ right: 10rpx;
+ z-index: 10;
+ box-sizing: border-box;
+ background-color: #fa3534;
+ border-radius: 100%;
+ width: 36rpx;
+ height: 36rpx;
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ justify-content: center;
+ }
+
+ .play-icon {
+ box-sizing: border-box;
+ color: #ffffff;
+ font-size: 60rpx;
+ padding-top: 20rpx;
+ }
+ .play-text {
+ margin-top: -20rpx;
+ color: #ffffff;
+ font-size: 24rpx;
+ }
+ }
+ }
+ .image {
+ width: 156rpx;
+ }
+ .video {
+ position: relative;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ &.no-mask {
+ &::after {
+ display: none;
+ }
+ }
+ &::after {
+ content: '';
+ position: absolute;
+ left: 0;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ border-radius: var(--radius);
+ background-color: rgba(0, 0, 0, 0.3);
+ }
+ .video-play {
+ position: absolute;
+ left: 50%;
+ top: 50%;
+ transform: translate(-50%, -50%);
+ width: 50rpx;
+ height: 50rpx;
+ border-radius: 50%;
+ border: 4rpx solid #fff;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ z-index: 2;
+ &-icon {
+ }
+ }
+ .video-play-cover {
+ width: 100%;
+ height: 100%;
+ box-sizing: border-box;
+ padding: 12rpx 0;
+ border: 2rpx solid #eee;
+ background-color: #f2f2f2;
+ &-image {
+ width: 100%;
+ height: 100%;
+ z-index: 2;
+ }
+ }
+ .video-play-cover-icon {
+ display: inline-block;
+ width: 100%;
+ height: 100%;
+ text-align: center;
+ line-height: 120rpx;
+ font-size: 110rpx;
+ border: 2rpx solid #eee;
+ background-color: #f2f2f2;
+ }
+ .video-play-name {
+ width: 150rpx;
+ position: absolute;
+ bottom: 10rpx;
+ font-size: 24rpx;
+ color: #333;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+ }
+ .delete-icon {
+ position: absolute;
+ top: 10rpx;
+ right: 10rpx;
+ z-index: 10;
+ box-sizing: border-box;
+ background-color: #fa3534;
+ border-radius: 100%;
+ width: 36rpx;
+ height: 36rpx;
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ justify-content: center;
+ }
+ .delete-cover {
+ width: 160rpx;
+ height: 152rpx;
+ position: relative;
+ background-color: transparent;
+ z-index: 2;
+ .icon {
+ position: absolute;
+ top: 10rpx;
+ right: 10rpx;
+ z-index: 10;
+ box-sizing: border-box;
+ background-color: #fa3534;
+ border-radius: 100%;
+ width: 44rpx;
+ height: 44rpx;
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ justify-content: center;
+ }
+ }
+}
+.select-item {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ align-content: center;
+ justify-content: center;
+ justify-items: center;
+ box-sizing: border-box;
+ border: 2rpx dashed #dadada;
+ margin: 8rpx;
+ width: 156rpx;
+ height: 152rpx;
+ border-radius: 6rpx;
+ .icon {
+ margin-top: 16rpx;
+ z-index: 3;
+ }
+ .e-icon-video {
+ color: #999 !important;
+ font-size: 40rpx;
+ margin-top: 14rpx;
+ }
+ .text {
+ color: #999;
+ font-size: 24rpx;
+ }
+}
+.over-size-wrapper {
+ box-sizing: border-box;
+ margin: 8rpx;
+ padding: 10rpx;
+ width: 100%;
+ border-radius: 6rpx;
+ border: 2rpx dashed #ddb880;
+ &.in-modal {
+ margin: 0;
+ }
+ &-title {
+ display: flex;
+ margin-bottom: 10rpx;
+ color: red;
+ font-size: 24rpx;
+ &-tip {
+ flex-grow: 1;
+ }
+ &-clear {
+ width: 150rpx;
+ text-align: right;
+ font-size: 24rpx;
+ color: #ddb880;
+ &-icon {
+ }
+ }
+ }
+ &-list {
+ overflow: hidden;
+ display: flex;
+ flex-wrap: wrap;
+ &-item {
+ position: relative;
+ width: 25%;
+ padding: 6rpx;
+ &-image {
+ width: 100%;
+ height: 130rpx;
+ }
+ &-name {
+ text-align: center;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ white-space: nowrap;
+ font-size: 24rpx;
+ }
+ &-size {
+ position: absolute;
+ top: 105rpx;
+ right: 6rpx;
+ left: 6rpx;
+ text-align: center;
+ padding-right: 10rpx;
+ font-size: 24rpx;
+ background: #d6c09fa8;
+ color: #fff;
+ }
+ }
+ }
+}
+</style>
diff --git a/components/evan-upload/evan-utils.js b/components/evan-upload/evan-utils.js
new file mode 100644
index 0000000..abecd95
--- /dev/null
+++ b/components/evan-upload/evan-utils.js
@@ -0,0 +1,68 @@
+/**
+ * 获取文件扩展名
+ */
+export function getFileSuffix(str) {
+ if (str) return str.substring(str.lastIndexOf('.') + 1, str.length)
+ return ''
+}
+
+/**
+ * 文件大小单位转换
+ * from:原数据
+ * to :类型 M kb b
+ * */
+export function getFileUnitConversion(byte, from = 'B', to = 'M') {
+ from = from
+ .toString()
+ .toUpperCase()
+ .trim();
+ to = to
+ .toString()
+ .toUpperCase()
+ .trim();
+ switch (to) {
+ case 'M':
+ if (from == 'B') return (byte / Math.pow(1024, 2)).toFixed(2);
+ if (from == 'KB') return (byte / 1024).toFixed(2);
+ return (0).toFixed(2);
+ case 'KB':
+ if (from == 'M') return (byte * 1024).toFixed(2);
+ if (from == 'B') return (byte / 1024).toFixed(2);
+ return (0).toFixed(2);
+ case 'B':
+ if (from == 'M') return (byte * Math.pow(1024, 2)).toFixed(2);
+ if (from == 'KB') return (byte * 1024).toFixed(2);
+ return (0).toFixed(2);
+ default:
+ return (0).toFixed(2);
+ }
+};
+
+/**
+ * 图片预览
+ * @param {Number} current = [value] 索引
+ * @param {Array} images = [value] 图片数组
+ * @param {String} oUrlKey = [value] 图片的原图地址Key
+ */
+export function previewImages(current, images, oUrlKey = 'url') {
+ const urls = images.map(it => {
+ return it[oUrlKey];
+ });
+ uni.previewImage({
+ current,
+ urls,
+ loop: true,
+ indicator: 'number',
+ longPressActions: {
+ itemList: ['保存图片'],
+ success: res => {
+ uni.saveImageToPhotosAlbum({
+ filePath: res.tempFilePath,
+ success: res => {
+ console.log('图片保存成功');
+ }
+ });
+ }
+ }
+ });
+}
diff --git a/config b/config
deleted file mode 100644
index f57f45b..0000000
--- a/config
+++ /dev/null
@@ -1,9 +0,0 @@
-[core]
- bare = true
- repositoryformatversion = 0
- filemode = false
- symlinks = false
- ignorecase = true
-[remote "origin"]
- url = http://192.168.0.105:10010/r/Inspection-uniapp.git
- fetch = +refs/heads/*:refs/remotes/origin/*
diff --git a/description b/description
deleted file mode 100644
index 498b267..0000000
--- a/description
+++ /dev/null
@@ -1 +0,0 @@
-Unnamed repository; edit this file 'description' to name the repository.
diff --git a/hooks/applypatch-msg.sample b/hooks/applypatch-msg.sample
deleted file mode 100644
index a5d7b84..0000000
--- a/hooks/applypatch-msg.sample
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to check the commit log message taken by
-# applypatch from an e-mail message.
-#
-# The hook should exit with non-zero status after issuing an
-# appropriate message if it wants to stop the commit. The hook is
-# allowed to edit the commit message file.
-#
-# To enable this hook, rename this file to "applypatch-msg".
-
-. git-sh-setup
-commitmsg="$(git rev-parse --git-path hooks/commit-msg)"
-test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"}
-:
diff --git a/hooks/commit-msg.sample b/hooks/commit-msg.sample
deleted file mode 100644
index b58d118..0000000
--- a/hooks/commit-msg.sample
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to check the commit log message.
-# Called by "git commit" with one argument, the name of the file
-# that has the commit message. The hook should exit with non-zero
-# status after issuing an appropriate message if it wants to stop the
-# commit. The hook is allowed to edit the commit message file.
-#
-# To enable this hook, rename this file to "commit-msg".
-
-# Uncomment the below to add a Signed-off-by line to the message.
-# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
-# hook is more suited to it.
-#
-# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
-# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
-
-# This example catches duplicate Signed-off-by lines.
-
-test "" = "$(grep '^Signed-off-by: ' "$1" |
- sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
- echo >&2 Duplicate Signed-off-by lines.
- exit 1
-}
diff --git a/hooks/fsmonitor-watchman.sample b/hooks/fsmonitor-watchman.sample
deleted file mode 100644
index 23e856f..0000000
--- a/hooks/fsmonitor-watchman.sample
+++ /dev/null
@@ -1,174 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-use IPC::Open2;
-
-# An example hook script to integrate Watchman
-# (https://facebook.github.io/watchman/) with git to speed up detecting
-# new and modified files.
-#
-# The hook is passed a version (currently 2) and last update token
-# formatted as a string and outputs to stdout a new update token and
-# all files that have been modified since the update token. Paths must
-# be relative to the root of the working tree and separated by a single NUL.
-#
-# To enable this hook, rename this file to "query-watchman" and set
-# 'git config core.fsmonitor .git/hooks/query-watchman'
-#
-my ($version, $last_update_token) = @ARGV;
-
-# Uncomment for debugging
-# print STDERR "$0 $version $last_update_token\n";
-
-# Check the hook interface version
-if ($version ne 2) {
- die "Unsupported query-fsmonitor hook version '$version'.\n" .
- "Falling back to scanning...\n";
-}
-
-my $git_work_tree = get_working_dir();
-
-my $retry = 1;
-
-my $json_pkg;
-eval {
- require JSON::XS;
- $json_pkg = "JSON::XS";
- 1;
-} or do {
- require JSON::PP;
- $json_pkg = "JSON::PP";
-};
-
-launch_watchman();
-
-sub launch_watchman {
- my $o = watchman_query();
- if (is_work_tree_watched($o)) {
- output_result($o->{clock}, @{$o->{files}});
- }
-}
-
-sub output_result {
- my ($clockid, @files) = @_;
-
- # Uncomment for debugging watchman output
- # open (my $fh, ">", ".git/watchman-output.out");
- # binmode $fh, ":utf8";
- # print $fh "$clockid\n@files\n";
- # close $fh;
-
- binmode STDOUT, ":utf8";
- print $clockid;
- print "\0";
- local $, = "\0";
- print @files;
-}
-
-sub watchman_clock {
- my $response = qx/watchman clock "$git_work_tree"/;
- die "Failed to get clock id on '$git_work_tree'.\n" .
- "Falling back to scanning...\n" if $? != 0;
-
- return $json_pkg->new->utf8->decode($response);
-}
-
-sub watchman_query {
- my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty')
- or die "open2() failed: $!\n" .
- "Falling back to scanning...\n";
-
- # In the query expression below we're asking for names of files that
- # changed since $last_update_token but not from the .git folder.
- #
- # To accomplish this, we're using the "since" generator to use the
- # recency index to select candidate nodes and "fields" to limit the
- # output to file names only. Then we're using the "expression" term to
- # further constrain the results.
- my $last_update_line = "";
- if (substr($last_update_token, 0, 1) eq "c") {
- $last_update_token = "\"$last_update_token\"";
- $last_update_line = qq[\n"since": $last_update_token,];
- }
- my $query = <<" END";
- ["query", "$git_work_tree", {$last_update_line
- "fields": ["name"],
- "expression": ["not", ["dirname", ".git"]]
- }]
- END
-
- # Uncomment for debugging the watchman query
- # open (my $fh, ">", ".git/watchman-query.json");
- # print $fh $query;
- # close $fh;
-
- print CHLD_IN $query;
- close CHLD_IN;
- my $response = do {local $/; <CHLD_OUT>};
-
- # Uncomment for debugging the watch response
- # open ($fh, ">", ".git/watchman-response.json");
- # print $fh $response;
- # close $fh;
-
- die "Watchman: command returned no output.\n" .
- "Falling back to scanning...\n" if $response eq "";
- die "Watchman: command returned invalid output: $response\n" .
- "Falling back to scanning...\n" unless $response =~ /^\{/;
-
- return $json_pkg->new->utf8->decode($response);
-}
-
-sub is_work_tree_watched {
- my ($output) = @_;
- my $error = $output->{error};
- if ($retry > 0 and $error and $error =~ m/unable to resolve root .* directory (.*) is not watched/) {
- $retry--;
- my $response = qx/watchman watch "$git_work_tree"/;
- die "Failed to make watchman watch '$git_work_tree'.\n" .
- "Falling back to scanning...\n" if $? != 0;
- $output = $json_pkg->new->utf8->decode($response);
- $error = $output->{error};
- die "Watchman: $error.\n" .
- "Falling back to scanning...\n" if $error;
-
- # Uncomment for debugging watchman output
- # open (my $fh, ">", ".git/watchman-output.out");
- # close $fh;
-
- # Watchman will always return all files on the first query so
- # return the fast "everything is dirty" flag to git and do the
- # Watchman query just to get it over with now so we won't pay
- # the cost in git to look up each individual file.
- my $o = watchman_clock();
- $error = $output->{error};
-
- die "Watchman: $error.\n" .
- "Falling back to scanning...\n" if $error;
-
- output_result($o->{clock}, ("/"));
- $last_update_token = $o->{clock};
-
- eval { launch_watchman() };
- return 0;
- }
-
- die "Watchman: $error.\n" .
- "Falling back to scanning...\n" if $error;
-
- return 1;
-}
-
-sub get_working_dir {
- my $working_dir;
- if ($^O =~ 'msys' || $^O =~ 'cygwin') {
- $working_dir = Win32::GetCwd();
- $working_dir =~ tr/\\/\//;
- } else {
- require Cwd;
- $working_dir = Cwd::cwd();
- }
-
- return $working_dir;
-}
diff --git a/hooks/post-update.sample b/hooks/post-update.sample
deleted file mode 100644
index ec17ec1..0000000
--- a/hooks/post-update.sample
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to prepare a packed repository for use over
-# dumb transports.
-#
-# To enable this hook, rename this file to "post-update".
-
-exec git update-server-info
diff --git a/hooks/pre-applypatch.sample b/hooks/pre-applypatch.sample
deleted file mode 100644
index 4142082..0000000
--- a/hooks/pre-applypatch.sample
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to verify what is about to be committed
-# by applypatch from an e-mail message.
-#
-# The hook should exit with non-zero status after issuing an
-# appropriate message if it wants to stop the commit.
-#
-# To enable this hook, rename this file to "pre-applypatch".
-
-. git-sh-setup
-precommit="$(git rev-parse --git-path hooks/pre-commit)"
-test -x "$precommit" && exec "$precommit" ${1+"$@"}
-:
diff --git a/hooks/pre-commit.sample b/hooks/pre-commit.sample
deleted file mode 100644
index e144712..0000000
--- a/hooks/pre-commit.sample
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to verify what is about to be committed.
-# Called by "git commit" with no arguments. The hook should
-# exit with non-zero status after issuing an appropriate message if
-# it wants to stop the commit.
-#
-# To enable this hook, rename this file to "pre-commit".
-
-if git rev-parse --verify HEAD >/dev/null 2>&1
-then
- against=HEAD
-else
- # Initial commit: diff against an empty tree object
- against=$(git hash-object -t tree /dev/null)
-fi
-
-# If you want to allow non-ASCII filenames set this variable to true.
-allownonascii=$(git config --type=bool hooks.allownonascii)
-
-# Redirect output to stderr.
-exec 1>&2
-
-# Cross platform projects tend to avoid non-ASCII filenames; prevent
-# them from being added to the repository. We exploit the fact that the
-# printable range starts at the space character and ends with tilde.
-if [ "$allownonascii" != "true" ] &&
- # Note that the use of brackets around a tr range is ok here, (it's
- # even required, for portability to Solaris 10's /usr/bin/tr), since
- # the square bracket bytes happen to fall in the designated range.
- test $(git diff --cached --name-only --diff-filter=A -z $against |
- LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
-then
- cat <<\EOF
-Error: Attempt to add a non-ASCII file name.
-
-This can cause problems if you want to work with people on other platforms.
-
-To be portable it is advisable to rename the file.
-
-If you know what you are doing you can disable this check using:
-
- git config hooks.allownonascii true
-EOF
- exit 1
-fi
-
-# If there are whitespace errors, print the offending file names and fail.
-exec git diff-index --check --cached $against --
diff --git a/hooks/pre-merge-commit.sample b/hooks/pre-merge-commit.sample
deleted file mode 100644
index 399eab1..0000000
--- a/hooks/pre-merge-commit.sample
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to verify what is about to be committed.
-# Called by "git merge" with no arguments. The hook should
-# exit with non-zero status after issuing an appropriate message to
-# stderr if it wants to stop the merge commit.
-#
-# To enable this hook, rename this file to "pre-merge-commit".
-
-. git-sh-setup
-test -x "$GIT_DIR/hooks/pre-commit" &&
- exec "$GIT_DIR/hooks/pre-commit"
-:
diff --git a/hooks/pre-push.sample b/hooks/pre-push.sample
deleted file mode 100644
index 4ce688d..0000000
--- a/hooks/pre-push.sample
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/bin/sh
-
-# An example hook script to verify what is about to be pushed. Called by "git
-# push" after it has checked the remote status, but before anything has been
-# pushed. If this script exits with a non-zero status nothing will be pushed.
-#
-# This hook is called with the following parameters:
-#
-# $1 -- Name of the remote to which the push is being done
-# $2 -- URL to which the push is being done
-#
-# If pushing without using a named remote those arguments will be equal.
-#
-# Information about the commits which are being pushed is supplied as lines to
-# the standard input in the form:
-#
-# <local ref> <local oid> <remote ref> <remote oid>
-#
-# This sample shows how to prevent push of commits where the log message starts
-# with "WIP" (work in progress).
-
-remote="$1"
-url="$2"
-
-zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
-
-while read local_ref local_oid remote_ref remote_oid
-do
- if test "$local_oid" = "$zero"
- then
- # Handle delete
- :
- else
- if test "$remote_oid" = "$zero"
- then
- # New branch, examine all commits
- range="$local_oid"
- else
- # Update to existing branch, examine new commits
- range="$remote_oid..$local_oid"
- fi
-
- # Check for WIP commit
- commit=$(git rev-list -n 1 --grep '^WIP' "$range")
- if test -n "$commit"
- then
- echo >&2 "Found WIP commit in $local_ref, not pushing"
- exit 1
- fi
- fi
-done
-
-exit 0
diff --git a/hooks/pre-rebase.sample b/hooks/pre-rebase.sample
deleted file mode 100644
index 6cbef5c..0000000
--- a/hooks/pre-rebase.sample
+++ /dev/null
@@ -1,169 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2006, 2008 Junio C Hamano
-#
-# The "pre-rebase" hook is run just before "git rebase" starts doing
-# its job, and can prevent the command from running by exiting with
-# non-zero status.
-#
-# The hook is called with the following parameters:
-#
-# $1 -- the upstream the series was forked from.
-# $2 -- the branch being rebased (or empty when rebasing the current branch).
-#
-# This sample shows how to prevent topic branches that are already
-# merged to 'next' branch from getting rebased, because allowing it
-# would result in rebasing already published history.
-
-publish=next
-basebranch="$1"
-if test "$#" = 2
-then
- topic="refs/heads/$2"
-else
- topic=`git symbolic-ref HEAD` ||
- exit 0 ;# we do not interrupt rebasing detached HEAD
-fi
-
-case "$topic" in
-refs/heads/??/*)
- ;;
-*)
- exit 0 ;# we do not interrupt others.
- ;;
-esac
-
-# Now we are dealing with a topic branch being rebased
-# on top of master. Is it OK to rebase it?
-
-# Does the topic really exist?
-git show-ref -q "$topic" || {
- echo >&2 "No such branch $topic"
- exit 1
-}
-
-# Is topic fully merged to master?
-not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
-if test -z "$not_in_master"
-then
- echo >&2 "$topic is fully merged to master; better remove it."
- exit 1 ;# we could allow it, but there is no point.
-fi
-
-# Is topic ever merged to next? If so you should not be rebasing it.
-only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
-only_next_2=`git rev-list ^master ${publish} | sort`
-if test "$only_next_1" = "$only_next_2"
-then
- not_in_topic=`git rev-list "^$topic" master`
- if test -z "$not_in_topic"
- then
- echo >&2 "$topic is already up to date with master"
- exit 1 ;# we could allow it, but there is no point.
- else
- exit 0
- fi
-else
- not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
- /usr/bin/perl -e '
- my $topic = $ARGV[0];
- my $msg = "* $topic has commits already merged to public branch:\n";
- my (%not_in_next) = map {
- /^([0-9a-f]+) /;
- ($1 => 1);
- } split(/\n/, $ARGV[1]);
- for my $elem (map {
- /^([0-9a-f]+) (.*)$/;
- [$1 => $2];
- } split(/\n/, $ARGV[2])) {
- if (!exists $not_in_next{$elem->[0]}) {
- if ($msg) {
- print STDERR $msg;
- undef $msg;
- }
- print STDERR " $elem->[1]\n";
- }
- }
- ' "$topic" "$not_in_next" "$not_in_master"
- exit 1
-fi
-
-<<\DOC_END
-
-This sample hook safeguards topic branches that have been
-published from being rewound.
-
-The workflow assumed here is:
-
- * Once a topic branch forks from "master", "master" is never
- merged into it again (either directly or indirectly).
-
- * Once a topic branch is fully cooked and merged into "master",
- it is deleted. If you need to build on top of it to correct
- earlier mistakes, a new topic branch is created by forking at
- the tip of the "master". This is not strictly necessary, but
- it makes it easier to keep your history simple.
-
- * Whenever you need to test or publish your changes to topic
- branches, merge them into "next" branch.
-
-The script, being an example, hardcodes the publish branch name
-to be "next", but it is trivial to make it configurable via
-$GIT_DIR/config mechanism.
-
-With this workflow, you would want to know:
-
-(1) ... if a topic branch has ever been merged to "next". Young
- topic branches can have stupid mistakes you would rather
- clean up before publishing, and things that have not been
- merged into other branches can be easily rebased without
- affecting other people. But once it is published, you would
- not want to rewind it.
-
-(2) ... if a topic branch has been fully merged to "master".
- Then you can delete it. More importantly, you should not
- build on top of it -- other people may already want to
- change things related to the topic as patches against your
- "master", so if you need further changes, it is better to
- fork the topic (perhaps with the same name) afresh from the
- tip of "master".
-
-Let's look at this example:
-
- o---o---o---o---o---o---o---o---o---o "next"
- / / / /
- / a---a---b A / /
- / / / /
- / / c---c---c---c B /
- / / / \ /
- / / / b---b C \ /
- / / / / \ /
- ---o---o---o---o---o---o---o---o---o---o---o "master"
-
-
-A, B and C are topic branches.
-
- * A has one fix since it was merged up to "next".
-
- * B has finished. It has been fully merged up to "master" and "next",
- and is ready to be deleted.
-
- * C has not merged to "next" at all.
-
-We would want to allow C to be rebased, refuse A, and encourage
-B to be deleted.
-
-To compute (1):
-
- git rev-list ^master ^topic next
- git rev-list ^master next
-
- if these match, topic has not merged in next at all.
-
-To compute (2):
-
- git rev-list master..topic
-
- if this is empty, it is fully merged to "master".
-
-DOC_END
diff --git a/hooks/pre-receive.sample b/hooks/pre-receive.sample
deleted file mode 100644
index a1fd29e..0000000
--- a/hooks/pre-receive.sample
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to make use of push options.
-# The example simply echoes all push options that start with 'echoback='
-# and rejects all pushes when the "reject" push option is used.
-#
-# To enable this hook, rename this file to "pre-receive".
-
-if test -n "$GIT_PUSH_OPTION_COUNT"
-then
- i=0
- while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
- do
- eval "value=\$GIT_PUSH_OPTION_$i"
- case "$value" in
- echoback=*)
- echo "echo from the pre-receive-hook: ${value#*=}" >&2
- ;;
- reject)
- exit 1
- esac
- i=$((i + 1))
- done
-fi
diff --git a/hooks/prepare-commit-msg.sample b/hooks/prepare-commit-msg.sample
deleted file mode 100644
index 10fa14c..0000000
--- a/hooks/prepare-commit-msg.sample
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to prepare the commit log message.
-# Called by "git commit" with the name of the file that has the
-# commit message, followed by the description of the commit
-# message's source. The hook's purpose is to edit the commit
-# message file. If the hook fails with a non-zero status,
-# the commit is aborted.
-#
-# To enable this hook, rename this file to "prepare-commit-msg".
-
-# This hook includes three examples. The first one removes the
-# "# Please enter the commit message..." help message.
-#
-# The second includes the output of "git diff --name-status -r"
-# into the message, just before the "git status" output. It is
-# commented because it doesn't cope with --amend or with squashed
-# commits.
-#
-# The third example adds a Signed-off-by line to the message, that can
-# still be edited. This is rarely a good idea.
-
-COMMIT_MSG_FILE=$1
-COMMIT_SOURCE=$2
-SHA1=$3
-
-/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
-
-# case "$COMMIT_SOURCE,$SHA1" in
-# ,|template,)
-# /usr/bin/perl -i.bak -pe '
-# print "\n" . `git diff --cached --name-status -r`
-# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;;
-# *) ;;
-# esac
-
-# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
-# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE"
-# if test -z "$COMMIT_SOURCE"
-# then
-# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE"
-# fi
diff --git a/hooks/push-to-checkout.sample b/hooks/push-to-checkout.sample
deleted file mode 100644
index af5a0c0..0000000
--- a/hooks/push-to-checkout.sample
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/bin/sh
-
-# An example hook script to update a checked-out tree on a git push.
-#
-# This hook is invoked by git-receive-pack(1) when it reacts to git
-# push and updates reference(s) in its repository, and when the push
-# tries to update the branch that is currently checked out and the
-# receive.denyCurrentBranch configuration variable is set to
-# updateInstead.
-#
-# By default, such a push is refused if the working tree and the index
-# of the remote repository has any difference from the currently
-# checked out commit; when both the working tree and the index match
-# the current commit, they are updated to match the newly pushed tip
-# of the branch. This hook is to be used to override the default
-# behaviour; however the code below reimplements the default behaviour
-# as a starting point for convenient modification.
-#
-# The hook receives the commit with which the tip of the current
-# branch is going to be updated:
-commit=$1
-
-# It can exit with a non-zero status to refuse the push (when it does
-# so, it must not modify the index or the working tree).
-die () {
- echo >&2 "$*"
- exit 1
-}
-
-# Or it can make any necessary changes to the working tree and to the
-# index to bring them to the desired state when the tip of the current
-# branch is updated to the new commit, and exit with a zero status.
-#
-# For example, the hook can simply run git read-tree -u -m HEAD "$1"
-# in order to emulate git fetch that is run in the reverse direction
-# with git push, as the two-tree form of git read-tree -u -m is
-# essentially the same as git switch or git checkout that switches
-# branches while keeping the local changes in the working tree that do
-# not interfere with the difference between the branches.
-
-# The below is a more-or-less exact translation to shell of the C code
-# for the default behaviour for git's push-to-checkout hook defined in
-# the push_to_deploy() function in builtin/receive-pack.c.
-#
-# Note that the hook will be executed from the repository directory,
-# not from the working tree, so if you want to perform operations on
-# the working tree, you will have to adapt your code accordingly, e.g.
-# by adding "cd .." or using relative paths.
-
-if ! git update-index -q --ignore-submodules --refresh
-then
- die "Up-to-date check failed"
-fi
-
-if ! git diff-files --quiet --ignore-submodules --
-then
- die "Working directory has unstaged changes"
-fi
-
-# This is a rough translation of:
-#
-# head_has_history() ? "HEAD" : EMPTY_TREE_SHA1_HEX
-if git cat-file -e HEAD 2>/dev/null
-then
- head=HEAD
-else
- head=$(git hash-object -t tree --stdin </dev/null)
-fi
-
-if ! git diff-index --quiet --cached --ignore-submodules $head --
-then
- die "Working directory has staged changes"
-fi
-
-if ! git read-tree -u -m "$commit"
-then
- die "Could not update working tree to new HEAD"
-fi
diff --git a/hooks/update.sample b/hooks/update.sample
deleted file mode 100644
index c4d426b..0000000
--- a/hooks/update.sample
+++ /dev/null
@@ -1,128 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to block unannotated tags from entering.
-# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
-#
-# To enable this hook, rename this file to "update".
-#
-# Config
-# ------
-# hooks.allowunannotated
-# This boolean sets whether unannotated tags will be allowed into the
-# repository. By default they won't be.
-# hooks.allowdeletetag
-# This boolean sets whether deleting tags will be allowed in the
-# repository. By default they won't be.
-# hooks.allowmodifytag
-# This boolean sets whether a tag may be modified after creation. By default
-# it won't be.
-# hooks.allowdeletebranch
-# This boolean sets whether deleting branches will be allowed in the
-# repository. By default they won't be.
-# hooks.denycreatebranch
-# This boolean sets whether remotely creating branches will be denied
-# in the repository. By default this is allowed.
-#
-
-# --- Command line
-refname="$1"
-oldrev="$2"
-newrev="$3"
-
-# --- Safety check
-if [ -z "$GIT_DIR" ]; then
- echo "Don't run this script from the command line." >&2
- echo " (if you want, you could supply GIT_DIR then run" >&2
- echo " $0 <ref> <oldrev> <newrev>)" >&2
- exit 1
-fi
-
-if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
- echo "usage: $0 <ref> <oldrev> <newrev>" >&2
- exit 1
-fi
-
-# --- Config
-allowunannotated=$(git config --type=bool hooks.allowunannotated)
-allowdeletebranch=$(git config --type=bool hooks.allowdeletebranch)
-denycreatebranch=$(git config --type=bool hooks.denycreatebranch)
-allowdeletetag=$(git config --type=bool hooks.allowdeletetag)
-allowmodifytag=$(git config --type=bool hooks.allowmodifytag)
-
-# check for no description
-projectdesc=$(sed -e '1q' "$GIT_DIR/description")
-case "$projectdesc" in
-"Unnamed repository"* | "")
- echo "*** Project description file hasn't been set" >&2
- exit 1
- ;;
-esac
-
-# --- Check types
-# if $newrev is 0000...0000, it's a commit to delete a ref.
-zero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0')
-if [ "$newrev" = "$zero" ]; then
- newrev_type=delete
-else
- newrev_type=$(git cat-file -t $newrev)
-fi
-
-case "$refname","$newrev_type" in
- refs/tags/*,commit)
- # un-annotated tag
- short_refname=${refname##refs/tags/}
- if [ "$allowunannotated" != "true" ]; then
- echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
- echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
- exit 1
- fi
- ;;
- refs/tags/*,delete)
- # delete tag
- if [ "$allowdeletetag" != "true" ]; then
- echo "*** Deleting a tag is not allowed in this repository" >&2
- exit 1
- fi
- ;;
- refs/tags/*,tag)
- # annotated tag
- if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
- then
- echo "*** Tag '$refname' already exists." >&2
- echo "*** Modifying a tag is not allowed in this repository." >&2
- exit 1
- fi
- ;;
- refs/heads/*,commit)
- # branch
- if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
- echo "*** Creating a branch is not allowed in this repository" >&2
- exit 1
- fi
- ;;
- refs/heads/*,delete)
- # delete branch
- if [ "$allowdeletebranch" != "true" ]; then
- echo "*** Deleting a branch is not allowed in this repository" >&2
- exit 1
- fi
- ;;
- refs/remotes/*,commit)
- # tracking branch
- ;;
- refs/remotes/*,delete)
- # delete tracking branch
- if [ "$allowdeletebranch" != "true" ]; then
- echo "*** Deleting a tracking branch is not allowed in this repository" >&2
- exit 1
- fi
- ;;
- *)
- # Anything else (is there anything else?)
- echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
- exit 1
- ;;
-esac
-
-# --- Finished
-exit 0
diff --git a/info/exclude b/info/exclude
deleted file mode 100644
index a5196d1..0000000
--- a/info/exclude
+++ /dev/null
@@ -1,6 +0,0 @@
-# git ls-files --others --exclude-from=.git/info/exclude
-# Lines that start with '#' are comments.
-# For a project mostly in C, the following would be a good set of
-# exclude patterns (uncomment them if you want to use them):
-# *.[oa]
-# *~
diff --git a/objects/3c/926a7cc47bb1137cc7b3e1582e62658c450f62 b/objects/3c/926a7cc47bb1137cc7b3e1582e62658c450f62
deleted file mode 100644
index 2ca0ec2..0000000
--- a/objects/3c/926a7cc47bb1137cc7b3e1582e62658c450f62
+++ /dev/null
Binary files differ
diff --git a/objects/8f/e8a906a5a5cc31c8aee6953db98ab275def06d b/objects/8f/e8a906a5a5cc31c8aee6953db98ab275def06d
deleted file mode 100644
index 099de3c..0000000
--- a/objects/8f/e8a906a5a5cc31c8aee6953db98ab275def06d
+++ /dev/null
@@ -1 +0,0 @@
-x��=�0@a��;���$�b�v����*s�r�7}zmC
��/v�p&�p�h�k�,>2ƐX���ʎ>���e��3���jw�9�8�X\�"�vn��
�sSSZ�'��>3.
\ No newline at end of file
diff --git a/objects/f2/09a1c0d17bfaa9e4b82b6f13b0324bf3fbf88b b/objects/f2/09a1c0d17bfaa9e4b82b6f13b0324bf3fbf88b
deleted file mode 100644
index 66b056e..0000000
--- a/objects/f2/09a1c0d17bfaa9e4b82b6f13b0324bf3fbf88b
+++ /dev/null
Binary files differ
diff --git a/pages/taskinfo/eventsReported.vue b/pages/taskinfo/eventsReported.vue
index 02d7916..a168132 100644
--- a/pages/taskinfo/eventsReported.vue
+++ b/pages/taskinfo/eventsReported.vue
@@ -40,7 +40,8 @@
</u-action-sheet> -->
<u-form-item label-position="top" label-width="25%" label="图片上传:">
- <u-upload ref="uUpload" :header="header" :action="uploadApi" max-count="5" ></u-upload>
+ <!-- <u-upload ref="uUpload" :header="header" :action="uploadApi" max-count="5" ></u-upload> -->
+ <evan-upload ref="evanUpload" :imgLimit="4" :options="uploadOption" @on-upload="onUpload"></evan-upload>
</u-form-item>
<u-form-item label-position="top" label="备注:">
@@ -51,6 +52,7 @@
<view class="submitBtn">
<u-button @click="submit">提交</u-button>
</view>
+
</view>
</template>
@@ -59,7 +61,9 @@
import {clientId,clientSecret} from '@/common/setting'
import {add} from "@/api/eventgm/eventgm.js"
import {getDicList} from "@/api/dict/dict.js"
+import evanUpload from "@/components/evan-upload/evan-upload.vue";
export default {
+ components: {'evan-upload' :evanUpload },
data() {
return {
form: {
@@ -91,6 +95,11 @@
//换用其他写法
uploadApi:"http://localhost/blade-resource/oss/endpoint/put-file-attach",
header:{},
+ uploadOption:{
+ url:"http://localhost/blade-resource/oss/endpoint/put-file-attach",
+ header:{},
+ },
+ uploadList:[],
showType:false,
typeList:[],
showState:false,
@@ -119,11 +128,14 @@
methods:{
getHeader(){
let accessToken = uni.getStorageSync('accessToken');
+ var myHeader = {}
if (accessToken) {
- this.header['Blade-Auth'] = 'bearer ' + accessToken;
+ myHeader['Blade-Auth'] = 'bearer ' + accessToken;
}
// 客户端认证参数
- this.header['Authorization'] = 'Basic ' + Base64.encode(clientId + ':' + clientSecret);
+ myHeader['Authorization'] = 'Basic ' + Base64.encode(clientId + ':' + clientSecret);
+ this.header = myHeader
+ this.uploadOption.header = myHeader
},
getAddress(){
uni.getLocation({
@@ -131,7 +143,6 @@
isHighAccuracy:true,
geocode:true,
success: res=> {
- console.log(res)
console.log('当前位置的经度:' + res.longitude);
console.log('当前位置的纬度:' + res.latitude);
this.form.longitude = res.longitude
@@ -180,12 +191,23 @@
submit(){
this.$refs.uForm.validate(valid => {
if (valid) {
- let lists = this.$refs.uUpload.lists
- if(lists.length>0){
- lists.forEach(e=>{
+ // let lists = this.$refs.uUpload.lists
+ // if(lists.length>0){
+ // lists.forEach(e=>{
+ // this.form.picUrls.push({
+ // label:e.response.data.name,
+ // value:e.response.data.link
+ // })
+ // })
+ // }else{
+ // this.form.picUrls = null
+ // }
+ if(this.uploadList.length>0){
+ this.uploadList.forEach(e=>{
+ var res = JSON.parse(e.url)
this.form.picUrls.push({
- label:e.response.data.name,
- value:e.response.data.link
+ label:res.data.name,
+ value:res.data.link
})
})
}else{
@@ -200,6 +222,23 @@
})
}
});
+ },
+ onUpload(res){
+ this.uploadList = res.data
+ if(this.$refs.evanUpload.imgArr.length>0){
+ this.$refs.evanUpload.imgArr.forEach(e=>{
+ var res = JSON.parse(e.url)
+ e.thumbnail = res.data.link
+ })
+ }
+
+ if(this.$refs.evanUpload.videoArr.length>0){
+ this.$refs.evanUpload.videoArr.forEach(e=>{
+ var res = JSON.parse(e.url)
+ e.thumbnail = res.data.link
+ })
+ }
+
}
}
};
diff --git a/refs/remotes/origin/master b/refs/remotes/origin/master
deleted file mode 100644
index 13b5bde..0000000
--- a/refs/remotes/origin/master
+++ /dev/null
@@ -1 +0,0 @@
-8fe8a906a5a5cc31c8aee6953db98ab275def06d
--
Gitblit v1.9.3