index.vue
3.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<!--
* @Date: 2022-09-19 14:11:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-09-26 17:07:34
* @FilePath: /swx/src/pages/index/index.vue
* @Description: 首页
-->
<template>
<view>
<swiper class='slide-box' indicatorColor='#94B294' indicatorActiveColor='#FFFFFF' current="current"
:duration="duration" :interval="interval" :circular="isCircular" :autoplay="isAutoplay"
:indicatorDots="hasIndicatorDots">
<swiper-item v-for="(item, idx) in imgUrls" :key="idx">
<image :src="item" class="slide-image" />
</swiper-item>
</swiper>
</view>
<view style="padding: 1rem 1rem 0.5rem 1rem;">
<text class="bg-gradient" style="font-size: 1.15rem;">推荐活动</text>
</view>
<view style="padding: 0 1rem;">
<activity-card v-for="(item, index) in activity_list" :key="index" :data="item"></activity-card>
</view>
<view style="height: 6rem;"></view>
<navbar activated="home" />
</template>
<script setup>
import Taro from '@tarojs/taro'
import { ref } from 'vue';
import activityCard from '@/components/activity-card.vue'
import navbar from '@/components/navbar.vue'
const activity_list = ref([{
title: '智慧没有烦恼',
address: '上海市杨浦区军工路100号A座05室',
}, {
title: '万人共乘浪漫热气球',
address: '',
}, {
title: '八段锦',
address: '',
}, {
title: '智慧没有烦恼',
address: '上海市杨浦区军工路100号A座05室',
}, {
title: '万人共乘浪漫热气球',
address: '',
}, {
title: '八段锦',
address: '',
}]);
</script>
<script>
import "./index.less";
export default {
name: "indexPage",
onReady() {
if (!Taro.canIUse("getUpdateManager")) {
Taro.showModal({
title: "提示",
content: "当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试",
showCancel: false,
});
return;
}
// https://developers.weixin.qq.com/miniprogram/dev/api/base/update/UpdateManager.html
const updateManager = Taro.getUpdateManager();
updateManager.onCheckForUpdate((res) => {
// 请求完新版本信息的回调
if (res.hasUpdate) {
updateManager.onUpdateReady(function () {
Taro.showModal({
title: "更新提示",
content: "新版本已经准备好,是否重启应用?",
success: function (res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate();
}
},
});
});
updateManager.onUpdateFailed(function () {
// 新版本下载失败
Taro.showModal({
title: "更新提示",
content: "新版本已上线,请删除当前小程序,重新搜索打开",
});
});
}
});
},
data() {
return {
current: 1,
duration: 500,
interval: 5000,
isCircular: true,
isAutoplay: false,
hasIndicatorDots: true,
imgUrls: [
'http://gyzs.onwall.cn/swx_banner%402x.png',
'http://gyzs.onwall.cn/swx_banner%402x.png',
'http://gyzs.onwall.cn/swx_banner%402x.png',
],
};
},
methods: {
}
};
</script>