123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- const app = getApp();
- Page({
- data: {
- information: '',
- optioninfo:'',
- houselunbo:'',
-
- adopticon:'',
- headurl: [],
-
- },
- onShow: function (options) {
- var that = this;
-
- let information_url = 'my/personaldata/personal';
- let information_data = {
- };
- app.postRequest(information_url, information_data, function (res) {
- if (res.code == 201) {
-
- that.setData({
- information: res.data
- })
- }
- })
-
-
- let optioninfo_url = 'my/personaloption/optioninfo';
- let optioninfo_data = {
- };
- app.postRequest(optioninfo_url, optioninfo_data, function (res) {
-
- if (res.code == 201) {
- that.setData({
- optioninfo: res.data,
- optioninfocode:res,
- })
- }
- })
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- let adopticon_url = 'my/authentication/adopticon';
- let adopticon_data = {
- };
- app.postRequest(adopticon_url, adopticon_data, function (res) {
- console.log(res.data);
-
- if (res.code == 201) {
- that.setData({
- adopticon: res.data,
- adopticoncode: res,
- })
- }
- })
-
- let headurl_url = 'my/images/headurl';
- let headurl_data = {
- };
- app.postRequest(headurl_url, headurl_data, function (res) {
- if (res.code == 201) {
-
- that.setData({
- headurl: res.data
- })
- }
-
- })
-
- },
-
- chooseImageTap: function (e) {
- var _this = this;
- wx.showActionSheet({
- itemList: ['预览图片', '上传头像'],
- success(res) {
-
- if (res.tapIndex == 0) {
-
-
-
- wx.previewImage({
- urls: [e.currentTarget.dataset.src],
- current: e.currentTarget.dataset.src
- })
- }
- if (res.tapIndex == 1) {
-
- wx.chooseImage({
- count: 1,
- sizeType: ['original', 'compressed'],
- sourceType: ['album', 'camera'],
- success(res) {
- let tempFilesSize = res.tempFiles[0].size;
- if (tempFilesSize > 1024 * 1024 * 3) {
- wx.showModal({
- title: '提示',
- content: '图片不得超过3MB',
- showCancel: false,
- })
- return;
- }
- var Headportrait = res.tempFilePaths[0];
-
-
- wx.uploadFile({
- url: app.globalData.url + 'my/images/headimg',
- filePath: Headportrait,
- name: 'photo',
- formData: {
- key: wx.getStorageSync('access_key'),
- token: wx.getStorageSync('access_token')
- },
- success: function (res) {
- var data = JSON.parse(res.data);
- console.log(data);
- if (data.code == 201) {
- var _qrcode = '上传成功'
- getApp().Tips(_qrcode);
- _this.onShow();
- return;
- }
- var _qrcode2 = data.msg;
- getApp().Tips(_qrcode2);
- }, fail: function (d) {
- }
- })
- }
- })
- }
- },
- fail(res) {
- console.log(res.errMsg)
- }
- })
- },
-
- })
|