Browse Source

小程序我的页面功能实现

h5_css
yanyan 3 years ago
parent
commit
d7ba590a91
  1. 2
      pages/index/index.vue
  2. 19
      pages/my/my.vue
  3. 2
      subpkg/address/address.vue
  4. 33
      subpkg/feedback/feedback.vue
  5. 25
      subpkg/medal/medal.vue

2
pages/index/index.vue

@ -44,7 +44,7 @@
}, },
onLoad() { onLoad() {
this.getSwiperList(); this.getSwiperList();
// this.checkLogin() this.checkLogin()
}, },
onShow() { onShow() {
this.page= "home" this.page= "home"

19
pages/my/my.vue

@ -3,7 +3,7 @@
<!-- 头像和昵称区域 --> <!-- 头像和昵称区域 -->
<view class="top-box"> <view class="top-box">
<image :src="avatarUrl" class="avatar"></image> <image :src="avatarUrl" class="avatar"></image>
<view class="nickname">盛大鹏</view> <view class="nickname">{{name}}</view>
</view> </view>
<!-- 面板区域 --> <!-- 面板区域 -->
@ -12,7 +12,7 @@
<view class="panel"> <view class="panel">
<view class="panel-body"> <view class="panel-body">
<view class="panel-item" @click="showMedal()"> <view class="panel-item" @click="showMedal()">
<text>0</text> <text>{{medalNum}}</text>
<text>勋章</text> <text>勋章</text>
</view> </view>
<view class="panel-item"> <view class="panel-item">
@ -59,7 +59,9 @@
export default { export default {
data() { data() {
return { return {
medalNum:0,
page: "", page: "",
name:"",
avatarUrl: uni.$http.baseUrl + "/profile//2024/01/18/6147d64a3b94d7b3d3cc35aaf8cbfe06.png", avatarUrl: uni.$http.baseUrl + "/profile//2024/01/18/6147d64a3b94d7b3d3cc35aaf8cbfe06.png",
//轮播图数据列表 //轮播图数据列表
swiperList: [], swiperList: [],
@ -68,8 +70,11 @@
}; };
}, },
onLoad() { onLoad() {
this.name = this.userinfo.nickName;
this.avatarUrl = this.userinfo.avatarUrl;
this.getSwiperList() this.getSwiperList()
this.getFunctionList() this.getFunctionList()
this.getMyMedalList()
}, },
onShow() { onShow() {
this.page = "my" this.page = "my"
@ -91,6 +96,16 @@
this.updateToken('') this.updateToken('')
} }
}, },
async getMyMedalList() {
const {
data: res
} = await uni.$http.post('/small/wechat/showMyMedal',{openId:"cpqKnCOSsO+0mWqJI/T1MQ=="})
if (!res.success) return uni.$showMsg()
this.medalNum = res.data.length;
uni.$showMsg('数据请求成功!')
},
async getSwiperList() { async getSwiperList() {
const { const {

2
subpkg/address/address.vue

@ -41,7 +41,7 @@
<!-- 商品的名字 --> <!-- 商品的名字 -->
<view class="goods-name">{{goods.goods_name}}</view> <view class="goods-name">{{goods.goods_name}}</view>
<view class="goods-info-box"> <view class="goods-info-box">
<view class="goods-price">¥{{goods.goods_price | tofixed}}</view> <view class="goods-price"><bV> </bV>{{goods.goods_price | tofixed}}</view>
<uni-number-box :min="1" :value="goods.goods_count" v-if="showNum" @change="numChangeHandler"></uni-number-box> <uni-number-box :min="1" :value="goods.goods_count" v-if="showNum" @change="numChangeHandler"></uni-number-box>
</view> </view>
</view> </view>

33
subpkg/feedback/feedback.vue

@ -23,15 +23,32 @@
}, },
} }
}, },
computed: {
...mapState('m_user', ['userinfo'])
},
methods:{ methods:{
toTable(){ async toTable(){
console.log(this.formData.mobile); if(this.formData.content.length === 0){
console.log(this.formData.content); return uni.$showMsg('请填写您要反馈的内容。')
}, }
setTable(mobile,content){ const mobileReq = this.formData.mobile;
this.formData.mobile = mobile//获取到的名称 const contentReq = this.formData.content;
this.formData.content = content//获取到的单位名称 const req = {
}, content: contentReq,
mobile: mobileReq,
nickname: this.userinfo.nickName,
city: this.userinfo.city
}
const {
data: res
} = await uni.$http.post('/small/project/feedback/add',req)
if (!res.success) return uni.$showMsg()
this.formData.mobile =''
this.formData.content =''
return uni.$showMsg('非常感谢您提出宝贵的建议。我们非常重视您的反馈,会尽快对相关内容进行改进。')
}
} }
} }
</script> </script>

25
subpkg/medal/medal.vue

@ -23,7 +23,7 @@
</view> </view>
<!-- 任务奖章区域 --> <!-- 任务奖章区域 -->
<view class="nav-list" v-else="showMedal == false"> <view class="nav-list" v-else="showMedal == false">
<view class="nav-item" v-for="(item, i) in medalList" :key="i"> <view class="nav-item" v-for="(item, i) in myMedalList" :key="i">
<image :src="item" class="nav-img"></image> <image :src="item" class="nav-img"></image>
</view> </view>
</view> </view>
@ -42,7 +42,8 @@
}; };
}, },
onLoad() { onLoad() {
this.getMedalList() this.getMedalList();
this.getMyMedalList()
}, },
methods: { methods: {
@ -50,12 +51,26 @@
const { const {
data: res data: res
} = await uni.$http.post('/small/scene/manage/listAll',{name:this.name}) } = await uni.$http.post('/small/project/medal/listAll')
if (!res.success) return uni.$showMsg() if (!res.success) return uni.$showMsg()
res.data.forEach(item=>{ res.data.forEach(item=>{
item.uploadPath = uni.$http.baseUrl +item.uploadPath item.iconPath = uni.$http.baseUrl +item.iconPath
this.taskMedalList.push(item.uploadPath) this.taskMedalList.push(item.iconPath)
})
uni.$showMsg('数据请求成功!')
},
async getMyMedalList() {
const {
data: res
} = await uni.$http.post('/small/wechat/showMyMedal',{openId:"cpqKnCOSsO+0mWqJI/T1MQ=="})
if (!res.success) return uni.$showMsg()
res.data.forEach(item=>{
item.iconPath = uni.$http.baseUrl +item.iconPath
this.myMedalList.push(item.iconPath)
}) })
uni.$showMsg('数据请求成功!') uni.$showMsg('数据请求成功!')

Loading…
Cancel
Save