作者 wxy071800

@@ -31,36 +31,21 @@ Page({ @@ -31,36 +31,21 @@ Page({
31 sourceType: ['album', 'camera'], 31 sourceType: ['album', 'camera'],
32 success: function (res) { 32 success: function (res) {
33 const filePath = res.tempFilePaths[0]; 33 const filePath = res.tempFilePaths[0];
34 - // var filePath = res.tempFilePaths[0];  
35 that.setData({ 34 that.setData({
36 photoPath: filePath 35 photoPath: filePath
37 }); 36 });
38 - // var filePath = res.tempFilePaths[0];  
39 - // 交给七牛上传  
40 qiniuUploader.upload(filePath, (res) => { 37 qiniuUploader.upload(filePath, (res) => {
41 console.log(res) 38 console.log(res)
42 - // 每个文件上传成功后,处理相关的事情  
43 - // 其中 info 是文件上传成功后,服务端返回的json,形式如  
44 - // {  
45 - // "hash": "Fh8xVqod2MQ1mocfI4S4KpRL6D98",  
46 - // "key": "gogopher.jpg"  
47 - // }  
48 - // 参考http://developer.qiniu.com/docs/v6/api/overview/up/response/simple-response.html  
49 let a ='http://qiniu.himrhi.com/'+res.key 39 let a ='http://qiniu.himrhi.com/'+res.key
50 that.setData({ 40 that.setData({
51 key: a 41 key: a
52 }); 42 });
53 - console.log(a)  
54 - // console.log(that.data.key + "新的")  
55 }, (error) => { 43 }, (error) => {
56 console.log('error: ' + error); 44 console.log('error: ' + error);
57 }, { 45 }, {
58 region: 'ECN', 46 region: 'ECN',
59 - domain: 'qiniu.himrhi.com', // // bucket 域名,下载资源时用到。如果设置,会在 success callback 的 res 参数加上可以直接使用的 ImageURL 字段。否则需要自己拼接  
60 - // key: 'customFileName.jpg', // [非必须]自定义文件 key。如果不设置,默认为使用微信小程序 API 的临时文件名  
61 - // 以下方法三选一即可,优先级为:uptoken > uptokenURL > uptokenFunc  
62 - // uptoken: 'JMgHPK8vEdZfUfxZIW8qIsyucRCZeTZ4aqHLWsjI:9VjchzcKJTa9uqK_0MWELzc4_zg=:eyJzY29wZSI6ImhpLWZyZXNoIiwiZGVhZGxpbmUiOjE1NjA3MzU3ODF9', // 由其他程序生成七牛 uptoken  
63 - uptokenURL: 'http://www.himrhi.com/api/wxapp/public/getQiniuToken', // 从指定 url 通过 HTTP GET 获取 uptoken,返回的格式必须是 json 且包含 uptoken 字段,例如: {"uptoken": "[yourTokenString]"} 47 + domain: 'qiniu.himrhi.com',
  48 + uptokenURL: 'http://www.himrhi.com/api/wxapp/public/getQiniuToken',
64 uptokenFunc: function () { return 'JMgHPK8vEdZfUfxZIW8qIsyucRCZeTZ4aqHLWsjI:9VjchzcKJTa9uqK_0MWELzc4_zg=:eyJzY29wZSI6ImhpLWZyZXNoIiwiZGVhZGxpbmUiOjE1NjA3MzU3ODF9'; } 49 uptokenFunc: function () { return 'JMgHPK8vEdZfUfxZIW8qIsyucRCZeTZ4aqHLWsjI:9VjchzcKJTa9uqK_0MWELzc4_zg=:eyJzY29wZSI6ImhpLWZyZXNoIiwiZGVhZGxpbmUiOjE1NjA3MzU3ODF9'; }
65 }, (res) => { 50 }, (res) => {
66 console.log('上传进度', res.progress) 51 console.log('上传进度', res.progress)
@@ -31,7 +31,6 @@ Page({ @@ -31,7 +31,6 @@ Page({
31 var myreg = /^[1][3,4,5,7,8][0-9]{9}$/; 31 var myreg = /^[1][3,4,5,7,8][0-9]{9}$/;
32 let username = that.data.username; 32 let username = that.data.username;
33 let st=that.data.st 33 let st=that.data.st
34 - console.log(username)  
35 if (!myreg.test(username)) { 34 if (!myreg.test(username)) {
36 wx.showToast({ 35 wx.showToast({
37 title: '请输入合法的手机号', 36 title: '请输入合法的手机号',
@@ -5,3 +5,4 @@ @@ -5,3 +5,4 @@
5 </view> 5 </view>
6 <button open-type='getUserInfo' bindgetuserinfo='getUserInfo' class='color'>立即开启</button> 6 <button open-type='getUserInfo' bindgetuserinfo='getUserInfo' class='color'>立即开启</button>
7 </view> 7 </view>
  8 +