Merge branch 'develop' of http://25.13.9.101:9000/K17_AITS/tra-app into develop
This commit is contained in:
+2
-2
@@ -6,7 +6,7 @@ ENV = 'development'
|
||||
|
||||
# VITE_APP_BASE_API_Url = 'https://aits.jlbank.com.cn:7001'
|
||||
|
||||
VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001'
|
||||
#VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002'
|
||||
|
||||
|
||||
# VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7002'
|
||||
@@ -14,7 +14,7 @@ VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001'
|
||||
# VITE_APP_BASE_API_Url = 'http://aitscdn.jlbank.com.cn:7001'
|
||||
# VITE_APP_BASE_API_Url = 'http://192.168.108.129'
|
||||
# dev
|
||||
#VITE_APP_BASE_API_Url = 'http://25.18.122.65:7001'
|
||||
VITE_APP_BASE_API_Url = 'http://25.18.122.65:7001'
|
||||
# sit
|
||||
|
||||
#VITE_APP_BASE_API_Url = 'http://25.18.122.91:9786'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"version" : "1.0",
|
||||
"configurations" : [
|
||||
{
|
||||
"playground" : "standard",
|
||||
"playground" : "custom",
|
||||
"type" : "uni-app:app-android"
|
||||
},
|
||||
{
|
||||
|
||||
+114
-87
@@ -1,6 +1,6 @@
|
||||
<script>
|
||||
export default {
|
||||
onLaunch: function () {
|
||||
onLaunch: function() {
|
||||
uni.onTabBarMidButtonTap(() => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/index/dialog',
|
||||
@@ -11,24 +11,24 @@
|
||||
plus.screen.lockOrientation('portrait-primary')
|
||||
// #endif
|
||||
},
|
||||
onShow: function () {
|
||||
|
||||
onShow: function() {
|
||||
|
||||
},
|
||||
onHide: function () {
|
||||
}
|
||||
onHide: function() {}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
/* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
|
||||
// @import "@/uni_modules/uview-ui/index.scss";
|
||||
|
||||
|
||||
@font-face {
|
||||
font-family: 'PingFangSC';
|
||||
src: url('@/static/font/PingFang-SC.ttf') format('truetype');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
view {
|
||||
box-sizing: border-box;
|
||||
font-family: 'PingFangSC';
|
||||
@@ -42,85 +42,6 @@
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.max_page {
|
||||
min-height: 100vh;
|
||||
}
|
||||
.mr-10 {
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
.mb-8 {
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
.pt-8 {
|
||||
padding-top: 8rpx;
|
||||
}
|
||||
.mb-10 {
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
.mb-18 {
|
||||
margin-bottom: 18rpx;
|
||||
}
|
||||
.mb-64 {
|
||||
margin-bottom: 64rpx;
|
||||
}
|
||||
.mb-30 {
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
.mb-36 {
|
||||
margin-bottom: 36rpx;
|
||||
}
|
||||
.mb-4 {
|
||||
margin-bottom: 4rpx;
|
||||
}
|
||||
.fz-30 {
|
||||
font-size: 30rpx;
|
||||
}
|
||||
.fz-28 {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
.fz-24 {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.w_100 {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.h_100 {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.flex {
|
||||
display: flex;
|
||||
}
|
||||
.flex-jcsb {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
.flex-c-c {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.tar {
|
||||
text-align: right;
|
||||
}
|
||||
.fw-600 {
|
||||
font-weight: 600;
|
||||
}
|
||||
.fw-400 {
|
||||
font-weight: 400;
|
||||
}
|
||||
.img_100 {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.color-666{
|
||||
color: #666666;
|
||||
}
|
||||
.fl1 {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.font_pf {
|
||||
font-family: 'PingFangSC';
|
||||
}
|
||||
@@ -143,14 +64,120 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
.max_page {
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
|
||||
.mr-10 {
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
.mb-8 {
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.pt-8 {
|
||||
padding-top: 8rpx;
|
||||
}
|
||||
|
||||
.mb-10 {
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.mb-18 {
|
||||
margin-bottom: 18rpx;
|
||||
}
|
||||
|
||||
.mb-64 {
|
||||
margin-bottom: 64rpx;
|
||||
}
|
||||
|
||||
.mb-30 {
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.mb-36 {
|
||||
margin-bottom: 36rpx;
|
||||
}
|
||||
|
||||
.mb-4 {
|
||||
margin-bottom: 4rpx;
|
||||
}
|
||||
|
||||
.fz-30 {
|
||||
font-size: 30rpx;
|
||||
}
|
||||
|
||||
.fz-28 {
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.fz-24 {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.w_100 {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.h_100 {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.flex {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.flex-jcsb {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.flex-c-c {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.tar {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.fw-600 {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.fw-400 {
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.img_100 {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.color-666 {
|
||||
color: #666666;
|
||||
}
|
||||
|
||||
.fl1 {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.no-overflow {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
.maoh{
|
||||
|
||||
.maoh {
|
||||
margin-right: 8rpx;
|
||||
margin-left: 2rpx;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -0,0 +1,306 @@
|
||||
let popupView = null // 窗口实例
|
||||
export function showModal(info) {
|
||||
const title = info && info.title ? info.title : '标题'
|
||||
const content = info && info.content ? info.content : '请输入内容'
|
||||
let screenWidth = plus.screen.resolutionWidth
|
||||
let screenHeight = plus.screen.resolutionHeight
|
||||
const popupViewWidth = screenWidth * 0.85
|
||||
const viewContentPadding = 20 // 减小内边距
|
||||
const viewContentWidth = parseInt(popupViewWidth - (viewContentPadding * 2))
|
||||
const descriptionList = drawtext(content, viewContentWidth)
|
||||
let popupViewHeight = 60 + 20 + 20 // 减小整体高度
|
||||
let popupViewContentList = [{
|
||||
tag: 'font',
|
||||
id: 'title',
|
||||
text: title,
|
||||
textStyles: {
|
||||
size: '18px',
|
||||
color: "#333333",
|
||||
weight: "bold",
|
||||
whiteSpace: "normal"
|
||||
},
|
||||
position: {
|
||||
top: '25px', // 调整标题位置
|
||||
left: viewContentPadding + "px",
|
||||
width: viewContentWidth + "px",
|
||||
height: "25px",
|
||||
}
|
||||
}]
|
||||
|
||||
const textHeight = 24 // 调整行高
|
||||
let contentTop = 60 // 调整内容起始位置
|
||||
|
||||
descriptionList.forEach((item, index) => {
|
||||
if (index > 0) {
|
||||
popupViewHeight += textHeight;
|
||||
contentTop += textHeight;
|
||||
}
|
||||
popupViewContentList.push({
|
||||
tag: 'font',
|
||||
id: 'content' + index + 1,
|
||||
text: item.content,
|
||||
textStyles: {
|
||||
size: '15px',
|
||||
color: "#666666",
|
||||
lineSpacing: "50%", // 调整行间距
|
||||
align: "left"
|
||||
},
|
||||
position: {
|
||||
top: contentTop + "px",
|
||||
left: viewContentPadding + "px",
|
||||
width: viewContentWidth + "px",
|
||||
height: textHeight + "px",
|
||||
}
|
||||
});
|
||||
if (item.type == "break") {
|
||||
contentTop += 8; // 减小段落间距
|
||||
popupViewHeight += 8;
|
||||
}
|
||||
})
|
||||
|
||||
popupView = new plus.nativeObj.View("popupView", {
|
||||
tag: "rect",
|
||||
top: "80px", // 固定在靠近顶部的位置
|
||||
left: (screenWidth - popupViewWidth) / 2 + "px",
|
||||
height: popupViewHeight + "px",
|
||||
width: popupViewWidth + "px"
|
||||
})
|
||||
|
||||
// 绘制主体背景
|
||||
popupView.drawRect({
|
||||
color: "#FFFFFF",
|
||||
radius: "12px",
|
||||
borderWidth: "1px",
|
||||
borderColor: "#E5E5E5"
|
||||
}, {
|
||||
top: "0px",
|
||||
height: popupViewHeight + "px",
|
||||
})
|
||||
|
||||
popupView.draw(popupViewContentList)
|
||||
popupView.show()
|
||||
}
|
||||
|
||||
|
||||
function closeModal() {
|
||||
// 在不再需要 popupView 时关闭它
|
||||
popupView && popupView.close();
|
||||
popupView = null;
|
||||
}
|
||||
|
||||
// 文字换行
|
||||
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 = 14;
|
||||
// otherFont宽度
|
||||
let otherWidth = 7;
|
||||
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
|
||||
}
|
||||
}
|
||||
} 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") {
|
||||
rowText.push({
|
||||
type: "break",
|
||||
content: text.substring(previousNode, i)
|
||||
})
|
||||
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: "text",
|
||||
content: text.substring(previousNode, i + 1 - letterWidth)
|
||||
})
|
||||
previousNode = i + 1 - letterWidth
|
||||
nodeWidth = letterWidth * otherWidth
|
||||
letterWidth = 0
|
||||
}
|
||||
} else {
|
||||
if (nodeWidth + otherWidth > maxWidth) {
|
||||
rowText.push({
|
||||
type: "text",
|
||||
content: text.substring(previousNode, i)
|
||||
});
|
||||
previousNode = i
|
||||
nodeWidth = otherWidth
|
||||
} else {
|
||||
nodeWidth += otherWidth
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (previousNode < len) {
|
||||
rowText.push({
|
||||
type: "text",
|
||||
content: text.substring(previousNode, len)
|
||||
})
|
||||
}
|
||||
return rowText
|
||||
}
|
||||
|
||||
|
||||
|
||||
//权限检测
|
||||
export function requestPermissions(info) {
|
||||
const permissionID = info.permissionID
|
||||
console.log(info,permissionID)
|
||||
return new Promise((rev, jec) => {
|
||||
if (!permissionID) {
|
||||
rev({
|
||||
isSuc: false,
|
||||
msg: "缺少permissionID"
|
||||
})
|
||||
return false
|
||||
}
|
||||
//判断安卓与ios设备
|
||||
if (plus.os.name == 'Android') {
|
||||
let _permissionID = 'android.permission.' + permissionID;
|
||||
plus.android.checkPermission(_permissionID,
|
||||
granted => {
|
||||
console.log(granted)
|
||||
if (granted.checkResult == 0) {
|
||||
rev({
|
||||
isSuc: true
|
||||
})
|
||||
}
|
||||
if (granted.checkResult == -1) {
|
||||
//还未授权当前查询的权限,打开权限申请目的自定义弹框
|
||||
closeModal() // 先关闭再弹窗
|
||||
showModal(info)
|
||||
plus.android.requestPermissions([_permissionID],
|
||||
(e) => {
|
||||
console.log(e)
|
||||
//关闭权限申请目的自定义弹框
|
||||
if (e.granted.length > 0) {
|
||||
closeModal()
|
||||
//当前查询权限已授权,此时可以通知页面执行接下来的操作
|
||||
rev({
|
||||
isSuc: true
|
||||
})
|
||||
}
|
||||
if (e.deniedPresent.length > 0) {
|
||||
closeModal()
|
||||
//当前查询权限已授权,此时可以通知页面执行接下来的操作
|
||||
rev({
|
||||
isSuc: false,
|
||||
msg: "用户已拒绝"
|
||||
})
|
||||
}
|
||||
if (e.deniedAlways.length > 0) {
|
||||
//当前查询权限已被永久禁用,此时需要引导用户跳转手机系统设置去开启
|
||||
uni.showModal({
|
||||
title: '温馨提示',
|
||||
content: '还没有该权限,立即去设置开启?',
|
||||
cancelText: "取消",
|
||||
confirmText: "去设置",
|
||||
showCancel: true,
|
||||
confirmColor: '#000',
|
||||
cancelColor: '#666',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
goSetting();
|
||||
}
|
||||
if (res.cancel) {
|
||||
rev({
|
||||
isSuc: false,
|
||||
msg: "取消前往权限设置页面"
|
||||
})
|
||||
}
|
||||
},
|
||||
fail(e) {
|
||||
rev({
|
||||
isSuc: false,
|
||||
msg: e.message || "弹窗失败"
|
||||
})
|
||||
},
|
||||
complete() {
|
||||
closeModal()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
error => {
|
||||
rev({
|
||||
isSuc: false,
|
||||
mes: error.message || '检查权限失败'
|
||||
})
|
||||
}
|
||||
);
|
||||
|
||||
} else {
|
||||
//IOS不需要添加自定义弹框来描述权限目的,因为在配置文件的隐私信息访问的许可描述里可添加
|
||||
rev({
|
||||
isSuc: true
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
//跳转手机系统设置
|
||||
export function goSetting() {
|
||||
if (plus.os.name == "iOS") {
|
||||
var UIApplication = plus.ios.import("UIApplication");
|
||||
var application2 = UIApplication.sharedApplication();
|
||||
var NSURL2 = plus.ios.import("NSURL");
|
||||
var setting2 = NSURL2.URLWithString("app-settings:");
|
||||
application2.openURL(setting2);
|
||||
plus.ios.deleteObject(setting2);
|
||||
plus.ios.deleteObject(NSURL2);
|
||||
plus.ios.deleteObject(application2);
|
||||
} else {
|
||||
var Intent = plus.android.importClass("android.content.Intent");
|
||||
var Settings = plus.android.importClass("android.provider.Settings");
|
||||
var Uri = plus.android.importClass("android.net.Uri");
|
||||
var mainActivity = plus.android.runtimeMainActivity();
|
||||
var intent = new Intent();
|
||||
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
|
||||
intent.setData(uri);
|
||||
mainActivity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
+95
-32
@@ -2,7 +2,13 @@
|
||||
* 本模块封装了Android、iOS的应用权限判断、打开应用权限设置界面、以及位置系统服务是否开启
|
||||
*/
|
||||
|
||||
var isIos
|
||||
import common from '@/common/common.js'
|
||||
import {
|
||||
getPhoneEnvBool
|
||||
} from '@/common/common.js'
|
||||
const IsAndEnv = getPhoneEnvBool('AND')
|
||||
|
||||
let isIos
|
||||
// #ifdef APP-PLUS
|
||||
isIos = (plus.os.name == "iOS")
|
||||
// #endif
|
||||
@@ -63,35 +69,90 @@ function judgeIosPermissionLocation() {
|
||||
|
||||
// 判断麦克风权限是否开启
|
||||
function judgeIosPermissionRecord() {
|
||||
var result = false;
|
||||
var avaudiosession = plus.ios.import("AVAudioSession");
|
||||
var avaudio = avaudiosession.sharedInstance();
|
||||
var permissionStatus = avaudio.recordPermission();
|
||||
console.log("permissionStatus:" + permissionStatus);
|
||||
if (permissionStatus == 1684369017 || permissionStatus == 1970168948) {
|
||||
console.log("麦克风权限没有开启");
|
||||
} else {
|
||||
result = true;
|
||||
console.log("麦克风权限已经开启");
|
||||
}
|
||||
plus.ios.deleteObject(avaudiosession);
|
||||
return result;
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const authSetting = uni.getAppAuthorizeSetting();
|
||||
const state = authSetting.microphoneAuthorized;
|
||||
console.log('麦克风state', state);
|
||||
switch (state) {
|
||||
case 'authorized':
|
||||
console.log("麦克风权限是否开启");
|
||||
resolve()
|
||||
break;
|
||||
case 'denied': // ios拒绝,安卓拒绝或者未授权都是这个
|
||||
if (IsAndEnv) { // 安卓二次判定
|
||||
const result = await requestAndroidPermission('android.permission.RECORD_AUDIO')
|
||||
if (result === 1) {
|
||||
resolve()
|
||||
break;
|
||||
}
|
||||
}
|
||||
const resultT = await common.show(
|
||||
'提示信息',
|
||||
'当前页面需要使用录音权限,是否前往开启?'
|
||||
)
|
||||
if (resultT) {
|
||||
// 前往权限设置页面
|
||||
uni.openAppAuthorizeSetting();
|
||||
}
|
||||
reject()
|
||||
break;
|
||||
case 'not determined': // 表示尚未请求授权,仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关
|
||||
resolve()
|
||||
break;
|
||||
case 'config error': // 只有在 App 端时返回
|
||||
resolve()
|
||||
break;
|
||||
default:
|
||||
resolve()
|
||||
break;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 判断相机权限是否开启
|
||||
function judgeIosPermissionCamera() {
|
||||
var result = false;
|
||||
var AVCaptureDevice = plus.ios.import("AVCaptureDevice");
|
||||
var authStatus = AVCaptureDevice.authorizationStatusForMediaType('vide');
|
||||
console.log("authStatus:" + authStatus);
|
||||
if (authStatus == 3) {
|
||||
result = true;
|
||||
console.log("相机权限已经开启");
|
||||
} else {
|
||||
console.log("相机权限没有开启");
|
||||
}
|
||||
plus.ios.deleteObject(AVCaptureDevice);
|
||||
return result;
|
||||
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const authSetting = uni.getAppAuthorizeSetting();
|
||||
const state = authSetting.cameraAuthorized;
|
||||
console.log('相机权限', state);
|
||||
switch (state) {
|
||||
case 'authorized':
|
||||
console.log("相机权限已经开启");
|
||||
resolve()
|
||||
break;
|
||||
case 'denied': // ios拒绝,安卓拒绝或者未授权都是这个
|
||||
console.log('IsAndEnv', IsAndEnv);
|
||||
if (IsAndEnv) { // 安卓二次判定
|
||||
const result = await requestAndroidPermission('android.permission.CAMERA')
|
||||
console.log('安卓二次判定', result);
|
||||
if (result === 1) {
|
||||
resolve()
|
||||
break;
|
||||
}
|
||||
}
|
||||
const resultT = await common.show(
|
||||
'提示信息',
|
||||
'当前页面需要使用相机权限,是否前往开启?'
|
||||
)
|
||||
if (resultT) {
|
||||
// 前往权限设置页面
|
||||
uni.openAppAuthorizeSetting();
|
||||
}
|
||||
reject()
|
||||
break;
|
||||
case 'not determined': // 表示尚未请求授权,仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关
|
||||
resolve()
|
||||
break;
|
||||
case 'config error': // 只有在 App 端时返回
|
||||
resolve()
|
||||
break;
|
||||
default:
|
||||
resolve()
|
||||
break;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 判断相册权限是否开启
|
||||
@@ -264,9 +325,11 @@ function checkSystemEnableLocation() {
|
||||
}
|
||||
}
|
||||
|
||||
export default ({
|
||||
judgeIosPermission: judgeIosPermission,
|
||||
requestAndroidPermission: requestAndroidPermission,
|
||||
checkSystemEnableLocation: checkSystemEnableLocation,
|
||||
gotoAppPermissionSetting: gotoAppPermissionSetting
|
||||
})
|
||||
|
||||
|
||||
export default {
|
||||
judgeIosPermission,
|
||||
requestAndroidPermission,
|
||||
checkSystemEnableLocation,
|
||||
gotoAppPermissionSetting
|
||||
}
|
||||
@@ -194,19 +194,11 @@
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(newVal) => {
|
||||
console.log('modelValue', newVal);
|
||||
// console.log('modelValue', newVal);
|
||||
item_answer.value = typeof newVal === 'string' ? newVal.split(',') : newVal;
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
// watch(
|
||||
// item_answer,
|
||||
// (newVal) => {
|
||||
// console.log('item_answer', newVal);
|
||||
// emit('update:modelValue', newVal);
|
||||
// },
|
||||
// { deep: true }
|
||||
// );
|
||||
|
||||
const feedback_click = () => {
|
||||
emit('subject_click', 'feedback', props.item);
|
||||
|
||||
+12
-12
@@ -33,8 +33,8 @@
|
||||
/* 模块配置 */
|
||||
"modules" : {
|
||||
"Camera" : {
|
||||
"description": "用于访问摄像头进行实时预览"
|
||||
},
|
||||
"description" : "用于访问摄像头进行实时预览"
|
||||
},
|
||||
"Barcode" : {},
|
||||
"Record" : {},
|
||||
"VideoPlayer" : {},
|
||||
@@ -66,16 +66,16 @@
|
||||
/* ios打包配置 */
|
||||
"ios" : {
|
||||
"dSYMs" : false,
|
||||
"deploymentTarget": "11.0",
|
||||
"privacyDescription": {
|
||||
"NSCameraUsageDescription": "此应用需要访问您的摄像头来进行视频录制和拍照功能",
|
||||
"NSMicrophoneUsageDescription": "此应用需要访问您的麦克风来录制音频"
|
||||
},
|
||||
"capabilities": {
|
||||
"entitlements": {
|
||||
"com.apple.developer.avfoundation.multitasking-camera-access": true
|
||||
}
|
||||
}
|
||||
"deploymentTarget" : "11.0",
|
||||
"privacyDescription" : {
|
||||
"NSCameraUsageDescription" : "此应用需要访问您的摄像头来进行视频录制和拍照功能",
|
||||
"NSMicrophoneUsageDescription" : "此应用需要访问您的麦克风来录制音频"
|
||||
},
|
||||
"capabilities" : {
|
||||
"entitlements" : {
|
||||
"com.apple.developer.avfoundation.multitasking-camera-access" : true
|
||||
}
|
||||
}
|
||||
},
|
||||
/* SDK配置 */
|
||||
"sdkConfigs" : {},
|
||||
|
||||
@@ -147,6 +147,7 @@
|
||||
const pkData = reactive({
|
||||
comLimit: 0,
|
||||
crsId: '',
|
||||
comId: '',
|
||||
name: '', // 名称
|
||||
orgId: '',
|
||||
papersId: '',
|
||||
@@ -247,7 +248,7 @@
|
||||
traQnsInfoVo = res.body.traQnsInfoVo;
|
||||
}
|
||||
topic.value.isPreview = true; // 不能在点击了,打开预览模式
|
||||
console.log('给出来的traQnsInfoVo', traQnsInfoVo);
|
||||
// console.log('给出来的traQnsInfoVo', traQnsInfoVo);
|
||||
common.hideLoading();
|
||||
topic.value.clearResult = false; // 不清除正确答案
|
||||
topic.value.analyContent = traQnsInfoVo.analyContent; // 答案解析
|
||||
@@ -257,7 +258,6 @@
|
||||
topic.value.judgeResult = traQnsInfoVo.judgeResult; // 正确答案字符串分割
|
||||
|
||||
if (questionNumber.value >= topicList.length - 1) {
|
||||
console.log('pk页答完了,带走的数据', pkData);
|
||||
common.setPageCache('competition_pk_to_resulf', pkData);
|
||||
nextTick(() => {
|
||||
common.redirectTo(
|
||||
@@ -418,7 +418,7 @@
|
||||
}
|
||||
nextTick(() => {
|
||||
common.redirectTo(
|
||||
`/pages/competition/result?mode=${mode}&execId=${pkData.execId}&orgId=${pkData.orgId}&papersId=${pkData.papersId}&autoSub=01`
|
||||
`/pages/competition/result?mode=${mode}&execId=${pkData.execId}&orgId=${pkData.orgId}&papersId=${pkData.papersId}&autoSub=01&comId=${pkData.comId}`
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
<view class="points-title">{{ detailedInfo.badgeName }}</view>
|
||||
<view class="points-div select-institution-div">
|
||||
<view class="points-remark">{{ detailedInfo.remark }}</view>
|
||||
<view class="points-time">{{ detailedInfo.obtainTm }}</view>
|
||||
<view class="points-time">获得时间:{{ detailedInfo.obtainTm }}</view>
|
||||
</view>
|
||||
<view class="points-button-div">
|
||||
<uv-button
|
||||
|
||||
@@ -169,7 +169,6 @@ export class ProtocolCodec {
|
||||
// STRING 序列化:必须传入字符串(非 PING 消息已校验非空)
|
||||
serializedBody = textEncoder.encode(body as string);
|
||||
break;
|
||||
|
||||
case SerializationType.JSON:
|
||||
// 断言:body 是 string 或 object
|
||||
if (typeof body === 'string') {
|
||||
|
||||
@@ -22,8 +22,8 @@ const DEFAULT_AUTH_PARAMS = {
|
||||
user_id: '1001', // 默认用户ID(可从缓存/全局状态取)
|
||||
token: '', // 优先从缓存获取,避免硬编码
|
||||
name: '测试用户',
|
||||
device_id: uni.getSystemInfoSync().deviceId || '', // 设备ID(补充)
|
||||
timestamp: Date.now() // 时间戳(防篡改)
|
||||
// device_id: uni.getSystemInfoSync().deviceId || '', // 设备ID(补充)
|
||||
// timestamp: Date.now() // 时间戳(防篡改)
|
||||
};
|
||||
// const wsUrl = 'ws://127.0.0.1:8000/ws/audio'
|
||||
const url = '/trapractice/voiceCallSocket/voiceCall'
|
||||
@@ -44,6 +44,7 @@ export default function useWebSocket(aaas = null, options = {}) {
|
||||
...DEFAULT_AUTH_PARAMS,
|
||||
...authParams,
|
||||
};
|
||||
|
||||
ws.value = uni.connectSocket({
|
||||
url: wsUrl,
|
||||
fail: () => {
|
||||
@@ -54,15 +55,12 @@ export default function useWebSocket(aaas = null, options = {}) {
|
||||
}
|
||||
});
|
||||
ws.value.onOpen((res) => {
|
||||
console.log('onOpen', finalAuthParams);
|
||||
ws.value.send({
|
||||
data: ProtocolCodec.pack(MessageType.IDENTITY, finalAuthParams)
|
||||
});
|
||||
});
|
||||
ws.value.onError((err) => onError(err))
|
||||
|
||||
|
||||
|
||||
ws.value.onClose((err) => {
|
||||
console.log('onClose', err);
|
||||
onClose(err)
|
||||
|
||||
+79
-20
@@ -3,7 +3,7 @@
|
||||
<image-preview :src="dataInfo.ossAddr" class="show-box-avatar"></image-preview>
|
||||
<view class="show-box" :class="{ isVideo: isVideoStyle }">
|
||||
<nav-bar :is_seat="true"></nav-bar>
|
||||
<view class="switch-div">
|
||||
<view class="switch-div" v-if="isVideoStyle">
|
||||
<!-- <view class="switch-text">场景提示</view> -->
|
||||
<!-- <switch class="switch" :checked="!sceneDescShow" @click="switchChange" /> -->
|
||||
<view class="title-time" v-if="isRecording">{{ formattedTime }}</view>
|
||||
@@ -28,9 +28,29 @@
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref, reactive, onMounted, onUnmounted, computed, getCurrentInstance, nextTick } from 'vue';
|
||||
import { onShow, onLoad, onUnload, onBackPress, onReady } from '@dcloudio/uni-app';
|
||||
import { ProtocolCodec, MessageType, CompressionType, ControlCommand } from './js/ProtocolCodec';
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
computed,
|
||||
getCurrentInstance,
|
||||
nextTick,
|
||||
toRaw
|
||||
} from 'vue';
|
||||
import {
|
||||
onShow,
|
||||
onLoad,
|
||||
onUnload,
|
||||
onBackPress,
|
||||
onReady
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
ProtocolCodec,
|
||||
MessageType,
|
||||
CompressionType,
|
||||
ControlCommand
|
||||
} from './js/ProtocolCodec';
|
||||
import common from '@/common/common';
|
||||
import talkMicrophone from './components/talk-microphone.vue';
|
||||
import talkSpeaker from './components/talk-speaker.vue';
|
||||
@@ -40,7 +60,12 @@
|
||||
const talkSpeakerRef = ref(null);
|
||||
const talkCameraRef = ref(null);
|
||||
|
||||
const { initConnection, close, send, isRecording } = useWebSocket();
|
||||
const {
|
||||
initConnection,
|
||||
close,
|
||||
send,
|
||||
isRecording
|
||||
} = useWebSocket();
|
||||
const isVideo = ref(false);
|
||||
const isVideoStyle = computed(() => dataInfo.traInterTyp === '03');
|
||||
|
||||
@@ -86,16 +111,20 @@
|
||||
if (type <= 2) {
|
||||
nextTick(() => {
|
||||
setTimeout(() => {
|
||||
common.redirectTo(
|
||||
'/pages/sparring/result?isOver=1&traId=' +
|
||||
if (dataInfo.execId) {
|
||||
common.redirectTo(
|
||||
'/pages/sparring/result?isOver=1&traId=' +
|
||||
dataInfo.traId +
|
||||
'&execId=' +
|
||||
dataInfo.execId +
|
||||
'&type=' +
|
||||
dataInfo.traType +
|
||||
'&isPreview=' +
|
||||
(dataInfo.isPreview ? '1' : '')
|
||||
);
|
||||
(dataInfo.preview ? '1' : '')
|
||||
);
|
||||
} else {
|
||||
common.navigateBack()
|
||||
}
|
||||
}, 300);
|
||||
});
|
||||
}
|
||||
@@ -153,7 +182,10 @@
|
||||
frameSize: 1024,
|
||||
gain: 1.0,
|
||||
// 音频数据的帧接口回调,直接转码后接入到websocket的发送函数
|
||||
onFrameRecorded: ({ isLastFrame, frameBuffer }) => send(ProtocolCodec.pack(MessageType.AUDIO_DATA, frameBuffer))
|
||||
onFrameRecorded: ({
|
||||
isLastFrame,
|
||||
frameBuffer
|
||||
}) => send(ProtocolCodec.pack(MessageType.AUDIO_DATA, frameBuffer))
|
||||
});
|
||||
};
|
||||
const playOver = (id) => {
|
||||
@@ -195,7 +227,9 @@
|
||||
// onError({code:1001}); //处理逻辑和报错一样,直接调用报错方法
|
||||
} else if (error?.code === 1011) {
|
||||
// 服务器错误
|
||||
onError({ code: 1011 }); //处理逻辑和报错一样,直接调用报错方法
|
||||
onError({
|
||||
code: 1011
|
||||
}); //处理逻辑和报错一样,直接调用报错方法
|
||||
} else if (error?.code === 1000) {
|
||||
// 用户主动挂断
|
||||
} else if (error?.code === 4001) {
|
||||
@@ -213,7 +247,6 @@
|
||||
// 只有app才能打开摄像头
|
||||
isVideo.value = dataInfo.traInterTyp === '03';
|
||||
//#endif
|
||||
console.log('isVideo.value', isVideo.value);
|
||||
dataInfo.preview = e.isPreview === '1'; // 是否是预览
|
||||
const pageData = common.getPageCache('tipMsgsceneDesc');
|
||||
dataInfo.ossAddr = pageData.ossAddr;
|
||||
@@ -222,7 +255,13 @@
|
||||
});
|
||||
onMounted(() => {
|
||||
initConnection({
|
||||
authParams: Object.assign({}, dataInfo),
|
||||
authParams: {
|
||||
traId: dataInfo.traId,
|
||||
chaId: dataInfo.chaId,
|
||||
traType: dataInfo.traType,
|
||||
traInterTyp: dataInfo.traInterTyp,
|
||||
preview: dataInfo.preview
|
||||
},
|
||||
onStartRecord: onStartRecord,
|
||||
playPcmCallback: (res) => talkSpeakerRef.value.playPCM(res),
|
||||
setPlayNumber: (id) => talkSpeakerRef.value.setPlayNumber(id),
|
||||
@@ -248,17 +287,17 @@
|
||||
|
||||
<style scoped lang="scss">
|
||||
.isVideo {
|
||||
|
||||
// background-color: red;
|
||||
.role-info {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&.show-box {
|
||||
background: linear-gradient(
|
||||
120deg,
|
||||
rgba(51, 51, 51, 0.2) 0%,
|
||||
rgba(102, 102, 102, 0.2) 50%,
|
||||
rgba(51, 51, 51, 0.2) 100%
|
||||
);
|
||||
background: linear-gradient(120deg,
|
||||
rgba(51, 51, 51, 0.2) 0%,
|
||||
rgba(102, 102, 102, 0.2) 50%,
|
||||
rgba(51, 51, 51, 0.2) 100%);
|
||||
backdrop-filter: blur(0px);
|
||||
}
|
||||
}
|
||||
@@ -271,31 +310,44 @@
|
||||
font-size: 38rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.role-name {
|
||||
margin-bottom: 26rpx;
|
||||
// position: relative;
|
||||
// width: 100vw;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
line-height: 58rpx;
|
||||
font-size: 38rpx;
|
||||
}
|
||||
|
||||
.title-tip {
|
||||
padding-right: 20rpx;
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
animation: loading 2.5s infinite;
|
||||
}
|
||||
|
||||
@keyframes loading {
|
||||
0% {
|
||||
content: '';
|
||||
}
|
||||
|
||||
25% {
|
||||
content: '.';
|
||||
}
|
||||
|
||||
50% {
|
||||
content: '..';
|
||||
}
|
||||
|
||||
75% {
|
||||
content: '...';
|
||||
}
|
||||
|
||||
100% {
|
||||
content: '';
|
||||
}
|
||||
@@ -315,8 +367,10 @@
|
||||
font-size: 28rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.switch {
|
||||
transform: scale(0.7) rotate(180deg);
|
||||
|
||||
:deep(.uni-switch-input) {
|
||||
&.uni-switch-input-checked {
|
||||
border-color: #9eacbf !important;
|
||||
@@ -329,10 +383,12 @@
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
&:before {
|
||||
background-color: #62a1ff !important;
|
||||
border-color: #62a1ff !important;
|
||||
}
|
||||
|
||||
&:not(.uni-switch-input-checked) {
|
||||
background-color: #62a1ff !important;
|
||||
border-color: #62a1ff !important;
|
||||
@@ -340,10 +396,12 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.fl1-div-1 {
|
||||
min-height: 120rpx;
|
||||
max-height: 240rpx;
|
||||
}
|
||||
|
||||
.show-box {
|
||||
background: linear-gradient(120deg, #333333cc 0%, #666666cc 50%, #333333cc 100%);
|
||||
backdrop-filter: blur(10px);
|
||||
@@ -394,6 +452,7 @@
|
||||
border-radius: 16rpx;
|
||||
opacity: 0;
|
||||
transition: opacity 0.5s ease;
|
||||
|
||||
&.show {
|
||||
opacity: 1;
|
||||
}
|
||||
@@ -411,4 +470,4 @@
|
||||
margin-bottom: 112rpx;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -141,6 +141,7 @@
|
||||
import points from '@/components/points-and-badge/points';
|
||||
import usePointsAndBadge from '@/components/points-and-badge/usePointsAndBadge';
|
||||
import { initRecord } from '@/composables/useExamSubject.js';
|
||||
import permissionApi from '@/common/permission'
|
||||
const { pointAndBadgesRun, badgeRef, pointsRef } = usePointsAndBadge();
|
||||
|
||||
const socketStore = useSocketStore();
|
||||
@@ -246,14 +247,18 @@
|
||||
|
||||
const toTalking = async () => {
|
||||
try {
|
||||
|
||||
//#ifdef APP-PLUS
|
||||
console.log('申请权限', getPhoneEnvBool('AND'));
|
||||
if (getPhoneEnvBool('AND')) {
|
||||
console.log('申请权限');
|
||||
await initRecord();
|
||||
}
|
||||
try {
|
||||
// await initRecord();
|
||||
await permissionApi.judgeIosPermission('record')
|
||||
await permissionApi.judgeIosPermission('camera')
|
||||
} catch(e) {
|
||||
console.error('摄像头或者麦克风权限申请失败:', e);
|
||||
return;
|
||||
}
|
||||
//#endif
|
||||
|
||||
common.setPageCache('tipMsgsceneDesc', {
|
||||
ossAddr: detailInfo.value.ossAddr,
|
||||
chaName: detailInfo.value.chaName,
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
<script setup>
|
||||
import common from '@/common/common';
|
||||
import permision from '@/common/permission'
|
||||
import {
|
||||
get_base_url
|
||||
} from '../../api/request';
|
||||
@@ -34,8 +35,8 @@
|
||||
const bbbb = () => {
|
||||
|
||||
}
|
||||
const aaaa = () => {
|
||||
common.navigateTo('/pages/test/testChat')
|
||||
const aaaa = async() => {
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user