From 9bebc27e1aac000446ec144ecc7d06fae6af79ac Mon Sep 17 00:00:00 2001 From: luo <17530855@qq.com> Date: Sat, 3 Jun 2023 17:43:54 +0800 Subject: [PATCH] oa单 --- app.json | 4 ++++ packageA/pages/profile/profile.js | 23 +++++++++++++++++++++-- packageA/pages/profile/profile.wxml | 3 ++- packageE/pages/user/nick_avatar_add/nick_avatar_add.js | 137 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ packageE/pages/user/nick_avatar_add/nick_avatar_add.json | 4 ++++ packageE/pages/user/nick_avatar_add/nick_avatar_add.wxml | 25 +++++++++++++++++++++++++ packageE/pages/user/nick_avatar_add/nick_avatar_add.wxss | 30 ++++++++++++++++++++++++++++++ pages/user/userinfo/userinfo.js | 2 +- 8 files changed, 224 insertions(+), 4 deletions(-) create mode 100644 packageE/pages/user/nick_avatar_add/nick_avatar_add.js create mode 100644 packageE/pages/user/nick_avatar_add/nick_avatar_add.json create mode 100644 packageE/pages/user/nick_avatar_add/nick_avatar_add.wxml create mode 100644 packageE/pages/user/nick_avatar_add/nick_avatar_add.wxss diff --git a/app.json b/app.json index ef5cf8f..153f35a 100644 --- a/app.json +++ b/app.json @@ -211,6 +211,7 @@ "pages/user/user_fw/user_fw", "pages/user/cardinfo/cardinfo", "pages/user/nick_avatar/nick_avatar", + "pages/user/nick_avatar_add/nick_avatar_add", "pages/user/slimming/slimming", "pages/user/punchInhistory/punchInhistory", "pages/user/grow_value/grow_value", @@ -297,6 +298,9 @@ "usingComponents": { "customtabbar": "custom-tab-bar/index" }, + "requiredPrivateInfos":[ + "getLocation" + ], "useExtendedLib": { "weui": true }, diff --git a/packageA/pages/profile/profile.js b/packageA/pages/profile/profile.js index f332d06..5747b04 100644 --- a/packageA/pages/profile/profile.js +++ b/packageA/pages/profile/profile.js @@ -474,7 +474,16 @@ Page({ choice_sort_store: 0 }); }, - + // 获取用户头像昵称 + getUserProfile(e) { + var th = this; + var ob={ + nickname:this.data.nickname, + head_pic:this.data.head_pic, + } + getApp().globalData.up_nick_avatar=ob; + getApp().goto('/packageE/pages/user/nick_avatar_add/nick_avatar_add'); + }, //身份证号严格校验 IdentityIDCard: function (e) { @@ -783,6 +792,13 @@ Page({ choice_guide = JSON.parse(JSON.stringify(getApp().globalData.choice_guide)); getApp().globalData.choice_guide = null; } + //获取头像和昵称 + let nick_obj = wx.getStorageSync('nick_obj') + if (nick_obj && nick_obj.head_pic && nick_obj.nickname) { + this.setData({head_pic: nick_obj.head_pic, nickname: nick_obj.nickname}) + wx.removeStorageSync('nick_obj') + } + }, getIsBool(){ @@ -1365,7 +1381,10 @@ Page({ app.my_warnning("请您先阅读和勾选指定的内容", 0, this); return false; } - + let uu = getApp().globalData.zc_dd; + uu.head_pic=this.data.head_pic + uu.nickname=this.data.nickname + getApp().globalData.zc_dd=uu var post_data = {...getApp().globalData.zc_dd, ...data}; delete post_data.sessionKey; diff --git a/packageA/pages/profile/profile.wxml b/packageA/pages/profile/profile.wxml index b243c54..9277f88 100644 --- a/packageA/pages/profile/profile.wxml +++ b/packageA/pages/profile/profile.wxml @@ -17,8 +17,9 @@ + - + diff --git a/packageE/pages/user/nick_avatar_add/nick_avatar_add.js b/packageE/pages/user/nick_avatar_add/nick_avatar_add.js new file mode 100644 index 0000000..22a200c --- /dev/null +++ b/packageE/pages/user/nick_avatar_add/nick_avatar_add.js @@ -0,0 +1,137 @@ +// pages/user/userfw/userfw.js +var e = getApp(), os = e.globalData.setting; +var utils = require('../../../../utils/util.js'); +var regeneratorRuntime = require('../../../../utils/runtime.js'); + + +Page({ + /** + * 页面的初始数据 + */ + data: { + defaultAvatar: os.imghost + "/miniapp/images/no-head.jpg", + ob: {}, + load: 0 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + if(getApp().globalData.up_nick_avatar){ + this.setData({ + ob: JSON.parse(JSON.stringify(getApp().globalData.up_nick_avatar)) + }) + getApp().globalData.up_nick_avatar=null; + } + + }, + /** + * 生命周期函数--监听页面显示 + */ + onShow: async function () { + + }, + + + onChooseAvatar: function (e) { + console.log(e, 1111); + var th = this; + getApp().request.uploadFile(os.url + "/api/weshop/comment/uploadCommentImg", { + filePath: e.detail.avatarUrl, + name: "file", + success: function (t) { + var u = t.data.data; + th.setData({'ob.head_pic': u}) + } + }); + + }, + + get_val: function (e) { + console.log(e, 2222); + this.setData({'ob.nickname': e.detail.value}) + }, + + save_data() { + + var that=this; + setTimeout(()=>{ + if (!this.data.ob.head_pic) { + wx.showToast({ + title: '请选择头像', + icon: 'none', + duration: 2000 + }); + return false; + } + + if (!this.data.ob.nickname) { + wx.showToast({ + title: '请输入昵称', + icon: 'none', + duration: 2000 + }); + return false; + } + + if (this.data.load) return false; + this.setData({load: 1}) + + wx.showLoading(); + + getApp().request.put("/api/weshop/users/update", { + data: { + store_id: os.stoid, + user_id: getApp().globalData.user_id, + nickname: this.data.ob.nickname, + head_pic: this.data.ob.head_pic + + }, + success: function (su) { + + setTimeout(()=>{ + wx.hideLoading(); + if (su.data.code == 0) { + wx.navigateBack({delta: 1}) + }else{ + that.setData({load: 0}) + wx.showToast({ + title: su.data.msg, + icon: 'none', + duration: 2000 + }); + } + },1000) + + + } + }); + },500) + + + }, + save_cell(){ + if (!this.data.ob.head_pic) { + wx.showToast({ + title: '请选择头像', + icon: 'none', + duration: 2000 + }); + return false; + } + if (!this.data.ob.nickname) { + wx.showToast({ + title: '请输入昵称', + icon: 'none', + duration: 2000 + }); + return false; + } + if (this.data.load) return false; + this.setData({load: 1}) + wx.setStorageSync('nick_obj', this.data.ob) + wx.navigateBack() + } + +}) \ No newline at end of file diff --git a/packageE/pages/user/nick_avatar_add/nick_avatar_add.json b/packageE/pages/user/nick_avatar_add/nick_avatar_add.json new file mode 100644 index 0000000..5abf709 --- /dev/null +++ b/packageE/pages/user/nick_avatar_add/nick_avatar_add.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "个人信息", + "usingComponents": {} +} \ No newline at end of file diff --git a/packageE/pages/user/nick_avatar_add/nick_avatar_add.wxml b/packageE/pages/user/nick_avatar_add/nick_avatar_add.wxml new file mode 100644 index 0000000..40aa033 --- /dev/null +++ b/packageE/pages/user/nick_avatar_add/nick_avatar_add.wxml @@ -0,0 +1,25 @@ + + + 头像 + + + + + 昵称 + + + + + + + + + + + 确认 + + + + \ No newline at end of file diff --git a/packageE/pages/user/nick_avatar_add/nick_avatar_add.wxss b/packageE/pages/user/nick_avatar_add/nick_avatar_add.wxss new file mode 100644 index 0000000..c8665ea --- /dev/null +++ b/packageE/pages/user/nick_avatar_add/nick_avatar_add.wxss @@ -0,0 +1,30 @@ +.avatar_btn{ width: 60rpx !important; height: 60rpx !important; border-radius:50%; border: none !important; + margin-left:0 !important;margin-right: 0 !important; } +.head_img{ width: 60rpx; height: 60rpx; border-radius: 50%} + +.page_set{ border-top: 20rpx solid #eee; } +.item{ height: 80rpx; border-bottom: 1rpx solid #eee;padding:0 20rpx} +.nick_inp{ text-align: right; color: #999} + + +.confirm { + width: 100%; + left: 0rpx; + bottom: 0rpx; + height: 130rpx; + background-color: rgb(255, 255, 255); + z-index: 9; + +} + +.confirmtext { + width: 495rpx; + height: 65rpx; + color: rgb(255, 255, 255); + background-color: rgb(214, 1, 33); + border-radius: 35rpx; +} + +.load{ + background-color:#eee !important; +} \ No newline at end of file diff --git a/pages/user/userinfo/userinfo.js b/pages/user/userinfo/userinfo.js index a89e846..370e3a3 100644 --- a/pages/user/userinfo/userinfo.js +++ b/pages/user/userinfo/userinfo.js @@ -5,7 +5,7 @@ function e(e, a, r) { configurable: !0, writable: !0 }) : e[a] = r, e; -} +} var a = getApp(), r = a.globalData.setting, -- libgit2 0.21.4