瀏覽代碼

登录页面

lvmax 4 月之前
父節點
當前提交
6a3518103a

+ 1 - 0
pages/examPage/examInfo.vue

@@ -221,6 +221,7 @@ this.$refs.inputDialog.open()
 			},
 			// 退出
 			infoExit() {
+				screenfull.exit()
 				exit()
 			},
 			// 开始考试

+ 107 - 12
pages/login/Login.vue

@@ -11,7 +11,7 @@
 		style="background-image:url(../../static/bg1.svg) ;height: 100vh;background-size: cover;background-color: #beb685;">
 		<view class="flex-item flex-item-V uni-bg-red">
 			<view style="height: 50px;padding: 30px;">
-				<view class="title">艺术监测考试</view>
+				<view class="title"><strong style="color: #414100 ;">艺术监测考试</strong></view>
 			</view>
 		</view>
 		<view class="flex-item flex-item-V uni-bg-green">
@@ -31,11 +31,23 @@
 				<view class="flex-item uni-bg-blue">
 				</view>
 			</view>
-			<view style="position: fixed;right: 10px;bottom: 10px;background-color: #c1c1c1;width: 300px;height: 200px;">
-				<a href="https://down.360safe.com/se/qd/360se_setup__sembg100031.exe">360浏览器</a>
-				<br/>
-				<a href="https://c2rsetup.officeapps.live.com/c2r/downloadEdge.aspx?platform=Default&source=EdgeStablePage&Channel=Stable&language=zh-cn&brand=M100">edge浏览器</a>
-			</view>
+			<uni-card :title="'浏览器下载和音频测试'"
+				style="position: fixed;right: 10px;bottom: 10px;background-color: #a4c1bd;width: 280px;height: 180px;border-radius: 25px;padding: 20px;">
+				<strong><uni-link href="https://browser.360.cn/" text="360浏览器" color="#780002"></uni-link> /
+					<uni-link href="https://www.microsoft.com/zh-cn/edge/download" text="Edge浏览器"
+						color="#780002"></uni-link> /
+					<uni-link href="https://www.google.cn/intl/zh-CN/chrome/browser-tools/" text="谷歌浏览器"
+						color="#780002"></uni-link></strong>
+				<view style="width: 95%;height: 60%;background-color: #adab6f;padding: 2%;border-radius: 5px;">
+					<slider :value="sliderValue" @change="onSliderChange" max="100" style="width: 85%;" :block-size='15'
+						block-color='#A2ABAA' activeColor='#19C590'></slider>
+					<button @click="onplay()"
+						style="width: 40%;display: inline-block;margin: 0 4% ;padding: 2px;">播放/暂停</button>
+					<button @click="stop()"
+						style="width: 40%;display: inline-block;margin: 0 4% ;padding: 2px;">结束</button>
+				</view>
+
+			</uni-card>
 		</view>
 	</view>
 
@@ -59,7 +71,13 @@
 				msgType: 'success',
 				messageText: '这是一条成功提示',
 				value: '',
-
+				innerAudioContext: null,
+				audio: true,
+				sliderValue: null,
+				intervalIDqw: null,
+				intervalIDs: null,
+				duration: '',
+				currentTime: '',
 			}
 		},
 		methods: {
@@ -87,6 +105,7 @@
 							let user = JSON.stringify(data.data.result.userInfo)
 							sessionStorage.removeItem("user")
 							sessionStorage.setItem("user", user)
+							this.stop()
 							redirectTo('/pages/examPage/examInfo');
 						} else {
 							this.messageToggle('error', data.data.message)
@@ -96,7 +115,80 @@
 					.catch(err => {
 						this.messageToggle('error', "网络质量不佳,请重试")
 					})
-			}
+			},
+			onplay() {
+				if (this.audio) {
+					this.audio = false
+					this.innerAudioContext.play();
+					this.intervalIDs = setInterval(() => {
+						if (this.innerAudioContext.duration !== 0) {
+							// clearInterval(intervalID);
+							this.duration = this.formatTime(this.innerAudioContext.duration) // 总时长
+							this.currentTime = this.formatTime(this.innerAudioContext.currentTime) // 当前时长
+							if (this.currentTime === this.duration) {
+								clearInterval(this.intervalIDs);
+							}
+						}
+					}, 500);
+					// 启动定时器,每秒更新一次进度条位置
+					this.intervalIDqw = setInterval(() => {
+						if (this.innerAudioContext.duration > 0) {
+							this.sliderValue = (this.innerAudioContext.currentTime / this.innerAudioContext
+								.duration) * 100;
+						}
+					}, 1000)
+
+				} else {
+					this.audio = true
+					this.innerAudioContext.pause()
+					clearInterval(this.intervalIDs);
+					clearInterval(this.intervalIDqw);
+				}
+			},
+			stop() {
+				this.audio = true
+				this.innerAudioContext.stop()
+				this.sliderValue = 0
+				clearInterval(this.intervalIDs);
+				clearInterval(this.intervalIDqw);
+			},
+			formatTime(seconds) {
+				const minutes = Math.floor(seconds / 60);
+				const remainingSeconds = Math.floor(seconds % 60);
+				return `${minutes}:${remainingSeconds < 10 ? '0' : ''}${remainingSeconds}`;
+			},
+			onSliderChange(event) {
+				const value = event.detail.value;
+				if (this.innerAudioContext && this.innerAudioContext.duration > 0) {
+					// 验证 value 是否是有效的百分比值(0-100之间)
+					if (isNaN(value) || value < 0 || value > 100) {
+						console.error("Invalid value:", value);
+						return;
+					}
+
+					// 计算新的位置
+					const newPosition = (value / 100) * this.innerAudioContext.duration;
+
+					// 验证 newPosition 是否是有效的数字,不是 NaN,并且在有效范围内
+					if (!isNaN(newPosition) && newPosition >= 0 && newPosition <= this.innerAudioContext.duration) {
+						// 设置音频播放位置
+						this.innerAudioContext.seek(newPosition);
+						console.log("Seeking to position:", newPosition);
+						if (!this.dragging) { // 避免拖动滑块时自动更新
+							this.sliderValue = value;
+						}
+					} else {
+						console.error("Invalid newPosition:", newPosition);
+					}
+				}
+			},
+			doKey(e) {
+				const ev = e || window.event // 获取event对象
+				if (ev.keyCode === 13) {
+					this.submitUser()
+				}
+			},
+
 		},
 		mounted() {
 
@@ -104,6 +196,9 @@
 				.getItem("token") !== "") {
 				redirectTo('/pages/examPage/examInfo');
 			}
+			this.innerAudioContext = uni.createInnerAudioContext();
+			this.innerAudioContext.src = 'http://10.11.12.100:9000/exam-bucket/中华人民共和国国歌.mp3';
+			document.onkeydown = this.doKey
 		},
 		created() {
 
@@ -114,11 +209,11 @@
 	.uni-input {
 		padding-left: 20px;
 		border: 1rpx solid #EEEEEE;
-		height: 96rpx;
+		height: 50px;
 		box-shadow: 2px 2px 5px #aaaaaa;
 		margin: auto;
-		margin-top: 300px;
-		line-height: 96rpx;
+		margin-top: 25vh;
+
 		color: #000000;
 		width: 380px;
 		display: flex;
@@ -153,6 +248,6 @@
 		color: #000000;
 		width: 600px;
 		text-align: center;
-		margin: auto;
+		margin: 0 auto 0 auto;
 	}
 </style>

二進制
static/uni.ttf


+ 17 - 0
uni_modules/uni-link/changelog.md

@@ -0,0 +1,17 @@
+## 1.0.0(2021-11-19)
+- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
+- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-link](https://uniapp.dcloud.io/component/uniui/uni-link)
+## 1.1.7(2021-11-08)
+## 0.0.7(2021-09-03)
+- 修复 在 nvue 下不显示的 bug
+## 0.0.6(2021-07-30)
+- 新增 支持自定义插槽
+## 0.0.5(2021-06-21)
+- 新增 download 属性,H5平台下载文件名
+## 0.0.4(2021-05-12)
+- 新增 组件示例地址
+## 0.0.3(2021-03-09)
+- 新增 href 属性支持 tel:|mailto:
+
+## 0.0.2(2021-02-05)
+- 调整为uni_modules目录规范

+ 128 - 0
uni_modules/uni-link/components/uni-link/uni-link.vue

@@ -0,0 +1,128 @@
+<template>
+	<a v-if="isShowA" class="uni-link" :href="href"
+		:class="{'uni-link--withline':showUnderLine===true||showUnderLine==='true'}"
+		:style="{color,fontSize:fontSize+'px'}" :download="download">
+		<slot>{{text}}</slot>
+	</a>
+	<!-- #ifndef APP-NVUE -->
+	<text v-else class="uni-link" :class="{'uni-link--withline':showUnderLine===true||showUnderLine==='true'}"
+		:style="{color,fontSize:fontSize+'px'}" @click="openURL">
+		<slot>{{text}}</slot>
+	</text>
+	<!-- #endif -->
+	<!-- #ifdef APP-NVUE -->
+	<text v-else class="uni-link" :class="{'uni-link--withline':showUnderLine===true||showUnderLine==='true'}"
+		:style="{color,fontSize:fontSize+'px'}" @click="openURL">
+		{{text}}
+	</text>
+	<!-- #endif -->
+</template>
+
+<script>
+	/**
+	 * Link 外部网页超链接组件
+	 * @description uni-link是一个外部网页超链接组件,在小程序内复制url,在app内打开外部浏览器,在h5端打开新网页
+	 * @tutorial https://ext.dcloud.net.cn/plugin?id=1182
+	 * @property {String} href 点击后打开的外部网页url
+	 * @property {String} text 显示的文字
+	 * @property {String} downlaod H5平台下载文件名
+	 * @property {Boolean} showUnderLine 是否显示下划线
+	 * @property {String} copyTips 在小程序端复制链接时显示的提示语
+	 * @property {String} color 链接文字颜色
+	 * @property {String} fontSize 链接文字大小
+	 * @example * <uni-link href="https://ext.dcloud.net.cn" text="https://ext.dcloud.net.cn"></uni-link>
+	 */
+	export default {
+		name: 'uniLink',
+		props: {
+			href: {
+				type: String,
+				default: ''
+			},
+			text: {
+				type: String,
+				default: ''
+			},
+			download: {
+				type: String,
+				default: ''
+			},
+			showUnderLine: {
+				type: [Boolean, String],
+				default: true
+			},
+			copyTips: {
+				type: String,
+				default: '已自动复制网址,请在手机浏览器里粘贴该网址'
+			},
+			color: {
+				type: String,
+				default: '#999999'
+			},
+			fontSize: {
+				type: [Number, String],
+				default: 14
+			}
+		},
+		computed: {
+			isShowA() {
+				// #ifdef H5
+				this._isH5 = true;
+				// #endif
+				if ((this.isMail() || this.isTel()) && this._isH5 === true) {
+					return true;
+				}
+				return false;
+			}
+		},
+		created() {
+			this._isH5 = null;
+		},
+		methods: {
+			isMail() {
+				return this.href.startsWith('mailto:');
+			},
+			isTel() {
+				return this.href.startsWith('tel:');
+			},
+			openURL() {
+				// #ifdef APP-PLUS
+				if (this.isTel()) {
+					this.makePhoneCall(this.href.replace('tel:', ''));
+				} else {
+					plus.runtime.openURL(this.href);
+				}
+				// #endif
+				// #ifdef H5
+				window.open(this.href)
+				// #endif
+				// #ifdef MP
+				uni.setClipboardData({
+					data: this.href
+				});
+				uni.showModal({
+					content: this.copyTips,
+					showCancel: false
+				});
+				// #endif
+			},
+			makePhoneCall(phoneNumber) {
+				uni.makePhoneCall({
+					phoneNumber
+				})
+			}
+		}
+	}
+</script>
+
+<style>
+	/* #ifndef APP-NVUE */
+	.uni-link {
+		cursor: pointer;
+	}
+
+	/* #endif */
+	.uni-link--withline {
+		text-decoration: underline;
+	}
+</style>

+ 87 - 0
uni_modules/uni-link/package.json

@@ -0,0 +1,87 @@
+{
+  "id": "uni-link",
+  "displayName": "uni-link 超链接",
+  "version": "1.0.0",
+  "description": "uni-link是一个外部网页超链接组件,在小程序内复制url,在app内打开外部浏览器,在h5端打",
+  "keywords": [
+    "uni-ui",
+    "uniui",
+    "link",
+    "超链接",
+    ""
+],
+  "repository": "https://github.com/dcloudio/uni-ui",
+  "engines": {
+    "HBuilderX": ""
+  },
+  "directories": {
+    "example": "../../temps/example_temps"
+  },
+  "dcloudext": {
+    "category": [
+      "前端组件",
+      "通用组件"
+    ],
+    "sale": {
+      "regular": {
+        "price": "0.00"
+      },
+      "sourcecode": {
+        "price": "0.00"
+      }
+    },
+    "contact": {
+      "qq": ""
+    },
+    "declaration": {
+      "ads": "无",
+      "data": "无",
+      "permissions": "无"
+    },
+    "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
+  },
+  "uni_modules": {
+    "dependencies": ["uni-scss"],
+    "encrypt": [],
+    "platforms": {
+      "cloud": {
+        "tcb": "y",
+        "aliyun": "y"
+      },
+      "client": {
+        "App": {
+          "app-vue": "y",
+          "app-nvue": "y"
+        },
+        "H5-mobile": {
+          "Safari": "y",
+          "Android Browser": "y",
+          "微信浏览器(Android)": "y",
+          "QQ浏览器(Android)": "y"
+        },
+        "H5-pc": {
+          "Chrome": "y",
+          "IE": "y",
+          "Edge": "y",
+          "Firefox": "y",
+          "Safari": "y"
+        },
+        "小程序": {
+          "微信": "y",
+          "阿里": "y",
+          "百度": "y",
+          "字节跳动": "y",
+          "QQ": "y"
+        },
+        "快应用": {
+          "华为": "y",
+          "联盟": "y"
+        },
+        "Vue": {
+            "vue2": "y",
+            "vue3": "y"
+        }
+      }
+    }
+  }
+}

+ 11 - 0
uni_modules/uni-link/readme.md

@@ -0,0 +1,11 @@
+
+
+## Link 链接
+> **组件名:uni-link**
+> 代码块: `uLink`
+
+
+uni-link是一个外部网页超链接组件,在小程序内复制url,在app内打开外部浏览器,在h5端打开新网页。
+
+### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-link)
+#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839