Skip to content

Commit

Permalink
refactor: 使用 open-data 替换 getUserInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
airingursb committed Jan 8, 2019
1 parent 175a4e9 commit 57fed47
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 26 deletions.
9 changes: 8 additions & 1 deletion README.md
Expand Up @@ -46,4 +46,11 @@
### v1.0.5

1. 本地词库增加至1000词
2. 修复帮助页面信息显示错误
2. 修复帮助页面信息显示错误

### v1.0.6

1. 更新播放音频功能
2. “下一个”单词优化

感谢 [@PaiGuFan](https://github.com/PaiGuFan) 的 PR。
23 changes: 0 additions & 23 deletions pages/settings/settings.js
@@ -1,29 +1,6 @@
var app = getApp()

Page({
data: {
userInfo: {}
},
onLoad: function (options) {
// 生命周期函数--监听页面加载
console.log('onLoad')
var that = this
//调用应用实例的方法获取全局数据
app.getUserInfo(function (userInfo) {
//更新数据
that.setData({
userInfo: userInfo
})
})
},
onShareAppMessage: function () {
// 用户点击右上角分享
return {
title: '', // 分享标题
desc: '', // 分享描述
path: '' // 分享路径
}
},
showMyWord: function () {
wx.showModal({
title: '提示',
Expand Down
7 changes: 5 additions & 2 deletions pages/settings/settings.wxml
@@ -1,7 +1,10 @@
<view class="container">
<view bindtap="bindViewTap" class="userinfo">
<image class="userinfo-avatar" src="{{userInfo.avatarUrl}}" background-size="cover"></image>
<text class="userinfo-nickname">{{userInfo.nickName}}</text>
<view class="userinfo-avatar">
<open-data type="userAvatarUrl"></open-data>
</view>

<open-data class="userinfo-nickname" type="userNickName"></open-data>
</view>
<view class="list-container">
<!--<view class="list-item" bindtap="showMyWord">
Expand Down
2 changes: 2 additions & 0 deletions pages/settings/settings.wxss
Expand Up @@ -14,6 +14,8 @@
}

.userinfo-avatar {
overflow:hidden;
display: block;
width: 168rpx;
height: 168rpx;
margin-top: 124rpx;
Expand Down
40 changes: 40 additions & 0 deletions project.config.json
@@ -0,0 +1,40 @@
{
"description": "项目配置文件",
"packOptions": {
"ignore": []
},
"setting": {
"urlCheck": true,
"es6": true,
"postcss": true,
"minified": true,
"newFeature": true,
"autoAudits": false
},
"compileType": "miniprogram",
"libVersion": "2.4.2",
"appid": "wx47817ec9c247735b",
"projectname": "%E5%92%A9%E5%92%A9%E5%8D%95%E8%AF%8D",
"debugOptions": {
"hidedInDevtools": []
},
"isGameTourist": false,
"condition": {
"search": {
"current": -1,
"list": []
},
"conversation": {
"current": -1,
"list": []
},
"game": {
"currentL": -1,
"list": []
},
"miniprogram": {
"current": -1,
"list": []
}
}
}

0 comments on commit 57fed47

Please sign in to comment.