123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <template>
- <view class="div order-item" @click="onclick()">
- <view>
- <image mode="aspectFit" class="img order-item-icon" :src="src" />
- </view>
- <label class="item-title order-item-title">{{title}}</label>
- <text class="span number" v-if="orderNumber == 0 ? '': orderNumber && isEmpty == false ? '': orderNumber">{{ orderNumber }}</text>
- </view>
- </template>
- <script>
- import { urlencode } from '@/util/common'
- import { mapState, mapMutations } from 'vuex'
- export default {
- props: {
- src: {
- type: String
- },
- title: {
- type: String
- },
- testAttr: {
- type: String
- },
- state: {
- default: ''
- },
- orderNumber: {
- type: Number,
- default: 0
- }
- },
- data () {
- return {
- isEmpty: false
- }
- },
- computed: mapState({
- isOnline: state => state.member.isOnline
- }),
- created () {
- this.isSignin()
- },
- methods: {
- ...mapMutations({
- changeStatus: 'changeStatus'
- }),
- onclick () {
- if (this.isOnline) {
- uni.navigateTo({ url: this.testAttr+'?'+urlencode( { state: this.state } )})
- } else {
- uni.navigateTo({ url: 'signin' })
- }
- },
- // 是否登录
- isSignin () {
- if (this.isOnline) {
- this.isEmpty = true
- } else {
- this.isEmpty = false
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .order-item {
- display: flex;
- flex-direction: column;
- justify-content: flex-start;
- align-items: center;
- }
- .item-title {
- font-size: $fontSize;
- color: $descTextColor;
- }
- .order-item-icon {
- width: 1.4rem;
- height: 1.4rem;
- font-size:1.3rem;
- margin-top:0.8rem;
- }
- .order-item-title {
- margin-top:0.4rem;
- }
- .span.number {
- width:0.8rem;
- height:0.8rem;
- line-height:0.8rem;
- margin-top:-3rem;
- margin-left:1rem;
- background: $primaryColor;
- border-radius:50%;
- font-size:$h6;
- text-align: center;
- color: RGBA(255, 255, 255, 1);
- font-weight: normal;
- position: relative;
- z-index: 2;
- }
- </style>
|