diff --git a/App.vue b/App.vue
index 2e7a443..4686595 100644
--- a/App.vue
+++ b/App.vue
@@ -121,7 +121,6 @@ export default {
}
-
diff --git a/main.js b/main.js
index cbcf4d9..a0311c6 100644
--- a/main.js
+++ b/main.js
@@ -13,6 +13,8 @@ import'./common/css/iconfont.css'
import md5 from 'js-md5'
import {tansParams} from './common/util.js'
+import { uploadQiniuFileWithRetry, fetchQiniuToken } from './common/qiniuUploadUtil.js'
+import QiniuUploadProgress from '@/components/qiniu-upload-progress/qiniu-upload-progress.vue'
// 引入公共组件 tabbar
import tabbar from '@/components/tab-bar/tab-bar.vue';
@@ -24,6 +26,13 @@ Vue.use('tab-bar',tabbar)
Vue.use(uView);
Vue.use(cookies);
Vue.config.productionTip = false
+Vue.component('qiniu-upload-progress', QiniuUploadProgress)
+Vue.prototype.$uploadQiniuFile = function(options) {
+ return uploadQiniuFileWithRetry(this.$u, options)
+}
+Vue.prototype.$fetchQiniuToken = function() {
+ return fetchQiniuToken(this.$u)
+}
Vue.prototype.$md5 = md5;
diff --git a/manifest.json b/manifest.json
index 7ba3bf9..dcd5686 100644
--- a/manifest.json
+++ b/manifest.json
@@ -55,7 +55,7 @@
// "baseurl": "http://test.com"
// },
"libVersion" : "latest",
- "appid" : "wxc7e95836981d11fc",
+ "appid" : "wx8a05cf95418a6859",
"setting" : {
"urlCheck" : false,
"es6" : true,
diff --git a/page_fenbao/storedlist/pdfht/index.vue b/page_fenbao/storedlist/pdfht/index.vue
index e991a8b..e5f44af 100644
--- a/page_fenbao/storedlist/pdfht/index.vue
+++ b/page_fenbao/storedlist/pdfht/index.vue
@@ -14,6 +14,7 @@
+
@@ -135,39 +136,30 @@
})
return
}
- // 生成图片的临时路径
- // H5 生成的是base64
- this.tempUrl = res.tempFilePath
- console.log('临时路径', res.tempFilePath)
- uni.showLoading({
- title: '签名上传中',
- mask: 'true',
- })
let math = 'static/' + this.$u.guid(20)
let that = this
- wx.uploadFile({
- url: 'https://up-z2.qiniup.com',
- name: 'file',
- filePath: res.tempFilePath,
- formData: {
- token: that.token, //后端返回的token
- key: 'smartmeter/img/' + math
- },
- success: function(res) {
- console.log(res, 'resres');
- let str = JSON.parse(res.data)
- let tempFilePaths = 'https://api.ccttiot.com/' + str.key
- that.userInfo.signatureUrl = tempFilePaths
- console.log('签名路径', tempFilePaths, that.userInfo.signatureUrl)
- console.log('表单数据:', that.userInfo)
- uni.hideLoading()
- uni.showLoading({
- title: '正在生成协议',
- mask: 'true',
- })
- that.getsc()
- }
- })
+ try {
+ const url = await this.$uploadQiniuFile({
+ filePath: res.tempFilePath,
+ token: that.token,
+ key: 'smartmeter/img/' + math,
+ title: '签名上传'
+ })
+ that.userInfo.signatureUrl = url
+ console.log('签名路径', url, that.userInfo.signatureUrl)
+ console.log('表单数据:', that.userInfo)
+ uni.showLoading({
+ title: '正在生成协议',
+ mask: true,
+ })
+ that.getsc()
+ } catch (e) {
+ uni.showToast({
+ title: '上传失败',
+ icon: 'none',
+ duration: 2000
+ })
+ }
},
})
return
diff --git a/page_fenbao/storedlist/trueorder/components/CheckVideoUploader.vue b/page_fenbao/storedlist/trueorder/components/CheckVideoUploader.vue
index 8a50404..aa57f0c 100644
--- a/page_fenbao/storedlist/trueorder/components/CheckVideoUploader.vue
+++ b/page_fenbao/storedlist/trueorder/components/CheckVideoUploader.vue
@@ -8,6 +8,7 @@
保持车辆录像的完整清晰,不要随意拍摄,确保视频中车辆出境,并且出现车牌号
+
@@ -43,6 +44,7 @@
return
}
this.videoPath = res.tempFilePath
+ this.videoUrl = ''
this.upload()
},
fail: () => {
@@ -51,22 +53,17 @@
})
},
upload() {
- uni.showLoading({ title: '上传中' })
let math = 'static/' + this.$u.guid(20)
- wx.uploadFile({
- url: 'https://up-z2.qiniup.com',
- name: 'file',
+ this.$uploadQiniuFile({
filePath: this.videoPath,
- formData: {
- token: this.token,
- key: 'bike/video/' + math
- },
- success: (res) => {
- uni.hideLoading()
- let str = JSON.parse(res.data)
- this.videoUrl = 'https://api.ccttiot.com/' + str.key
- this.$emit('uploaded', this.videoUrl)
- }
+ token: this.token,
+ key: 'bike/video/' + math,
+ title: '上传验车视频'
+ }).then((url) => {
+ this.videoUrl = url
+ this.$emit('uploaded', this.videoUrl)
+ }).catch(() => {
+ uni.showToast({ title: '上传失败', icon: 'none', duration: 3000 })
})
}
}
diff --git a/page_fenbao/storedlist/trueorder/components/FeeDetailPanel.vue b/page_fenbao/storedlist/trueorder/components/FeeDetailPanel.vue
index 85d918d..b55dc5f 100644
--- a/page_fenbao/storedlist/trueorder/components/FeeDetailPanel.vue
+++ b/page_fenbao/storedlist/trueorder/components/FeeDetailPanel.vue
@@ -153,7 +153,7 @@
¥{{ insurancePriceDisplay }}/次
- 含安心骑保障:除押金外另计保障服务费{{ insurancePriceDisplay }}元/次,总价以试算为准。
+ 含安心骑保障:除押金外另计保障服务费{{ insurancePriceDisplay }}元/次,总价以实际价格为准。
diff --git a/page_fenbao/storedlist/trueorder/device_insurance_add.vue b/page_fenbao/storedlist/trueorder/device_insurance_add.vue
index fd02ce1..9b00d05 100644
--- a/page_fenbao/storedlist/trueorder/device_insurance_add.vue
+++ b/page_fenbao/storedlist/trueorder/device_insurance_add.vue
@@ -123,6 +123,7 @@
+
@@ -133,7 +134,6 @@
bgc: { backgroundColor: '#F3F4F6' },
areaId: '',
token: '',
- qiniuLoading: false,
insuranceId: '',
insuranceText: '',
insuranceList: [],
@@ -373,34 +373,16 @@
},
uploadToQiniu(filePath) {
const math = 'static/' + this.$u.guid(20)
- uni.showLoading({ title: '上传中...', mask: true })
- uni.uploadFile({
- url: 'https://up-z2.qiniup.com',
+ this.$uploadQiniuFile({
filePath,
- name: 'file',
- formData: {
- token: this.token,
- key: 'bike/img/' + math
- },
- success: (res) => {
- try {
- const body = JSON.parse(res.data || '{}')
- if (body.key) {
- this.licensePicture = 'https://api.ccttiot.com/' + body.key
- uni.showToast({ title: '上传成功', icon: 'success' })
- } else {
- uni.showToast({ title: '上传失败', icon: 'none' })
- }
- } catch (e) {
- uni.showToast({ title: '上传失败', icon: 'none' })
- }
- },
- fail: () => {
- uni.showToast({ title: '上传失败', icon: 'none' })
- },
- complete: () => {
- uni.hideLoading()
- }
+ token: this.token,
+ key: 'bike/img/' + math,
+ title: '上传行驶证照片'
+ }).then((url) => {
+ this.licensePicture = url
+ uni.showToast({ title: '上传成功', icon: 'success' })
+ }).catch(() => {
+ uni.showToast({ title: '上传失败', icon: 'none' })
})
},
previewLicense() {
diff --git a/page_fenbao/storedlist/trueorder/device_insurance_detail.vue b/page_fenbao/storedlist/trueorder/device_insurance_detail.vue
index 3e4c490..b7e4583 100644
--- a/page_fenbao/storedlist/trueorder/device_insurance_detail.vue
+++ b/page_fenbao/storedlist/trueorder/device_insurance_detail.vue
@@ -148,6 +148,7 @@
+
@@ -344,8 +345,7 @@
this.form.id = str(d.id)
this.form.insuranceCode = str(d.insuranceCode)
this.form.insuranceContent = str(d.insuranceContent)
- this.form.insuranceDepositAmount =
- d.insuranceDepositAmount != null && d.insuranceDepositAmount !== '' ? String(d.insuranceDepositAmount) : ''
+ this.form.insuranceDepositAmount = d.insuranceDepositAmount != null && d.insuranceDepositAmount !== '' ? String(d.insuranceDepositAmount) : ''
this.form.insuranceFeeRule = str(d.insuranceFeeRule)
this.form.insuranceId = str(d.insuranceId)
this.form.insuranceName = str(d.insuranceName)
@@ -575,34 +575,16 @@
},
uploadToQiniu(filePath) {
const math = 'static/' + this.$u.guid(20)
- uni.showLoading({ title: '上传中...', mask: true })
- uni.uploadFile({
- url: 'https://up-z2.qiniup.com',
+ this.$uploadQiniuFile({
filePath,
- name: 'file',
- formData: {
- token: this.token,
- key: 'bike/img/' + math
- },
- success: (res) => {
- try {
- const body = JSON.parse(res.data || '{}')
- if (body.key) {
- this.form.licensePicture = 'https://api.ccttiot.com/' + body.key
- uni.showToast({ title: '上传成功', icon: 'success' })
- } else {
- uni.showToast({ title: '上传失败', icon: 'none' })
- }
- } catch (err) {
- uni.showToast({ title: '上传失败', icon: 'none' })
- }
- },
- fail: () => {
- uni.showToast({ title: '上传失败', icon: 'none' })
- },
- complete: () => {
- uni.hideLoading()
- }
+ token: this.token,
+ key: 'bike/img/' + math,
+ title: '上传行驶证照片'
+ }).then((url) => {
+ this.form.licensePicture = url
+ uni.showToast({ title: '上传成功', icon: 'success' })
+ }).catch(() => {
+ uni.showToast({ title: '上传失败', icon: 'none' })
})
},
clearLicense() {
diff --git a/page_fenbao/storedlist/trueorder/index.vue b/page_fenbao/storedlist/trueorder/index.vue
index cc37865..eb20a96 100644
--- a/page_fenbao/storedlist/trueorder/index.vue
+++ b/page_fenbao/storedlist/trueorder/index.vue
@@ -1063,12 +1063,13 @@
this.$u.get("/getInfo").then(res => {
if (res.code == 200) {
if (res.user.isReal == false) {
+ let that = this
uni.showModal({
title: '提示',
content: '您当前还未实名认证,是否前去实名认证?',
showCancel: true,
success: function(res) {
- if (res.confirm) uni.navigateTo({ url: '/page_user/shiming' })
+ if (res.confirm) uni.navigateTo({ url: '/page_user/shiming?areaId=' + that.bikeobj.areaId })
}
})
} else {
@@ -1304,9 +1305,10 @@
this.getlogo(() => this.btnzhifu())
} else if (resp.code == 10001) {
uni.hideLoading()
+ let that = this
uni.showModal({
title: '提示', content: '您当前还未实名认证,是否前去实名认证?', showCancel: true,
- success: function(res) { if (res.confirm) uni.navigateTo({ url: '/page_user/shiming' }) }
+ success: function(res) { if (res.confirm) uni.navigateTo({ url: '/page_user/shiming?areaId=' + that.bikeobj.areaId }) }
})
} else if (resp.code == 10002) {
uni.hideLoading()
diff --git a/page_fenbao/tousu/index.vue b/page_fenbao/tousu/index.vue
index ba863f3..3f6ffdb 100644
--- a/page_fenbao/tousu/index.vue
+++ b/page_fenbao/tousu/index.vue
@@ -181,6 +181,7 @@
+
@@ -266,30 +267,31 @@
// 选择图片
chooseImage() {
- let _this = this
- let math = 'static/' + _this.$u.guid(20)
+ const math = 'static/' + this.$u.guid(20)
uni.chooseImage({
count: 4 - this.imglist.length,
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
- success(res) {
- const tempFilePaths = res.tempFilePaths[0]
- wx.uploadFile({
- url: 'https://up-z2.qiniup.com',
- name: 'file',
- filePath: tempFilePaths,
- formData: {
- token: _this.token, //后端返回的token
- key: 'smartmeter/img/' + math
- },
- success: function(res) {
- console.log(res, 'resres');
- let str = JSON.parse(res.data)
- let tempFilePaths = 'https://api.ccttiot.com/' + str.key
- _this.imglist.push(tempFilePaths)
- console.log(_this.imglist);
- }
- })
+ success: async (res) => {
+ const filePath = res.tempFilePaths[0]
+ if (!this.token) {
+ this.token = await this.$fetchQiniuToken()
+ }
+ if (!this.token) {
+ uni.showToast({ title: '上传失败', icon: 'none' })
+ return
+ }
+ try {
+ const url = await this.$uploadQiniuFile({
+ filePath,
+ token: this.token,
+ key: 'smartmeter/img/' + math,
+ title: '上传投诉截图'
+ })
+ this.imglist.push(url)
+ } catch (e) {
+ uni.showToast({ title: '上传失败', icon: 'none' })
+ }
}
})
},
diff --git a/page_fenbao/tousu/shtsxq.vue b/page_fenbao/tousu/shtsxq.vue
index b44aa81..a3a6046 100644
--- a/page_fenbao/tousu/shtsxq.vue
+++ b/page_fenbao/tousu/shtsxq.vue
@@ -228,6 +228,7 @@
+