新增我的

This commit is contained in:
letwind 2020-12-30 14:28:04 +08:00
parent 0517d645e3
commit a5f3adafee
15 changed files with 305 additions and 53 deletions

57
App.vue
View File

@ -2,6 +2,10 @@
export default { export default {
onLaunch: function() { onLaunch: function() {
console.log('App Launch'); console.log('App Launch');
const userInfo = uni.getStorageSync('userInfo');
if(userInfo){
this.globalData.userInfo = userInfo
}
}, },
onShow: function() { onShow: function() {
console.log('App Show'); console.log('App Show');
@ -11,15 +15,56 @@ export default {
}, },
globalData: { globalData: {
api: { api: {
home: 'https://88d58ce0-c72d-4ad5-9ad5-5196f032ef71.bspapp.com/http/api/home', home: 'https://728da630-a10b-4780-b26e-30aa5aec7ee7.bspapp.com/http/api/home',
openid: 'https://88d58ce0-c72d-4ad5-9ad5-5196f032ef71.bspapp.com/http/api/openid', openid: 'https://728da630-a10b-4780-b26e-30aa5aec7ee7.bspapp.com/http/api/openid',
}, },
subscribe: 'https://88d58ce0-c72d-4ad5-9ad5-5196f032ef71.bspapp.com/http/subscribe', subscribe: 'https://728da630-a10b-4780-b26e-30aa5aec7ee7.bspapp.com/http/subscribe',
openid: '', openid: '',
userInfo: '',
}, },
methods: {
shareConfig(){
var messages = [{
title: '美团饿了么大额红包,每日可领!',
path: '/pages/index/index',
imageUrl : 'https://upload-images.jianshu.io/upload_images/302100-d28345a30e3c51c7.png',
imageUrl : 'https://upload-images.jianshu.io/upload_images/302100-d28345a30e3c51c7.png',
},{
title: '吃了这么多年外卖,你知道这个秘密吗?',
path: '/pages/index/index',
imageUrl : 'https://upload-images.jianshu.io/upload_images/302100-d28345a30e3c51c7.png'
},{
title: '这样点外卖,一年省下一个亿',
path: '/pages/index/index',
imageUrl : 'https://upload-images.jianshu.io/upload_images/302100-d28345a30e3c51c7.png'
},{
title: '点外卖前先领券,吃霸王餐',
path: '/pages/index/index',
imageUrl : 'https://upload-images.jianshu.io/upload_images/302100-d28345a30e3c51c7.png'
},{
title: '美团饿了么内部优惠券,手慢无',
path: '/pages/index/index',
imageUrl : 'https://upload-images.jianshu.io/upload_images/302100-d28345a30e3c51c7.png'
},{
title: '点外卖不用优惠券你就out了',
path: '/pages/index/index',
imageUrl : 'https://upload-images.jianshu.io/upload_images/302100-d28345a30e3c51c7.png'
},{
title: '外卖不为人知的秘密,点这解密',
path: '/pages/index/index',
imageUrl : 'https://upload-images.jianshu.io/upload_images/302100-d28345a30e3c51c7.png'
},{
title: '震惊小伙点外卖竟然花了1分钱',
path: '/pages/index/index',
imageUrl : 'https://upload-images.jianshu.io/upload_images/302100-d28345a30e3c51c7.png'
},{
title: '从这点外卖,你也可以吃霸王餐',
path: '/pages/index/index',
imageUrl : 'https://upload-images.jianshu.io/upload_images/302100-d28345a30e3c51c7.png'
}];
return messages[Math.floor(Math.random()*messages.length)];
}
}
}; };
</script> </script>

View File

@ -88,15 +88,37 @@
} }
] ]
}, },
"tab": { "tab": { //
"schema": { "data": [ //
"bsonType": "object", {
"permission": { "icon": "/static/all.png",
".create": false, "text": "全部",
".delete": false, "tabId": 0
".read": true, },
".update": false {
} "icon": "/static/ele.png",
} "text": "饿了么",
} "tabId": 1
},
{
"icon": "/static/meituan.png",
"text": "美团",
"tabId": 2
},
{
"icon": "/static/jd.png",
"text": "京东",
"tabId": 3
}
],
"schema": {
"bsonType": "object",
"permission": {
".read": true,
".create": false,
".update": false,
".delete": false
}
}
}
} }

View File

@ -1,7 +1,32 @@
{ {
"pages": [{ "pages": [{
"path": "pages/index/index" "path": "pages/index/index"
}, {
"path": "pages/user/user",
"style": {
"navigationBarTitleText": "我的",
"enablePullDownRefresh": false
}
}], }],
"tabBar": {
"backgroundColor": "#F7F7FA",
"color": "#707070",
"selectedColor": "#ffad00",
"list": [{
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "/static/tabbar/home.png",
"selectedIconPath": "/static/tabbar/home_fill.png"
},
{
"pagePath": "pages/user/user",
"text": "我的",
"iconPath": "/static/tabbar/user.png",
"selectedIconPath": "/static/tabbar/user_fill.png"
}
]
},
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "white", "navigationBarTextStyle": "white",
"navigationBarTitleText": "外卖专享优惠", "navigationBarTitleText": "外卖专享优惠",

View File

@ -50,35 +50,7 @@ export default {
this.changeTab(this.current) this.changeTab(this.current)
}, },
onShareAppMessage(res) { onShareAppMessage(res) {
var messages = [{ return getApp().shareConfig()
title: '美团饿了么大额红包,每日可领!',
path: '/pages/index/index'
},{
title: '吃了这么多年外卖,你知道这个秘密吗?',
path: '/pages/index/index'
},{
title: '这样点外卖,一年省下一个亿',
path: '/pages/index/index'
},{
title: '点外卖前先领券,吃霸王餐',
path: '/pages/index/index'
},{
title: '美团饿了么内部优惠券,手慢无',
path: '/pages/index/index'
},{
title: '点外卖不用优惠券你就out了',
path: '/pages/index/index'
},{
title: '外卖不为人知的秘密,点这解密',
path: '/pages/index/index'
},{
title: '震惊小伙点外卖竟然花了1分钱',
path: '/pages/index/index'
},{
title: '从这点外卖,你也可以吃霸王餐',
path: '/pages/index/index'
}];
return messages[Math.floor(Math.random()*messages.length)];
}, },
methods: { methods: {
onSubscribe() { onSubscribe() {
@ -105,13 +77,13 @@ export default {
openid: openid, openid: openid,
}; };
console.log(data) console.log(data)
uni.showLoading({ // uni.showLoading({
title: '订阅中...', // title: '...',
}); // });
setTimeout(function () { // setTimeout(function () {
uni.hideLoading(); // uni.hideLoading();
}, 5000); // }, 2000);
// API // API
wx.requestSubscribeMessage({ wx.requestSubscribeMessage({
// id id // id id
tmplIds: [lessonTmplId], tmplIds: [lessonTmplId],

188
pages/user/user.vue Normal file
View File

@ -0,0 +1,188 @@
<template>
<view class="container">
<view class="head">
<block v-if="userInfo">
<image :src="userInfo.avatarUrl" class="avatarUrl"></image>
<view class="nickName">{{ userInfo.nickName }}</view>
</block>
<block v-else>
<view class="loginBtn"><button open-type="getUserInfo" lang="zh_CN" @getuserinfo="onGotUserInfo" type="primary">授权登录</button></view>
</block>
</view>
<view class="others">
<view class="item">
<image class="icon" src="/static/user_share.png"></image>
<button class="content share" open-type="share">
<view>分享好友</view>
<image class="right" src="/static/right_h.png"></image>
</button>
</view>
<view class="item" bindtap="sponsor">
<image class="icon" src="/static/user_hezuo.png"></image>
<button class="content share" open-type="contact">
<view>我要制作</view>
<image class="right" src="/static/right_h.png"></image>
</button>
</view>
<view class="item">
<image class="icon" src="/static/user_kefu.png"></image>
<button class="content share" open-type="contact">
<view>在线客服</view>
<image class="right" src="/static/right_h.png"></image>
</button>
</view>
</view>
<view class="version">
v3.0
</view>
</view>
</template>
<script>
export default {
data() {
return {
userInfo: ''
};
},
onLoad() {
this.userInfo = getApp().globalData.userInfo
},
onShareAppMessage(res) {
return getApp().shareConfig()
},
methods: {
/*登录 */
onGotUserInfo(e) {
this.userInfo = e.detail.userInfo
uni.setStorageSync('userInfo', e.detail.userInfo);
}
}
};
</script>
<style lang="scss">
page {
background: #f8f8f8;
}
.container {
padding-bottom: 20rpx;
}
.head {
background: #fff;
position: relative;
text-align: center;
flex-wrap: wrap;
display: flex;
align-items: center;
justify-content: center;
padding: 20px 0;
height: 220rpx;
}
.head .avatarUrl {
width: 120rpx;
height: 120rpx;
display: block;
margin: auto;
border-radius: 50%;
}
.head .nickName {
margin-top: 10rpx;
text-align: center;
font-size: 36rpx;
color: #333;
width: 100%;
}
.head .loginBtn {
text-align: center;
}
.head .loginBtn button {
display: inline-block;
background: linear-gradient(90deg, #33cc33, #33bb33);
font-size: 32rpx;
height: 70rpx;
line-height: 70rpx;
border: none;
padding: 0 20rpx;
border-radius: 35rpx;
}
.head .loginBtn button::after {
border: none;
}
.head .lot {
position: absolute;
bottom: 0;
left: 0;
display: flex;
border-top: 1px solid #f8f8f8;
width: 690rpx;
padding: 30rpx;
}
.head .lot > view {
width: 50%;
text-align: center;
}
.head .lot .num {
color: #333;
font-size: 32rpx;
font-weight: 700;
}
.head .lot .name {
color: #666;
font-size: 28rpx;
}
.head .lot .all {
border-right: 1px solid #f8f8f8;
box-sizing: border-box;
}
.others {
margin: 20rpx 0;
background: #fff;
}
.others .item {
display: flex;
align-items: center;
width: 690rpx;
padding: 0 30rpx;
border-bottom: 1px solid #ededf0;
}
.others .item:last-child {
border-bottom: none;
}
.others .item .icon {
width: 50rpx;
height: 50rpx;
margin-right: 30rpx;
}
.others .item .content {
width: 620rpx;
padding: 30rpx 0;
display: flex;
align-items: center;
font-size: 34rpx;
color: #333;
}
.others .item .content.share {
background: none;
text-align: left;
border: none;
line-height: normal;
}
.others .item .content.share::after {
border: none;
}
.others .item .content .right {
width: 25rpx;
height: 25rpx;
margin-left: auto;
}
.version{
position: fixed;
bottom: 20rpx;
display: block;
width: 100%;
text-align: center;
font-size: 28rpx;
color: #666;
}
</style>

BIN
static/right_h.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1008 B

BIN
static/tabbar/fuli.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
static/tabbar/fuli_fill.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
static/tabbar/home.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
static/tabbar/home_fill.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
static/tabbar/user.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
static/tabbar/user_fill.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
static/user_hezuo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
static/user_kefu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
static/user_share.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB