Bläddra i källkod

add index data file

taoqiang 4 år sedan
förälder
incheckning
d6c975f0af
3 ändrade filer med 102 tillägg och 149 borttagningar
  1. 17 1
      pages/home/Statistical-task/index.vue
  2. 13 148
      pages/home/index.vue
  3. 72 0
      static/common/data/data.js

+ 17 - 1
pages/home/Statistical-task/index.vue

@@ -57,6 +57,7 @@
 				pixelRatio: 1,
 				piearr: [],
 				textarea: '',
+				offsetX: 0
 			}
 		},
 		onLoad() {
@@ -70,6 +71,21 @@
 			uni.setNavigationBarTitle({
 			    title: this.$t('taskStatistics.title')
 			});
+			
+			// canvas 中间标题不同语言情况下不居中显示
+			let self = this
+			uni.getStorage({
+			    key: 'lang',
+			    success: function (res) {
+					if (res.data && res.data === 'en') {
+						self.offsetX = 12
+					} else {
+						self.offsetX = 0
+					}
+			    }
+			});
+			
+			
 		},
 		onShow() {
 			this.getDate()
@@ -174,7 +190,7 @@
 					title: {
 						name: this.$t('uView.finished'),
 						color: '#666666',
-						offsetX: 12,
+						offsetX: this.offsetX,
 						fontSize: 13 * _self.pixelRatio,
 					},
 					extra: {

+ 13 - 148
pages/home/index.vue

@@ -13,12 +13,6 @@
 			<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">
-				<u-image width="350rpx" src="../../static/sailun/scan_in.png" @tap="$u.throttle(inPage(0), 1000)" mode="widthFix"
-				 class="u-skeleton-fillet"></u-image>
-				<u-image width="350rpx" src="../../static/sailun/scan_out.png" @tap="$u.throttle(inPage(1), 1000)" mode="widthFix"
-				 class="u-skeleton-fillet"></u-image>
-			</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"
@@ -29,19 +23,10 @@
 				<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">
-					<u-image class="u-skeleton-fillet" width="350rpx" height="212rpx" src="../../static/sailun/task.png" style="margin:10rpx 10rpx 25rpx 10rpx;box-shadow:0rpx 0rpx 20rpx rgba(0,0,0,0.2);border-radius: 30rpx;"
-					 @click="inPage(5)"></u-image>
-					<u-image class="u-skeleton-fillet" width="350rpx" height="212rpx" src="../../static/sailun/2.png" style="margin: 10rpx 10rpx 25rpx 10rpx;box-shadow:0rpx 0rpx 20rpx rgba(0,0,0,0.2);border-radius: 30rpx;"
-					 @click="inPage(3)"></u-image>
-					<u-image class="u-skeleton-fillet" width="350rpx" height="212rpx" src="../../static/sailun/inquire.png" style="margin: 10rpx;box-shadow:0rpx 0rpx 20rpx rgba(0,0,0,0.2);border-radius: 30rpx;"
-					 @click="inPage(4)"></u-image>
-					<u-image class="u-skeleton-fillet" width="350rpx" height="212rpx" src="../../static/sailun/1.png" style="margin: 10rpx;box-shadow:0rpx 0rpx 20rpx rgba(0,0,0,0.2);border-radius: 30rpx;"
-					 @click="inPage(2)"></u-image>
-				</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" 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;"
+					<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>
@@ -62,13 +47,9 @@
 
 <script>
 	import versionUpgrade from "../../components/luo-version-upgrade/luo-version-upgrade.vue";
-	import {
-		mapState,
-		mapMutations
-	} from 'vuex'
-	import {
-		request
-	} from '../../common/request/request'
+	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 {
@@ -89,78 +70,7 @@
 				Copywriting: '',
 				platform:'',
 				langIndex: 0,
-				package: [{
-					swiper: [
-						'../../static/sailun/swiper1.png',
-						'../../static/sailun/swiper1.png'
-					],
-					banner: [
-						{
-							img: '../../static/sailun/scan_in.png',
-							url: 'pages/home/scancode/index'
-						},
-						{
-							img: '../../static/sailun/scan_out.png',
-							url: 'pages/home/scancode/scancodeout'
-						}
-					],
-					service: [
-						{
-							img: '../../static/sailun/task.png',
-							url: 'pages/home/Statistical-task/index',
-						},
-						{
-							img: '../../static/sailun/2.png',
-							url: 'pages/home/monthly-policy/monthly-policy'
-						},
-						{
-							img: '../../static/sailun/inquire.png',
-							url: 'pages/home/scancodequery/result'
-						},
-						{
-							img: '../../static/sailun/1.png',
-							url: 'pages/home/my-stock/my-stock'
-						}
-					],
-					ad:[
-						'../../static/sailun/88reward.png'
-					]
-				}, {
-					swiper: [
-						'../../static/sailun/swiper1.png'
-					],
-					banner: [
-						{
-							img: '../../static/sailun/scan_out.png',
-							url: 'pages/home/scancode/scancodeout'
-						},
-						{
-							img: '../../static/sailun/scan_in.png',
-							url: 'pages/home/scancode/index'
-						}
-					],
-					service: [
-						{
-							img: '../../static/sailun/inquire.png',
-							url: 'pages/home/scancodequery/result'
-						},
-						{
-							img: '../../static/sailun/1.png',
-							url: 'pages/home/my-stock/my-stock'
-						},
-						{
-							img: '../../static/sailun/task.png',
-							url: 'pages/home/Statistical-task/index',
-						},
-						{
-							img: '../../static/sailun/2.png',
-							url: 'pages/home/monthly-policy/monthly-policy'
-						}
-					],
-					ad:[
-						'../../static/sailun/88reward.png'
-					]
-				}]
+				package: indexData
 			}
 		},
 		onLoad() {
@@ -177,6 +87,7 @@
 			}
 		},
 		created() {
+			console.log('indexData', indexData)
 			if (this.hasLogin) {
 				uni.showLoading({
 					title: this.$t('unified.Loading')
@@ -197,10 +108,8 @@
 					
 					let lang = localStorage.getItem('lang')
 					if (lang === 'zh') {
-						console.log('当前为中文')
 						this.langIndex = 0
 					} else if (lang === 'en') {
-						console.log('当前为英文')
 						this.langIndex = 1
 					} else {
 						this.langIndex = 0
@@ -221,8 +130,7 @@
 			
 		},
 		onShow() {
-			this.system()
-			
+			this.system()	
 		},
 		onPullDownRefresh() {
 			axios.all([this.getBanners(), this.getTiceList()])
@@ -397,54 +305,7 @@
 				this.$u.route({
 					url: url,
 				})
-			},
-			
-			inPage(index) {
-				switch (index) {
-					case 0:
-						{
-							this.$u.route({
-								url: 'pages/home/scancode/index',
-							})
-							break;
-						}
-					case 1:
-						{
-							this.$u.route({
-								url: 'pages/home/scancode/scancodeout',
-							})
-							break;
-						}
-					case 2:
-						{
-							this.$u.route({
-								url: 'pages/home/my-stock/my-stock',
-							})
-							break;
-						}
-					case 3:
-						{
-							this.$u.route({
-								url: 'pages/home/monthly-policy/monthly-policy',
-							})
-							break;
-						}
-					case 4:
-						{
-							this.$u.route({
-								url: 'pages/home/scancodequery/result',
-							})
-							break;
-						}
-					case 5:
-						{
-							this.$u.route({
-								url: 'pages/home/Statistical-task/index',
-							})
-							break;
-						}
-				}
-			},
+			}
 		},
 	}
 </script>
@@ -455,4 +316,8 @@
 		width: 100%;
 		background-color: #FFF;
 	}
+	
+	.quick-service-item {
+		
+	}
 </style>

+ 72 - 0
static/common/data/data.js

@@ -0,0 +1,72 @@
+export const indexData = [{
+	swiper: [
+		'../../static/sailun/swiper1.png',
+		'../../static/sailun/swiper1.png'
+	],
+	banner: [
+		{
+			img: '../../static/sailun/scan_in.png',
+			url: 'pages/home/scancode/index'
+		},
+		{
+			img: '../../static/sailun/scan_out.png',
+			url: 'pages/home/scancode/scancodeout'
+		}
+	],
+	service: [
+		{
+			img: '../../static/sailun/task.png',
+			url: 'pages/home/Statistical-task/index',
+		},
+		{
+			img: '../../static/sailun/2.png',
+			url: 'pages/home/monthly-policy/monthly-policy'
+		},
+		{
+			img: '../../static/sailun/inquire.png',
+			url: 'pages/home/scancodequery/result'
+		},
+		{
+			img: '../../static/sailun/1.png',
+			url: 'pages/home/my-stock/my-stock'
+		}
+	],
+	ad:[
+		'../../static/sailun/88reward.png'
+	]
+}, {
+	swiper: [
+		'../../static/sailun/swiper1.png'
+	],
+	banner: [
+		{
+			img: '../../static/sailun/scan_out.png',
+			url: 'pages/home/scancode/scancodeout'
+		},
+		{
+			img: '../../static/sailun/scan_in.png',
+			url: 'pages/home/scancode/index'
+		}
+	],
+	service: [
+		{
+			img: '../../static/sailun/inquire.png',
+			url: 'pages/home/scancodequery/result'
+		},
+		{
+			img: '../../static/sailun/1.png',
+			url: 'pages/home/my-stock/my-stock'
+		},
+		{
+			img: '../../static/sailun/task.png',
+			url: 'pages/home/Statistical-task/index',
+		},
+		{
+			img: '../../static/sailun/2.png',
+			url: 'pages/home/monthly-policy/monthly-policy'
+		}
+	],
+	ad:[
+		'../../static/sailun/88reward.png'
+	]
+}]