Browse Source

feat: update report buttons and mini program fonts

Developer 1 week ago
parent
commit
d6f49953c9

+ 5 - 4
App.vue

@@ -101,9 +101,10 @@
 		src: url("@/static/Bebas.TTF");
 	}
 
-	* {
-		box-sizing: border-box;
-	}
+	*:not(.u-icon__icon):not([class*="iconfont"]) {
+		box-sizing: border-box;
+		font-family: Calibri, "Microsoft JhengHei UI", sans-serif !important;
+	}
 
 	uni-page-body,
 	html,
@@ -223,4 +224,4 @@
 		text-align: center;
 		letter-spacing: 2rpx;
 	}
-</style>
+</style>

+ 35 - 16
pagesHome/components/report/generateList.vue

@@ -25,8 +25,8 @@
 					</view>
 					<view class="gbox-item-bottom adfacjb">
 						<view class="gbox-item-bottom-rightbox adfac" v-if="item.type==1">
-							<view class="gbox-item-bottom-right" @click="reviewArtifact(item, 'background')" v-if="item.state==1">背景报告</view>
-							<view class="gbox-item-bottom-right" @click="reviewArtifact(item, 'professional')" v-if="item.state==1">教练报告</view>
+							<view class="gbox-item-bottom-right report-button-disabled" @click="showReportUnavailable('background')" v-if="item.state==1">背景报告</view>
+							<view class="gbox-item-bottom-right report-button-disabled" @click="showReportUnavailable('professional')" v-if="item.state==1">教练报告</view>
 							<view class="gbox-item-bottom-right" @click="reviewArtifact(item, 'public')" v-if="item.state==1">团队报告</view>
 							<view class="gbox-item-bottom-right" @click="reSendReport(item)" v-if="item.state==-1">重新生成</view>
 						</view>
@@ -42,13 +42,20 @@
 				</view>
 			</u-list-item>
 		</u-list>
-		<view class="kind-reminder adffcacjc" v-if="testShow">
-			<view class="kr-box adffcac">
-				<view class="kr-title">温馨提示</view>
-				<view class="kr-p" style="margin-top: 54rpx;">功能测试中,即将上线,敬请期待!</view>
-				<view class="kr-btn" @click="testShow=false">确定</view>
-			</view>
-		</view>
+		<view class="kind-reminder adffcacjc" v-if="testShow">
+			<view class="kr-box adffcac">
+				<view class="kr-title">温馨提示</view>
+				<view class="kr-p" style="margin-top: 54rpx;">功能测试中,即将上线,敬请期待!</view>
+				<view class="kr-btn" @click="testShow=false">确定</view>
+			</view>
+		</view>
+		<view class="kind-reminder adffcacjc" v-if="reportReminderShow">
+			<view class="kr-box adffcac">
+				<view class="kr-title">温馨提示</view>
+				<view class="kr-p" style="margin-top: 54rpx;">{{reportReminderMsg}}</view>
+				<view class="kr-btn" @click="reportReminderShow=false">确定</view>
+			</view>
+		</view>
 		<cus-select-team-user 
 			ref="selectTeamUser" 
 			:show="teamUserShow"
@@ -95,7 +102,9 @@
 				categoryData:[],
 				sendType:1,
 				selectItem:null,
-				testShow:false
+				testShow:false,
+				reportReminderShow:false,
+				reportReminderMsg:''
 			}
 		},
 		methods:{
@@ -155,12 +164,18 @@
 				})
 				this.$refs.selectTeamUser.selectNums = this.teamUserList.filter(l=>l.select).length;
 			},
-			dealNumAndAll(){
+			dealNumAndAll(){
 				const selectnum = this.teamUserList.filter(l=>l.select).length;
 				this.$refs.selectTeamUser.selectNums = selectnum;
-				this.$refs.selectTeamUser.selectAll = selectnum === this.teamUserList.length;
-			},
-			sendConfirm(){
+				this.$refs.selectTeamUser.selectAll = selectnum === this.teamUserList.length;
+			},
+			showReportUnavailable(kind){
+				this.reportReminderMsg = kind === 'background'
+					? '背景报告需配合团队版评估数据生成'
+					: '教练报告需要配合团队版评估数据生成';
+				this.reportReminderShow = true;
+			},
+			sendConfirm(){
 				if(this.teamUserList.filter(t=>t.select).length===0) return this.$showToast('请选择要发送的用户')
 				if(this.sendType===1&&(!uni.getStorageSync('userInfo')||!JSON.parse(uni.getStorageSync('userInfo')).email)) return this.$showModal('发送前请先在我的-设置-用户信息中绑定邮箱')
 				
@@ -402,8 +417,12 @@
 					font-family: PingFang-SC, PingFang-SC;
 					font-size: 24rpx;
 					color: #FFFFFF;
-					margin-left: 35rpx;
-				}
+					margin-left: 35rpx;
+					&.report-button-disabled{
+						background: #D5DDE2;
+						color: #FFFFFF;
+					}
+				}
 			}
 		}
 	

+ 13 - 0
tests/fontFamily.test.js

@@ -0,0 +1,13 @@
+const assert = require('node:assert/strict')
+const fs = require('node:fs')
+const path = require('node:path')
+
+const root = path.join(__dirname, '..')
+const appSource = fs.readFileSync(path.join(root, 'App.vue'), 'utf8')
+
+assert.match(
+	appSource,
+	/\*:not\(\.u-icon__icon\):not\(\[class\*=['"]iconfont['"]\]\)\s*\{[\s\S]*?font-family:\s*Calibri,\s*['"]Microsoft JhengHei UI['"],\s*sans-serif\s*!important;/
+)
+
+console.log('global font family rules: PASS')

+ 32 - 0
tests/reportButtonAvailability.test.js

@@ -0,0 +1,32 @@
+const assert = require('assert');
+const fs = require('fs');
+
+const source = fs.readFileSync('pagesHome/components/report/generateList.vue', 'utf8');
+
+assert.match(
+  source,
+  /class="gbox-item-bottom-right report-button-disabled"\s+@click="showReportUnavailable\('background'\)"/
+);
+assert.match(
+  source,
+  /class="gbox-item-bottom-right report-button-disabled"\s+@click="showReportUnavailable\('professional'\)"/
+);
+assert.match(source, /背景报告需配合团队版评估数据生成/);
+assert.match(source, /教练报告需要配合团队版评估数据生成/);
+assert.match(source, /v-if="reportReminderShow"/);
+assert.match(source, /<view class="kr-title">温馨提示<\/view>/);
+assert.match(source, /<view class="kr-btn" @click="reportReminderShow=false">确定<\/view>/);
+assert.match(
+  source,
+  /class="gbox-item-bottom-right"\s+@click="reviewArtifact\(item, 'public'\)"\s+v-if="item\.state==1">团队报告/
+);
+assert.match(
+  source,
+  /class="gbox-item-bottom-right"\s+@click="reviewArtifact\(item, 'background'\)"\s+v-if="item\.state==1">背景报告/
+);
+assert.match(
+  source,
+  /class="gbox-item-bottom-right"\s+@click="reviewArtifact\(item, 'professional'\)"\s+v-if="item\.state==1">教练报告/
+);
+
+console.log('reportButtonAvailability.test.js: all assertions passed');