From 51b7757f81143d6c7bdcbd713c07ff7e29a4a991 Mon Sep 17 00:00:00 2001 From: meo <18801474720@163.com> Date: Fri, 21 Jun 2019 16:21:27 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=9B=BE=E7=89=87=E4=B8=8A=E4=BC=A0][?= =?UTF-8?q?=E4=BF=AE=E6=94=B9]:[=E6=B4=BB=E5=8A=A8=E6=8A=A5=E5=90=8D?= =?UTF-8?q?=E7=9A=84=E5=9B=BE=E7=89=87=E4=B8=8A=E4=BC=A0]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.js | 2 ++ pages/radetail/joinActivity/edit.js | 29 +++++++++++++++++++++++++++ pages/radetail/joinActivity/edit.wxml | 6 ++++++ pages/radetail/joinActivity/edit.wxss | 13 ++++++++++++ 4 files changed, 50 insertions(+) diff --git a/config/config.js b/config/config.js index 924c5e3..fc2451e 100755 --- a/config/config.js +++ b/config/config.js @@ -14,6 +14,8 @@ var config = { * 授权后获取用户的昵称,unionId等信息 */ getUserInfo: "/user/getUserInfo", + //图片上传 + imgUpload: '/upload/awsFileUpload', /** * 接口用途:授权后获取用户的手机号 */ diff --git a/pages/radetail/joinActivity/edit.js b/pages/radetail/joinActivity/edit.js index bc75814..28ef30c 100644 --- a/pages/radetail/joinActivity/edit.js +++ b/pages/radetail/joinActivity/edit.js @@ -1,6 +1,7 @@ const util = require("../../../utils/util.js"); const Http = require("../../../utils/HttpBasics"); const config = require("../../../config/config"); +let app = getApp(); Page({ /** * 页面的初始数据 @@ -10,6 +11,7 @@ Page({ flag: 1, answerflag: "", flagsex: 0, + useImg:0, items: [{ name: 1, value: '男', @@ -184,6 +186,30 @@ Page({ that.getDetail(options.activityId); } }, + uploadImg() { + let that = this; + wx.chooseImage({ + success(res) { + const tempFilePaths = res.tempFilePaths + console.log(config.api.imgUpload) + console.log(res) + wx.uploadFile({ + url: config.api.imgUpload, // 仅为示例,非真实的接口地址 + filePath: tempFilePaths[0], + name: 'file', + header: { + 'token': app.globalData.token + }, + success(res) { + const data = res.data + that.setData({ + receiptUrl: JSON.parse(res.data).data.url + }) + } + }) + } + }) + }, getDetail(activityId) { let that = this; Http.get({ @@ -193,6 +219,9 @@ Page({ } }).then(res => { if (res && res.data && res.data.activity) { + this.setData({ + useImg: res.data.activity.useImg + }) if (res.data && res.data.activity && res.data.activity.question) { that.setData({ question: JSON.parse(res.data.activity.question) diff --git a/pages/radetail/joinActivity/edit.wxml b/pages/radetail/joinActivity/edit.wxml index ca09bf7..324e427 100644 --- a/pages/radetail/joinActivity/edit.wxml +++ b/pages/radetail/joinActivity/edit.wxml @@ -31,5 +31,11 @@ + + + + + + + \ No newline at end of file diff --git a/pages/radetail/joinActivity/edit.wxss b/pages/radetail/joinActivity/edit.wxss index 4ec1e11..d158e1b 100644 --- a/pages/radetail/joinActivity/edit.wxss +++ b/pages/radetail/joinActivity/edit.wxss @@ -17,6 +17,19 @@ input { margin: 0 auto; border-bottom: 1px solid #eee; } +.camera{ + width: 400rpx; + height: 400rpx; + line-height: 400rpx; + margin: 30rpx auto 0; + border: 1px dotted orange; +} +.camera text{ + display: block; + text-align: center; + font-size: 200rpx; + color: orange; +} .address{ width: 710rpx; margin: 0 auto;