Browse Source

修复部分显示异常

XSXS 1 month ago
parent
commit
6253a47a22

+ 56 - 68
common/util.js

@@ -84,93 +84,81 @@ function removeStorage(key) {
 function drawtext(text, maxWidth) {
 	let textArr = text.split("");
 	let len = textArr.length;
-	// 上个节点
-	let previousNode = 0;
-	// 记录节点宽度
-	let nodeWidth = 0;
-	// 文本换行数组
 	let rowText = [];
-	// 如果是字母,侧保存长度
-	let letterWidth = 0;
-	// 汉字宽度
-	let chineseWidth = 16;
-	// otherFont宽度
-	let otherWidth = 8;
+	let currentLine = "";
+	let currentWidth = 0;
+	let lastChineseIndex = -1;
+	
 	for (let i = 0; i < len; i++) {
-		if (/[\u4e00-\u9fa5]|[\uFE30-\uFFA0]/g.test(textArr[i])) {
-			if (letterWidth > 0) {
-				if (nodeWidth + chineseWidth + letterWidth * otherWidth > maxWidth) {
-					rowText.push({
-						type: "text",
-						content: text.substring(previousNode, i)
-					});
-					previousNode = i;
-					nodeWidth = chineseWidth;
-					letterWidth = 0;
-				} else {
-					nodeWidth += chineseWidth + letterWidth * otherWidth;
-					letterWidth = 0;
-				}
-			} else {
-				if (nodeWidth + chineseWidth > maxWidth) {
-					rowText.push({
-						type: "text",
-						content: text.substring(previousNode, i)
-					});
-					previousNode = i;
-					nodeWidth = chineseWidth;
-				} else {
-					nodeWidth += chineseWidth;
-				}
-			}
+		let char = textArr[i];
+		let charWidth = 0;
+		
+		// 计算字符宽度
+		if (/[\u4e00-\u9fa5]|[\uFE30-\uFFA0]/g.test(char)) {
+			charWidth = 16; // 汉字宽度
+			lastChineseIndex = i;
+		} else if (/[a-zA-Z0-9]/g.test(char)) {
+			charWidth = 8; // 字母和数字宽度
 		} else {
-			if (/\n/g.test(textArr[i])) {
-				rowText.push({
-					type: "break",
-					content: text.substring(previousNode, i)
-				});
-				previousNode = i + 1;
-				nodeWidth = 0;
-				letterWidth = 0;
-			} else if (textArr[i] == "\\" && textArr[i + 1] == "n") {
+			charWidth = 16; // 其他字符宽度
+		}
+		
+		// 处理换行符
+		if (char === "\n" || (char === "\\" && textArr[i + 1] === "n")) {
+			if (currentLine) {
 				rowText.push({
-					type: "break",
-					content: text.substring(previousNode, i)
+					type: "text",
+					content: currentLine
 				});
-				previousNode = i + 2;
-				nodeWidth = 0;
-				letterWidth = 0;
-			} else if (/[a-zA-Z0-9]/g.test(textArr[i])) {
-				letterWidth += 1;
-				if (nodeWidth + letterWidth * otherWidth > maxWidth) {
+			}
+			rowText.push({
+				type: "break",
+				content: ""
+			});
+			currentLine = "";
+			currentWidth = 0;
+			lastChineseIndex = -1;
+			if (char === "\\") i++; // 跳过\n中的n
+			continue;
+		}
+		
+		// 检查是否需要换行
+		if (currentWidth + charWidth > maxWidth) {
+			if (currentLine) {
+				// 如果当前字符是汉字,且不是第一个字符,则在上一个汉字处换行
+				if (lastChineseIndex > 0 && lastChineseIndex < i) {
 					rowText.push({
 						type: "text",
-						content: text.substring(previousNode, i + 1 - letterWidth)
+						content: currentLine.substring(0, lastChineseIndex + 1)
 					});
-					previousNode = i + 1 - letterWidth;
-					nodeWidth = letterWidth * otherWidth;
-					letterWidth = 0;
-				}
-			} else {
-				if (nodeWidth + otherWidth > maxWidth) {
+					currentLine = currentLine.substring(lastChineseIndex + 1) + char;
+					currentWidth = currentLine.length * charWidth;
+				} else {
 					rowText.push({
 						type: "text",
-						content: text.substring(previousNode, i)
+						content: currentLine
 					});
-					previousNode = i;
-					nodeWidth = otherWidth;
-				} else {
-					nodeWidth += otherWidth;
+					currentLine = char;
+					currentWidth = charWidth;
 				}
+			} else {
+				currentLine = char;
+				currentWidth = charWidth;
 			}
+		} else {
+			currentLine += char;
+			currentWidth += charWidth;
 		}
 	}
-	if (previousNode < len) {
+	
+	// 添加最后一行
+	if (currentLine) {
 		rowText.push({
 			type: "text",
-			content: text.substring(previousNode, len)
+			content: currentLine
 		});
 	}
+	
 	return rowText;
 }
 // 重写app弹窗

+ 4 - 4
components/CommentSection/CommentSection.vue

@@ -12,10 +12,10 @@
 				:tableTotal.sync="tableTotal" :deleteMode="deleteMode" @likeFun="likeFun" @replyFun="replyFun"
 				@deleteFun="deleteFun" :isComment="articleInfo.can_comment"></CComment>
 
-			<view class="comment-button" @tap="openComment">
+		<!-- 	<view class="comment-button" @tap="openComment">
 				<text class="fa fa-pencil"></text>
 				<text>发表新评论</text>
-			</view>
+			</view> -->
 			<view class="bottomFixed">
 				<view class="inbutBox" @tap="openComment">
 					<view class="left-box">
@@ -312,7 +312,7 @@ export default {
 		display: flex;
 		align-items: center;
 		margin-bottom: 20rpx;
-
+		padding-left: 28rpx;
 		.fa {
 			font-size: 36rpx;
 			color: #666;
@@ -327,7 +327,7 @@ export default {
 
 		.comment-count {
 			font-size: 28rpx;
-			margin-left: 10rpx;
+			// margin-left: 10rpx;
 			font-family: 'PingFang SC-Medium';
 			font-weight: 400;
 			color: #1F1F1F;

+ 1 - 0
components/WorkItem/WorkItem.vue

@@ -79,6 +79,7 @@ export default {
         box-sizing: border-box;
         background-color: #f8f9fa;
         margin-bottom: 12rpx;
+		border-radius: 16rpx;
         .icon {
         }
         &.icon-box2 {

+ 4 - 1
components/card/card.vue

@@ -210,9 +210,12 @@ export default {
   margin-bottom: 20rpx;
   border-radius: 30rpx;
   position: relative;
+  border-radius: 16rpx;
+  overflow: hidden;
 
   // #ifndef APP-NVUE
   .waterfall-item__image {
+    border-radius: 16rpx;
     width: 100%;
     height: auto;
     box-sizing: border-box;
@@ -245,7 +248,7 @@ export default {
       flex-direction: row;
       align-items: center;
       background: rgba(0, 0, 0, 0.2);
-      padding: 4rpx 14rpx;
+      padding: 8rpx 14rpx;
       border-radius: 12rpx;
 
       .look-icon {

+ 1 - 1
components/cc-comment/cc-comment.vue

@@ -570,7 +570,7 @@ export default {
 
 ////////////////////////
 .c_total {
-	padding: 20rpx 30rpx 0 30rpx;
+	padding: 20rpx 30rpx 0 28rpx;
 	font-size: 28rpx;
 }
 

+ 5 - 5
components/page-navbar/page-navbar.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="page-top">
-		<image class="bg" src="@/static/home/sy_img_top.png"></image>
+		<!-- <image class="bg" src="@/static/home/sy_img_top.png"></image> -->
 		<uv-navbar bgColor="transparent" placeholder>
 			<template #left>
 				<slot name="navLeft"></slot>
@@ -30,12 +30,12 @@
 	.page-top {
 		// position: relative;
 		width: 750rpx;
-		height: calc(400rpx + var(--status-bar-height));
-		margin-bottom: -72rpx;
+		height: calc(380rpx + var(--status-bar-height));
+		margin-bottom: -120rpx;
 
 		.bg {
 			width: 750rpx;
-			height: calc(400rpx + var(--status-bar-height));
+			height: calc(380rpx + var(--status-bar-height));
 		}
 
 		::v-deep.uv-navbar__content {
@@ -47,7 +47,7 @@
 			flex-direction: column;
 			align-items: flex-start;
 			box-sizing: border-box;
-			padding-top: 60rpx;
+			padding-top: 20rpx;
 			padding-bottom: 14rpx;
 
 			.input-box {

+ 3 - 3
manifest.json

@@ -2,8 +2,8 @@
     "name" : "萌创星球",
     "appid" : "__UNI__00BD11F",
     "description" : "这里是创意与灵魂汇聚的起点",
-    "versionName" : "1.0.0",
-    "versionCode" : 100,
+    "versionName" : "1.0.1",
+    "versionCode" : 101,
     "transformPx" : false,
     "app-plus" : {
         "compatible" : {
@@ -74,7 +74,7 @@
                 "ad" : {},
                 "payment" : {
                     "weixin" : {
-                        "__platform__" : [ "android" ],
+                        "__platform__" : [ "ios", "android" ],
                         "appid" : "wxfed977c88f539599",
                         "UniversalLinks" : ""
                     },

+ 7 - 1
pages/AboutUs/xieyi.vue

@@ -40,7 +40,13 @@
 						'desc': '',
 						'path': 'https://e.zhichao.art/web/yhxy.php',
 						'icon': '../../static/me/profile.png'
-					} 
+					},
+					// {
+					// 	'name': '应用权限隐私清单',
+					// 	'desc': '',
+					// 	'path': 'https://e.zhichao.art/web/yyqx.php',
+					// 	'icon': '../../static/me/profile.png'
+					// } 
 				],
 			}
 		},

+ 13 - 6
pages/index/index.scss

@@ -6,6 +6,9 @@
 	    font-weight: normal;
 	    font-style: normal;
 	}
+	.page-top{
+		background:url("/static/home/home-top.png") 518rpx calc(-10rpx + var(--status-bar-height))/212rpx 296rpx no-repeat,url("/static/home/home-t.png") top center/100% auto no-repeat,linear-gradient(to top, #D0FFA5, #ACFF5F);
+	}
 	.tab-nav {
 		display: flex;
 		justify-content: flex-start;
@@ -68,10 +71,13 @@
 		}
 
 		.hot-topics-list {
-			padding: 22rpx 26rpx; 
+			padding: 0 26rpx; 
 			padding-bottom: 0;
-				 
-		}
+			height: 100%;
+			display: flex;
+			flex-direction: column;
+			justify-content: space-between;
+					}
 
 		.topic-item {
 			 
@@ -79,6 +85,7 @@
 			align-items: center;
 			padding: 5rpx 0;
 			justify-content: space-between;
+			flex: 1;
 			.hot-topics-left{
 				display: flex;
 				.topic-index{
@@ -291,10 +298,10 @@
 		box-sizing: border-box;
 		padding:  20rpx; 
 		background: #fff;	
-		border-top-left-radius: 20rpx;
-		border-top-right-radius: 20rpx;
+		border-top-left-radius: 40rpx;
+		border-top-right-radius: 40rpx;
 		::v-deep.uv-swiper{
-			border-radius: 10rpx !important;
+			border-radius: 20rpx !important;
 			overflow: hidden;
 		}
 		.classModel{

+ 3 - 3
pages/index/index.vue

@@ -66,8 +66,8 @@
 			<z-paging-cell class="benner-box" style="padding-bottom: 0;">
 				<sortble :default-sorts="['uvSwiper', 'classModel', 'uvSwiperCard']">
 					<template #uvSwiper>
-						<uv-swiper :list="bannerList" keyName="image" :autoplay="true" circular :interval="5000"
-							indicator indicator-mode="dot" @click="handleBannerClick" height="120" radius="0">
+						<uv-swiper style="border-radius: 20rpx;" :list="bannerList" keyName="image" :autoplay="true" circular :interval="5000"
+							indicator indicator-mode="dot" @click="handleBannerClick" height="116" radius="0">
 
 						</uv-swiper>
 					</template>
@@ -1140,5 +1140,5 @@ export default {
 }
 </style>
 <style>
-@import "@/style/qweather-icons.css";
+@import "@/style/qweather-icons.css"; 
 </style>

+ 1 - 1
pages/index/workDetail.scss

@@ -201,7 +201,7 @@ page {
   }
   .inspirationPictures {
     border-radius: 0px 0px 32rpx 32rpx;
-    border: 2rpx solid #000000;
+    // border: 2rpx solid #000000;
   }
 }
 // 音乐模式样式

+ 22 - 9
pages/login/login.vue

@@ -9,7 +9,7 @@
 		</view>
 
 		<!-- <view class="tbody"> -->
-		<view class="tbody" style="position: fixed;top: 50%;left: 50%;transform: translate(-50%,-50%);">
+		<view class="tbody" style="position: fixed;top: 70%;left: 50%;transform: translate(-50%,-50%);">
 			<block v-if="type == 'onelogin'">
 				<image class="icon" mode="widthFix" src="../../static/me/avator.png"></image>
 				<text class="mobile">+ 86 1**********</text>
@@ -22,7 +22,7 @@
 				</view>
 			</block>
 			<block v-if="type == 'pass' || type == 'mobile'">
-				<template v-if="true">
+				<template v-if="false">
 					<view class="name">手机号码:</view>
 					<view class="item">
 						<input type="number" class="input" v-model="mobile" placeholder="请输入手机号码" maxlength="11" />
@@ -563,7 +563,11 @@ export default {
 								this_ = this
 								setTimeout(() => {
 									uni.closeAuthView() //关闭一键登录弹出窗口
-									this.onClickMsgLogin()
+									_this.onClickMsgLogin()
+									uni.showToast({
+										title: "请插入SIM卡并且使用流量后再重试",
+										icon: "none"
+									})
 								}, 500)
 							})
 						},
@@ -579,18 +583,27 @@ export default {
 					// 根据错误信息判断失败原因,如有需要可将错误提交给统计服务器
 					console.log(res.errCode)
 					console.log(res.errMsg)
-					this.onClickMsgLogin()
+					_this.onClickMsgLogin()
+					uni.hideToast();
+					uni.showToast({
+						title: "请插入SIM卡并且使用流量后再重试",
+						icon: "none",
+						duration: 3000
+					})
 				}
 			})
 		},
 		// 一键登录失败
 		onClickMsgLogin() {
 			uni.closeAuthView()
-			uni.showToast({
-				// title: '一键登录失败,请使用其他方式登录',
-				title: '一键登录失败,请重试',
-				icon: "none"
-			})
+			uni.hideToast();
+			setTimeout(() => {
+				uni.showToast({
+					title: "请插入SIM卡并且使用流量后再重试",
+					icon: "none",
+					duration: 3000
+				}) 
+			}, 500)
 
 
 		}

+ 55 - 14
pages/make/fabuArticle.vue

@@ -1,7 +1,5 @@
 <template>
-	<view class="page">
-
-
+	<view class="page"> 
 		<view class="nav-bar">
 			<view class="left">
 				<view class="uni-btn-icon" @click="goBack">&#xe601;</view>
@@ -110,6 +108,7 @@
 </template>
 
 <script>
+import permission from '@/common/permission.js';
 export default {
 	components: {},
 	data() {
@@ -424,22 +423,64 @@ export default {
 				});
 				return
 			}
-			this.upload2(type)
+			uni.showActionSheet({
+				itemList: ['拍照', '从相册选择'],
+				success: (res) => {
+					const sourceType = res.tapIndex === 0 ? 'camera' : 'album';
+					this.checkRights(sourceType);
+				}
+			});
+		},
+		async checkRights(sourceType) {
+			try {
+				let hasPermission = false;
+				
+				if (sourceType === 'camera') {
+					hasPermission = await permission.request(permission.PermissionType.CAMERA, {
+						title: '相机权限申请',
+						describe: '需要使用相机拍摄照片,用于帮助您完成图片制作、图片拍摄、图片上传等功能'
+					});
+					
+					if (!hasPermission) {
+						uni.showToast({
+							title: '未获得相机权限',
+							icon: 'none'
+						});
+						return;
+					}
+				} else {
+					hasPermission = await permission.request(permission.PermissionType.PHOTO_LIBRARY, {
+						title: '相册权限申请',
+						describe: '需要访问相册选择照片,用于帮助您完成图片制作、图片拍摄、图片上传等功能'
+					});
+					
+					if (!hasPermission) {
+						uni.showToast({
+							title: '未获得相册权限',
+							icon: 'none'
+						});
+						return;
+					}
+				}
+				
+				// 权限获取成功后,继续执行上传
+				this.upload2(type, sourceType);
+			} catch (error) {
+				console.error('权限检查失败:', error);
+				uni.showToast({
+					title: '权限检查失败',
+					icon: 'none'
+				});
+			}
 		},
-		upload2(type) {
+		upload2(type, sourceType) {
 			console.log("----upload");
-			// this.$refs.files.upload();
-			// 图片选择上传upload() {
-
 			var _self = this;
-
-			// 图片选择,只支持一次选择一张图片
-
 			uni.chooseImage({
 				count: 5,
-				sizeType: ['compressed'], //可以指定是原图还是压缩图,默认二者都有
-				sourceType: ['album', 'camera'], //从相册、相机选择
-				success: function (res) {
+				sizeType: ['compressed'],
+				sourceType: [sourceType],
+				success: function(res) {
 					console.log('res:', res)
 					for (let index = 0; index < res.tempFilePaths.length; index++) {
 						let filepath = "";

+ 8 - 6
pages/make/index.scss

@@ -1,11 +1,12 @@
 page {
-  background: #f2f6f2;
+
 }
 .container {
   min-height: 100vh;
   background: linear-gradient(180deg, #f0f7ff 0%, #fff1f9 100%);
-  padding: 0;
-  background: #f2f6f2;
+  padding: 0; 
+   background: url("../../static/make/wd_bg_bianjiziliao.png") center top/100% auto
+    no-repeat,#f2f6f2;
 }
 
 .header-box {
@@ -13,8 +14,7 @@ page {
   display: flex;
   align-items: center;
   justify-content: space-between;
-  background: url("../../static/make/wd_bg_bianjiziliao.png") center/100% auto
-    no-repeat;
+
 
   .title {
     font-size: 40rpx;
@@ -26,6 +26,7 @@ page {
   .currency-area {
     display: flex;
     gap: 20rpx;
+	align-items: center;
     // width: 260rpx;
     .coin-box,
     .gold-box {
@@ -57,7 +58,8 @@ page {
 }
 
 .card-grid {
-  padding-left: 30rpx;
+  padding-left: 20rpx;
+  padding-right: 20rpx;
   display: grid;
   grid-template-columns: repeat(2, 1fr);
   grid-template-areas:

+ 1 - 0
pages/makedetail/makeImgDetail.scss

@@ -16,6 +16,7 @@
     align-items: center;
     justify-content: space-between;
     padding: 0 24rpx;
+	padding-top: var(--status-bar-height);
     box-sizing: border-box;
     background: url("../../static/makedetail/cz_bg_top.png") center top / 100%
         auto no-repeat,

+ 1 - 1
pages/makedetail/makeImgDetail.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="makedetail-container">
-		<view class="status-bar"></view>
+		<!-- <view class="status-bar"></view> -->
 		<!-- 顶部导航 -->
 		<view class="nav-bar">
 			<view class="left">

+ 2 - 1
pages/makedetail/makeMusicDetail.scss

@@ -9,13 +9,14 @@
   .status-bar {
     height: var(--status-bar-height);
   }
-  .nav-bar {
+  .nav-bar { 
     width: 100vw;
     height: calc(96rpx + var(--status-bar-height));
     display: flex;
     align-items: center;
     justify-content: space-between;
     padding: 0 24rpx;
+	padding-top: var(--status-bar-height);
     box-sizing: border-box;
     background: url("../../static/makedetail/cz_bg_top.png") center top / 100%
         auto no-repeat,

+ 1 - 0
pages/makedetail/makeMusicDetail.vue

@@ -1,6 +1,7 @@
 <template>
 	<view class="make-music-detail">
 		<!-- 顶部导航 -->
+		<!-- <view class="status-bar"></view> -->
 		<view class="nav-bar">
 			<view class="left">
 				<view class="uni-btn-icon" @click="goBack">&#xe601;</view>

+ 1 - 1
pages/my/userHomepage.vue

@@ -378,7 +378,7 @@ page {
 
 .header {
   padding: 20rpx;
-  padding-top: 48rpx;
+  padding-top:calc( 48rpx  + var(--status-bar-height));
   background: linear-gradient(225deg, #cdff9f 0%, #acff5f 30%, #d0ffa5 100%);
   min-height: 720rpx;
   margin-bottom: -210rpx;

BIN
static/home/home-t.png


BIN
static/home/home-top.png