liujd 6 лет назад
Родитель
Сommit
2269cc732e

+ 1 - 0
mobile-code/package.json

@@ -38,6 +38,7 @@
     "regenerator-runtime": "^0.12.1",
     "vue": "^2.6.10",
     "vue-eslint-parser": "^6.0.4",
+    "vue-lazyload": "^1.3.3",
     "vuex": "^3.0.1"
   },
   "devDependencies": {

+ 36 - 0
mobile-code/src/components/app-img.vue

@@ -0,0 +1,36 @@
+<template>
+	<block>
+		<!-- #ifdef APP-PLUS -->
+		<img :lazy-load="true" :src="src" :alt="alt" :title="title" />
+		<!-- #endif -->
+		<!-- #ifdef H5 -->
+		<img v-lazy="src" :alt="alt" :title="title" />
+		<!-- #endif -->
+	</block>
+</template>
+
+<script>
+import Vue from 'vue'
+import VueLazyload from 'vue-lazyload'
+Vue.use(VueLazyload)
+export default {
+	name: 'app-img',
+	props: {
+		src: {
+			type: String,
+			default: ''
+		},
+		alt: {
+			type: String,
+			default: ''
+		},
+		title: {
+			type: String,
+			default: ''
+		}
+	}
+}
+</script>
+
+<style>
+</style>

+ 2 - 2
mobile-code/src/constant/index.js

@@ -15,12 +15,12 @@ const envVal = {
 // 项目配置
 if (ProjectName == 'mobile') {
 	envVal.formal = process.env.NODE_ENV == 'development' ? 'http://m.huaml.com' : `${window.location.protocol}//${window.location.host}`
-	envVal.hostUrl = process.env.NODE_ENV == 'development' ? 'http://api.m.huaml.com' : `http://api.m.huaml.com`
+	envVal.hostUrl = process.env.NODE_ENV == 'development' ? `http://api.m.huaml.com` : `${window.location.protocol}//api.m.${window.location.host}`
 
 	uni.setStorageSync('source', 'mobile')
 } else {
 	envVal.formal = process.env.NODE_ENV == 'development' ? 'http://b.huaml.com' : `${window.location.protocol}//${window.location.host}`
-	envVal.hostUrl = process.env.NODE_ENV == 'development' ? 'http://api.b.huaml.com' : `http://api.b.huaml.com`
+	envVal.hostUrl = process.env.NODE_ENV == 'development' ? 'http://api.b.huaml.com' : `${window.location.protocol}://api.b.${window.location.host}`
 
 	uni.setStorageSync('source', 'business')
 }

+ 6 - 4
mobile-code/src/official/index.vue

@@ -15,7 +15,7 @@
 				<div class="tit-sub">{{ item.subTitle }}</div>
 			</div>
 			<div class="module-det">
-				<img class="module-img" :src="item.img" :lazy-load="true">
+				<app-img class="module-img" :src="item.img" :lazy-load="true" />
 			</div>
 		</div>
 		<!-- ad -->
@@ -26,13 +26,13 @@
 			</div>
 			<div class="ad-list-wrap">
 				<div class="ad-list" v-for="(item, index) in adData" :key="index">
-					<img :src="item" alt />
+					<app-img :src="item" alt />
 				</div>
 			</div>
 			<div class="official-wrap">
 				<div class="off-title">花卉宝,花店经营的标配工具</div>
 				<div class="off-sub-tit">
-					<img src="../static/images/official/phone-small.png" alt="">
+					<app-img src="../static/images/official/phone-small.png" alt="" />
 					<span>咨询热线:0592 - 3272000</span>
 				</div>
 			</div>
@@ -48,6 +48,7 @@
 
 <script>
 import AppSwiper from '@/components/app-swiper'
+import AppImg from '@/components/app-img'
 // img
 import banner1 from '@/static/images/official/banner-1.png'
 import banner2 from '@/static/images/official/banner-2.png'
@@ -74,7 +75,8 @@ import list8 from '@/static/images/official/list-8.png'
 export default {
 	name: 'index',
 	components: {
-		AppSwiper
+		AppSwiper,
+		AppImg
 	},
 	data() {
 		return {

BIN
mobile-code/src/static/images/official/banner-2.png


BIN
mobile-code/src/static/images/official/banner-3.png


BIN
mobile-code/src/static/images/official/banner-4.png