Browse Source

Merge branch 'master' of http://47.98.226.240:3000/twt/college

twt 3 years ago
parent
commit
61f919f711
4 changed files with 111 additions and 41 deletions
  1. 10 2
      pages.json
  2. 41 0
      pages/mobile/accessory_app.vue
  3. 42 30
      pages/mobile/detail.vue
  4. 18 9
      pages/mobile/index.vue

+ 10 - 2
pages.json

@@ -91,11 +91,19 @@
 				"navigationStyle": "custom"
 			}
 		}
+        ,{
+            "path" : "pages/mobile/accessory_app",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": ""
+            }
+            
+        }
     ],
 	"globalStyle": {
 		"navigationBarTextStyle": "black",
 		"navigationBarTitleText": "门店学院",
-		"navigationBarBackgroundColor": "#F8F8F8",
-		"backgroundColor": "#F8F8F8"
+		"navigationBarBackgroundColor": "#FFFFFF",
+		"backgroundColor": "#FFFFFF"
 	}
 }

+ 41 - 0
pages/mobile/accessory_app.vue

@@ -0,0 +1,41 @@
+<template>
+	<view class="content">
+
+		<iframe :src="fileUrl"></iframe>
+		
+		
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				fileName: '',
+				fileUrl: '',
+			}
+		},
+		onLoad(opt) {
+			this.fileName = opt.fileName;
+			this.fileUrl = opt.fileUrl;
+
+			uni.setNavigationBarTitle({
+				title: this.fileName
+			})
+		},
+		methods: {
+
+		}
+	}
+</script>
+
+<style>
+	.content {
+		height: 100%;
+		width: 100%;
+		background-color: #FFFFFF;
+		
+	}
+	
+	
+</style>

+ 42 - 30
pages/mobile/detail.vue

@@ -2,6 +2,7 @@
 	<view class="content">
 
 		<!-- 导航 -->
+
 		<view class="nav">
 			<view class="leftView" @click="back">
 				<image src="../../static/mobile/backBtn.png" mode=""
@@ -25,7 +26,7 @@
 
 		<view class="html" v-html="detailData.contents"></view>
 
-		
+
 		<!-- item -->
 
 		<view class="itemBg" v-if="itemArr.length != 0">
@@ -33,13 +34,13 @@
 				:class="{grayLine:index < itemArr.length-1}">
 				<view class="itemLeftView">
 					<image src="../../static/mobile/icon_fujian.png" mode="" class="img2"></image>
-					<view class="title" @click="goUrl(item.fileUrl)" >{{item.fileName}}</view>
+					<view class="title" @click="goUrl(item)">{{item.fileName}}</view>
 					<!-- <a class="title" :href='item.fileUrl'>{{item.fileName}}</a> -->
 				</view>
 
 
-				
-				
+
+
 			</view>
 		</view>
 
@@ -55,17 +56,16 @@
 	</view>
 </template>
 
-<script>
-	
+<script>
 	export default {
-		
+
 		data() {
 			return {
 				id: '',
 				detailData: {},
 				couContent: '',
-				itemArr: [],
-				
+				itemArr: [],
+				userType: '',
 			}
 		},
 		onLoad(opt) {
@@ -75,25 +75,35 @@
 			this.getDetailData()
 			// uni.setNavigationBarTitle({
 			// 	title: this.topName
-			// })
-			
+			// })
+
+			this.userType = uni.getStorageSync("userType");
+			console.log('userType', this.userType);
 		},
-		methods: {
-			goUrl(url){
-				console.log('url',url);
-				window.location.href = url
-
-			},
-			
+		methods: {
+			goUrl(item) {
+				// console.log('item',item);
+				
+				if (this.userType == 'app') {
+					uni.navigateTo({
+						url: 'accessory_app?fileName=' + item.fileName + '&fileUrl=' + item.fileUrl
+
+					})
+				} else {
+					window.location.href = item.fileUrl
+				}
+
+			},
+
 			gotoTop() {
 				uni.pageScrollTo({
 					scrollTop: 0,
 					duration: 300
 				});
 			},
-			
 
-			
+
+
 			getDetailData() {
 				uni.showLoading({
 					title: '加载中'
@@ -116,13 +126,13 @@
 
 					this.detailData = data
 
-					
-					console.log('contents1111',this.detailData.contents);
-					
+
+					console.log('contents1111', this.detailData.contents);
+
 					if (this.detailData.contents) {
-						
-						
-						this.detailData.contents = this.detailData.contents.replace(/<iframe([\s\w"-=\/\.:;]+)/ig,
+
+
+						this.detailData.contents = this.detailData.contents.replace(/<iframe([\s\w"-=\/\.:;]+)/ig,
 							'<iframe style="width: 100%;height:300px;" $1');
 
 					}
@@ -137,8 +147,8 @@
 							.replace(/<img([\s\w"-=\/\.:;]+)((?:(alt="[^"]+")))/ig, '<img$1')
 							.replace(/<img([\s\w"-=\/\.:;]+)/ig, '<img style="width: 100%;" $1');
 					}
-
-				console.log('contents',this.detailData.contents);
+
+					console.log('contents', this.detailData.contents);
 					this.itemArr = this.detailData.fileList
 
 				})
@@ -173,7 +183,7 @@
 	}
 </script>
 
-<style scoped>
+<style scoped>
 	.content {
 		min-height: 100vh;
 		background-color: #FFFFFF;
@@ -287,7 +297,9 @@
 		font-size: 28rpx;
 		color: #333333;
 		width: 100%;
-		word-break: break-all;
+		word-break: break-all;
+		text-decoration:underline;
+		
 	}
 
 	.title2 {

+ 18 - 9
pages/mobile/index.vue

@@ -4,7 +4,7 @@
 		<!-- 导航 -->
 		<view class="nav">
 			<view class="leftView" @click="back">
-				<image src="../../static/mobile/backBtn.png" mode=""
+				<image v-if="type == 'app'" src="../../static/mobile/backBtn.png" mode=""
 					style="width: 22rpx; height: 40rpx; padding-left: 24rpx;"></image>
 			</view>
 			<view class="navTitle">门店学院</view>
@@ -103,8 +103,8 @@
 				},
 				itemArr: [],
 				showSift: false,
-				siftData: [],
-				type:'',
+				siftData: [],
+				type: '',
 			}
 		},
 		onLoad(opt) {
@@ -112,14 +112,23 @@
 			this.getSiftData()
 			this.type = opt.type
 			
+			if (this.type) {
+				uni.setStorage({
+					key: 'userType',
+					data: this.type,
+					success: function() {
+						
+					}
+				});
+			}
 		},
-		methods: {
-			
+		methods: {
+
 			back() {
-				
-				console.log('type',this.type);
-				if (this.type == "app") {
-					
+
+				console.log('type', this.type);
+				if (this.type == "app") {
+
 					var standalone = window.navigator.standalone
 					var userAgent = window.navigator.userAgent.toLowerCase()
 					var safari = /safari/.test(userAgent)