Browse Source

小程序页面优化

h5_css
yanyan 3 years ago
parent
commit
995fa6769c
  1. 8
      pages.json
  2. 9
      pages/my/my.vue
  3. 32
      pages/scan/scan.vue
  4. 18
      subpkg/address/address.vue
  5. 9
      subpkg/list/list.vue
  6. 8
      subpkg/medal/medal.vue

8
pages.json

@ -94,6 +94,14 @@
"navigationBarTitleText" : "",
"enablePullDownRefresh" : true
}
},
{
"path" : "role/role",
"style" :
{
"navigationBarTitleText" : "",
"enablePullDownRefresh" : false
}
}]
}],
"globalStyle": {

9
pages/my/my.vue

@ -52,10 +52,7 @@
<script>
import tabbar from "@/components/tabbar/tabbar.vue";
import {
mapState,
mapMutations
} from 'vuex'
import {mapState,mapMutations} from 'vuex'
export default {
data() {
return {
@ -80,7 +77,7 @@
this.page = "my"
},
computed: {
...mapState('m_user', ['userinfo'])
...mapState('m_user', ['userinfo','userId'])
},
methods: {
...mapMutations('m_user', ['updateAddress', 'updateUserInfo', 'updateToken']),
@ -100,7 +97,7 @@
const {
data: res
} = await uni.$http.post('/small/wechat/showMyMedal',{openId:"cpqKnCOSsO+0mWqJI/T1MQ=="})
} = await uni.$http.post('/small/wechat/showMyMedal',{guid:this.userId})
if (!res.success) return uni.$showMsg()
this.medalNum = res.data.length;

32
pages/scan/scan.vue

@ -1,45 +1,39 @@
<template>
<view>
<view class="video-wrapper" id="video-container">
</view>
<sVideo jsonId="6215c8757e8947c8aae0fd0b3d2d503b"></sVideo>
<tabbar :page="page"></tabbar>
</view>
</template>
<script>
import tabbar from "@/components/tabbar/tabbar.vue";
import sVideo from "@/components/s-video/s-video.vue";
import tabbar from "@/components/tabbar/tabbar.vue";
export default {
data() {
return {
page: "",
page: ""
};
},
onReady() {
this.QR();
},
onShow() {
this.page = "scan"
this.page= "scan"
},
methods: {
QR() {
// uni.scanCode({
// onlyFromCamera: true,
// success: (res) => {
// console.log(',:' + res.result);
// },
// error: (res) => {
// console.log('')
// }
// })
uni.scanCode({
onlyFromCamera: true,
success: (res) => {
console.log('扫描二维码成功,结果:' + res.result);
},
error: (res) => {
console.log('扫描二维码出现错误')
}
})
},
},
components: {
tabbar,
sVideo
tabbar
}
}
</script>

18
subpkg/address/address.vue

@ -13,7 +13,7 @@
<view>
<uni-swipe-action>
<block v-for="(item, i) in addressList" :key="i">
<uni-swipe-action-item :options="options" @click="swipeItemClickHandler(item)">
<uni-swipe-action-item :right-options="options" @click="swipeItemClickHandler(item)">
<view class="address-info-box">
<view class="row1">
<view class="row1-left">
@ -55,10 +55,17 @@
<script>
import { mapState, mapMutations, mapGetters } from 'vuex'
import addressVue from './address.vue';
export default {
data() {
return {
options: [{
text: '删除',
style: {
backgroundColor: '#C00000'
}
}],
addressList:[]
};
},
@ -118,7 +125,14 @@
if (settingResult.authSetting['scope.address']) return uni.$showMsg('授权成功!请选择地址')
}
})
}
},
async swipeItemClickHandler(item){
this.addressList = this.addressList.filter(x=>x.guid!=item.guid);
const {
data: res
} = await uni.$http.post('/small/project/address/remove',item.guid)
if (!res.success) return uni.$showMsg()
}
},
computed: {
...mapState('m_user', ['address','userId']),

9
subpkg/list/list.vue

@ -21,7 +21,7 @@
</view>
<!-- 场景区域 -->
<view class="nav-list">
<view class="nav-item" v-for="(item, i) in sceneList" :key="i">
<view class="nav-item" v-for="(item, i) in sceneList" :key="i" @click="navClickHandler(item)">
<image :src="item" class="nav-img"></image>
</view>
</view>
@ -80,6 +80,13 @@
}
return arr.join('&')
},
navClickHandler(item) {
if(item !== ""){
uni.navigateTo({
url:'/subpkg/role/role'
})
}
},
input(e){
clearTimeout(this.timer)

8
subpkg/medal/medal.vue

@ -31,6 +31,7 @@
</template>
<script>
import { mapState, mapMutations, mapGetters } from 'vuex'
export default {
data() {
return {
@ -41,6 +42,9 @@
myMedalList: [],
};
},
computed: {
...mapState('m_user', ['userId'])
},
onLoad() {
this.getMedalList();
this.getMyMedalList()
@ -62,10 +66,10 @@
uni.$showMsg('数据请求成功!')
},
async getMyMedalList() {
const {
data: res
} = await uni.$http.post('/small/wechat/showMyMedal',{openId:"cpqKnCOSsO+0mWqJI/T1MQ=="})
} = await uni.$http.post('/small/wechat/showMyMedal',{guid:this.userId})
if (!res.success) return uni.$showMsg()
res.data.forEach(item=>{

Loading…
Cancel
Save