|
@@ -1,46 +1,124 @@
|
|
|
<template>
|
|
|
- <!-- pages/me.wxml -->
|
|
|
+ <!-- pages/me.wxml -->
|
|
|
+ <view class="uni-container">
|
|
|
+ <view class="uni-header-logo">
|
|
|
+ <img class="uni-header-image" :src="initInfo.headImg == null || initInfo.headImg == '' ? 'http://116.142.80.12:9000/10_03.png' : initInfo.headImg" />
|
|
|
+ <span>{{initInfo.name == null || initInfo.name == '' ? initInfo.wechatName : initInfo.name}}</span>
|
|
|
+ <text>{{initInfo.scoreNum}}</text>
|
|
|
+ </view>
|
|
|
+ <view class="uni-panel" v-for="(item, index) in list" :key="item.id">
|
|
|
+ <view class="uni-panel-h" :class="item.open ? 'uni-panel-h-on' : ''" @click="goDetailPage(index, item.id)">
|
|
|
+ <text class="uni-panel-text">{{item.name}}</text>
|
|
|
+ <text class="uni-panel-icon uni-icon" :class="item.open ? 'uni-panel-icon-on' : ''">{{item.pages ? '' : ''}}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import {getScore, getUserInfo} from '@/api/me/me.js'
|
|
|
// pages/me.js
|
|
|
export default {
|
|
|
- data() {
|
|
|
- return {};
|
|
|
- }
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面加载
|
|
|
- */,
|
|
|
- onLoad(options) {},
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面初次渲染完成
|
|
|
- */
|
|
|
- onReady() {},
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面显示
|
|
|
- */
|
|
|
- onShow() {},
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面隐藏
|
|
|
- */
|
|
|
- onHide() {},
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面卸载
|
|
|
- */
|
|
|
- onUnload() {},
|
|
|
- /**
|
|
|
- * 页面相关事件处理函数--监听用户下拉动作
|
|
|
- */
|
|
|
- onPullDownRefresh() {},
|
|
|
- /**
|
|
|
- * 页面上拉触底事件的处理函数
|
|
|
- */
|
|
|
- onReachBottom() {},
|
|
|
- /**
|
|
|
- * 用户点击右上角分享
|
|
|
- */
|
|
|
- onShareAppMessage() {},
|
|
|
- methods: {}
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ initInfo:{
|
|
|
+ userId: null,
|
|
|
+ scoreNum: 0,
|
|
|
+ wechatName: "微信用户",
|
|
|
+ name: null,
|
|
|
+ headImg: null,
|
|
|
+ },
|
|
|
+ list: [
|
|
|
+ {
|
|
|
+ id: 'me/meOperate',//id是文件路径
|
|
|
+ name: '我的积分流水',
|
|
|
+ open: false,
|
|
|
+ pages: ['meOperate']
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 'wenba/wenba',
|
|
|
+ name: '我的问答',
|
|
|
+ open: false,
|
|
|
+ pages: ['meOperate']
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ };
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面加载
|
|
|
+ */ onLoad(options) {},
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面初次渲染完成
|
|
|
+ */
|
|
|
+ onReady() {
|
|
|
+ this.userId = getApp().globalData.userId
|
|
|
+ this.getUserInfoByUserId(this.userId)
|
|
|
+ this.getScoreForMe(this.userId)
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面显示
|
|
|
+ */
|
|
|
+ onShow() {},
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面隐藏
|
|
|
+ */
|
|
|
+ onHide() {},
|
|
|
+ /**
|
|
|
+ * 生命周期函数--监听页面卸载
|
|
|
+ */
|
|
|
+ onUnload() {},
|
|
|
+ /**
|
|
|
+ * 页面相关事件处理函数--监听用户下拉动作
|
|
|
+ */
|
|
|
+ onPullDownRefresh() {},
|
|
|
+ /**
|
|
|
+ * 页面上拉触底事件的处理函数
|
|
|
+ */
|
|
|
+ onReachBottom() {},
|
|
|
+ /**
|
|
|
+ * 用户点击右上角分享
|
|
|
+ */
|
|
|
+ onShareAppMessage() {},
|
|
|
+ methods: {
|
|
|
+ goDetailPage(panel, e) {
|
|
|
+ if (typeof e === 'string') {
|
|
|
+ const url = '/pages/' + e
|
|
|
+ if (this.hasLeftWin) {
|
|
|
+ uni.reLaunch({
|
|
|
+ url: url
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: url
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (this.hasLeftWin) {
|
|
|
+ uni.reLaunch({
|
|
|
+ url: e.url
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: e.url
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //获取用户信息:用户名称:头像
|
|
|
+ getUserInfoByUserId(userId){
|
|
|
+ getUserInfo(userId).then(res =>{
|
|
|
+ this.initInfo.wechatName = res.data.wechatName;
|
|
|
+ this.initInfo.name = res.data.name;
|
|
|
+ this.initInfo.wechatName = res.data.wechatName;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //获取当前积分
|
|
|
+ getScoreForMe(userId){
|
|
|
+ getScore(this.userId).then(res =>{
|
|
|
+ this.initInfo.socreNum = res.data.scoreNum
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
};
|
|
|
</script>
|
|
|
<style>
|