| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <template>
- <view style="height: 100%;width: 100%;">
- <!-- <view style="width: 100%;">
- <image style="width: 100%;" mode="widthFix" :src="$util.spliceAssetsUrl('/om/home-header.png')"></image>
- </view> -->
- <!-- <span style="color: #FFFFFF;">{{ tableData.length }}</span> -->
- <view v-if="tableData.length == 0">
- <view style="height: 100%;width: 100%;" @click="onchange('/upms/views/home/home?type=' + 1)">
- <u-empty text="暂无活动" :icon="$util.spliceAssetsUrl('/ma/empty_data.png')" :iconSize="100" width="300"
- height="300" marginTop="700" textSize="56">
- </u-empty>
- </view>
- </view>
- <swiper class="screen-swiper round-dot" :indicator-dots="false" :circular="true" :autoplay="false"
- interval="5000" duration="500" v-else>
- <block v-for="(item,index) in tableData" :key="index">
- <swiper-item @click="onchange('/upms/views/home/home?type=' + 1)"
- class="flex justify-center align-center" v-if="item.activityType == 0">
- <!-- <u--image :src="item.fileUrl" mode="aspectFill" v-if="item.activityType == 0"
- :errorIcon="$util.spliceAssetsUrl('/ma/empty_data.png')" bgColor="#1F262C"></u--image> -->
- <!-- <video :src="item.fileUrl" :autoplay="true" :loop="true" v-if="item.activityType == 1" :show-fullscreen-btn="false"></video> -->
- <!-- <image :src="item.fileUrl" mode="aspectFill"> -->
- <!-- <view class="text-white">{{ item.isError }}</view> -->
- <image :src="item.fileUrl" mode="aspectFill" v-if="!item.isError" @error="errorImage(index)" />
- <u-empty text="活动图片加载失败" :icon="$util.spliceAssetsUrl('/ma/empty_data.png')" :iconSize="100"
- width="300" height="300" marginTop="100" textSize="56" v-else>
- </u-empty>
- </swiper-item>
- </block>
- </swiper>
- <!-- 测试打印机模板 -->
- <!-- <view class="m-t-20">
- <button class="cu-btn round bg-gradual-blue shadow" @click="testPrintString">测试打印机模板</button>
- </view>
-
- <view class="m-t-20">
- <button class="cu-btn round bg-gradual-blue shadow" @click="onchange('/upms/views/dineWay/dineWay')">下一页</button>
- </view> -->
- </view>
- </template>
- <script>
- import api from '@/utils/api'
- const app = getApp();
- export default {
- data() {
- return {
- cardCur: "",
- theme: app.globalData.theme, //全局颜色变量
- keySecret: "",
- errorImagenumber: 0,
- tableData: []
- }
- },
- mounted() {
- this.getList()
- if (this.tableData.length == 0) {
- //如果没有活动,需要直接跳入点餐界面
- this.onchange('/upms/views/home/home?type=' + 1)
- }
-
- },
- methods: {
- getList() {
- api.orderingMachineActivityList().then(res => {
- this.tableData = res.data
- for (var i = 0; i < this.tableData.length; i++) {
- this.tableData[i].isError = false
- this.$set(this.tableData, i, this.tableData[i])
- this.$forceUpdate()
- }
- })
- },
- errorImage(e) {
- this.tableData[e].isError = true
- // this.$set(this.tableData, e, this.tableData[e])
- console.log(this.tableData[e].isError)
- },
- cardSwiper(e) {
- this.cardCur = e.detail.current
- },
- onchange(url) {
- uni.navigateTo({
- url: url
- })
- },
- // 测试打印机模板
- testPrintString() {
- api.takeAwayMachineTemplate('1590535772905246721').then(res => {
- let tplStr = res.data
- const ToastPlusModule = uni.requireNativePlugin("unitest")
- ToastPlusModule.androidPrint(tplStr, pRes => {
- uni.showToast({
- title: "打印状态--->" + pRes,
- icon: 'none',
- duration: 2000
- });
- })
- })
- }
- }
- }
- </script>
- <style lang="scss">
- .tower-swiper .tower-item {
- transform: scale(calc(0.5 + var(--index) / 10));
- margin-left: calc(var(--left) * 100upx - 150upx);
- z-index: var(--index);
- }
- .screen-swiper {
- // min-height: 600rpx;
- // margin-left: 80rpx;
- // margin-right: 80rpx;
- // margin-top: 20rpx;
- height: 1920px;
- width: 100%;
- }
- .uni-swiper-dots {
- display: NONE;
- align-items: center;
- width: 100%;
- justify-content: center;
- }
- </style>
|