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" : "", "navigationBarTitleText" : "",
"enablePullDownRefresh" : true "enablePullDownRefresh" : true
} }
},
{
"path" : "role/role",
"style" :
{
"navigationBarTitleText" : "",
"enablePullDownRefresh" : false
}
}] }]
}], }],
"globalStyle": { "globalStyle": {

9
pages/my/my.vue

@ -52,10 +52,7 @@
<script> <script>
import tabbar from "@/components/tabbar/tabbar.vue"; import tabbar from "@/components/tabbar/tabbar.vue";
import { import {mapState,mapMutations} from 'vuex'
mapState,
mapMutations
} from 'vuex'
export default { export default {
data() { data() {
return { return {
@ -80,7 +77,7 @@
this.page = "my" this.page = "my"
}, },
computed: { computed: {
...mapState('m_user', ['userinfo']) ...mapState('m_user', ['userinfo','userId'])
}, },
methods: { methods: {
...mapMutations('m_user', ['updateAddress', 'updateUserInfo', 'updateToken']), ...mapMutations('m_user', ['updateAddress', 'updateUserInfo', 'updateToken']),
@ -100,7 +97,7 @@
const { const {
data: res 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() if (!res.success) return uni.$showMsg()
this.medalNum = res.data.length; this.medalNum = res.data.length;

32
pages/scan/scan.vue

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

18
subpkg/address/address.vue

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

9
subpkg/list/list.vue

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

8
subpkg/medal/medal.vue

@ -31,6 +31,7 @@
</template> </template>
<script> <script>
import { mapState, mapMutations, mapGetters } from 'vuex'
export default { export default {
data() { data() {
return { return {
@ -41,6 +42,9 @@
myMedalList: [], myMedalList: [],
}; };
}, },
computed: {
...mapState('m_user', ['userId'])
},
onLoad() { onLoad() {
this.getMedalList(); this.getMedalList();
this.getMyMedalList() this.getMyMedalList()
@ -62,10 +66,10 @@
uni.$showMsg('数据请求成功!') uni.$showMsg('数据请求成功!')
}, },
async getMyMedalList() { async getMyMedalList() {
const { const {
data: res 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() if (!res.success) return uni.$showMsg()
res.data.forEach(item=>{ res.data.forEach(item=>{

Loading…
Cancel
Save