Selaa lähdekoodia

登录加防抖以及上传图片加身份认证

1410417013 8 kuukautta sitten
vanhempi
commit
1e206a60d7

+ 10 - 2
my/apply/index.vue

@@ -380,13 +380,17 @@ export default {
 						//初始绘画区域是画布自身的宽度也就是屏幕宽度
 						let drawWidth = uni.getSystemInfoSync().windowWidth
 						let that = this
+						let token = uni.getStorageSync('token')
 						getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, that, (resPath) => {
 							uni.showLoading({
 								title: '上传中'
 							})
 							uni.uploadFile({
-								url: that.config('APIHOST1') + '/alioss/upload',
+								url: that.config('APIHOST1') + '/app/new-file/upload',
 								filePath: resPath,
+								header: {
+									token: token
+								},
 								name: 'file',
 								success: (uploadFileRes) => {
 									that.detailsImg = JSON.parse(uploadFileRes.data).data
@@ -422,13 +426,17 @@ export default {
 						//初始绘画区域是画布自身的宽度也就是屏幕宽度
 						let drawWidth = uni.getSystemInfoSync().windowWidth
 						let that = this
+						let token = uni.getStorageSync('token')
 						getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, that, (resPath) => {
 							uni.showLoading({
 								title: '上传中'
 							})
 							uni.uploadFile({
-								url: that.config('APIHOST1') + '/alioss/upload',
+								url: that.config('APIHOST1') + '/app/new-file/upload',
 								filePath: resPath,
+								header: {
+									token: token
+								},
 								name: 'file',
 								success: (uploadFileRes) => {
 									if (e == 1) {

+ 17 - 5
my/check/index.vue

@@ -162,7 +162,6 @@ import getLessLimitSizeImage from '@/utils/imageCompress.js'
 export default {
 	data() {
 		return {
-			action: 'https://newxxpw.xianmxkj.com/sqx_fast/alioss/upload',
 			fileList: [],
 			show: false,
 			params: {
@@ -214,6 +213,8 @@ export default {
 	methods: {
 		// 上传视频
 		addVideo() {
+			let that=this
+			let token = uni.getStorageSync('token')
 			uni.chooseVideo({
 				count: 1,
 				sourceType: ['album', 'camera'],
@@ -223,9 +224,12 @@ export default {
 					console.log(res.tempFilePath)
 					uni.uploadFile({
 						// 上传接口
-						// url: this.config("APIHOST1") + '/alioss/upload', //真实的接口地址
-						url: 'https://newxxpw.xianmxkj.com/sqx_fast/alioss/upload',
+						// url: this.config("APIHOST1") + '/app/new-file/upload', //真实的接口地址
+						url: that.config('APIHOST1') + '/app/new-file/upload',
 						filePath: res.tempFilePath,
+						header: {
+							token: token
+						},
 						name: 'file',
 						timeout: '30000',
 						success: (uploadFileRes) => {
@@ -257,13 +261,17 @@ export default {
 						//初始绘画区域是画布自身的宽度也就是屏幕宽度
 						let drawWidth = uni.getSystemInfoSync().windowWidth
 						let that = this
+						let token = uni.getStorageSync('token')
 						getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, that, (resPath) => {
 							uni.showLoading({
 								title: '上传中'
 							})
 							uni.uploadFile({
-								url: 'https://newxxpw.xianmxkj.com/sqx_fast/alioss/upload',
+								url: that.config('APIHOST1') + '/app/new-file/upload',
 								filePath: resPath,
+								header: {
+									token: token
+								},
 								name: 'file',
 								success: (uploadFileRes) => {
 									if (e == 1) {
@@ -301,13 +309,17 @@ export default {
 						//初始绘画区域是画布自身的宽度也就是屏幕宽度
 						let drawWidth = uni.getSystemInfoSync().windowWidth
 						let that = this
+						let token = uni.getStorageSync('token')
 						getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, that, (resPath) => {
 							uni.showLoading({
 								title: '上传中'
 							})
 							uni.uploadFile({
-								url: 'https://newxxpw.xianmxkj.com/sqx_fast/alioss/upload',
+								url: that.config('APIHOST1') + '/app/new-file/upload',
 								filePath: resPath,
+								header: {
+									token: token
+								},
 								name: 'file',
 								success: (uploadFileRes) => {
 									if (this.infantImgs.length < 9) {

+ 5 - 1
my/recruit/index.vue

@@ -247,13 +247,17 @@ export default {
 						//初始绘画区域是画布自身的宽度也就是屏幕宽度
 						let drawWidth = uni.getSystemInfoSync().windowWidth
 						let that = this
+						let token = uni.getStorageSync('token')
 						getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, that, (resPath) => {
 							uni.showLoading({
 								title: '上传中'
 							})
 							uni.uploadFile({
-								url: that.config('APIHOST1') + '/alioss/upload',
+								url: that.config('APIHOST1') + '/app/new-file/upload',
 								filePath: resPath,
+								header: {
+									token: token
+								},
 								name: 'file',
 								success: (uploadFileRes) => {
 									console.log(uploadFileRes.data)

+ 5 - 1
my/setting/chat.vue

@@ -635,13 +635,17 @@ export default {
 						//初始绘画区域是画布自身的宽度也就是屏幕宽度
 						let drawWidth = uni.getSystemInfoSync().windowWidth
 						let that = this
+						let token = uni.getStorageSync('token')
 						getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, that, (resPath) => {
 							uni.showLoading({
 								title: '上传中'
 							})
 							uni.uploadFile({
-								url: this.config('APIHOST') + '/alioss/upload',
+								url: this.config('APIHOST') + '/app/new-file/upload',
 								filePath: resPath,
+								header: {
+									token: token
+								},
 								name: 'file',
 								success: (uploadFileRes) => {
 									this.content = JSON.parse(uploadFileRes.data).data

+ 5 - 1
pages/index/shop/im.vue

@@ -441,13 +441,17 @@ export default {
 						//初始绘画区域是画布自身的宽度也就是屏幕宽度
 						let drawWidth = uni.getSystemInfoSync().windowWidth
 						let that = this
+						let token = uni.getStorageSync('token')
 						getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, that, (resPath) => {
 							uni.showLoading({
 								title: '上传中'
 							})
 							uni.uploadFile({
-								url: this.config('APIHOST') + '/alioss/upload',
+								url: this.config('APIHOST') + '/app/new-file/upload',
 								filePath: resPath,
+								header: {
+									token: token
+								},
 								name: 'file',
 								success: (uploadFileRes) => {
 									console.log(uploadFileRes)

+ 4 - 3
pages/my/index.vue

@@ -333,8 +333,8 @@ export default {
 				mask: true // 是否显示透明蒙层,防止触摸穿透
 			})
 			uni.uploadFile({
-				// url: config.APIHOST1 + '/alioss/upload', //仅为示例,非真实的接口地址
-				url: that.config('APIHOST1') + '/alioss/upload', //仅为示例,非真实的接口地址
+				// url: config.APIHOST1 + '/app/new-file/upload', //仅为示例,非真实的接口地址
+				url: that.config('APIHOST1') + '/app/new-file/upload', //仅为示例,非真实的接口地址
 				filePath: e.detail.avatarUrl,
 				header: {
 					token: token
@@ -413,12 +413,13 @@ export default {
 									//初始绘画区域是画布自身的宽度也就是屏幕宽度
 									let drawWidth = uni.getSystemInfoSync().windowWidth
 									let that = this
+									let token = uni.getStorageSync('token')
 									getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, that, (resPath) => {
 										uni.showLoading({
 											title: '上传中'
 										})
 										uni.uploadFile({
-											url: that.config('APIHOST') + '/alioss/upload',
+											url: that.config('APIHOST') + '/app/new-file/upload',
 											filePath: resPath,
 											header: {
 												token: token

+ 5 - 1
pages/order/feedback.vue

@@ -230,13 +230,17 @@ export default {
 						//初始绘画区域是画布自身的宽度也就是屏幕宽度
 						let drawWidth = uni.getSystemInfoSync().windowWidth
 						let that = this
+						let token = uni.getStorageSync('token')
 						getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, that, (resPath) => {
 							uni.showLoading({
 								title: '上传中'
 							})
 							uni.uploadFile({
-								url: configUrl.APIHOST + '/alioss/upload',
+								url: configUrl.APIHOST + '/app/new-file/upload',
 								filePath: resPath,
+								header: {
+									token: token
+								},
 								name: 'file',
 								success: (uploadFileRes) => {
 									if (this.shopBanner.length < 9) {

+ 5 - 1
pages/order/feedbacks.vue

@@ -138,13 +138,17 @@ export default {
 						//初始绘画区域是画布自身的宽度也就是屏幕宽度
 						let drawWidth = uni.getSystemInfoSync().windowWidth
 						let that = this
+						let token = uni.getStorageSync('token')
 						getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, that, (resPath) => {
 							uni.showLoading({
 								title: '上传中'
 							})
 							uni.uploadFile({
-								url: configUrl.APIHOST + '/alioss/upload',
+								url: configUrl.APIHOST + '/app/new-file/upload',
 								filePath: resPath,
+								header: {
+									token: token
+								},
 								name: 'file',
 								success: (uploadFileRes) => {
 									if (that.shopBanner.length < 9) {

+ 4 - 0
pages/public/login.vue

@@ -274,6 +274,10 @@
 			//登录
 			login(nickName, avatarUrl, sex) {
 				let that = this;
+				uni.showLoading({
+					title: '登录中...',
+					mask: true // 是否显示透明蒙层,防止触摸穿透
+				})
 				// 1.wx获取登录用户code
 				uni.login({
 					provider: 'weixin',