From a8618d0b5d1ebedef286e55c926f428cb877437c Mon Sep 17 00:00:00 2001
From: GGJ <357021191@qq.com>
Date: Fri, 6 Sep 2024 14:35:06 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E5=8D=8E=E4=B8=BA?=
=?UTF-8?q?=E5=95=86=E5=9F=8E=E5=8F=8D=E9=A6=88=E7=9B=B8=E6=9C=BA=20?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
components/yk-authpup/yk-authpup.vue | 328 ++++
manifest.json | 8 +-
package.json | 34 +-
pages/device/new.vue | 1079 ++++++-------
pages/home/feedback.vue | 7 +-
pages/index/mine.vue | 22 +-
pages/mine/about.vue | 2 +-
pages/user/head.vue | 232 +--
.../uni-file-picker/uni-file-picker.vue | 1344 +++++++++--------
.../uni-file-picker/upload-image.vue | 671 ++++----
10 files changed, 2110 insertions(+), 1617 deletions(-)
create mode 100644 components/yk-authpup/yk-authpup.vue
diff --git a/components/yk-authpup/yk-authpup.vue b/components/yk-authpup/yk-authpup.vue
new file mode 100644
index 0000000..214d658
--- /dev/null
+++ b/components/yk-authpup/yk-authpup.vue
@@ -0,0 +1,328 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/manifest.json b/manifest.json
index c0263de..12c1338 100644
--- a/manifest.json
+++ b/manifest.json
@@ -2,8 +2,8 @@
"name" : "灿能物联",
"appid" : "__UNI__88BC25B",
"description" : "",
- "versionName" : "1.5.9",
- "versionCode" : 159,
+ "versionName" : "1.6.0",
+ "versionCode" : 160,
"transformPx" : false,
/* 5+App特有相关 */
"app-plus" : {
@@ -143,8 +143,8 @@
"proxy" : {
"/api" : {
"https" : true,
- "target" : "https://pqmcn.com:8092/api",
- // "target" : "http://192.168.1.126:10215",
+ // "target" : "https://pqmcn.com:8092/api",
+ "target" : "http://192.168.1.126:10215",
"changOrigin" : true,
"pathRewrite" : {
"/api" : ""
diff --git a/package.json b/package.json
index f4b0e82..97c55d7 100644
--- a/package.json
+++ b/package.json
@@ -1,16 +1,20 @@
{
- "dependencies": {
- "crypto-js": "^4.1.1",
- "html2canvas": "^1.4.1",
- "image-tools": "^1.4.0",
- "jsrsasign": "^10.8.6",
- "mqtt": "3.0.0",
- "pinyin-pro": "^3.13.2",
- "qs": "^6.11.2",
- "vconsole": "^3.15.1"
- },
- "devDependencies": {
- "@types/html5plus": "^1.0.2",
- "@types/uni-app": "^1.4.4"
- }
-}
+ "id": "yk-authpup",
+ "name": "解决软件在运行时,未见向用户告知权限申请的目的,华为等上架被拒问题",
+ "displayName": "解决软件在运行时,未见向用户告知权限申请的目的,华为等上架被拒问题",
+ "version": "1.0.5",
+ "description": "解决软件在运行时,未见向用户告知权限申请的目的,华为等上架被拒问题",
+ "keywords": [
+ "uniapp",
+ "华为上架",
+ "权限",
+ "权限申请",
+ "权限判断"
+ ],
+ "dcloudext": {
+ "category": [
+ "前端组件",
+ "通用组件"
+ ]
+ }
+}
\ No newline at end of file
diff --git a/pages/device/new.vue b/pages/device/new.vue
index 3c3e97e..7365dae 100644
--- a/pages/device/new.vue
+++ b/pages/device/new.vue
@@ -1,575 +1,588 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 选择拓扑图
-
-
-
-
-
-
- {{ item2.name }}
- 请选择监测点
-
-
-
-
-
-
-
-
- 提交
-
-
-
-
-
- 暂无拓扑图
-
-
- 取消
- 确定
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 选择拓扑图
+
+
+
+
+
+
+ {{ item2.name }}
+ 请选择监测点
+
+
+
+
+
+
+
+
+ 提交
+
+
+
+
+
+ 暂无拓扑图
+
+
+ 取消
+ 确定
+
+
+
+
+
+
+
+
+
-
-
-
- {{ point.alias || point.name }}
-
-
-
-
-
-
- 请拖动图中的文字选择监测点位置
-
-
-
-
-
- 取消
- 确定
-
-
-
-
-
-
+
+
+
+ {{ point.alias || point.name }}
+
+
+
+
+
+
+ 请拖动图中的文字选择监测点位置
+
+
+
+
+
+ 取消
+ 确定
+
+
+
+
+
+
+
diff --git a/pages/home/feedback.vue b/pages/home/feedback.vue
index c4beb42..64fd767 100644
--- a/pages/home/feedback.vue
+++ b/pages/home/feedback.vue
@@ -14,7 +14,9 @@
-
+
+
+
@@ -54,6 +56,9 @@ export default {
console.log(e);
this.formData.files = this.formData.files.filter(item => item.url !== e.tempFilePath)
},
+ pickerClick(){
+ console.log(123);
+ },
fileChange(e) {
console.log(e);
e.tempFilePaths.forEach(item => {
diff --git a/pages/index/mine.vue b/pages/index/mine.vue
index 74be2fb..581eafd 100644
--- a/pages/index/mine.vue
+++ b/pages/index/mine.vue
@@ -120,14 +120,19 @@
用于相机扫描二维码!
+
+
diff --git a/uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue b/uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue
index 04ecdcf..023b33e 100644
--- a/uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue
+++ b/uni_modules/uni-file-picker/components/uni-file-picker/uni-file-picker.vue
@@ -1,665 +1,683 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+ this.chooseFiles(type)
+ },
+
+ /**
+ * 选择文件并上传
+ */
+ chooseFiles(type) {
+ const _extname = get_extname(this.fileExtname)
+
+ // 获取后缀
+ uniCloud
+ .chooseAndUploadFile({
+ type: this.fileMediatype,
+ compressed: false,
+ sourceType: [type],//type? :this.sourceType ,
+ sizeType: this.sizeType,
+ // TODO 如果为空,video 有问题
+ extension: _extname.length > 0 ? _extname : undefined,
+ count: this.limitLength - this.files.length, //默认9
+ onChooseFile: this.chooseFileCallback,
+ onUploadProgress: (progressEvent) => {
+ this.setProgress(progressEvent, progressEvent.index)
+ },
+ })
+ .then((result) => {
+ console.log('选择失败', result)
+ this.setSuccessAndError(result.tempFiles)
+ })
+ .catch((err) => {
+ console.log('选择失败', err)
+ })
+ },
+
+ /**
+ * 选择文件回调
+ * @param {Object} res
+ */
+ async chooseFileCallback(res) {
+ const _extname = get_extname(this.fileExtname)
+ const is_one =
+ (Number(this.limitLength) === 1 && this.disablePreview && !this.disabled) ||
+ this.returnType === 'object'
+ // 如果这有一个文件 ,需要清空本地缓存数据
+ if (is_one) {
+ this.files = []
+ }
+
+ let { filePaths, files } = get_files_and_is_max(res, _extname)
+ if (!(_extname && _extname.length > 0)) {
+ filePaths = res.tempFilePaths
+ files = res.tempFiles
+ }
+
+ let currentData = []
+ for (let i = 0; i < files.length; i++) {
+ if (this.limitLength - this.files.length <= 0) break
+ files[i].uuid = Date.now()
+ let filedata = await get_file_data(files[i], this.fileMediatype)
+ filedata.progress = 0
+ filedata.status = 'ready'
+ this.files.push(filedata)
+ currentData.push({
+ ...filedata,
+ file: files[i],
+ })
+ }
+ this.$emit('select', {
+ tempFiles: currentData,
+ tempFilePaths: filePaths,
+ })
+ res.tempFiles = files
+ // 停止自动上传
+ if (!this.autoUpload || this.noSpace) {
+ res.tempFiles = []
+ }
+ },
+
+ /**
+ * 批传
+ * @param {Object} e
+ */
+ uploadFiles(files) {
+ files = [].concat(files)
+ return uploadCloudFiles
+ .call(this, files, 5, (res) => {
+ this.setProgress(res, res.index, true)
+ })
+ .then((result) => {
+ this.setSuccessAndError(result)
+ return result
+ })
+ .catch((err) => {
+ console.log(err)
+ })
+ },
+
+ /**
+ * 成功或失败
+ */
+ async setSuccessAndError(res, fn) {
+ let successData = []
+ let errorData = []
+ let tempFilePath = []
+ let errorTempFilePath = []
+ for (let i = 0; i < res.length; i++) {
+ const item = res[i]
+ const index = item.uuid ? this.files.findIndex((p) => p.uuid === item.uuid) : item.index
+
+ if (index === -1 || !this.files) break
+ if (item.errMsg === 'request:fail') {
+ this.files[index].url = item.path
+ this.files[index].status = 'error'
+ this.files[index].errMsg = item.errMsg
+ // this.files[index].progress = -1
+ errorData.push(this.files[index])
+ errorTempFilePath.push(this.files[index].url)
+ } else {
+ this.files[index].errMsg = ''
+ this.files[index].fileID = item.url
+ const reg = /cloud:\/\/([\w.]+\/?)\S*/
+ if (reg.test(item.url)) {
+ this.files[index].url = await this.getTempFileURL(item.url)
+ } else {
+ this.files[index].url = item.url
+ }
+
+ this.files[index].status = 'success'
+ this.files[index].progress += 1
+ successData.push(this.files[index])
+ tempFilePath.push(this.files[index].fileID)
+ }
+ }
+
+ if (successData.length > 0) {
+ this.setEmit()
+ // 状态改变返回
+ this.$emit('success', {
+ tempFiles: this.backObject(successData),
+ tempFilePaths: tempFilePath,
+ })
+ }
+
+ if (errorData.length > 0) {
+ this.$emit('fail', {
+ tempFiles: this.backObject(errorData),
+ tempFilePaths: errorTempFilePath,
+ })
+ }
+ },
+
+ /**
+ * 获取进度
+ * @param {Object} progressEvent
+ * @param {Object} index
+ * @param {Object} type
+ */
+ setProgress(progressEvent, index, type) {
+ const fileLenth = this.files.length
+ const percentNum = (index / fileLenth) * 100
+ const percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total)
+ let idx = index
+ if (!type) {
+ idx = this.files.findIndex((p) => p.uuid === progressEvent.tempFile.uuid)
+ }
+ if (idx === -1 || !this.files[idx]) return
+ // fix by mehaotian 100 就会消失,-1 是为了让进度条消失
+ this.files[idx].progress = percentCompleted - 1
+ // 上传中
+ this.$emit('progress', {
+ index: idx,
+ progress: parseInt(percentCompleted),
+ tempFile: this.files[idx],
+ })
+ },
+
+ /**
+ * 删除文件
+ * @param {Object} index
+ */
+ async delFile(index) {
+ let res = await this.beforeRemove({
+ tempFile: this.files[index],
+ tempFilePath: this.files[index].url,
+ })
+ if (res === false) return
+ this.$emit('delete', {
+ tempFile: this.files[index],
+ tempFilePath: this.files[index].url,
+ })
+ this.files.splice(index, 1)
+ this.$nextTick(() => {
+ this.setEmit()
+ })
+ },
+
+ /**
+ * 获取文件名和后缀
+ * @param {Object} name
+ */
+ getFileExt(name) {
+ const last_len = name.lastIndexOf('.')
+ const len = name.length
+ return {
+ name: name.substring(0, last_len),
+ ext: name.substring(last_len + 1, len),
+ }
+ },
+
+ /**
+ * 处理返回事件
+ */
+ setEmit() {
+ let data = []
+ if (this.returnType === 'object') {
+ data = this.backObject(this.files)[0]
+ this.localValue = data ? data : null
+ } else {
+ data = this.backObject(this.files)
+ if (!this.localValue) {
+ this.localValue = []
+ }
+ this.localValue = [...data]
+ }
+ // #ifdef VUE3
+ this.$emit('update:modelValue', this.localValue)
+ // #endif
+ // #ifndef VUE3
+ this.$emit('input', this.localValue)
+ // #endif
+ },
+
+ /**
+ * 处理返回参数
+ * @param {Object} files
+ */
+ backObject(files) {
+ let newFilesData = []
+ files.forEach((v) => {
+ newFilesData.push({
+ ...v,
+ extname: v.extname,
+ fileType: v.fileType,
+ image: v.image,
+ name: v.name,
+ path: v.path,
+ size: v.size,
+ fileID: v.fileID,
+ url: v.url,
+ })
+ })
+ return newFilesData
+ },
+ async getTempFileURL(fileList) {
+ fileList = {
+ fileList: [].concat(fileList),
+ }
+ const urls = await uniCloud.getTempFileURL(fileList)
+ return urls.fileList[0].tempFileURL || ''
+ },
+ /**
+ * 获取父元素实例
+ */
+ getForm(name = 'uniForms') {
+ let parent = this.$parent
+ let parentName = parent.$options.name
+ while (parentName !== name) {
+ parent = parent.$parent
+ if (!parent) return false
+ parentName = parent.$options.name
+ }
+ return parent
+ },
+ },
+}
+
+
+
diff --git a/uni_modules/uni-file-picker/components/uni-file-picker/upload-image.vue b/uni_modules/uni-file-picker/components/uni-file-picker/upload-image.vue
index 0c1abe8..435aabb 100644
--- a/uni_modules/uni-file-picker/components/uni-file-picker/upload-image.vue
+++ b/uni_modules/uni-file-picker/components/uni-file-picker/upload-image.vue
@@ -1,292 +1,379 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- 点击重试
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 点击重试
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 拍摄
+ 从相册选择
+
+ 取消
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file