123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- <template>
- <view style="background-color: #FFFFFF;height: 100vh;" class="u-skeleton">
- <view class="status_bar">
- <!-- 这里是状态栏 -->
- </view>
- <view class="u-page" style="margin-bottom: 30rpx;">
- <view class="u-m-t-35">
- <u-swiper :list="bannersList" :height="310" :effect3d="true" border-radius="20" effect3d-previous-margin="20"
- bg-color="#FFF" class="u-skeleton-fillet" v-if="bannersList.length!=0"></u-swiper>
- <u-swiper :list="package[langIndex].swiper" :height="310" :effect3d="true" border-radius="20" effect3d-previous-margin="20" bg-color="#FFF"
- class="u-skeleton-fillet" v-else></u-swiper>
- </view>
- <view class="u-flex u-m-t-35 u-m-l-20 u-m-r-20 u-skeleton-fillet" style="width:710rpx;">
- <u-notice-bar mode="vertical" :list="noticebarList" style="width: 710rpx;" type="primary"></u-notice-bar>
- </view>
- <view class="u-flex u-m-t-35 u-row-around u-m-l-10 u-m-r-10">
- <template v-for="(item, index) in package[langIndex].banner">
- <u-image width="350rpx" :src="item.img" @tap="$u.throttle(routerPage(item.url), 1000)" mode="widthFix"
- class="u-skeleton-fillet"></u-image>
- </template>
- </view>
- <view class="u-m-t-35">
- <view class="u-m-l-30 u-m-b-10" style="font-size: 34rpx;">
- {{ $t('index.quickService') }}
- </view>
- <view class="u-flex u-flex-wrap u-row-center">
- <template v-for="(item, index) in package[langIndex].service">
- <u-image class="u-skeleton-fillet quick-service-item" width="350rpx" height="212rpx" :src="item.img" style="margin:10rpx 10rpx 25rpx 10rpx;box-shadow:0rpx 0rpx 20rpx rgba(0,0,0,0.2);border-radius: 30rpx;"
- @click="routerPage(item.url)"></u-image>
- </template>
- </view>
- </view>
- <view class="u-flex u-row-center u-m-t-35">
- <template v-for="(item, index) in package[langIndex].ad">
- <u-image class="u-skeleton-fillet" width="680rpx" :src="item" mode="widthFix"></u-image>
- </template>
- </view>
- </view>
- <!-- 与包裹页面所有内容的元素u-page同级,且在它的下方 -->
- <!-- <u-tabbar v-model="current" :list="list"></u-tabbar> -->
- <u-skeleton :loading="loading" :animation="true"></u-skeleton>
- <u-toast ref="ulogin" />
- <luo-version-upgrade v-if="show_s == true" :version="platform" :url="url" :is_force="is_force" :describe="Copywriting"></luo-version-upgrade>
- </view>
- </template>
- <script>
- import versionUpgrade from "../../components/luo-version-upgrade/luo-version-upgrade.vue";
- import {mapState, mapMutations } from 'vuex'
- import { request } from '../../common/request/request'
- import { indexData } from '../../static/common/data/data.js'
- require("promise.prototype.finally").shim()
- import axios from 'axios'
- export default {
- components: {
- versionUpgrade
- },
- data() {
- return {
- bannersList: [],
- noticebarList: [],
- loading: true, // 是否显示骨架屏组件
- list: [
- '../../static/sailun/swiper1.png'
- ],
- show_s: false,
- url: '',
- is_force: false,
- Copywriting: '',
- platform:'',
- langIndex: 0,
- package: indexData
- }
- },
- onLoad() {
- uni.$on('login', (data) => {
- this.loginStatus = data.msg
- })
- // uni.startPullDownRefresh();
- },
- onReady() {
- if (this.loginStatus == "登录成功" || this.loginStatus == "login sucess") {
- this.$refs.ulogin.show({
- title: this.$t('index.loginSuc'),
- })
- }
- },
- created() {
- console.log('indexData', indexData)
- if (this.hasLogin) {
- uni.showLoading({
- title: this.$t('unified.Loading')
- });
- axios.all([this.getBanners(), this.getTiceList()])
- .then(axios.spread((one, two) => {
- this.bannersList = one.data.data.map(t => t.imgPath)
- // console.log(one)
- this.noticebarList = two.data.data.map(t => t.msgContent)
- }))
- .catch(err => {
- })
- .finally(() => {
- this.loading = false;
- uni.hideLoading();
- })
-
- let lang = localStorage.getItem('lang')
- if (lang === 'zh') {
- this.langIndex = 0
- } else if (lang === 'en') {
- this.langIndex = 1
- } else {
- this.langIndex = 0
- }
- uni.setTabBarItem({
- index: 0,
- text: this.$t('tabBar.index')
- })
- uni.setTabBarItem({
- index: 1,
- text: this.$t('tabBar.msg')
- })
- uni.setTabBarItem({
- index: 2,
- text: this.$t('tabBar.my')
- })
- }
-
- },
- onShow() {
- this.system()
- },
- onPullDownRefresh() {
- axios.all([this.getBanners(), this.getTiceList()])
- .then(axios.spread((one, two) => {
- this.bannersList = one.data.data.map(t => t.imgPath)
- this.noticebarList = two.data.data.map(t => t.msgContent)
- }))
- .catch(err => {
- })
- .finally(() => {
- this.loading = false;
- uni.stopPullDownRefresh();
- })
- },
- computed: {
- ...mapState(['hasLogin'])
- },
- methods: {
- system() {
- uni.getSystemInfo({
- success: res => {
- this.platform = res.platform
- },
- complete: err => {
- this.platform = err.platform
- if (err.platform == 'android') {
- this.onLaunch_s()
- } else if (err.platform == 'ios') {
- //
- this.iosstartup()
- }
- }
- });
- },
- iosstartup() {
- request({
- url: '/baseReq/apkUpgrade',
- method: 'get',
- params: {
- osType: 1
- }
- }).then(res => {
- plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
- //
- //版本号
- if (wgtinfo.version == res.data.version) {
- this.show_s = true
- // uni.showToast({
- // icon: 'none',
- // title: '已是最新版本',
- // position: "bottom"
- // })
- //
- } else if (wgtinfo.version != res.data.forceVersion) {
- //
- res.data.msg = res.data.msg.replace(/\\n/g, "\n")
- uni.showModal({
- title: this.$t('index.tip1'),
- content: res.data.msg,
- showCancel: false,
- confirmText: this.$t('index.tip2'),
- success: function(res) {
- if (res.confirm) {
- //
- let appleId = 1518555723
- plus.runtime.launchApplication({
- action: `itms-apps://itunes.apple.com/cn/app/id${appleId}?mt=8`
- }, function(e) {
- });
- } else if (res.cancel) {
- }
- }
- })
- } else if (wgtinfo.version == res.data.forceVersion) {
- res.data.msg = res.data.msg.replace(/\\n/g, "\n")
- uni.showModal({
- title: this.$t('index.tip1'),
- content: res.data.msg,
- showCancel: true,
- confirmText: this.$t('index.tip2'),
- success: function(res) {
- if (res.confirm) {
- let appleId = 1518555723
- plus.runtime.launchApplication({
- action: `itms-apps://itunes.apple.com/cn/app/id${appleId}?mt=8`
- }, function(e) {
- });
- } else if (res.cancel) {
- }
- }
- })
- }
- })
- }).catch(err => {
- })
- .finally(() => {
- // Loading.close()
- })
- },
- //升级调用的接口
- onLaunch_s() {
- request({
- url: '/baseReq/apkUpgrade',
- method: 'get',
- params: {
- osType: 0
- }
- }).then(res =>{
- plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
- if (wgtinfo.version == res.data.version) {
- this.show_s = false
- // uni.showToast({
- // icon: 'none',
- // title: '已是最新版本',
- // position: "bottom"
- // })
- } else if (wgtinfo.version != res.data.forceVersion) {
- this.Copywriting = res.data.msg
- this.show_s = true
- this.url = res.data.url
- this.is_force = true
- } else if (wgtinfo.version == res.data.forceVersion) {
- this.Copywriting = res.data.msg
- this.is_force = false
- this.show_s = true
- this.url = res.data.url
- }
- })
- }).catch(err => {
- })
- .finally(() => {
- // Loading.close()
- })
- },
- //轮播图
- getBanners() {
- return request({
- url: '/homepage/getBanners',
- method: 'post',
- data: {
- "storeId": this.$store.state.storeInfo.storeId,
- "showPosition": 0, //门店0
- }
- })
- },
- //消息文字跑马灯
- getTiceList() {
- return request({
- url: '/homepage/noticeList',
- method: 'post',
- data: {
- "storeId": this.$store.state.storeInfo.storeId,
- "contentType": "1" //门店1
- }
- })
- },
-
- // 当前跳转路由
- routerPage(url) {
- this.$u.route({
- url: url,
- })
- }
- },
- }
- </script>
- <style lang="scss" scoped>
- .status_bar {
- height: var(--status-bar-height);
- width: 100%;
- background-color: #FFF;
- }
-
- .quick-service-item {
-
- }
- </style>
|