小程序源码

This commit is contained in:
mindskip
2020-09-02 08:44:41 +08:00
parent 30b54a23ff
commit 593017f562
277 changed files with 5497 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
const app = getApp()
Page({
data: {
spinShow: false,
info: {}
},
onLoad: function(options) {
this.loadUserInfo()
},
loadUserInfo() {
let _this = this
_this.setData({
spinShow: true
});
app.formPost('/api/wx/student/user/current', null).then(res => {
if (res.code == 1) {
_this.setData({
info: res.response
});
}
_this.setData({
spinShow: false
});
}).catch(e => {
_this.setData({
spinShow: false
});
app.message(e, 'error')
})
},
logOut() {
let _this = this
_this.setData({
spinShow: true
});
app.formPost('/api/wx/student/auth/unBind', null).then(res => {
if (res.code == 1) {
wx.setStorageSync('token', '')
wx.reLaunch({
url: '/pages/user/bind/index',
});
}
_this.setData({
spinShow: false
});
}).catch(e => {
_this.setData({
spinShow: false
});
app.message(e, 'error')
})
}
})

View File

@@ -0,0 +1,9 @@
{
"usingComponents": {
"i-cell-group": "/component/iView/cell-group/index",
"i-cell": "/component/iView/cell/index",
"i-icon": "/component/iView/icon/index",
"i-message": "/component/iView/message/index",
"i-spin": "/component/iView/spin/index"
}
}

View File

@@ -0,0 +1,46 @@
<view class="userinfo">
<block>
<image class="userinfo-avatar" src="{{info.imagePath}}"></image>
<text class="userinfo-nickname">{{info.userName}}</text>
</block>
</view>
<view>
<i-cell-group i-class="my-group-margin">
<i-cell title="个人资料" is-link url="/pages/my/info/index">
<i-icon type="mine_fill" slot="icon" size="20" />
</i-cell>
<i-cell title="个人动态" is-link url="/pages/my/log/index">
<i-icon type="collection_fill" slot="icon" size="20" />
</i-cell>
<i-cell title="消息" is-link url="/pages/my/message/list/index">
<i-icon type="message_fill" slot="icon" size="20" />
</i-cell>
</i-cell-group>
</view>
<view>
<i-cell-group i-class="my-group-margin">
<i-cell title="设置" is-link url="/pages/dashboard/index">
<i-icon type="setup_fill" slot="icon" size="20" />
</i-cell>
<i-cell title="反馈" is-link url="/pages/dashboard/index">
<i-icon type="praise_fill" slot="icon" size="20" />
</i-cell>
<i-cell title="关于" is-link url="/pages/dashboard/index">
<i-icon type="prompt_fill" slot="icon" size="20" />
</i-cell>
</i-cell-group>
</view>
<view>
<i-cell-group i-class="my-group-margin">
<i-cell title="退出账号" bind:click="logOut">
<i-icon type="flashlight_fill" slot="icon" size="20" />
</i-cell>
</i-cell-group>
</view>
<view class="copyright">武汉思维跳跃科技有限公司 提供技术支持</view>
<i-spin size="large" fix wx:if="{{ spinShow }}"></i-spin>
<i-message id="message" />

View File

@@ -0,0 +1,32 @@
/**index.wxss**/
.userinfo {
display: flex;
flex-direction: row;
align-items: center;
background: #598ce4;
height: 100px;
}
.userinfo-avatar {
width: 48px;
height: 48px;
margin-left: 30px;
}
.userinfo-nickname {
color: white;
margin-left: 20px;
}
.my-group-margin{
margin-top: 10px;
}
.copyright{
color: #8c8c8c;
text-align: center;
margin-top: 20px;
font-size: 14px;
}