冲突修改
This commit is contained in:
commit
4dda9cae91
@ -1,6 +1,5 @@
|
|||||||
import request from "../utils/Request"
|
import request from '../utils/Request'
|
||||||
import tempRequest from '../common/utils/tempRequest'
|
import http from '@ohos.net.http'
|
||||||
import http from "@ohos.net.http"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 照片比对
|
* 照片比对
|
||||||
|
|||||||
@ -1,101 +0,0 @@
|
|||||||
/**
|
|
||||||
* 静默安装
|
|
||||||
* 事前准备:打包、放在rawFile文件夹下
|
|
||||||
*/
|
|
||||||
import installer from '@ohos.bundle.installer';
|
|
||||||
// @ts-ignore
|
|
||||||
// import { BusinessError } from '@ohos.base';
|
|
||||||
import fs from '@ohos.file.fs';
|
|
||||||
import buffer from '@ohos.buffer';
|
|
||||||
|
|
||||||
let TAG = 'APPInstall-'
|
|
||||||
// let context = getContext(this) as common.UIAbilityContext;
|
|
||||||
const context=AppStorage.get('context')
|
|
||||||
let filesDir = context.filesDir;
|
|
||||||
|
|
||||||
|
|
||||||
let installParam: installer.InstallParam = {
|
|
||||||
userId: 100,
|
|
||||||
isKeepData: false,
|
|
||||||
installFlag: 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default class AppInstaller {
|
|
||||||
// hap包沙箱路径
|
|
||||||
static hapFilePaths: Array<string>
|
|
||||||
// hap包名
|
|
||||||
static hapName: string = ''
|
|
||||||
// 待卸载应用名
|
|
||||||
static bundleName: string = ''
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 从rawFile向沙箱路径复制文件
|
|
||||||
* @param name:待安装的hap包名
|
|
||||||
*/
|
|
||||||
async FromRawToBox(name: string) {
|
|
||||||
|
|
||||||
let file = filesDir + '/' + name;
|
|
||||||
AppInstaller.hapFilePaths = [file]
|
|
||||||
try {
|
|
||||||
fs.access(file).then((res: boolean) => {
|
|
||||||
if (res) {
|
|
||||||
console.info(TAG + "file exists");
|
|
||||||
} else {
|
|
||||||
let sss = fs.createStreamSync(file, "w+"); //没有会创建一个空的
|
|
||||||
sss.closeSync();
|
|
||||||
|
|
||||||
//获取rawfile下hap包
|
|
||||||
let uint8Array: Uint8Array = context.resourceManager.getRawFileContentSync(name);
|
|
||||||
let bf
|
|
||||||
try {
|
|
||||||
bf = buffer.from(uint8Array).buffer;
|
|
||||||
} catch (error) {
|
|
||||||
console.log('buffererror', error)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 打开文件
|
|
||||||
const fsOpen =
|
|
||||||
fs.openSync(file, fs.OpenMode.READ_WRITE | fs.OpenMode.READ_ONLY | fs.OpenMode.CREATE | fs.OpenMode.TRUNC)
|
|
||||||
|
|
||||||
// 写入文件
|
|
||||||
let destFile = fs.writeSync(fsOpen.fd, bf);
|
|
||||||
console.info(TAG + 'write successfully!')
|
|
||||||
// 关闭文件
|
|
||||||
fs.close(destFile)
|
|
||||||
}
|
|
||||||
}).catch((err) => {
|
|
||||||
console.error("access failed with error message: " + err.message + ", error code: " + err.code);
|
|
||||||
});
|
|
||||||
} catch (err) {
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 安装hap包
|
|
||||||
* @param src:hap包沙箱路径
|
|
||||||
*/
|
|
||||||
async SlientInstaller(src: string) {
|
|
||||||
let hapFilePaths = [src]
|
|
||||||
try {
|
|
||||||
const data = await installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
|
|
||||||
data.install(hapFilePaths, installParam)
|
|
||||||
.then((data: void) => {
|
|
||||||
console.info(TAG + 'install successfully: ' + JSON.stringify(data));
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error(TAG + 'install failed:' + error.message);
|
|
||||||
});
|
|
||||||
}).catch((error) => {
|
|
||||||
console.error(TAG + 'getBundleInstaller failed. Cause: ' + error.message);
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
// let message = (error as BusinessError).message;
|
|
||||||
console.error('getBundleInstaller failed. Cause: ' + error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,96 +0,0 @@
|
|||||||
import Prompt from '@system.prompt';
|
|
||||||
import http from '@ohos.net.http';
|
|
||||||
|
|
||||||
enum RequestMethod {
|
|
||||||
OPTIONS = "OPTIONS",
|
|
||||||
GET = "GET",
|
|
||||||
HEAD = "HEAD",
|
|
||||||
POST = "POST",
|
|
||||||
PUT = "PUT",
|
|
||||||
DELETE = "DELETE",
|
|
||||||
TRACE = "TRACE",
|
|
||||||
CONNECT = "CONNECT"
|
|
||||||
}
|
|
||||||
|
|
||||||
const BaseUrl = ""
|
|
||||||
|
|
||||||
interface Response {
|
|
||||||
code: number,
|
|
||||||
data: any,
|
|
||||||
msg: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function request<T>(
|
|
||||||
url: string,
|
|
||||||
config: {
|
|
||||||
method: string;
|
|
||||||
params?: any;
|
|
||||||
data?: any
|
|
||||||
|
|
||||||
[key: string]: any
|
|
||||||
}
|
|
||||||
): Promise<T> {
|
|
||||||
const httpRequest = http.createHttp();
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
console.info("start request url: ", url, "request params: ", JSON.stringify(config.params || config.data || {}))
|
|
||||||
httpRequest.request(BaseUrl + url,
|
|
||||||
{
|
|
||||||
method: config.method as RequestMethod,
|
|
||||||
header: {
|
|
||||||
...config.header,
|
|
||||||
},
|
|
||||||
extraData: {
|
|
||||||
...(config.params || {}),
|
|
||||||
...(config.data || {})
|
|
||||||
},
|
|
||||||
expectDataType: http.HttpDataType.OBJECT,
|
|
||||||
connectTimeout: 60000, //超时时间
|
|
||||||
}).then(async (data) => {
|
|
||||||
let result = data.result as Response
|
|
||||||
if (result.code === 1) {
|
|
||||||
console.info("success request url: ", url)
|
|
||||||
console.info(JSON.stringify(result))
|
|
||||||
resolve(data.result as T)
|
|
||||||
} else if (result.code === 401) {
|
|
||||||
// console.error("401 request", url)
|
|
||||||
// let user = await PreferenceUtils.getUserModel()
|
|
||||||
// if (user?.isLogin) {
|
|
||||||
// userLoginUsingPost({
|
|
||||||
// account: user.account,
|
|
||||||
// psd: user.password,
|
|
||||||
// }).then(res => {
|
|
||||||
// let newUser: UserModel = new UserModel(res.data)
|
|
||||||
// newUser.account = user.account
|
|
||||||
// newUser.password = user.password
|
|
||||||
// newUser.isLogin = true
|
|
||||||
// PreferenceUtils.writeUserData(newUser)
|
|
||||||
// request(url, config)
|
|
||||||
// }).catch(() => {
|
|
||||||
// PreferenceUtils.writeUserData(new UserModel())
|
|
||||||
// if (router.getState().name !== "Login") {
|
|
||||||
// router.pushUrl({ url: "pages/Login" })
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// } else {
|
|
||||||
// PreferenceUtils.writeUserData(new UserModel())
|
|
||||||
// if (router.getState().name !== "Login") {
|
|
||||||
// router.pushUrl({ url: "pages/Login" })
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
} else {
|
|
||||||
console.error("error request url: ", url)
|
|
||||||
console.error(result.msg)
|
|
||||||
reject(result.msg)
|
|
||||||
Prompt.showToast({
|
|
||||||
message: result.msg,
|
|
||||||
duration: 2000,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}).catch((err) => {
|
|
||||||
console.error("error request url: ", BaseUrl + url)
|
|
||||||
console.error(err)
|
|
||||||
reject(err)
|
|
||||||
})
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@ -1,255 +0,0 @@
|
|||||||
import http from '@ohos.net.http';
|
|
||||||
import convertxml from '@ohos.convertxml';
|
|
||||||
import prompt from '@ohos.prompt';
|
|
||||||
import { tcpUtil } from './TcpRequest';
|
|
||||||
import Prompt from '@system.prompt';
|
|
||||||
import tempRequest from './tempRequest';
|
|
||||||
|
|
||||||
|
|
||||||
export default async function request<T>(req: any): Promise<T> {
|
|
||||||
return tempRequest(req)
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
let {url,params = {},data = {},xml,method = 'get',host,isNewCenter = false, timeout} = req;
|
|
||||||
try {
|
|
||||||
const options = {
|
|
||||||
method: http.RequestMethod[method.toUpperCase()],
|
|
||||||
header: {
|
|
||||||
'Content-Type': xml ? 'text/xml' : 'application/json'
|
|
||||||
},
|
|
||||||
extraData: xml ? data : JSON.stringify(data),
|
|
||||||
}
|
|
||||||
let paramsStr = Reflect.ownKeys(params).reduce((p: string, n: string) => (`${p}${n}=${params[n]}&`), '?') || '';
|
|
||||||
paramsStr = paramsStr.toString();
|
|
||||||
paramsStr = paramsStr.substring(0, paramsStr.length - 1)
|
|
||||||
let baseUrl = host ? host : AppStorage.get('host')
|
|
||||||
console.log('响应头地址1' + baseUrl, url, options.extraData.length)
|
|
||||||
|
|
||||||
tcpUtil.request(`${baseUrl}${url}${paramsStr}`, {
|
|
||||||
method: options.method,
|
|
||||||
data: xml ? data : JSON.stringify(data),
|
|
||||||
type: xml ? 1 : 0,
|
|
||||||
contentType: xml ? 'text/xml' : 'application/json',
|
|
||||||
timeout: timeout || 90000
|
|
||||||
}, (data) => {
|
|
||||||
try {
|
|
||||||
console.log(JSON.stringify(data))
|
|
||||||
const result = JSON.parse(JSON.stringify(data))
|
|
||||||
console.log('响应头地址' + JSON.stringify(result))
|
|
||||||
let res: any = xml ? xmlToJson(result, url) : result;
|
|
||||||
console.log('响应头地址 xml 后 res' + JSON.stringify(res))
|
|
||||||
console.log('响应头地址 xml 后 res 类型', typeof res)
|
|
||||||
|
|
||||||
let resObj = null;
|
|
||||||
if (typeof res === "string") {
|
|
||||||
res = JSON.parse(res)
|
|
||||||
}
|
|
||||||
//处理中心服务code
|
|
||||||
if (res.Envelope) {
|
|
||||||
const msgXml = res.Envelope.Body.writeObjectOutResponse.return;
|
|
||||||
const dd = handleCenterCode(msgXml, isNewCenter);
|
|
||||||
// @ts-ignore
|
|
||||||
resolve(dd)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!xml) {
|
|
||||||
if (res.head.resultCode === '0') {
|
|
||||||
resolve(res)
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
const resultMessage = res?.body?.resultMessage || res?.head?.resultMessage
|
|
||||||
prompt.showToast({
|
|
||||||
message: decodeURIComponent(resultMessage),
|
|
||||||
duration: 3000
|
|
||||||
});
|
|
||||||
reject(false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (let i in res) {
|
|
||||||
resObj = res[i].head
|
|
||||||
}
|
|
||||||
console.info('res in request' + url + JSON.stringify(resObj))
|
|
||||||
if (resObj.resultCode === '0') {
|
|
||||||
resolve(res)
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
Prompt.showToast({
|
|
||||||
message: decodeURIComponent(resObj.resultMessage),
|
|
||||||
duration: 3000
|
|
||||||
});
|
|
||||||
reject(res)
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
reject(e)
|
|
||||||
console.log("http parse error: ", JSON.stringify(e))
|
|
||||||
}
|
|
||||||
|
|
||||||
}, (error) => {
|
|
||||||
console.log("req timeout", JSON.stringify(error))
|
|
||||||
console.log("req timeout url", url)
|
|
||||||
if (!error || !(error?.message)) {
|
|
||||||
reject({
|
|
||||||
code: -1
|
|
||||||
})
|
|
||||||
}
|
|
||||||
const code = error?.code;
|
|
||||||
Prompt.showToast({
|
|
||||||
message: error?.message,
|
|
||||||
duration: 5000
|
|
||||||
});
|
|
||||||
switch (code) {
|
|
||||||
//断网
|
|
||||||
case 2300007:
|
|
||||||
reject({
|
|
||||||
code: 2300007
|
|
||||||
})
|
|
||||||
break;
|
|
||||||
// 超时
|
|
||||||
case 2300028:
|
|
||||||
reject({
|
|
||||||
code: 2300028
|
|
||||||
})
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
reject(error)
|
|
||||||
}
|
|
||||||
Prompt.showToast({
|
|
||||||
message: JSON.stringify(error),
|
|
||||||
duration: 3000
|
|
||||||
});
|
|
||||||
})
|
|
||||||
} catch (e) {
|
|
||||||
console.info('test-error' + url + ' error:resp: ' + JSON.stringify(e))
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//xml格式转JSON
|
|
||||||
function xmlToJson(result, url) {
|
|
||||||
console.log("xmlToJson begin", url);
|
|
||||||
let xmlOptions = {
|
|
||||||
trim: false,
|
|
||||||
declarationKey: "_declaration",
|
|
||||||
instructionKey: "_instruction",
|
|
||||||
attributesKey: "_attributes",
|
|
||||||
textKey: "_text",
|
|
||||||
cdataKey: "_cdata",
|
|
||||||
doctypeKey: "_doctype",
|
|
||||||
commentKey: "_comment",
|
|
||||||
parentKey: "_parent",
|
|
||||||
typeKey: "_type",
|
|
||||||
nameKey: "_name",
|
|
||||||
elementsKey: "_elements",
|
|
||||||
"skipPreprocess": true
|
|
||||||
}
|
|
||||||
|
|
||||||
let strXml = result.toString();
|
|
||||||
let conv = new convertxml.ConvertXML();
|
|
||||||
|
|
||||||
console.log("xmlToJson result.length = " + result.length);
|
|
||||||
console.log("xmlToJson result content = " + result);
|
|
||||||
// @ts-ignore
|
|
||||||
let {_elements:xmlArr} = conv.convertToJSObject(strXml, xmlOptions);
|
|
||||||
console.log("xmlToJson deeml begin");
|
|
||||||
let res = deeml(xmlArr);
|
|
||||||
console.log("xmlToJson end", url);
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
||||||
//处理中心服务code
|
|
||||||
function handleCenterCode(msgXml, isNewCenter) {
|
|
||||||
//新监管
|
|
||||||
if (isNewCenter) {
|
|
||||||
const msg = JSON.parse(msgXml);
|
|
||||||
const result = msg?.data[0]?.result;
|
|
||||||
if (result) {
|
|
||||||
const {code,message,retval} = result
|
|
||||||
if (code != '1') {
|
|
||||||
const rMessage = decodeURIComponent(message as string)
|
|
||||||
prompt.showToast({
|
|
||||||
message: rMessage,
|
|
||||||
duration: 3000
|
|
||||||
});
|
|
||||||
return { code, message }
|
|
||||||
} else {
|
|
||||||
return { code, keystr: retval }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//正则匹配code message字段
|
|
||||||
const [code, message, keystr] = [/<code>(.*)<\/code>/i, /<message>(.*)<\/message>/i, /<keystr>(.*)<\/keystr>/i].map(pattern => {
|
|
||||||
const patternArr = pattern.exec(msgXml);
|
|
||||||
return patternArr && patternArr[1]
|
|
||||||
});
|
|
||||||
|
|
||||||
if (code != '1') {
|
|
||||||
prompt.showToast({
|
|
||||||
message: decodeURIComponent(message as string),
|
|
||||||
duration: 3000
|
|
||||||
});
|
|
||||||
return { code, message: decodeURIComponent(message) }
|
|
||||||
} else {
|
|
||||||
return { code, keystr, message }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//JSON转xml格式
|
|
||||||
const deeml = (elements, _name?) => {
|
|
||||||
const json = {}
|
|
||||||
|
|
||||||
elements.map(ele => {
|
|
||||||
const _elements = ele._elements
|
|
||||||
if (ele._type === 'element') {
|
|
||||||
if (_elements == undefined) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const thisJson = json[ele._name]
|
|
||||||
if (_elements && _elements.length === 1 && _elements[0]._type === 'text') {
|
|
||||||
// 如果值存在了
|
|
||||||
if (thisJson) {
|
|
||||||
handleCommonArr(_elements[0]._text)
|
|
||||||
} else {
|
|
||||||
json[ele._name] = _elements[0]._text
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (thisJson) {
|
|
||||||
handleCommonArr(deeml(ele._elements, ele._name))
|
|
||||||
} else {
|
|
||||||
json[ele._name] = deeml(ele._elements, ele._name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//通用处理重复标签
|
|
||||||
function handleCommonArr(obj) {
|
|
||||||
if (thisJson) {
|
|
||||||
if (Array.isArray(thisJson)) {
|
|
||||||
json[ele._name].push(obj)
|
|
||||||
} else {
|
|
||||||
json[ele._name] = [json[ele._name], obj]
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
json[ele._name] = obj
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
0
|
|
||||||
} else {
|
|
||||||
//标签上有属性
|
|
||||||
if (ele._attributes) {
|
|
||||||
json[_name] = {
|
|
||||||
value: ele._text,
|
|
||||||
attributes: ele.__attributes
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
return json
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,253 +0,0 @@
|
|||||||
import http from '@ohos.net.http';
|
|
||||||
import convertxml from '@ohos.convertxml';
|
|
||||||
import prompt from '@ohos.prompt'
|
|
||||||
import { sendGreen } from '../../pages/judgeSDK/utils/judgeCommon';
|
|
||||||
import { GlobalConfig } from '../../config/index'
|
|
||||||
import FileUtil from '../../common/utils/File';
|
|
||||||
import { dateFormat } from '../utils/tools'
|
|
||||||
import Prompt from '@system.prompt';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author: Renjun Su
|
|
||||||
* @date: 2023/2/20
|
|
||||||
* @desc 接口请求封装
|
|
||||||
* @param {method}
|
|
||||||
* @param {xml} xml请求的数据 xml是字符串
|
|
||||||
* @param {data} post请求的数据
|
|
||||||
* @param {params} get请求的数据
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
export default async function tempRequest<T>(req: any): Promise<T> {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
let httpRequest = http.createHttp();
|
|
||||||
const { url, params = {}, data = {}, xml, method = 'get', host, isNewCenter = false } = req;
|
|
||||||
try {
|
|
||||||
const options = {
|
|
||||||
method: http.RequestMethod[method.toUpperCase()],
|
|
||||||
header: {
|
|
||||||
'Content-Type': xml ? 'text/xml' : 'application/json'
|
|
||||||
},
|
|
||||||
extraData: xml ? data : JSON.stringify(data),
|
|
||||||
connectTimeout: 15 * 1000
|
|
||||||
}
|
|
||||||
let paramsStr = Reflect.ownKeys(params).reduce((p: string, n: string) => (`${p}${n}=${params[n]}&`), '?') || '';
|
|
||||||
paramsStr = paramsStr.toString();
|
|
||||||
paramsStr = paramsStr.substring(0, paramsStr.length - 1)
|
|
||||||
let baseUrl = host ? host : AppStorage.get('host')
|
|
||||||
// let baseUrl=host?config.csptHost:config.host'
|
|
||||||
console.log('响应头地址1' + baseUrl, url, options.extraData.length)
|
|
||||||
// const {result,responseCode} = await
|
|
||||||
httpRequest.request(`${baseUrl}${url}${paramsStr}`, {
|
|
||||||
...options
|
|
||||||
})
|
|
||||||
.then(async (data) => {
|
|
||||||
const result = data.result
|
|
||||||
console.log('响应头地址' + JSON.stringify(result))
|
|
||||||
let res: any = xml ? xmlToJson(result, url) : result;
|
|
||||||
console.log('响应头地址' + JSON.stringify(res))
|
|
||||||
|
|
||||||
let resObj = null;
|
|
||||||
if (typeof res === "string") {
|
|
||||||
res = JSON.parse(res)
|
|
||||||
}
|
|
||||||
//处理中心服务code
|
|
||||||
if (res.Envelope) {
|
|
||||||
const msgXml = res.Envelope.Body.writeObjectOutResponse.return;
|
|
||||||
const dd = handleCenterCode(msgXml, isNewCenter);
|
|
||||||
httpRequest.destroy();
|
|
||||||
// @ts-ignore
|
|
||||||
resolve(dd)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!xml) {
|
|
||||||
if (res.head.resultCode === '0') {
|
|
||||||
httpRequest.destroy();
|
|
||||||
resolve(res)
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
const resultMessage = res?.body?.resultMessage || res?.head?.resultMessage
|
|
||||||
Prompt.showToast({
|
|
||||||
message: decodeURIComponent(resultMessage),
|
|
||||||
duration: 3000
|
|
||||||
});
|
|
||||||
httpRequest.destroy();
|
|
||||||
reject(false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (let i in res) {
|
|
||||||
resObj = res[i].head
|
|
||||||
}
|
|
||||||
console.info('jiangsong:res in request' + url + JSON.stringify(resObj))
|
|
||||||
if (resObj.resultCode === '0') {
|
|
||||||
httpRequest.destroy();
|
|
||||||
resolve(res)
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
Prompt.showToast({
|
|
||||||
message: decodeURIComponent(resObj.resultMessage),
|
|
||||||
duration: 3000
|
|
||||||
});
|
|
||||||
httpRequest.destroy();
|
|
||||||
reject(res)
|
|
||||||
}
|
|
||||||
}).catch(Error => {
|
|
||||||
console.info('test-error0' + url + ' error:resp: ' + JSON.stringify(Error.message))
|
|
||||||
Prompt.showToast({
|
|
||||||
message: Error?.message,
|
|
||||||
duration: 5000
|
|
||||||
});
|
|
||||||
reject(Error)
|
|
||||||
})
|
|
||||||
|
|
||||||
} catch (e) {
|
|
||||||
console.info('test-error' + url + ' error:resp: ' + JSON.stringify(e))
|
|
||||||
if (!e || !(e?.message)) {
|
|
||||||
httpRequest.destroy();
|
|
||||||
reject({
|
|
||||||
code: -1
|
|
||||||
})
|
|
||||||
}
|
|
||||||
Prompt.showToast({
|
|
||||||
message: e?.message,
|
|
||||||
duration: 5000
|
|
||||||
});
|
|
||||||
reject({
|
|
||||||
code: e.code
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//xml格式转JSON
|
|
||||||
function xmlToJson(result, url) {
|
|
||||||
console.log("xmlToJson begin", url);
|
|
||||||
let xmlOptions = {
|
|
||||||
trim: false,
|
|
||||||
declarationKey: "_declaration",
|
|
||||||
instructionKey: "_instruction",
|
|
||||||
attributesKey: "_attributes",
|
|
||||||
textKey: "_text",
|
|
||||||
cdataKey: "_cdata",
|
|
||||||
doctypeKey: "_doctype",
|
|
||||||
commentKey: "_comment",
|
|
||||||
parentKey: "_parent",
|
|
||||||
typeKey: "_type",
|
|
||||||
nameKey: "_name",
|
|
||||||
elementsKey: "_elements",
|
|
||||||
"skipPreprocess": true
|
|
||||||
}
|
|
||||||
|
|
||||||
let strXml = result.toString();
|
|
||||||
let conv = new convertxml.ConvertXML();
|
|
||||||
|
|
||||||
console.log("xmlToJson result.length = " + result.length);
|
|
||||||
console.log("xmlToJson result content = " + result);
|
|
||||||
// @ts-ignore
|
|
||||||
let { _elements: xmlArr } = conv.convertToJSObject(strXml, xmlOptions);
|
|
||||||
console.log("xmlToJson deeml begin");
|
|
||||||
let res = deeml(xmlArr);
|
|
||||||
console.log("xmlToJson end", url);
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
||||||
//处理中心服务code
|
|
||||||
function handleCenterCode(msgXml, isNewCenter) {
|
|
||||||
//新监管
|
|
||||||
if (isNewCenter) {
|
|
||||||
const msg = JSON.parse(msgXml);
|
|
||||||
const result = msg?.data[0]?.result;
|
|
||||||
if (result) {
|
|
||||||
const { code, message, retval } = result
|
|
||||||
if (code != '1') {
|
|
||||||
const rMessage = decodeURIComponent(message as string)
|
|
||||||
Prompt.showToast({
|
|
||||||
message: rMessage,
|
|
||||||
duration: 3000
|
|
||||||
});
|
|
||||||
return { code, message }
|
|
||||||
} else {
|
|
||||||
return { code, keystr: retval }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//正则匹配code message字段
|
|
||||||
const [code, message, keystr] = [/<code>(.*)<\/code>/i, /<message>(.*)<\/message>/i, /<keystr>(.*)<\/keystr>/i].map(pattern => {
|
|
||||||
const patternArr = pattern.exec(msgXml);
|
|
||||||
return patternArr && patternArr[1]
|
|
||||||
});
|
|
||||||
|
|
||||||
if (code != '1') {
|
|
||||||
prompt.showToast({
|
|
||||||
message: decodeURIComponent(message as string),
|
|
||||||
duration: 3000
|
|
||||||
});
|
|
||||||
|
|
||||||
return { code, message: decodeURIComponent(message) }
|
|
||||||
} else {
|
|
||||||
return { code, keystr, message }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//JSON转xml格式
|
|
||||||
const deeml = (elements, _name?) => {
|
|
||||||
const json = {}
|
|
||||||
|
|
||||||
elements.map(ele => {
|
|
||||||
const _elements = ele._elements
|
|
||||||
if (ele._type === 'element') {
|
|
||||||
if (_elements == undefined) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const thisJson = json[ele._name]
|
|
||||||
if (_elements && _elements.length === 1 && _elements[0]._type === 'text') {
|
|
||||||
// 如果值存在了
|
|
||||||
if (thisJson) {
|
|
||||||
handleCommonArr(_elements[0]._text)
|
|
||||||
} else {
|
|
||||||
json[ele._name] = _elements[0]._text
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (thisJson) {
|
|
||||||
handleCommonArr(deeml(ele._elements, ele._name))
|
|
||||||
} else {
|
|
||||||
json[ele._name] = deeml(ele._elements, ele._name)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//通用处理重复标签
|
|
||||||
function handleCommonArr(obj) {
|
|
||||||
if (thisJson) {
|
|
||||||
if (Array.isArray(thisJson)) {
|
|
||||||
json[ele._name].push(obj)
|
|
||||||
} else {
|
|
||||||
json[ele._name] = [json[ele._name], obj]
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
json[ele._name] = obj
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
0
|
|
||||||
} else {
|
|
||||||
//标签上有属性
|
|
||||||
if (ele._attributes) {
|
|
||||||
json[_name] = {
|
|
||||||
value: ele._text,
|
|
||||||
attributes: ele.__attributes
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
return json
|
|
||||||
};
|
|
||||||
|
|
||||||
@ -292,4 +292,3 @@ export function debounce(fn, delay) {
|
|||||||
timer = setTimeout(fn, delay);
|
timer = setTimeout(fn, delay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
;
|
|
||||||
@ -7,8 +7,7 @@ export default struct TopLogo {
|
|||||||
@State ratio: number = 850 / 960
|
@State ratio: number = 850 / 960
|
||||||
@State timeText: string = '';
|
@State timeText: string = '';
|
||||||
@Link outFlag: boolean; //返回按钮触发
|
@Link outFlag: boolean; //返回按钮触发
|
||||||
private timer: any = null;
|
private timer: number = -1;
|
||||||
private vocObj = null;
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
@ -65,7 +64,6 @@ export default struct TopLogo {
|
|||||||
|
|
||||||
aboutToDisappear() {
|
aboutToDisappear() {
|
||||||
clearInterval(this.timer)
|
clearInterval(this.timer)
|
||||||
console.log('jiangsong: topLogo aboutToDisappear222222222')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,175 +1,232 @@
|
|||||||
import {MarkRule} from '../../judgeSDK/api/judgeSDK'
|
import { MarkRule } from '../../judgeSDK/api/judgeSDK';
|
||||||
import EndPoPup from './EndPopup';
|
import EndPoPup from './EndPopup';
|
||||||
|
|
||||||
interface SEL{
|
interface SEL {
|
||||||
fontColor:string
|
fontColor: string
|
||||||
bgColor:string
|
bgColor: string
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
export default struct DeductedPopup {
|
export default struct DeductedPopup {
|
||||||
|
@State fontSize: number = 30
|
||||||
|
@State unselected: SEL = { fontColor: '#000000', bgColor: '#CCC4B8' }
|
||||||
|
@State selected: SEL = { fontColor: '#FFAD33', bgColor: '#26231E' }
|
||||||
|
@State currentIndex: number = 0
|
||||||
|
@State currentPageIndex: number = 0
|
||||||
|
//通用评判扣分
|
||||||
|
@State currentUniversalPageIndex: number = 0;
|
||||||
|
@State universalMarkRules: MarkRule[] = []
|
||||||
|
@State manualMarkRules: MarkRule[] = []
|
||||||
|
@State lineBg: Array<string> = ['#4D4136', '#26231E']
|
||||||
|
@State selectedLine: number = undefined
|
||||||
|
@State endPopupVisible: boolean = false
|
||||||
|
@State selectedLineStyle: SEL = {
|
||||||
|
fontColor: '#FFF',
|
||||||
|
bgColor: '#B36E00'
|
||||||
|
}
|
||||||
|
@Prop defaultTabIndex: number = 0
|
||||||
|
@Prop @Watch('changeCurrentItems') currentItems: string[] = [];
|
||||||
|
@State preCurrentItemsLength: number = 0
|
||||||
|
private markRules: MarkRule[] = []
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
}
|
}
|
||||||
|
|
||||||
@State fontSize:number = 30
|
aboutToAppear() {
|
||||||
@State unselected:SEL = {fontColor:'#000000', bgColor:'#CCC4B8'}
|
this.universalMarkRules = this.markRules.filter(item => (this.currentItems.includes(item.itemno.toString()) ||
|
||||||
@State selected:SEL = {fontColor:'#FFAD33', bgColor:'#26231E'}
|
this.currentItems.includes(item.itemno + '')));
|
||||||
|
|
||||||
@State currentIndex:number = 0
|
|
||||||
@State currentPageIndex:number = 0
|
|
||||||
//通用评判扣分
|
|
||||||
@State currentUniversalPageIndex:number = 0;
|
|
||||||
private markRules:MarkRule[] = []
|
|
||||||
@State universalMarkRules:MarkRule[] = []
|
|
||||||
@State manualMarkRules:MarkRule[] = []
|
|
||||||
@State lineBg:Array<string> = ['#4D4136','#26231E']
|
|
||||||
@State selectedLine:number = undefined
|
|
||||||
@State endPopupVisible:boolean = false
|
|
||||||
private closePopup:Function = ()=> {}
|
|
||||||
private confirmMark:Function = (itemno:number,serial:string) => {}
|
|
||||||
@State selectedLineStyle:SEL = {
|
|
||||||
fontColor:'#FFF',
|
|
||||||
bgColor:'#B36E00'
|
|
||||||
}
|
|
||||||
|
|
||||||
@Prop defaultTabIndex:number = 0
|
|
||||||
@Prop @Watch('changeCurrentItems') currentItems:string[] = [];
|
|
||||||
@State preCurrentItemsLength:number = 0
|
|
||||||
|
|
||||||
aboutToAppear(){
|
|
||||||
//@ts-ignore
|
|
||||||
this.universalMarkRules = this.markRules.filter(item => (this.currentItems.includes(item.itemno) || this.currentItems.includes(item.itemno + '')));
|
|
||||||
this.currentIndex = this.defaultTabIndex
|
this.currentIndex = this.defaultTabIndex
|
||||||
if(this.currentIndex == 1){
|
if (this.currentIndex == 1) {
|
||||||
this.universalMarkRules = this.markRules.filter(item => item.itemno == 20 )
|
this.universalMarkRules = this.markRules.filter(item => item.itemno == 20)
|
||||||
}
|
}
|
||||||
this.preCurrentItemsLength = this.currentItems.length
|
this.preCurrentItemsLength = this.currentItems.length
|
||||||
}
|
}
|
||||||
|
|
||||||
changeCurrentItems(){
|
changeCurrentItems() {
|
||||||
if(this.currentItems?.length && (this.currentItems?.length >= this.preCurrentItemsLength)){
|
if (this.currentItems?.length && (this.currentItems?.length >= this.preCurrentItemsLength)) {
|
||||||
//@ts-ignore
|
this.universalMarkRules = this.markRules.filter(item => (this.currentItems.includes(item.itemno.toString()) ||
|
||||||
this.universalMarkRules = this.markRules.filter(item => (this.currentItems.includes(item.itemno) || this.currentItems.includes(item.itemno + '')));
|
this.currentItems.includes(item.itemno + '')));
|
||||||
this.currentIndex = this.defaultTabIndex
|
this.currentIndex = this.defaultTabIndex
|
||||||
if(this.currentIndex == 1){
|
if (this.currentIndex == 1) {
|
||||||
this.universalMarkRules = this.markRules.filter(item => item.itemno == 20 )
|
this.universalMarkRules = this.markRules.filter(item => item.itemno == 20)
|
||||||
}
|
}
|
||||||
this.preCurrentItemsLength = this.currentItems.length
|
this.preCurrentItemsLength = this.currentItems.length
|
||||||
}else{
|
} else {
|
||||||
this.preCurrentItemsLength = 0
|
this.preCurrentItemsLength = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//上一页 下一页
|
//上一页 下一页
|
||||||
goPage(typeIndex){
|
goPage(typeIndex: number) {
|
||||||
const currentIndex = this.currentIndex
|
const currentIndex = this.currentIndex
|
||||||
if(currentIndex){
|
if (currentIndex) {
|
||||||
//通用评判
|
//通用评判
|
||||||
typeIndex ? (this.currentUniversalPageIndex += 1) : (this.currentUniversalPageIndex -= 1)
|
typeIndex ? (this.currentUniversalPageIndex += 1) : (this.currentUniversalPageIndex -= 1)
|
||||||
}else{
|
} else {
|
||||||
typeIndex ? (this.currentPageIndex += 1) : (this.currentPageIndex -= 1)
|
typeIndex ? (this.currentPageIndex += 1) : (this.currentPageIndex -= 1)
|
||||||
}
|
}
|
||||||
this.selectedLine = -1
|
this.selectedLine = -1
|
||||||
}
|
}
|
||||||
|
|
||||||
//选中扣分项
|
//选中扣分项
|
||||||
getSelectedLine(index){
|
getSelectedLine(index: number) {
|
||||||
const {selectedLine,selectedLineStyle,lineBg} = this;
|
// const { selectedLine, selectedLineStyle, lineBg } = this;
|
||||||
if(selectedLine === index){
|
if (this.selectedLine === index) {
|
||||||
return selectedLineStyle.bgColor
|
return this.selectedLineStyle.bgColor
|
||||||
}
|
}
|
||||||
if(index % 2 === 0){
|
if (index % 2 === 0) {
|
||||||
return lineBg[0]
|
return this.lineBg[0]
|
||||||
}else{
|
} else {
|
||||||
return lineBg[1]
|
return this.lineBg[1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取当前页的数据
|
//获取当前页的数据
|
||||||
getCurrentMarkRuleList(){
|
getCurrentMarkRuleList() {
|
||||||
const {currentIndex,currentUniversalPageIndex,currentPageIndex,markRules,universalMarkRules} = this;
|
// const { currentIndex, currentUniversalPageIndex, currentPageIndex, markRules, universalMarkRules } = this;
|
||||||
if(currentIndex){
|
if (this.currentIndex) {
|
||||||
//通用评判
|
//通用评判
|
||||||
return universalMarkRules.slice(currentUniversalPageIndex*7,(currentUniversalPageIndex + 1)*7)
|
return this.universalMarkRules.slice(this.currentUniversalPageIndex * 7, (this.currentUniversalPageIndex + 1) * 7)
|
||||||
}else{
|
} else {
|
||||||
return universalMarkRules.slice(currentPageIndex*7,(currentPageIndex + 1)*7)
|
return this.universalMarkRules.slice(this.currentPageIndex * 7, (this.currentPageIndex + 1) * 7)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
build(){
|
build() {
|
||||||
Column(){
|
Column() {
|
||||||
Column(){
|
Column() {
|
||||||
Column(){
|
Column() {
|
||||||
Row(){
|
Row() {
|
||||||
Row(){
|
Row() {
|
||||||
ForEach(['人工评判','通用评判'],(text,index)=>{
|
ForEach(['人工评判', '通用评判'], (text: string, index) => {
|
||||||
Row(){
|
Row() {
|
||||||
Text(text).fontColor(index === this.currentIndex ? this.selected.fontColor : this.unselected.fontColor).fontSize(this.fontSize).fontWeight(500)
|
Text(text)
|
||||||
|
.fontColor(index === this.currentIndex ? this.selected.fontColor : this.unselected.fontColor)
|
||||||
|
.fontSize(this.fontSize)
|
||||||
|
.fontWeight(500)
|
||||||
}
|
}
|
||||||
.width(140).height(60)
|
.width(140)
|
||||||
.backgroundColor(index === this.currentIndex ? this.selected.bgColor: this.unselected.bgColor ).justifyContent(FlexAlign.Center).justifyContent(FlexAlign.Center)
|
.height(60)
|
||||||
.borderRadius({topLeft:20,topRight:20}).margin({right:10})
|
.backgroundColor(index === this.currentIndex ? this.selected.bgColor : this.unselected.bgColor)
|
||||||
.onClick(()=>{
|
.justifyContent(FlexAlign.Center)
|
||||||
|
.justifyContent(FlexAlign.Center)
|
||||||
|
.borderRadius({ topLeft: 20, topRight: 20 })
|
||||||
|
.margin({ right: 10 })
|
||||||
|
.onClick(() => {
|
||||||
this.currentIndex = index;
|
this.currentIndex = index;
|
||||||
this.selectedLine = -1;
|
this.selectedLine = -1;
|
||||||
if(index === 1) {
|
if (index === 1) {
|
||||||
this.universalMarkRules = this.markRules.filter(item => item.itemno == 20 )
|
this.universalMarkRules = this.markRules.filter(item => item.itemno == 20)
|
||||||
}else{
|
} else {
|
||||||
//@ts-ignore
|
this.universalMarkRules =
|
||||||
this.universalMarkRules = this.markRules.filter(item => (this.currentItems.includes(item.itemno) || this.currentItems.includes(item.itemno+'')))
|
this.markRules.filter(item => (this.currentItems.includes(item.itemno.toString()) ||
|
||||||
|
this.currentItems.includes(item.itemno + '')))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
Row(){
|
|
||||||
if(
|
Row() {
|
||||||
(Math.ceil(this.universalMarkRules.length / 7 - 1)) >= (this.currentIndex ? this.currentUniversalPageIndex: this.currentPageIndex) &&
|
if (
|
||||||
(this.currentIndex ? this.currentUniversalPageIndex: this.currentPageIndex) > 0
|
(Math.ceil(this.universalMarkRules.length / 7 - 1)) >=
|
||||||
){
|
(this.currentIndex ? this.currentUniversalPageIndex : this.currentPageIndex) &&
|
||||||
Row(){
|
(this.currentIndex ? this.currentUniversalPageIndex : this.currentPageIndex) > 0
|
||||||
Image($rawfile(`judge/km3/zuo_nor.png`)).height(15).margin({left:20,top:0})
|
) {
|
||||||
Text('上一页'){}.fontColor('#FFF').fontSize(this.fontSize)
|
Row() {
|
||||||
}.width(150).height(60).justifyContent(FlexAlign.Start).alignItems(VerticalAlign.Center).backgroundImage($rawfile(`judge/km3/button_nor.png`)).backgroundImageSize({width:'100%',height:'100%'}).margin({right:30})
|
Image($rawfile(`judge/km3/zuo_nor.png`)).height(15).margin({ left: 20, top: 0 })
|
||||||
.onClick(()=>{this.goPage(0)})
|
Text('上一页') {
|
||||||
|
}.fontColor('#FFF').fontSize(this.fontSize)
|
||||||
|
}
|
||||||
|
.width(150)
|
||||||
|
.height(60)
|
||||||
|
.justifyContent(FlexAlign.Start)
|
||||||
|
.alignItems(VerticalAlign.Center)
|
||||||
|
.backgroundImage($rawfile(`judge/km3/button_nor.png`))
|
||||||
|
.backgroundImageSize({ width: '100%', height: '100%' })
|
||||||
|
.margin({ right: 30 })
|
||||||
|
.onClick(() => {
|
||||||
|
this.goPage(0)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if(
|
if (
|
||||||
(Math.ceil(this.universalMarkRules.length / 7 - 1)) > (this.currentIndex ? this.currentUniversalPageIndex: this.currentPageIndex)
|
(Math.ceil(this.universalMarkRules.length / 7 - 1)) >
|
||||||
){
|
(this.currentIndex ? this.currentUniversalPageIndex : this.currentPageIndex)
|
||||||
Row(){
|
) {
|
||||||
Text('下一页'){}.fontColor('#FFF').fontSize(this.fontSize).padding({left:30})
|
Row() {
|
||||||
Image($rawfile(`judge/km3/you_nor.png`)).height(15).margin({right:6,top:0})
|
Text('下一页') {
|
||||||
}.width(150).height(60).justifyContent(FlexAlign.Start).alignItems(VerticalAlign.Center).backgroundImage($rawfile(`judge/km3/button_nor.png`)).backgroundImageSize({width:'100%',height:'100%'}).margin({right:30})
|
}.fontColor('#FFF').fontSize(this.fontSize).padding({ left: 30 })
|
||||||
.onClick(()=>{this.goPage(1)})
|
|
||||||
|
Image($rawfile(`judge/km3/you_nor.png`)).height(15).margin({ right: 6, top: 0 })
|
||||||
|
}
|
||||||
|
.width(150)
|
||||||
|
.height(60)
|
||||||
|
.justifyContent(FlexAlign.Start)
|
||||||
|
.alignItems(VerticalAlign.Center)
|
||||||
|
.backgroundImage($rawfile(`judge/km3/button_nor.png`))
|
||||||
|
.backgroundImageSize({ width: '100%', height: '100%' })
|
||||||
|
.margin({ right: 30 })
|
||||||
|
.onClick(() => {
|
||||||
|
this.goPage(1)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
Row(){
|
Row() {
|
||||||
Text('扣 分'){}.fontColor('#FFF').fontSize(this.fontSize).padding({left:35})
|
Text('扣 分') {
|
||||||
}.width(140).height(60).justifyContent(FlexAlign.Start).alignItems(VerticalAlign.Center).backgroundImage($rawfile(`judge/km3/button_nor.png`)).backgroundImageSize({width:'100%',height:'100%'})
|
}.fontColor('#FFF').fontSize(this.fontSize).padding({ left: 35 })
|
||||||
.onClick(()=>{
|
}
|
||||||
|
.width(140)
|
||||||
|
.height(60)
|
||||||
|
.justifyContent(FlexAlign.Start)
|
||||||
|
.alignItems(VerticalAlign.Center)
|
||||||
|
.backgroundImage($rawfile(`judge/km3/button_nor.png`))
|
||||||
|
.backgroundImageSize({ width: '100%', height: '100%' })
|
||||||
|
.onClick(() => {
|
||||||
this.endPopupVisible = true
|
this.endPopupVisible = true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}.width('100%').justifyContent(FlexAlign.SpaceBetween)
|
}.width('100%').justifyContent(FlexAlign.SpaceBetween)
|
||||||
Column(){
|
|
||||||
ForEach(this.getCurrentMarkRuleList(),(item,index) => {
|
Column() {
|
||||||
Row(){
|
ForEach(this.getCurrentMarkRuleList(), (item: ESObject, index) => {
|
||||||
Row(){
|
Row() {
|
||||||
Text(`${item.markshow} (${item.markcatalog})`).fontColor('#FFF').fontSize(this.fontSize).fontWeight(600)
|
Row() {
|
||||||
|
Text(`${item.markshow} (${item.markcatalog})`)
|
||||||
|
.fontColor('#FFF')
|
||||||
|
.fontSize(this.fontSize)
|
||||||
|
.fontWeight(600)
|
||||||
}.width(1000)
|
}.width(1000)
|
||||||
Row(){
|
|
||||||
|
Row() {
|
||||||
Text(item.markreal + '').fontColor('#FFF').fontSize(this.fontSize).fontWeight(600)
|
Text(item.markreal + '').fontColor('#FFF').fontSize(this.fontSize).fontWeight(600)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.width('100%').justifyContent(FlexAlign.SpaceBetween).alignItems(VerticalAlign.Center).constraintSize({minHeight:70})
|
.width('100%')
|
||||||
.padding({left:20,right:20})
|
.justifyContent(FlexAlign.SpaceBetween)
|
||||||
|
.alignItems(VerticalAlign.Center)
|
||||||
|
.constraintSize({ minHeight: 70 })
|
||||||
|
.padding({ left: 20, right: 20 })
|
||||||
.backgroundColor(this.getSelectedLine(index))
|
.backgroundColor(this.getSelectedLine(index))
|
||||||
.onClick(()=>{this.selectedLine = index})
|
.onClick(() => {
|
||||||
|
this.selectedLine = index
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.width(1200).height(620).position({x:30,y:315}).backgroundColor('#E6E3DF').padding({top:15,bottom:15,left:25,right:25}).borderRadius(20)
|
}
|
||||||
|
.width(1200)
|
||||||
|
.height(620)
|
||||||
|
.position({ x: 30, y: 315 })
|
||||||
|
.backgroundColor('#E6E3DF')
|
||||||
|
.padding({
|
||||||
|
top: 15,
|
||||||
|
bottom: 15,
|
||||||
|
left: 25,
|
||||||
|
right: 25
|
||||||
|
})
|
||||||
|
.borderRadius(20)
|
||||||
|
|
||||||
// Row(){}.width(100).height(100).position({y:'85%',x:'50%'}).backgroundImage($rawfile('judge/km3/close_nor.png')).backgroundImageSize({width:'100%',height:'100%'})
|
// Row(){}.width(100).height(100).position({y:'85%',x:'50%'}).backgroundImage($rawfile('judge/km3/close_nor.png')).backgroundImageSize({width:'100%',height:'100%'})
|
||||||
//结束考试弹窗
|
//结束考试弹窗
|
||||||
if (this.endPopupVisible) {
|
if (this.endPopupVisible) {
|
||||||
@ -179,12 +236,19 @@ export default struct DeductedPopup {
|
|||||||
this.endPopupVisible = false;
|
this.endPopupVisible = false;
|
||||||
},
|
},
|
||||||
confirmFn: async () => {
|
confirmFn: async () => {
|
||||||
const index = this.currentIndex ? this.currentUniversalPageIndex: this.currentPageIndex;
|
const index = this.currentIndex ? this.currentUniversalPageIndex : this.currentPageIndex;
|
||||||
const mark = this.universalMarkRules[index * 7 + this.selectedLine]
|
const mark = this.universalMarkRules[index * 7 + this.selectedLine]
|
||||||
mark && this.confirmMark(mark.itemno,mark.markserial)
|
mark && this.confirmMark(mark.itemno, mark.markserial)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}.width('100%').height('100%').position({y:0}).onClick(()=>{this.closePopup()})
|
}.width('100%').height('100%').position({ y: 0 }).onClick(() => {
|
||||||
|
this.closePopup()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
private closePopup: Function = () => {
|
||||||
|
}
|
||||||
|
private confirmMark: Function = (itemno: number, serial: string) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
0
entry/src/main/ets/utils/Common.ets
Normal file
0
entry/src/main/ets/utils/Common.ets
Normal file
Loading…
x
Reference in New Issue
Block a user