2312970463@qq.com 3 yıl önce
ebeveyn
işleme
aed3a08a34
3 değiştirilmiş dosya ile 52 ekleme ve 25 silme
  1. 42 18
      config/app.js
  2. 8 5
      pages/set/set.vue
  3. 2 2
      utils/util.js

+ 42 - 18
config/app.js

@@ -1,18 +1,42 @@
-module.exports = {
-	// 请求域名 格式: https://您的域名
-	
-	HTTP_REQUEST_URL:'http://zccy.liuniu946.com',
-
-	
-	
-	// #ifdef H5
-	// HTTP_REQUEST_URL: window.location.protocol+"//"+window.location.host,
-	// #endif
-	HEADER:{
-		'content-type': 'application/json'
-	},
-	// 回话密钥名称 请勿修改此配置
-	TOKENNAME: 'Authori-zation',
-	// 缓存时间 0 永久
-	EXPIRE:0,
-};
+// #ifdef H5
+let VUE_APP_WS_URL = `ws://${location.hostname}?type=user`
+// #endif
+
+// 网络接口修改此字符 小程序域名要求https
+
+let httpApi = '' //测试站
+// let httpApi = 'http://192.168.31.50:8324' //本地
+
+// let httpApi = 'https://mer.crmeb.net'
+// let httpApi = ''
+
+
+
+
+// 聊天接口修改此字符 小程序聊天要求wss 例如:wss://mer.crmeb.net
+let wsApi = ''
+// let wsApi = 'wss://192.168.31.50:8324'
+
+module.exports = {
+	// 请求域名 格式: https://您的域名
+	// #ifdef MP
+	// HTTP_REQUEST_URL: httpApi,
+	HTTP_REQUEST_URL: httpApi,
+	VUE_APP_WS_URL: `${wsApi}?type=user`,
+	// #endif
+
+	// #ifdef H5
+	//H5接口是浏览器地址
+	HTTP_REQUEST_URL: httpApi || window.location.protocol + "//" + window.location.host,
+	// 聊天长连接地址
+	VUE_APP_WS_URL: wsApi ? `${wsApi}?type=user` : VUE_APP_WS_URL,
+	// #endif
+
+	HEADER: {
+		'content-type': 'application/json'
+	},
+	// 回话密钥名称 请勿修改此配置
+	TOKENNAME: 'X-Token',
+	// 缓存时间 0 永久
+	EXPIRE: 0,
+};

+ 8 - 5
pages/set/set.vue

@@ -114,7 +114,8 @@
   			// nickName:'李淡淡',
   			// id:'HFBNXISN',
   			// account:'13745262356',
-  			userInfo:'',
+  			userInfo:{},
+			pics:[]
   		};
   	},
   	onLoad() {
@@ -143,13 +144,15 @@
   				}
   			});
   		},
-  		imgsub() {
+  		imgsub() {
+			let obj = this
   			console.log('上传头像')
 			this.$util.uploadImageOne('upload/image', function(res) {
 				console.log('------',res);
-				this.pics.push(res.data.path);
-				this.$set(this, 'pics', this.pics);
-				this.$set(this, 'extract_pic', this.pics[0])
+				// this.pics.push(res.data.pathreplace(/http:\/\/mer.crmeb.net/,'http://zccy.liuniu946.com'));
+				obj.userInfo.avatar = res.data.path.replace(/http:\/\/mer.crmeb.net/,'http://zccy.liuniu946.com')
+				// obj.$set(this, 'pics', this.pics);
+				// obj.$set(this, 'extract_pic', this.pics[0])
 			});
   			// uploads({
   			// 	filename: ''

+ 2 - 2
utils/util.js

@@ -254,7 +254,7 @@ import {
  			sourceType = opt.sourceType || ['album', 'camera'],
  			is_load = opt.is_load || true,
  			uploadUrl = opt.url || '',
- 			inputName = opt.name || 'pics';
+ 			inputName = opt.name || 'field';
  		uni.chooseImage({
  			count: count, //最多可以选择的图片总数  
  			sizeType: sizeType, // 可以指定是原图还是压缩图,默认二者都有  
@@ -268,7 +268,7 @@ import {
  				});
 				console.log('----url',HTTP_REQUEST_URL + '/api/' + uploadUrl)
 				uni.uploadFile({
-					url: HTTP_REQUEST_URL + '/api/' + uploadUrl,
+					url: HTTP_REQUEST_URL + '/api/' + uploadUrl + '/' + inputName,
 					filePath: res.tempFilePaths[0],
 					name: inputName,
 					formData: {