Commit e4e2df2e authored by 珠峰架构's avatar 珠峰架构

小程序首页

parent aef39ebf
......@@ -15,7 +15,7 @@
page {
-webkit-overflow-scrolling: touch; // ios滑动不流畅
height: 100%;
background: #f0f0f0;
// background: #f0f0f0;
width: 100%;
font-size: 30rpx;
font-family: OPPOSANS;
......
......@@ -7,7 +7,7 @@
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "首页",
"navigationBarTitleText": "步数",
"navigationBarTextStyle": "black",
"enablePullDownRefresh":true,
"navigationBarBackgroundColor":"#ffffff",
......@@ -16,8 +16,8 @@
"meta": {
"auth": true,
"async": true,
"title": "首页",
"group": "用户"
"title": "步数",
"group": "步数"
},
"name":"index"
}
......@@ -51,19 +51,19 @@
"subPackages":[],
"tabBar": {
"color":"#626262",
"selectedColor": "#f1270c",
"selectedColor": "#00c791",
"backgroundColor": "#ffffff",
"borderStyle": "black",
"list":[{
"pagePath": "pages/index/cart",
"text": "购物车",
"iconPath": "static/img/logo.png",
"selectedIconPath": "/static/img/logo.png"
"text": "步数",
"iconPath": "static/img/run/tabbar_Index.png",
"selectedIconPath": "static/img/run/tabbar_Index1.png"
},{
"pagePath": "pages/index/category",
"text": "分类",
"iconPath": "static/img/logo.png",
"selectedIconPath": "/static/img/logo.png"
"text": "商城",
"iconPath": "static/img/run/tabbar_shop.png",
"selectedIconPath": "static/img/run/tabbar_shop1.png"
}
]
......@@ -78,7 +78,7 @@
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
"backgroundColor": "#ffffff"
},
"condition" : { //模式配置,仅开发期间生效
"current": 0, //当前激活的模式(list 的索引项)
......
<template>
<view>
<web-view @message="handleMsg" :src='url'></web-view>
<web-view @message="handleMsg" :src='webUrl'></web-view>
</view>
</template>
......@@ -8,12 +8,11 @@
export default {
data() {
return {
url:''
webUrl:''
}
} ,
onReady(){
let webUrl = "https://wx.zhonghuihaotai.com/webpage/wxdist/index.html#/?mallId=134581110000230&companyId=00000310&time="+new Date().getTime()
this.url = webUrl
this.webUrl = "https://wx.zhonghuihaotai.com/webpage/wxdist/index.html#/?mallId=134581110000230&companyId=00000310&time="+new Date().getTime()
},
methods:{
handleMsg(e){
......@@ -21,11 +20,11 @@
}
},
onLoad(){
uni.hideTabBar();
},
onLaunch(){
}
}
</script>
<style>
</style>
<template>
<view class="we-run-page">
<view class="header">
<view class="contant">
<image src="../../static/img/run/bg.png" class="bg" mode="widthFix"></image>
<view class="we-run-container">
<image src="../../static/img/run/runBg.png" class="run-logo" mode="widthFix"></image>
<view class="run-step-number">
<text>今日步数</text>
<view>阿斯蒂芬</view>
<text>今日步数</text>
<text class="title">今日步数</text>
<view class="steps" v-if="todayNum">
<text class="num">{{todayNum}}</text>
<text></text>
</view>
<view v-else class="steps-empower">
<u-button type="primary" size="mini" color="#00c791" :plain="true" text="授权查看"></u-button>
</view>
</view>
<image src="../../static/img/run/ranking_btn.png" class="ranking_btn" mode="widthFix"></image>
</view>
</view>
<view class="footer">
<view class="li">
1
</view>
<view class="li">
1
</view>
</view>
<u-tabbar :value="tabBarVal" @change="changeTabBar" :fixed="true" :placeholder="true" activeColor="#00c791" :safeAreaInsetBottom="true">
<u-tabbar-item text="步数" name="步数">
<image class="u-page__item__slot-icon" slot="active-icon" src="../../static/img/run/tabbar_Index1.png">
</image>
<image class="u-page__item__slot-icon" slot="inactive-icon" src="../../static/img/run/tabbar_Index.png">
</image>
</u-tabbar-item>
<u-tabbar-item text="商城" name="商城">
<image class="u-page__item__slot-icon" slot="active-icon" src="../../static/img/run/tabbar_shop1.png">
</image>
<image class="u-page__item__slot-icon" slot="inactive-icon" src="../../static/img/run/tabbar_shop.png">
</image>
</u-tabbar-item>
</u-tabbar>
</view>
</template>
<script>
import http from '@/shopro/request/index';
import store from '@/shopro/store';
......@@ -32,64 +42,91 @@
} from 'vuex'
export default {
data() {
return {}
return {
todayNum: 0,
tabBarVal: '步数'
}
},
computed: {
...mapGetters(['userInfo'])
},
methods: {
...mapActions([]),
getWeRunData(){
// 获取步数
getWeRunData() {
let wRunEncryptedData = {}
let that = this;
uni.getWeRunData({
success: function(res) {
console.log(res)
wRunEncryptedData.encryptedData = res.encryptedData
wRunEncryptedData.iv = res.iv
console.log(wRunEncryptedData)
http('user.wxRun', wRunEncryptedData).then(res => {
if (!res.code && res.data) {
that.todayNum = res.data.todayNum;
console.log(that.todayNum)
} else {
that.todayNum = 0;
// that.$u.toast(res.msg);
}
})
}
})
},
changeTabBar(name){
this.tabBarVal = name;
console.log(name)
if(name == '商城') {
uni.navigateTo({
url: '/pages/h5/index',
})
}
}
},
onHide(){
},
onShow() {
this.tabBarVal = "步数";
// uni.hideTabBar();
},
onReady() {
// this.geAauthorizeWeRun()
let token = uni.getStorageSync('token');
// 如果有缓存信息
if(token){
if (token) {
let authCheck = store.dispatch('authCheck');
authCheck.then(resolve =>{
}).catch(errCode =>{
authCheck.then(resolve => {
this.getWeRunData()
}).catch(errCode => {
console.log(errCode)
if(errCode == 2001) {
// 手机号输入
console.log(this.userInfo)
console.log("信息是--------------")
this.registerInfo = {
companyId:'999999998', //开放式传
mobile:'', //封闭式传
empcardno:'',//封闭式传
registerType:'register'//注册时的类型为普通注册
}
console.log(this.registerInfo)
http('user.register',this.registerInfo).then(res => {
if (!res.code) {
}else{
// that.$u.toast(res.msg);
}
})
if (errCode == 2001) {
// 手机号输入
console.log(this.userInfo)
console.log("信息是--------------")
this.registerInfo = {
companyId: '999999998', //开放式传
mobile: '15501156151', //封闭式传
empcardno: '', //封闭式传
registerType: 'register' //注册时的类型为普通注册
}
console.log(this.registerInfo)
http('user.register', this.registerInfo).then(res => {
if (!res.code) {
} else {
// that.$u.toast(res.msg);
}
})
}
})
}else{
} else {
let getUserInfo = store.dispatch('getUserInfo');
getUserInfo.then(resolve =>{
}).catch(errCode =>{
getUserInfo.then(resolve => {
}).catch(errCode => {
})
}
}
......@@ -97,36 +134,74 @@
</script>
<style lang="scss" scoped>
.we-run-page {
.header {
background-color: #fff;
.contant {
height: calc(100% - 100px - env(safe-area-inset-bottom));
box-sizing: border-box;
position: relative;
.bg{
.bg {
width: 100%;
}
.we-run-container{
}
.we-run-container {
position: absolute;
top:200rpx;
top: 250rpx;
text-align: center;
width: 100%;
.run-logo{
width: 96%;
.run-logo {
width: 425rpx;
}
}
}
.footer {
position: fixed;
bottom: 0;
background: red;
display: flex;
width: 100%;
li{
flex: 1;
.run-step-number {
position: absolute;
transform: translateX(-50%);
left: 50%;
top: 175rpx;
.title {
font-size: 25rpx;
}
.steps {
font-size: 25rpx;
.num {
font-size: 57rpx;
font-weight: bold;
}
}
.steps-empower {
margin-top: 30rpx;
font-size: 20rpx;
}
}
.ranking_btn {
margin-top: 100rpx;
height: 120rpx;
}
}
}
// .footer {
// position: fixed;
// bottom: 0;
// background: red;
// display: flex;
// width: 100%;
// li{
// flex: 1;
// }
// }
}
.u-page__item__slot-icon {
width: 40rpx;
height: 40rpx;
}
</style>
......@@ -18,7 +18,13 @@ export default {
url: 'mall/register',
auth: true,
method: "post"
}
},
wxRun :{
url: 'mall/miniProgram/wxRun',
auth: true,
method: "post"
},
},
index:{
......
......@@ -8,9 +8,6 @@ export default function http(
toastBefore = '', // 请求前加载提示
toastAfter = true, // 请求后错误提示
) {
console.log(url)
console.log("=============")
console.log(url)
let api = getApiPath(url);
/* 请求之前拦截器 */
shoproRequest.interceptor.request((config, cancel) => {
......
......@@ -70,7 +70,7 @@ const actions = {
let mallId = uni.getStorageSync('mallId');
if(token) {
state.userInfo = JSON.parse(decodeURI(token))
// commit('userInfo',JSON.parse(decodeURI(token)));
uni.setStorageSync("sessionKey",state.userInfo.sessionKey)
}
api("user.authCheck", {
mallId: mallId
......
static/img/run/bg.png

162 KB | W: | H:

static/img/run/bg.png

176 KB | W: | H:

static/img/run/bg.png
static/img/run/bg.png
static/img/run/bg.png
static/img/run/bg.png
  • 2-up
  • Swipe
  • Onion skin
static/img/run/runBg.png

165 KB | W: | H:

static/img/run/runBg.png

24.1 KB | W: | H:

static/img/run/runBg.png
static/img/run/runBg.png
static/img/run/runBg.png
static/img/run/runBg.png
  • 2-up
  • Swipe
  • Onion skin
static/img/run/tabbar_Index.png

1.35 KB | W: | H:

static/img/run/tabbar_Index.png

2.3 KB | W: | H:

static/img/run/tabbar_Index.png
static/img/run/tabbar_Index.png
static/img/run/tabbar_Index.png
static/img/run/tabbar_Index.png
  • 2-up
  • Swipe
  • Onion skin
static/img/run/tabbar_Index1.png

2.13 KB | W: | H:

static/img/run/tabbar_Index1.png

3.46 KB | W: | H:

static/img/run/tabbar_Index1.png
static/img/run/tabbar_Index1.png
static/img/run/tabbar_Index1.png
static/img/run/tabbar_Index1.png
  • 2-up
  • Swipe
  • Onion skin
static/img/run/tabbar_shop.png

1.48 KB | W: | H:

static/img/run/tabbar_shop.png

1.82 KB | W: | H:

static/img/run/tabbar_shop.png
static/img/run/tabbar_shop.png
static/img/run/tabbar_shop.png
static/img/run/tabbar_shop.png
  • 2-up
  • Swipe
  • Onion skin
static/img/run/tabbar_shop1.png

2.42 KB | W: | H:

static/img/run/tabbar_shop1.png

2.71 KB | W: | H:

static/img/run/tabbar_shop1.png
static/img/run/tabbar_shop1.png
static/img/run/tabbar_shop1.png
static/img/run/tabbar_shop1.png
  • 2-up
  • Swipe
  • Onion skin
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment