lhl il y a 4 ans
Parent
commit
bad01a2ddc
2 fichiers modifiés avec 183 ajouts et 6 suppressions
  1. 12 6
      pages.json
  2. 171 0
      pages/users/kefu/kefu.vue

+ 12 - 6
pages.json

@@ -127,6 +127,12 @@
 						"navigationBarTitleText": "个人资料"
 					}
 				},
+				{
+					"path": "kefu/kefu",
+					"style": {
+						"navigationBarTitleText": "客服"
+					}
+				},
 				{
 					"path": "user_get_coupon/index",
 					"style": {
@@ -151,12 +157,12 @@
 						"navigationBarTitleText": "签到记录"
 					}
 				},
-				// {
-				// 	"path": "user_money/index",
-				// 	"style": {
-				// 		"navigationBarTitleText": "我的账户"
-				// 	}
-				// },
+				{
+					"path": "user_money/index",
+					"style": {
+						"navigationBarTitleText": "我的账户"
+					}
+				},
 				{
 					"path": "user_bill/index",
 					"style": {

+ 171 - 0
pages/users/kefu/kefu.vue

@@ -0,0 +1,171 @@
+<template>
+	<view class="kefu">
+		<view class="kf">
+			<!-- #ifdef H5 -->
+			<image :src="kefu_img" class="kfimg"></image>
+			<!-- #endif -->
+			<!-- #ifdef MP -->
+			<image :src="kefu_img" @longpress="savePosterPath(kefu_img)" class="kfimg"></image>
+			<!-- #endif -->
+			<view class="kftext">
+				{{kefu_text}}
+			</view>
+		</view>	
+	</view>
+</template>
+
+<script>
+	import {
+		getArticleDetails
+	} from '@/api/api.js'
+
+	export default {
+		data() {
+			return {
+				kefu_img: '',
+				kefu_text: '',
+			}
+		},
+		onLoad() {
+			this.getKefuInfo()
+		},
+		methods: {
+			getKefuInfo() {
+				getArticleDetails(151, {}).then(({
+					data
+				}) => {
+					this.kefu_img = data.image_input
+					this.kefu_text = data.synopsis
+					uni.setNavigationBarTitle({
+						title: data.title
+					})
+				})
+			},
+			// #ifdef MP
+			// 小程序保存图片
+			savePosterPath(url) {
+				uni.downloadFile({
+					url,
+					success: (resFile) => {
+						console.log(resFile, "resFile");
+						if (resFile.statusCode === 200) {
+							uni.getSetting({
+								success: (res) => {
+									if (!res.authSetting["scope.writePhotosAlbum"]) {
+										uni.authorize({
+											scope: "scope.writePhotosAlbum",
+											success: () => {
+												uni.saveImageToPhotosAlbum({
+													filePath: resFile.tempFilePath,
+													success: (res) => {
+														return uni.showToast({
+															title: "保存成功!",
+														});
+													},
+													fail: (res) => {
+														return uni.showToast({
+															title: res.errMsg,
+														});
+													},
+													complete: (res) => {},
+												});
+											},
+											fail: () => {
+												uni.showModal({
+													title: "您已拒绝获取相册权限",
+													content: "是否进入权限管理,调整授权?",
+													success: (res) => {
+														if (res.confirm) {
+															uni.openSetting({
+																success: (res) => {
+																	console.log(res.authSetting);
+																},
+															});
+														} else if (res.cancel) {
+															return uni.showToast({
+																title: "已取消!",
+															});
+														}
+													},
+												});
+											},
+										});
+									} else {
+										uni.saveImageToPhotosAlbum({
+											filePath: resFile.tempFilePath,
+											success: (res) => {
+												return uni.showToast({
+													title: "保存成功!",
+												});
+											},
+											fail: (res) => {
+												return uni.showToast({
+													title: res.errMsg,
+												});
+											},
+											complete: (res) => {},
+										});
+									}
+								},
+								fail: (res) => {},
+							});
+						} else {
+							return uni.showToast({
+								title: resFile.errMsg,
+							});
+						}
+					},
+					fail: (res) => {
+						return uni.showToast({
+							title: res.errMsg,
+						});
+					},
+				});
+			},
+			// #endif
+		}
+	}
+</script>
+
+<style scoped lang="scss">
+	.kefu {
+		position: fixed;
+		background-color: #f5f5f5;
+		height: 100%;
+		width: 100%;
+		.kf {
+			height: 500rpx;
+			width: 500rpx;
+			position: absolute;
+			// background-color: #bfa;
+			top: 0;
+			right: 0;
+			left: 0;
+			bottom: 0;
+			margin: auto;
+			.kfimg {
+				display: block;
+				margin: 0 auto;
+				width: 400rpx;
+				height: 400rpx;
+			}
+			.kftext {
+				padding-top: 20rpx;
+				font-size: 32rpx;
+				text-align: center;
+			}
+		}
+		// .kftext {
+		// 	font-size: 32rpx;
+		// 	height: 50rpx;
+		// 	width: 750rpx;
+		// 	position: absolute;
+		// 	top: 0;
+		// 	right: 0;
+		// 	left: 0;
+		// 	bottom: 0;
+		// 	margin:50rpx auto 0;
+		// }
+	}
+	
+</style>