Commit 3afcd2f5 authored by 李维's avatar 李维

更新DDS素材

parent 4c62f368
No preview for this file type
......@@ -2,6 +2,8 @@
cocos creator技术框架下的H5互动模板框架脚手架,基于cocos creator实现快速开发基于绘玩云的H5互动课件。
[视频教程传送门](https://www.bilibili.com/video/BV1Dq4y1t7n5/)
# 使用简介
## 前期准备
......@@ -48,75 +50,46 @@ npm install
npm start
```
* 打开浏览器:http://staging-teach.ireadabc.com/template_ci/debug
* 点击右上角齿轮,选择技术选型、调试模式选择“普通”
### 互动模板
* 找到项目根路径下 index.html 文件
* 在引入JS的位置将air.js改为air_online_open.js
* 启动本地服务
```
npm start
```
* 打开浏览器:http://staging-teach.ireadabc.com/template_ci/debug
* 点击右上角齿轮,选择技术选型、调试模式选择“互动”
* 左侧老师、右侧学生
* 打开浏览器:http://staging-teach.ireadabc.com/template_ci/debug
* [点击查看调试视频教程](https://www.bilibili.com/video/BV1Dq4y1t7n5?p=8)
### 真机调试
* 下载模板调试专用app
安卓下载:
http://download-iplayabc.oss-cn-beijing.aliyuncs.com/iDebugABC.apk
![avatar](http://staging-teach.cdn.ireadabc.com/084f2f95-8213-4c5a-8c46-b194819d7677.png)
* 启动本地服务
```
npm start
```
iOS下载:
由于调试APP没有上架App Store 所以需要先获取手机的UDID 发送给我们的技术支持,加入后才可以扫码下载安装
获取UDID:https://www.pgyer.com/tools/udid
下载iOS: https://www.pgyer.com/gS0X
* 手机和电脑连接同一个Wifi
* 打开调试app,根据提示输入IP地址,点击开始就可以在手机上预览模板了
* 使用 this.log("==调试信息=="); 可以打印日志进行必要的调试
有时可能需要反复调试一些功能性的问题,与原生APP相关或者手上临时没有设备,我们提供了一个网页版的调试方式
### 关于联机模板
* 网络连接相关的代码位置:
assets/script/NetworkHelper.ts
http://staging-openapi.iteachabc.com/api/courseware/v1/middle/debug
* 服务器相关代码位置:
assets/script/Server.ts
* AI相关代码位置:
assets/script/AI.ts
* 启动本地服务
* 注意要将以下代码中的"op_16"参数改为自己的模板名称
```
this.networkHelper.init("op_16", 2);
npm start
```
* 联机对战引擎文档:
https://cloud.tencent.com/document/product/629/46678
https://cloud.tencent.com/document/product/1038/50849
### 联机模板额外的验收标准
* 联机功能可用
* 无人联机时,需要自动填充AI
* 有人掉线时,需弹出提示,让玩家自行选择退出或重开游戏
### 关于op_16的说明:
* 通信接口
SERVER_allPlayerInfo: 由server发给player,有玩家加入或离开时发送,用来更新玩家信息。
SERVER_updateStatus: 由server发给player,更新游戏状态,主要是回合结束换边等。
SERVER_playerRoll: 由server发给player,玩家转动转盘。
SERVER_playerRight: 由server发给player,玩家选择了正确的格子。
SERVER_playerWrong: 由server发给player,玩家选择了错误的格子。
SERVER_playerWin: 由server发给player,玩家胜利。
roll: player发送给server,玩家试图转动转盘。
right: player发送给server,玩家选择了正确的格子。
wrong: player发送给server,玩家选择了错误的格子。
* 手机和电脑连接同一个Wifi
* 打开调试app,根据提示输入IP地址,点击开始就可以在手机上预览模板了
* 使用 console.log("==调试信息=="); 可以打印日志进行必要的调试
* 点击左上角 “logcat” 可以查看运行日志,(logcat是可以按住拖动的, 所以不用考虑UI遮挡问题)
### 注意事项及常见问题
* 项目里所有文件及文件夹的命名方式要注意不能包含空格、汉字、减号
* 开发者新建的脚本文件(.js/.ts)的文件名必须包含项目名称,例如在 test_01 项目中添加一个脚本文件(如想命名为 hello.ts );则需要命名为 hello_test_01.ts
* 项目里尽量不要使用setTimeout、setInterval等定时器,如果使用了记得在onDestroy中释放掉(onDestroy 是指CocosCreator的生命周期钩子)
* 理论上禁止使用全局变量,因为模板到线上会进行组装,常见问题是一个模板使用多次造成全局变量被读脏
This diff is collapsed.
// import { getSprNode } from "./util";
import { getSprNode, playAudioByUrl, randomSortByArr, playAudio, showTrebleFirework, RandomInt, asyncDelay, exchangeNodePos, onHomeworkFinish } from "./util_JJ_Game_01";
import { getSprNode, playAudioByUrl, randomSortByArr, playAudio, showTrebleFirework, RandomInt, asyncDelay, exchangeNodePos, onHomeworkFinish } from "./JJ_Game_01_util";
cc.Class({
extends: cc.Component,
......@@ -393,10 +393,11 @@ cc.Class({
const hole = new cc.Node();
hole.scale = this._mapScaleMin;
const holeBg = getSprNode('hole_1');
const holeBg = getSprNode('hole_1', true);
hole.addChild(holeBg, 1);
const holeTop = getSprNode('hole_2');
const holeTop = getSprNode('hole_2', true);
// holeTop.anchorY = 0.99;
hole.addChild(holeTop, 10);
return hole;
......@@ -466,6 +467,7 @@ cc.Class({
node.addChild(node.textPanel);
node.addChild(penguin);
node.addChild(node.wrong);
node.anchorY = 0;
return node;
},
......@@ -842,8 +844,9 @@ cc.Class({
hole.penguin = penguin;
const downY = -180;
const downY = -50;
penguin.y = downY;
penguin.x = -5;
let panel;
......@@ -864,7 +867,7 @@ cc.Class({
}
penguin.moveTween = cc.tween(penguin)
.to(moveTime, { y: 0 }, { easing: 'quadInOut' })
.to(moveTime, { y: 120 }, { easing: 'quadInOut' })
.delay(standTime)
.call(() => {
hidePanel();
......
......@@ -80,7 +80,13 @@ export function getSpriteFrimeByUrl(url, cb) {
})
}
export function getSprNode(resName) {
export function getSprNode(resName, isCopy = false) {
if (isCopy) {
const baseSprNode = cc.find('Canvas/res/img/' + resName);
return cc.instantiate(baseSprNode);
}
const sf = cc.find('Canvas/res/img/' + resName).getComponent(cc.Sprite).spriteFrame;
const node = new cc.Node();
node.addComponent(cc.Sprite).spriteFrame = sf;
......
assets/JJ_Game_01/texture/bg.png

77.8 KB | W: | H:

assets/JJ_Game_01/texture/bg.png

14.6 KB | W: | H:

assets/JJ_Game_01/texture/bg.png
assets/JJ_Game_01/texture/bg.png
assets/JJ_Game_01/texture/bg.png
assets/JJ_Game_01/texture/bg.png
  • 2-up
  • Swipe
  • Onion skin
{
"ver": "2.3.5",
"uuid": "085687a5-ea01-4373-b958-f93d5421a6c6",
"uuid": "7c6d1bf0-353f-4166-a442-f1708502a09d",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
......@@ -13,17 +13,17 @@
"subMetas": {
"bg": {
"ver": "1.0.4",
"uuid": "440eb6ae-0f7f-4756-88cd-6f61daa639ae",
"rawTextureUuid": "085687a5-ea01-4373-b958-f93d5421a6c6",
"trimType": "custom",
"uuid": "5d1286fa-5112-4855-973f-b75c0f262cbf",
"rawTextureUuid": "7c6d1bf0-353f-4166-a442-f1708502a09d",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"offsetY": -25,
"trimX": 0,
"trimY": 0,
"trimY": 50,
"width": 1280,
"height": 720,
"height": 670,
"rawWidth": 1280,
"rawHeight": 720,
"borderTop": 0,
......
assets/JJ_Game_01/texture/bg_sky.png

44.5 KB | W: | H:

assets/JJ_Game_01/texture/bg_sky.png

220 Bytes | W: | H:

assets/JJ_Game_01/texture/bg_sky.png
assets/JJ_Game_01/texture/bg_sky.png
assets/JJ_Game_01/texture/bg_sky.png
assets/JJ_Game_01/texture/bg_sky.png
  • 2-up
  • Swipe
  • Onion skin
{
"ver": "2.3.5",
"uuid": "a8e35fb6-9a2a-4aea-b69f-01e4a2d60006",
"uuid": "8af454a1-39eb-4b6d-a9bc-3aa802ec4c0b",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
......@@ -8,14 +8,14 @@
"genMipmaps": false,
"packable": true,
"width": 1280,
"height": 202,
"height": 720,
"platformSettings": {},
"subMetas": {
"bg_sky": {
"ver": "1.0.4",
"uuid": "6a747ae5-f607-4cfc-ad58-83905f4b5fcb",
"rawTextureUuid": "a8e35fb6-9a2a-4aea-b69f-01e4a2d60006",
"trimType": "custom",
"uuid": "bb991d7e-1c7b-4fe1-b5e0-0a362ba67f62",
"rawTextureUuid": "8af454a1-39eb-4b6d-a9bc-3aa802ec4c0b",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
......@@ -23,9 +23,9 @@
"trimX": 0,
"trimY": 0,
"width": 1280,
"height": 202,
"height": 720,
"rawWidth": 1280,
"rawHeight": 202,
"rawHeight": 720,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "8f8e684e-0742-4a9d-9d6d-99127ed34a34",
"uuid": "e49fc43e-93af-40f1-908c-6a742c0a635e",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 379,
"height": 241,
"width": 360,
"height": 229,
"platformSettings": {},
"subMetas": {
"btn_restart": {
"ver": "1.0.4",
"uuid": "6ffad1ef-4969-4e94-b2f0-559edc5bf4a8",
"rawTextureUuid": "8f8e684e-0742-4a9d-9d6d-99127ed34a34",
"trimType": "custom",
"uuid": "1a8c261b-b360-4997-b18b-a1fea31ef3ef",
"rawTextureUuid": "e49fc43e-93af-40f1-908c-6a742c0a635e",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 379,
"height": 241,
"rawWidth": 379,
"rawHeight": 241,
"width": 360,
"height": 229,
"rawWidth": 360,
"rawHeight": 229,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
assets/JJ_Game_01/texture/btn_start.png

19.4 KB | W: | H:

assets/JJ_Game_01/texture/btn_start.png

6.64 KB | W: | H:

assets/JJ_Game_01/texture/btn_start.png
assets/JJ_Game_01/texture/btn_start.png
assets/JJ_Game_01/texture/btn_start.png
assets/JJ_Game_01/texture/btn_start.png
  • 2-up
  • Swipe
  • Onion skin
{
"ver": "2.3.5",
"uuid": "4be0ea22-e4dc-4070-8138-01551f6f5177",
"uuid": "f1722029-2171-4946-919b-77f20b185bd1",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 379,
"height": 241,
"width": 360,
"height": 229,
"platformSettings": {},
"subMetas": {
"btn_start": {
"ver": "1.0.4",
"uuid": "40c5db6d-c92c-412d-967b-191431831173",
"rawTextureUuid": "4be0ea22-e4dc-4070-8138-01551f6f5177",
"trimType": "custom",
"uuid": "38ddaf45-9637-4402-b93f-d9affe939e2b",
"rawTextureUuid": "f1722029-2171-4946-919b-77f20b185bd1",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 379,
"height": 241,
"rawWidth": 379,
"rawHeight": 241,
"width": 360,
"height": 229,
"rawWidth": 360,
"rawHeight": 229,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
assets/JJ_Game_01/texture/hole_1.png

15.9 KB | W: | H:

assets/JJ_Game_01/texture/hole_1.png

14.2 KB | W: | H:

assets/JJ_Game_01/texture/hole_1.png
assets/JJ_Game_01/texture/hole_1.png
assets/JJ_Game_01/texture/hole_1.png
assets/JJ_Game_01/texture/hole_1.png
  • 2-up
  • Swipe
  • Onion skin
{
"ver": "2.3.5",
"uuid": "320b23eb-5f3d-43d0-9e49-4401dbc126ea",
"uuid": "5483fcc7-f6d5-4e18-b84a-877b17cf1256",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 260,
"height": 484,
"width": 250,
"height": 571,
"platformSettings": {},
"subMetas": {
"hole_1": {
"ver": "1.0.4",
"uuid": "8c93b5aa-9dd1-4231-8b59-24bf84a1231f",
"rawTextureUuid": "320b23eb-5f3d-43d0-9e49-4401dbc126ea",
"trimType": "custom",
"uuid": "d1ec7cdd-edc8-423a-a199-6cd10e29196b",
"rawTextureUuid": "5483fcc7-f6d5-4e18-b84a-877b17cf1256",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"offsetX": -0.5,
"offsetY": 74.5,
"trimX": 0,
"trimY": 0,
"width": 260,
"height": 484,
"rawWidth": 260,
"rawHeight": 484,
"trimY": 144,
"width": 249,
"height": 134,
"rawWidth": 250,
"rawHeight": 571,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
assets/JJ_Game_01/texture/hole_2.png

14.6 KB | W: | H:

assets/JJ_Game_01/texture/hole_2.png

9.19 KB | W: | H:

assets/JJ_Game_01/texture/hole_2.png
assets/JJ_Game_01/texture/hole_2.png
assets/JJ_Game_01/texture/hole_2.png
assets/JJ_Game_01/texture/hole_2.png
  • 2-up
  • Swipe
  • Onion skin
{
"ver": "2.3.5",
"uuid": "8076c8f2-8d43-4d9a-9044-f7d67cc6a533",
"uuid": "f5bba8f7-a648-4c7c-9765-3e59e08f5d7c",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 260,
"height": 484,
"width": 250,
"height": 571,
"platformSettings": {},
"subMetas": {
"hole_2": {
"ver": "1.0.4",
"uuid": "896204c9-a098-4acd-bd32-5ec6fe90cb76",
"rawTextureUuid": "8076c8f2-8d43-4d9a-9044-f7d67cc6a533",
"trimType": "custom",
"uuid": "5c599cae-c6da-4143-ab87-1d327d5a576c",
"rawTextureUuid": "f5bba8f7-a648-4c7c-9765-3e59e08f5d7c",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"offsetY": -104,
"trimX": 0,
"trimY": 0,
"width": 260,
"height": 484,
"rawWidth": 260,
"rawHeight": 484,
"trimY": 208,
"width": 250,
"height": 363,
"rawWidth": 250,
"rawHeight": 571,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
assets/JJ_Game_01/texture/penguin_1.png

24.8 KB | W: | H:

assets/JJ_Game_01/texture/penguin_1.png

6.13 KB | W: | H:

assets/JJ_Game_01/texture/penguin_1.png
assets/JJ_Game_01/texture/penguin_1.png
assets/JJ_Game_01/texture/penguin_1.png
assets/JJ_Game_01/texture/penguin_1.png
  • 2-up
  • Swipe
  • Onion skin
{
"ver": "2.3.5",
"uuid": "f7f5e523-791b-4669-9380-b6ba353764f9",
"uuid": "0af0acb3-5324-453c-85d6-ab6c40570984",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 260,
"height": 484,
"width": 164,
"height": 192,
"platformSettings": {},
"subMetas": {
"penguin_1": {
"ver": "1.0.4",
"uuid": "78744b27-6811-4a52-b80c-1da020722b6a",
"rawTextureUuid": "f7f5e523-791b-4669-9380-b6ba353764f9",
"trimType": "custom",
"uuid": "c00e65a3-6b91-4571-9bfc-78fa86add7b5",
"rawTextureUuid": "0af0acb3-5324-453c-85d6-ab6c40570984",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 260,
"height": 484,
"rawWidth": 260,
"rawHeight": 484,
"width": 164,
"height": 192,
"rawWidth": 164,
"rawHeight": 192,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "e5008114-ac77-46c7-b993-14ed9fe61052",
"uuid": "52228ea0-f116-4d9f-a20b-cc6dc90bda06",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 260,
"height": 484,
"width": 186,
"height": 207,
"platformSettings": {},
"subMetas": {
"penguin_1_wrong": {
"ver": "1.0.4",
"uuid": "83f7e497-f454-484a-9f3b-0e751223d0e1",
"rawTextureUuid": "e5008114-ac77-46c7-b993-14ed9fe61052",
"trimType": "custom",
"uuid": "d4cf5c5d-7860-4c72-b4ae-3760cd0f0132",
"rawTextureUuid": "52228ea0-f116-4d9f-a20b-cc6dc90bda06",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 260,
"height": 484,
"rawWidth": 260,
"rawHeight": 484,
"width": 186,
"height": 207,
"rawWidth": 186,
"rawHeight": 207,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
const express = require('express');
const os = require('os');
const readline = require('readline');
const Base64 = require('js-base64');
const CryptoJS = require("crypto-js");
const http = require("http");
const { build, buildAndroid, buildIos } = require('./buildCocos');
const networkInfo = os.networkInterfaces();
......@@ -21,58 +18,12 @@ for (const infos of Object.values(networkInfo)) {
var app = express();
// Access-Control-Allow-Origin: *
app.use('/dist', express.static('dist'));
app.use('/form', express.static('form'));
app.get('/', function (req, res) {
res.header("Access-Control-Allow-Origin", "*");
res.send('Hello World');
});
app.get('/getSign', function (req, res) {
res.header("Access-Control-Allow-Origin", "*");
const gameId = req.query.gameId;
const openId = req.query.openId;
const secretKey = "060d81c7abaf24c8ce2afc5a725c152062676d35"; //替换为控制台上的 游戏 Key
const nonce = Math.floor(Math.random() * 1000000000);
const timestamp = Math.floor(new Date().getTime() / 1000);
const str = `game_id=${gameId}&nonce=${nonce}&open_id=${openId}&timestamp=${timestamp}`;
const sign = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA1(str, secretKey));
res.send(JSON.stringify({ nonce, timestamp, sign }));
});
// app.get('/jump', function (req, res) {
// res.header("Access-Control-Allow-Origin", "*");
// const gameId = req.query.gameId;
// const openId = req.query.openId;
// http.get({
// hostname: 'staging-teach.ireadabc.com',
// port: 80,
// path: `/api/oxford/game/v1/config?gameid=${gameId}&openid=${openId}`,
// agent: false // 仅为这个请求创建新代理
// }, (getres) => {
// getres.setEncoding('utf8');
// let rawData = '';
// getres.on('data', (chunk) => { rawData += chunk; });
// getres.on('end', () => {
// const secretKey = "060d81c7abaf24c8ce2afc5a725c152062676d35"; //替换为控制台上的 游戏 Key
// const data = JSON.parse(rawData);
// const str = `game_id=${gameId}&nonce=${data.nonce}&open_id=${openId}&timestamp=${data.timestamp}`;
// const sign = CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA1(str, secretKey));
// console.log('sign = ' + sign);
// res.send(rawData)
// });
// });
// });
})
let port = '';
var server = app.listen(8081, function () {
......
......@@ -330,84 +330,6 @@ async function replaceUuids() {
}
console.log('build_step_0 完成~!');
const sceneName = getFolderName(path);
let scriptUUids = [];
await fileForEach(path, (path) => {
const nameList = path.split('.');
if (nameList[nameList.length - 1] == 'meta') {
if (['js', 'ts'].includes(nameList[nameList.length - 2])) {
const scriptNameList = nameList[nameList.length - 3].split('/');
const scriptName = scriptNameList[scriptNameList.length - 1];
const data = JSON.parse(fs.readFileSync(path));
scriptUUids.push({
uuid: data.uuid,
shortUuid: getShortUuid(data.uuid),
scriptName: scriptName,
fileName: nameList[nameList.length - 3] + '.' + nameList[nameList.length - 2],
});
}
}
});
await fileForEach(path, (path) => {
const nameList = path.split('.');
const expectNameList = ['fire', 'prefab'];
if (expectNameList.includes(nameList[nameList.length - 1])) {
const data = fs.readFileSync(path);
scriptUUids.forEach(uuiddata => {
if (uuiddata.scriptName.includes(sceneName)) {
uuiddata.includes = false;
return;
}
if (uuiddata.includes == true) {
return;
}
if (data.includes(uuiddata.shortUuid)) {
uuiddata.includes = true;
}
});
}
});
scriptUUids = scriptUUids.filter(uuiddata => uuiddata.includes);
await fileForEach(path, (path) => {
const nameList = path.split('.');
const expectNameList = ['js', 'ts'];
if (expectNameList.includes(nameList[nameList.length - 1])) {
const data = fs.readFileSync(path);
scriptUUids.forEach(uuiddata => {
const strList = [
`.getComponent("${uuiddata.scriptName}")`,
`.getComponent('${uuiddata.scriptName}')`,
`.getComponent(\`${uuiddata.scriptName}\`)`
];
strList.forEach(str => {
if (data.includes(str)) {
fileReplace(path, str, `.getComponent("${sceneName}_${uuiddata.scriptName}")`);
}
});
});
}
});
scriptUUids.forEach((uuiddata) => {
const data = fs.readFileSync(uuiddata.fileName);
const metaData = fs.readFileSync(uuiddata.fileName + '.meta');
const new_fileName = `${sceneName}_${uuiddata.scriptName}`;
const newPath = uuiddata.fileName.split('/').map((str, idx, arr) => {
if (idx == arr.length - 1) {
const nameList = str.split('.');
return `${new_fileName}.${nameList[nameList.length - 1]}`;
}
return str;
}).join('/');
fs.writeFileSync(newPath, data);
fs.rmSync(uuiddata.fileName);
fs.writeFileSync(newPath + '.meta', metaData);
fs.rmSync(uuiddata.fileName + '.meta');
});
console.log(scriptUUids.map(uuiddata => uuiddata.scriptName));
}
function replaceIndexHtml() {
......@@ -417,8 +339,6 @@ function replaceIndexHtml() {
module.exports = {
replaceUuids: replaceUuids,
build: async function () {
const startTime = new Date().getTime();
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
define("ace/mode/json_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:"variable",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)'},{token:"string",regex:'"',next:"string"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:"text",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"comment",regex:"\\/\\/.*$"},{token:"comment.start",regex:"\\/\\*",next:"comment"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],string:[{token:"constant.language.escape",regex:/\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/},{token:"string",regex:'"|$',next:"start"},{defaultToken:"string"}],comment:[{token:"comment.end",regex:"\\*\\/",next:"start"},{defaultToken:"comment"}]}};r.inherits(s,i),t.JsonHighlightRules=s}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(e,t,n){var r=e.getLine(n);if(this.singleLineBlockCommentRe.test(r)&&!this.startRegionRe.test(r)&&!this.tripleStarBlockCommentRe.test(r))return"";var i=this._getFoldWidgetBase(e,t,n);return!i&&this.startRegionRe.test(r)?"start":i},this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n);if(this.startRegionRe.test(i))return this.getCommentRegionBlock(e,i,n);var s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!="all"&&(u=null)),u}if(t==="markbegin")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,"all",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)},this.getCommentRegionBlock=function(e,t,n){var r=t.search(/\s*$/),s=e.getLength(),o=n,u=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,a=1;while(++n<s){t=e.getLine(n);var f=u.exec(t);if(!f)continue;f[1]?a--:a++;if(!a)break}var l=n;if(l>o)return new i(o,r,l,t.length)}}.call(o.prototype)}),define("ace/mode/json",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/json_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle","ace/worker/worker_client"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./json_highlight_rules").JsonHighlightRules,o=e("./matching_brace_outdent").MatchingBraceOutdent,u=e("./behaviour/cstyle").CstyleBehaviour,a=e("./folding/cstyle").FoldMode,f=e("../worker/worker_client").WorkerClient,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new u,this.foldingRules=new a};r.inherits(l,i),function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t);if(e=="start"){var i=t.match(/^.*[\{\(\[]\s*$/);i&&(r+=n)}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new f(["ace"],"ace/mode/json_worker","JsonWorker");return t.attachToDocument(e.getDocument()),t.on("annotate",function(t){e.setAnnotations(t.data)}),t.on("terminate",function(){e.clearAnnotations()}),t},this.$id="ace/mode/json"}.call(l.prototype),t.Mode=l}); (function() {
window.require(["ace/mode/json"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();
\ No newline at end of file
define("ace/mode/json_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:"variable",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)'},{token:"string",regex:'"',next:"string"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:"text",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"comment",regex:"\\/\\/.*$"},{token:"comment.start",regex:"\\/\\*",next:"comment"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],string:[{token:"constant.language.escape",regex:/\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/},{token:"string",regex:'"|$',next:"start"},{defaultToken:"string"}],comment:[{token:"comment.end",regex:"\\*\\/",next:"start"},{defaultToken:"comment"}]}};r.inherits(s,i),t.JsonHighlightRules=s}),define("ace/mode/json5_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/json_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./json_highlight_rules").JsonHighlightRules,s=function(){i.call(this);var e=[{token:"variable",regex:/[a-zA-Z$_\u00a1-\uffff][\w$\u00a1-\uffff]*\s*(?=:)/},{token:"variable",regex:/['](?:(?:\\.)|(?:[^'\\]))*?[']\s*(?=:)/},{token:"constant.language.boolean",regex:/(?:null)\b/},{token:"string",regex:/'/,next:[{token:"constant.language.escape",regex:/\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\/bfnrt]|$)/,consumeLineEnd:!0},{token:"string",regex:/'|$/,next:"start"},{defaultToken:"string"}]},{token:"string",regex:/"(?![^"]*":)/,next:[{token:"constant.language.escape",regex:/\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\/bfnrt]|$)/,consumeLineEnd:!0},{token:"string",regex:/"|$/,next:"start"},{defaultToken:"string"}]},{token:"constant.numeric",regex:/[+-]?(?:Infinity|NaN)\b/}];for(var t in this.$rules)this.$rules[t].unshift.apply(this.$rules[t],e);this.normalizeRules()};r.inherits(s,i),t.Json5HighlightRules=s}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(e,t,n){var r=e.getLine(n);if(this.singleLineBlockCommentRe.test(r)&&!this.startRegionRe.test(r)&&!this.tripleStarBlockCommentRe.test(r))return"";var i=this._getFoldWidgetBase(e,t,n);return!i&&this.startRegionRe.test(r)?"start":i},this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n);if(this.startRegionRe.test(i))return this.getCommentRegionBlock(e,i,n);var s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!="all"&&(u=null)),u}if(t==="markbegin")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,"all",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)},this.getCommentRegionBlock=function(e,t,n){var r=t.search(/\s*$/),s=e.getLength(),o=n,u=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,a=1;while(++n<s){t=e.getLine(n);var f=u.exec(t);if(!f)continue;f[1]?a--:a++;if(!a)break}var l=n;if(l>o)return new i(o,r,l,t.length)}}.call(o.prototype)}),define("ace/mode/json5",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/json5_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./json5_highlight_rules").Json5HighlightRules,o=e("./matching_brace_outdent").MatchingBraceOutdent,u=e("./behaviour/cstyle").CstyleBehaviour,a=e("./folding/cstyle").FoldMode,f=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new u,this.foldingRules=new a};r.inherits(f,i),function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id="ace/mode/json5"}.call(f.prototype),t.Mode=f}); (function() {
window.require(["ace/mode/json5"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();
\ No newline at end of file
define("ace/snippets/javascript",["require","exports","module"],function(e,t,n){"use strict";t.snippetText='# Prototype\nsnippet proto\n ${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) {\n ${4:// body...}\n };\n# Function\nsnippet fun\n function ${1?:function_name}(${2:argument}) {\n ${3:// body...}\n }\n# Anonymous Function\nregex /((=)\\s*|(:)\\s*|(\\()|\\b)/f/(\\))?/\nsnippet f\n function${M1?: ${1:functionName}}($2) {\n ${0:$TM_SELECTED_TEXT}\n }${M2?;}${M3?,}${M4?)}\n# Immediate function\ntrigger \\(?f\\(\nendTrigger \\)?\nsnippet f(\n (function(${1}) {\n ${0:${TM_SELECTED_TEXT:/* code */}}\n }(${1}));\n# if\nsnippet if\n if (${1:true}) {\n ${0}\n }\n# if ... else\nsnippet ife\n if (${1:true}) {\n ${2}\n } else {\n ${0}\n }\n# tertiary conditional\nsnippet ter\n ${1:/* condition */} ? ${2:a} : ${3:b}\n# switch\nsnippet switch\n switch (${1:expression}) {\n case \'${3:case}\':\n ${4:// code}\n break;\n ${5}\n default:\n ${2:// code}\n }\n# case\nsnippet case\n case \'${1:case}\':\n ${2:// code}\n break;\n ${3}\n\n# while (...) {...}\nsnippet wh\n while (${1:/* condition */}) {\n ${0:/* code */}\n }\n# try\nsnippet try\n try {\n ${0:/* code */}\n } catch (e) {}\n# do...while\nsnippet do\n do {\n ${2:/* code */}\n } while (${1:/* condition */});\n# Object Method\nsnippet :f\nregex /([,{[])|^\\s*/:f/\n ${1:method_name}: function(${2:attribute}) {\n ${0}\n }${3:,}\n# setTimeout function\nsnippet setTimeout\nregex /\\b/st|timeout|setTimeo?u?t?/\n setTimeout(function() {${3:$TM_SELECTED_TEXT}}, ${1:10});\n# Get Elements\nsnippet gett\n getElementsBy${1:TagName}(\'${2}\')${3}\n# Get Element\nsnippet get\n getElementBy${1:Id}(\'${2}\')${3}\n# console.log (Firebug)\nsnippet cl\n console.log(${1});\n# return\nsnippet ret\n return ${1:result}\n# for (property in object ) { ... }\nsnippet fori\n for (var ${1:prop} in ${2:Things}) {\n ${0:$2[$1]}\n }\n# hasOwnProperty\nsnippet has\n hasOwnProperty(${1})\n# docstring\nsnippet /**\n /**\n * ${1:description}\n *\n */\nsnippet @par\nregex /^\\s*\\*\\s*/@(para?m?)?/\n @param {${1:type}} ${2:name} ${3:description}\nsnippet @ret\n @return {${1:type}} ${2:description}\n# JSON.parse\nsnippet jsonp\n JSON.parse(${1:jstr});\n# JSON.stringify\nsnippet jsons\n JSON.stringify(${1:object});\n# self-defining function\nsnippet sdf\n var ${1:function_name} = function(${2:argument}) {\n ${3:// initial code ...}\n\n $1 = function($2) {\n ${4:// main code}\n };\n }\n# singleton\nsnippet sing\n function ${1:Singleton} (${2:argument}) {\n // the cached instance\n var instance;\n\n // rewrite the constructor\n $1 = function $1($2) {\n return instance;\n };\n \n // carry over the prototype properties\n $1.prototype = this;\n\n // the instance\n instance = new $1();\n\n // reset the constructor pointer\n instance.constructor = $1;\n\n ${3:// code ...}\n\n return instance;\n }\n# class\nsnippet class\nregex /^\\s*/clas{0,2}/\n var ${1:class} = function(${20}) {\n $40$0\n };\n \n (function() {\n ${60:this.prop = ""}\n }).call(${1:class}.prototype);\n \n exports.${1:class} = ${1:class};\n# \nsnippet for-\n for (var ${1:i} = ${2:Things}.length; ${1:i}--; ) {\n ${0:${2:Things}[${1:i}];}\n }\n# for (...) {...}\nsnippet for\n for (var ${1:i} = 0; $1 < ${2:Things}.length; $1++) {\n ${3:$2[$1]}$0\n }\n# for (...) {...} (Improved Native For-Loop)\nsnippet forr\n for (var ${1:i} = ${2:Things}.length - 1; $1 >= 0; $1--) {\n ${3:$2[$1]}$0\n }\n\n\n#modules\nsnippet def\n define(function(require, exports, module) {\n "use strict";\n var ${1/.*\\///} = require("${1}");\n \n $TM_SELECTED_TEXT\n });\nsnippet req\nguard ^\\s*\n var ${1/.*\\///} = require("${1}");\n $0\nsnippet requ\nguard ^\\s*\n var ${1/.*\\/(.)/\\u$1/} = require("${1}").${1/.*\\/(.)/\\u$1/};\n $0\n',t.scope="javascript"}); (function() {
window.require(["ace/snippets/javascript"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();
\ No newline at end of file
; (function() {
window.require(["ace/snippets/json"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();
\ No newline at end of file
; (function() {
window.require(["ace/snippets/json5"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();
\ No newline at end of file
define("ace/theme/chrome",["require","exports","module","ace/lib/dom"],function(e,t,n){t.isDark=!1,t.cssClass="ace-chrome",t.cssText='.ace-chrome .ace_gutter {background: #ebebeb;color: #333;overflow : hidden;}.ace-chrome .ace_print-margin {width: 1px;background: #e8e8e8;}.ace-chrome {background-color: #FFFFFF;color: black;}.ace-chrome .ace_cursor {color: black;}.ace-chrome .ace_invisible {color: rgb(191, 191, 191);}.ace-chrome .ace_constant.ace_buildin {color: rgb(88, 72, 246);}.ace-chrome .ace_constant.ace_language {color: rgb(88, 92, 246);}.ace-chrome .ace_constant.ace_library {color: rgb(6, 150, 14);}.ace-chrome .ace_invalid {background-color: rgb(153, 0, 0);color: white;}.ace-chrome .ace_fold {}.ace-chrome .ace_support.ace_function {color: rgb(60, 76, 114);}.ace-chrome .ace_support.ace_constant {color: rgb(6, 150, 14);}.ace-chrome .ace_support.ace_type,.ace-chrome .ace_support.ace_class.ace-chrome .ace_support.ace_other {color: rgb(109, 121, 222);}.ace-chrome .ace_variable.ace_parameter {font-style:italic;color:#FD971F;}.ace-chrome .ace_keyword.ace_operator {color: rgb(104, 118, 135);}.ace-chrome .ace_comment {color: #236e24;}.ace-chrome .ace_comment.ace_doc {color: #236e24;}.ace-chrome .ace_comment.ace_doc.ace_tag {color: #236e24;}.ace-chrome .ace_constant.ace_numeric {color: rgb(0, 0, 205);}.ace-chrome .ace_variable {color: rgb(49, 132, 149);}.ace-chrome .ace_xml-pe {color: rgb(104, 104, 91);}.ace-chrome .ace_entity.ace_name.ace_function {color: #0000A2;}.ace-chrome .ace_heading {color: rgb(12, 7, 255);}.ace-chrome .ace_list {color:rgb(185, 6, 144);}.ace-chrome .ace_marker-layer .ace_selection {background: rgb(181, 213, 255);}.ace-chrome .ace_marker-layer .ace_step {background: rgb(252, 255, 0);}.ace-chrome .ace_marker-layer .ace_stack {background: rgb(164, 229, 101);}.ace-chrome .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgb(192, 192, 192);}.ace-chrome .ace_marker-layer .ace_active-line {background: rgba(0, 0, 0, 0.07);}.ace-chrome .ace_gutter-active-line {background-color : #dcdcdc;}.ace-chrome .ace_marker-layer .ace_selected-word {background: rgb(250, 250, 255);border: 1px solid rgb(200, 200, 250);}.ace-chrome .ace_storage,.ace-chrome .ace_keyword,.ace-chrome .ace_meta.ace_tag {color: rgb(147, 15, 128);}.ace-chrome .ace_string.ace_regex {color: rgb(255, 0, 0)}.ace-chrome .ace_string {color: #1A1AA6;}.ace-chrome .ace_entity.ace_other.ace_attribute-name {color: #994409;}.ace-chrome .ace_indent-guide {background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;}';var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass,!1)}); (function() {
window.require(["ace/theme/chrome"], function(m) {
if (typeof module == "object" && typeof exports == "object" && module) {
module.exports = m;
}
});
})();
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>NgOne</title>
<!-- <base href="/"> -->
<!-- <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="ace/ace.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="//staging-teach.cdn.ireadabc.com/h5template/h5-static-lib/js/air.js"></script>
<style>
#saveDataTextarea {
margin: 0;
position: absolute;
top: 0;
left: 0;
right: 180px;
height: 100%;
}
.upload-container {
width: 100px;
height: 40px;
position: absolute;
right: 40px;
border-radius: 2px;
border: 1px solid #dcdfe6;
line-height: 100px;
margin: 10px;
text-align: center;
display:flex;
align-items:center;
justify-content:center;
}
.hide-fileinput {
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
opacity: 0;
cursor: pointer;
}
</style>
</head>
<body onload="loadData();" style="background-color: white;">
<pre id="saveDataTextarea"></pre>
<div class="upload-container">
<div class="upload-file">上传文件</div>
<input class="hide-fileinput" type="file" name="file" onchange="uploadFile()">
</div>
</body>
<script>
var editor = ace.edit("saveDataTextarea");
editor.setTheme("ace/theme/chrome");
editor.session.setMode("ace/mode/json");
editor.session.on('change', function(delta) {
try {
const data = JSON.parse(editor.getValue());
window.courseware.setData(data, null, "cocos_001");
} catch (error) {}
});
let saveDataStr = '';
function loadData() {
window.courseware.getData((data) => {
try {
editor.setValue(JSON.stringify(data, null, 2));
editor.gotoLine(editor.session.getLength());
} catch (error) {}
}, "cocos_001");
}
function uploadFile(){
const dom = document.querySelector(".hide-fileinput");
const file = dom.files[0];
dom.setAttribute("disabled", true);
document.querySelector(".upload-file").innerHTML = "上传中...";
commonUploadFile(file, (data) => {
try {
const d = JSON.parse(data);
const protocolStr = document.location.protocol;
const url = d.url
.replace(/http:/g, protocolStr)
.replace(/https:/g, protocolStr);
editor.insert(url);
} catch (error) {}
dom.removeAttribute("disabled");
document.querySelector(".upload-file").innerHTML = "上传文件";
});
}
function commonUploadFile(file, callback) {
const uploadUrl = window.courseware.uploadUrl(); //上传文件的路径
const uploadData = window.courseware.uploadData(); //上传文件必须要的参数
const formData = new FormData();
formData.append("file", file);
for (const key in uploadData) {
formData.append(key, uploadData[key]);
}
var xhr = new XMLHttpRequest();
xhr.open("post",uploadUrl);
//回调
xhr.onreadystatechange = function () {
if (xhr.readyState==4 && xhr.status==200){
callback && callback(xhr.responseText);
}
}
//获取上传的进度
xhr.upload.onprogress = function (event) {
if(event.lengthComputable){
var percent = event.loaded/event.total *100;
document.querySelector(".upload-file").innerHTML = Math.floor(percent)+"%";
}
}
//将formdata上传
xhr.send(formData);
}
</script>
</html>
\ No newline at end of file
<div class="p-image-children-editor">
<h5 style="margin-left: 2.5%;"> preview: </h5>
<div class="preview-box" #wrap>
<canvas id="canvas" #canvas></canvas>
</div>
<div nz-row nzType="flex" nzAlign="middle">
<div nz-col nzSpan="5" nzOffset="1">
<h5> add background: </h5>
<div class="bg-box">
<app-upload-image-with-preview
[picUrl]="bgItem?.url"
(imageUploaded)="onBackgroundUploadSuccess($event)">
</app-upload-image-with-preview>
</div>
</div>
<div nz-col nzSpan="5" nzOffset="1" class="img-box"
*ngFor="let it of hotZoneArr; let i = index">
<div
style="margin: auto; padding: 5px; margin-top: 30px; width:90%; border: 2px dashed #ddd; border-radius: 10px">
<span style="margin-left: 40%;"> item-{{i + 1}}
</span>
<button style="float: right;" nz-button nzType="danger" nzSize="small" (click)="deleteBtnClick(i)">
X
</button>
<nz-divider style="margin-top: 10px;"></nz-divider>
<div style="margin-top: -20px; margin-bottom: 5px">
<nz-radio-group [ngModel]="it.itemType" (ngModelChange)="radioChange($event, it)">
<label *ngIf="isHasRect" nz-radio nzValue="rect">矩形</label>
<label *ngIf="isHasPic" nz-radio nzValue="pic">图片</label>
<label *ngIf="isHasText" nz-radio nzValue="text">文本</label>
</nz-radio-group>
</div>
<div *ngIf="it.itemType == 'pic'">
<app-upload-image-with-preview
[picUrl]="it?.pic_url"
(imageUploaded)="onItemImgUploadSuccess($event, it)">
</app-upload-image-with-preview>
</div>
<div *ngIf="it.itemType == 'text'">
<input type="text" nz-input [(ngModel)]="it.text" (blur)="saveText(it)">
</div>
<div style="width: 100%; margin-top: 5px;">
<app-audio-recorder
[audioUrl]="it.audio_url"
(audioUploaded)="onItemAudioUploadSuccess($event, it)"
></app-audio-recorder>
</div>
</div>
</div>
<div nz-col nzSpan="5" nzOffset="1">
<div class="bg-box">
<button nz-button nzType="dashed" (click)="addBtnClick()"
class="add-btn">
<i nz-icon nzType="plus-circle" nzTheme="outline"></i>
<!--Add Image-->
Add hot zone
</button>
</div>
</div>
</div>
<nz-divider></nz-divider>
<div class="save-box">
<button class="save-btn" nz-button nzType="primary" [nzSize]="'large'" nzShape="round"
(click)="saveClick()" >
<i nz-icon nzType="save"></i>
Save
</button>
</div>
</div>
<label style="opacity: 0; position: absolute; top: 0px; font-family: 'BRLNSR_1'">1</label>
<div class="model-content">
<div style="padding: 10px; width: 700px;">
<div *ngFor="let it of item.groupArr; let i = index" style="border: 1px solid #ccc; border-radius: 10px; margin-top: 30px; display: flex; align-items: center; flex-direction: column;">
<div style="display: flex; align-items: center; justify-content: center; padding: 10px;">
<div style="font-weight: 700; font-size: 22px; margin-right: 10px;">组-{{i+1}}</div>
<button nz-button nzType="danger" (click)="onBtnDeleteGroup(i)">
<!-- <i nz-icon nzType="close" nzTheme="outline"></i> -->
删除组
</button>
</div>
<div style="display: flex; align-items: center; justify-content: center; width: 700px;">
<span style="width: 80px; text-align: right;">题干:</span>
<app-audio-recorder
style="margin: 10px"
[audioUrl]="it.audio_url"
(audioUploaded)="onAudioUploadSuccess($event, 'audio_url', it)"
></app-audio-recorder>
<!-- <input type="text" nz-input [(ngModel)]="it.ques" style="width: 80%" (blur)="save()"> -->
</div>
<nz-divider></nz-divider>
<div style="width: 100%; margin-top: 10px" >
<div *ngFor="let op of it.optionArr; let j = index">
<div style="display: flex; align-items: center; justify-content: center; width: 700px;">
<span style="width: 100px; text-align: right;">答案-{{j+1}}:</span>
<nz-radio-group [ngModel]="op.type" (ngModelChange)="radioChange($event, op, 'type')" style="display: flex; align-items: center; justify-content: center; flex-wrap: wrap;">
<label nz-radio nzValue="text">文本</label>
<label nz-radio nzValue="pic">图片</label>
</nz-radio-group>
<button nz-button nzType="danger" (click)="onBtnDeleteOption(j, it)">
删除选项
</button>
</div>
<div style="width: 400px; margin: auto; margin-bottom: 20px; margin-top: 10px; display: flex; flex-direction: column; align-items: center;" >
<input *ngIf="op.type == 'text'" type="text" nz-input [(ngModel)]="op.text" (blur)="save()">
<app-upload-image-with-preview
style="width: 80%"
*ngIf="op.type == 'pic'"
[picUrl]="op.pic_url"
(imageUploaded)="onImageUploadSuccess($event, 'pic_url', op)">
</app-upload-image-with-preview>
<app-audio-recorder
style="margin: 10px"
[audioUrl]="op.audio_url"
(audioUploaded)="onAudioUploadSuccess($event, 'audio_url', op)"
></app-audio-recorder>
<nz-radio-group [ngModel]="op.isRight" (ngModelChange)="radioChange($event, op, 'isRight')" style="display: flex; align-items: center; justify-content: center; flex-wrap: wrap;">
<label nz-radio nzValue="1">正确</label>
<label nz-radio nzValue="0">错误</label>
</nz-radio-group>
</div>
<nz-divider></nz-divider>
</div>
<button nz-button nzType="dashed" (click)="addOptionBtnClick(it)" style="margin: 30px;">
<i nz-icon nzType="plus-circle" nzTheme="outline"></i>
添加选项
</button>
</div>
</div>
<button nz-button nzType="dashed" (click)="addGroupBtnClick()" style="width: 150px; height: 55px; margin: 50px;">
<i nz-icon nzType="plus-circle" nzTheme="outline"></i>
Add Group
</button>
<!-- <div style="width: 300px;" align='center'>
<span>图1: </span>
<app-upload-image-with-preview
[picUrl]="item.pic_url"
(imageUploaded)="onImageUploadSuccess($event, 'pic_url')">
</app-upload-image-with-preview>
</div>
<div style="width: 300px; margin-top: 5px;" align='center'>
<span>图2: </span>
<app-upload-image-with-preview
[picUrl]="item.pic_url_2"
(imageUploaded)="onImageUploadSuccess($event, 'pic_url_2')">
</app-upload-image-with-preview>
</div>
<div style="width: 300px; margin-top: 15px;">
<span>文本: </span>
<input type="text" nz-input [(ngModel)]="item.text" (blur)="save()">
</div>
<div style="margin-top: 5px">
<span>音频: </span>
<app-audio-recorder
[audioUrl]="item.audio_url"
(audioUploaded)="onAudioUploadSuccess($event, 'audio_url')"
></app-audio-recorder>
</div> -->
</div>
</div>
This diff is collapsed.
......@@ -130,6 +130,6 @@
},
"defaultProject": "ng-template-generator",
"cli": {
"analytics": false
"analytics": "5f501d82-8f25-4817-a608-9ac70d1f1f70"
}
}
\ No newline at end of file
......@@ -6,7 +6,7 @@ import { Component , OnInit} from '@angular/core';
styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
type = 'play';
type = 'form';
constructor() {
const tp = this.getQueryString('type');
......
<div class="d-flex">
<div class="d-flex" (drop)="handle_drop($event)" (dragover)="handle_dragover($event)">
<div class="p-btn-record d-flex">
<div class="btn-clear" style="cursor: pointer" (click)="onBtnClearAudio()" *ngIf="withRmBtn && (audioUrl || audioBlob)">
<fa-icon icon="times"></fa-icon>
......@@ -35,8 +35,7 @@
<ng-template #truthyTemplate >
<div class="btn-delete" (click)="onBtnDeleteAudio()">
<!-- <fa-icon icon="close"></fa-icon> -->
<i nz-icon nzType="close" nzTheme="outline"></i>
<fa-icon icon="close"></fa-icon>
</div>
</ng-template>
......@@ -46,17 +45,19 @@
<fa-icon icon="cog"></fa-icon>
</div>
</ng-template>
</div>
<div class="p-progress ml-2" (click)="onBtnPlay()" *ngIf="audioUrl || audioBlob">
<nz-progress [nzPercent]="percent" [nzWidth]="30" [nzFormat]="progressText"
nzType="circle"></nz-progress>
<div class="p-btn-play" [style.left]="isPlaying?'8px':''">
<div class="p-progress ml-2" (click)="onBtnPlay()" *ngIf="audioUrl || audioBlob"
style="background-color: #70B603; width: 35px; height: 35px; border-radius: 35px; margin-left: 10px;margin-top:-1px">
<nz-progress [nzPercent]="percent" [nzWidth]="35" [nzFormat]="progressText"
nzType="circle">
</nz-progress>
<div class="p-btn-play"
style="color: white;margin-left: 2px;margin-top: 1px;"
[style.left]="isPlaying?'8px':''">
<fa-icon [icon]="playIcon"></fa-icon>
</div>
</div>
<div class="audio-name">{{_audioName}}</div>
</div>
......@@ -90,17 +90,26 @@
}
.p-progress {
margin-top: 2px;
margin-top: 3.5px;
position: relative;
background-color: #27b43f;
border-radius: 15px;
line-height: 26px;
.p-btn-play {
position: absolute;
left: 10px;
left: 11px;
top: 3px;
color: #555;
color: #ffffff;
}
}
.audio-name{
margin-top: 3.5px;
position: relative;
margin-left: 7px;;
line-height: 26px;
}
:host ::ng-deep nz-upload {
line-height: 33px;
}
......
......@@ -26,17 +26,26 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
uploadData;
@Input()
needRemove = true;
needRemove = false;
@Input()
audioItem: any = null;
@Input()
_audioName: any = null;
@Input()
set audioUrl(url) {
this._audioUrl = url;
if (url) {
this.httpHeadCall(this._audioUrl, flag => {
if (flag) {
this.audio.src = this._audioUrl;
} else {
this.audio.src = this._audioUrl.replace("_l.", ".");
}
this.audio.load();
});
}
this.init();
}
......@@ -48,6 +57,7 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
@Output() audioUploaded = new EventEmitter();
@Output() audioUploadFailure = new EventEmitter();
@Output() audioRemoved = new EventEmitter();
@Output() audioName = new EventEmitter();
percent = 0;
progress = 0;
recorder: any;
......@@ -62,24 +72,42 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
this.uploadUrl = url;
this.uploadData = data;
};
this.setUploadUrl();
}
setUploadUrl() {
if (!this.uploadUrl) {
this.uploadUrl = (<any> window).courseware.uploadUrl();
this.uploadData = (<any> window).courseware.uploadData();
setTimeout(() => {
this.setUploadUrl();
}, 500);
httpHeadCall(requsetUrl: string, callback) {
let xhr = new XMLHttpRequest();
console.log("Status: Send Post Request to " + requsetUrl);
try {
xhr.onreadystatechange = () => {
try {
console.log('xhr.readyState: ', xhr.readyState);
if (xhr.readyState == 4) {
if ((xhr.status >= 200 && xhr.status < 400)) {
callback(true);
} else {
callback(false);
}
}
} catch (e) {
console.log(e)
}
};
xhr.open("HEAD", requsetUrl, true);
xhr.send();
xhr.timeout = 15000;
xhr.onerror = (e) => {
console.log("汪汪汪 posterror", e);
callback(false);
};
xhr.ontimeout = (e) => {
console.log("汪汪汪 ontimeout", e);
callback(false);
};
} catch (e) {
console.log("Send Get Request error: ", e)
}
}
init() {
this.playIcon = 'play';
......@@ -174,7 +202,6 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
onBtnDeleteAudio() {
this.audioUrl = null;
this.audioUploaded.emit({});
this.audioRemoved.emit();
}
......@@ -186,8 +213,12 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
break;
case 'success':
this.isUploading = false;
let url = info.file.response.url;
url = url.substring(0, url.lastIndexOf(".")) + "_l.mp3";
info.file.response.url = url;
this.uploadSuccess(info.file.response);
this.audioUploaded.emit(info.file.response);
this.audioName.emit(info.file.name);
break;
case 'progress':
this.progress = parseInt(info.event.percent, 10);
......@@ -245,6 +276,39 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
this.progress = Math.floor(p * 100);
}
linkInputed (url, name) {
url = url.substring(0, url.lastIndexOf(".")) + "_l.mp3";
this.audioUrl = url;
this.audioUploaded.emit({url});
this.audioName.emit(name);
}
handle_dragover(e) {
e.preventDefault();
}
handle_drop(e) {
const dt = e.dataTransfer.getData("text/plain");
console.log("handle_drop===", dt);
if (!dt) {
return;
}
try {
const {url, name} = JSON.parse(dt);
if (url.indexOf("teach")<0 || url.indexOf("cdn")<0) {
return;
}
const white = [".mp3"];
if (!white.includes(url.substr(url.lastIndexOf(".")))) {
return;
}
this.linkInputed(url, name);
} catch (error) {
console.warn("handle_drop拖拽在线音频传递参数不合法,应该是{url:'', name:''}");
}
}
}
enum Type {
......
......@@ -81,6 +81,10 @@
}
}
.anima-upload-btn {
padding: 10px;
}
h5 {
margin-top: 1rem;
}
......@@ -89,8 +93,8 @@ h5 {
@font-face
{
font-family: 'BRLNSR_1';
src: url("/assets/font/BRLNSR_1.TTF") ;
font-family: 'ahronbd-1';
src: url("/assets/font/ahronbd-1.ttf") ;
}
......@@ -105,106 +109,3 @@ h5 {
//@import '../../../style/common_mixin';
//
//.p-image-uploader {
// position: relative;
// display: block;
// width: 100%;
// height: 0;
// padding-bottom: 56.25%;
// .p-box {
// position: absolute;
// left: 0;
// top: 0;
// right: 0;
// bottom: 0;
// border: 2px dashed #ddd;
// border-radius: 0.5rem;
// background-color: #fafafa;
// text-align: center;
// color: #aaa;
// .p-upload-icon {
// text-align: center;
// margin: auto;
// .anticon-upload {
// color: #888;
// font-size: 5rem;
// }
// .p-progress-bar {
// position: relative;
// width: 20rem;
// height: 1.5rem;
// border: 1px solid #ccc;
// border-radius: 1rem;
// .p-progress-bg {
// background-color: #1890ff;
// border-radius: 1rem;
// height: 100%;
// }
// .p-progress-value {
// position: absolute;
// top: 0;
// left: 0;
// width: 100%;
// height: 100%;
// text-shadow: 0 0 4px #000;
// color: white;
// text-align: center;
// font-size: 0.9rem;
// line-height: 1.5rem;
// }
// }
// }
// .p-preview {
// width: 100%;
// height: 100%;
// //background-image: url("https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png");
// @include k-img-bg();
// }
// }
//}
//
//.p-btn-delete {
// position: absolute;
// right: -0.5rem;
// top: -0.5rem;
// width: 2rem;
// height: 2rem;
// border: 0.2rem solid white;
// border-radius: 50%;
// font-size: 1.2rem;
// background-color: #fb781a;
// color: white;
// text-align: center;
//}
//
//.p-upload-progress-bg {
// position: absolute;
// width: 100%;
// height: 100%;
// display: flex;
// align-items: center;
// justify-content: center;
// & .i-text {
// position: absolute;
// text-align: center;
// color: white;
// text-shadow: 0 0 2px rgba(0, 0, 0, .85);
// }
// & .i-bg {
// position: absolute;
// left: 0;
// top: 0;
// height: 100%;
// background-color: #27b43f;
// border-radius: 0.5rem;
// }
//}
//
//
//:host ::ng-deep .ant-upload {
// display: block;
//}
<div class="position-relative">
<div class="position-relative" (drop)="handle_drop($event)" (dragover)="handle_dragover($event)">
<button nz-button (click)="setAnimaBtnClick()" style=" border-radius: 0.5rem; border: 1px solid #ddd;">
<button nz-button (click)="setAnimaBtnClick()" style=" border-radius: 0.5rem; border: 1px solid #ddd;" (dragover)="handle_dragover($event)">
<i nz-icon nzType="tool" nzTheme="outline"></i>
{{btnName}}
</button>
......
......@@ -178,4 +178,43 @@ export class UploadDragonBoneComponent implements OnDestroy, OnChanges {
ngOnDestroy() {
}
linkInputed (ske, tex, png) {
this.skeJsonData["url"] = ske.url;
this.skeJsonData["name"] = ske.name;
this.texJsonData["url"] = tex.url;
this.texJsonData["name"] = tex.name;
this.texPngData["url"] = png.url;
this.texPngData["name"] = png.name;
this.animaPanelOk();
}
handle_dragover(e) {
e.preventDefault();
}
handle_drop(e) {
e.preventDefault();
const dt = e.dataTransfer.getData("text/plain");
console.log("handle_drop===", dt);
if (!dt) {
return;
}
try {
const {ske, tex, png} = JSON.parse(dt);
if (!ske || !tex || !png ||
ske.url.indexOf("teach")<0 || ske.url.indexOf("cdn")<0 || ske.url.indexOf(".json")<0 ||
tex.url.indexOf("teach")<0 || tex.url.indexOf("cdn")<0 || tex.url.indexOf(".json")<0 ||
png.url.indexOf("teach")<0 || png.url.indexOf("cdn")<0 || png.url.indexOf(".png")<0 ||
!ske.name || !tex.name || !png.name
) {
console.warn("handle_drop拖拽在线骨骼动画传递参数不合法,应该是{ske:{url:'', name:''},tex:{url:'', name:''},png:{url:'', name:''}}");
return;
}
this.linkInputed(ske, tex, png);
} catch (error) {
console.warn("handle_drop拖拽在线骨骼动画传递参数不合法,应该是{ske:{url:'', name:''},tex:{url:'', name:''},png:{url:'', name:''}}");
}
}
}
<div class="position-relative">
<div class="position-relative" (drop)="handle_drop($event)" (dragover)="handle_dragover($event)">
<nz-upload class="p-image-uploader" [nzDisabled]="disableUpload"
[nzShowUploadList]="false"
nzAccept = "image/*"
[nzAction]="uploadUrl"
[nzData]="uploadData"
(nzChange)="handleChange($event)">
(nzChange)="handleChange($event)"
>
<!--[nzBeforeUpload]="customUpload">-->
<div class="p-box d-flex align-items-center">
<div class="p-upload-icon" *ngIf="!picUrl && !uploading">
......
......@@ -155,4 +155,39 @@ export class UploadImageWithPreviewComponent implements OnDestroy, OnChanges {
ngOnDestroy() {
}
linkInputed (url) {
const file = {
response: {url}
};
const img = new Image();
img.addEventListener('load', () => {
const height = img.naturalHeight;
const width = img.naturalWidth;
file['height'] = height;
file['width'] = width;
img.remove();
this.imageUploaded.emit(file.response);
});
img.src = url;
this.picUrl = url;
}
handle_dragover(e) {
e.preventDefault();
}
handle_drop(e) {
const dt = e.dataTransfer.getData("text/plain");
console.log("handle_drop===", dt);
if (!dt || dt.indexOf("teach")<0 || dt.indexOf("cdn")<0) {
return;
}
const white = [".jpg", ".jpeg", ".png", ".bmp", ".JPG", ".JPEG", ".PNG", ".BMP"];
if (!white.includes(dt.substr(dt.lastIndexOf(".")))) {
return;
}
this.linkInputed(dt);
}
}
<div class="p-video-box">
<div class="up-video" style="display: flex;">
<div class="p-video-box" (drop)="handle_drop($event)" (dragover)="handle_dragover($event)">
<div class="up-video" style="display: flex;">
<!--<nz-upload class="" [nzDisabled]="!showUploadBtn"-->
<!--[nzShowUploadList]="false"-->
<!--[nzBeforeUpload]="beforeUpload"-->
<!--nzAccept = ".mp4"-->
<!--style="margin-right: 1rem">-->
<nz-upload class="p-image-uploader" [nzDisabled]="uploading"
[nzShowUploadList]="false"
nzAccept = ".mp4"
[nzAction]="uploadUrl"
[nzData]="uploadData"
(nzChange)="handleChange($event)"
style="margin-right: 1rem">
<nz-upload class="p-image-uploader" [nzDisabled]="uploading" [nzShowUploadList]="false" nzAccept=".mp4"
[nzAction]="uploadUrl" [nzData]="uploadData" (nzChange)="handleChange($event)" style="margin-right: 1rem">
<button type="button" nz-button nzType="default" *ngIf="showUploadBtn" [disabled]="uploading"
[nzLoading]="uploading" >
[nzLoading]="uploading">
<i nz-icon nzType="plus" nzTheme="outline"></i>
<span>{{ uploading ? 'Uploading' : 'Select Video' }}</span>
<!--<span>Select Video</span>-->
......@@ -54,8 +49,8 @@
-->
</div>
<div class="p-box d-flex align-items-center p-video-uploader">
</div>
<div class="p-box d-flex align-items-center p-video-uploader">
<div class="p-upload-icon" *ngIf="!showUploadBtn && !videoUrl && !uploading">
<i nz-icon nzType="upload" nzTheme="outline"></i>
<div class="m-3"></div>
......@@ -65,8 +60,7 @@
<div class="p-progress-value">{{progress}}%</div>
</div>
</div>
<div class="p-upload-progress-bg dddd " *ngIf="uploading"
[ngClass]="{'smart-bar': showUploadBtn}" >
<div class="p-upload-progress-bg dddd " *ngIf="uploading" [ngClass]="{'smart-bar': showUploadBtn}">
<div class="i-bg" [style.width]="progress+'%'"></div>
<div class="i-text">
<fa-icon icon="cloud-upload-alt"></fa-icon>
......@@ -80,15 +74,12 @@
<i nz-icon nzType="loading" nzTheme="outline"></i>Checking...
</div>
</div>
<div class="p-preview" *ngIf="!uploading && videoUrl " >
<div class="p-preview" *ngIf="!uploading && videoUrl ">
<!--<video crossorigin="anonymous" [src]="videoUrl" controls #videoNode></video>-->
<video [src]="safeVideoUrl(videoUrl)" controls #videoNode></video>
</div>
</div>
<div [style.display]="!checkVideoExists?'none':''">
</div>
<div [style.display]="!checkVideoExists?'none':''">
<span><i nz-icon nzType="loading" nzTheme="outline"></i> checking file to upload</span>
</div>
</div>
\ No newline at end of file
</div>
......@@ -80,43 +80,62 @@ export class UploadVideoComponent implements OnChanges, OnDestroy {
URL.revokeObjectURL(this.videoUrl);
}
safeVideoUrl(url) {
console.log(url);
return this.sanitization.bypassSecurityTrustResourceUrl(url); // `${url}`;
httpHeadCall(requsetUrl: string, callback) {
let xhr = new XMLHttpRequest();
console.log("Status: Send Post Request to " + requsetUrl);
try {
xhr.onreadystatechange = () => {
try {
console.log('xhr.readyState: ', xhr.readyState);
if (xhr.readyState == 4) {
if ((xhr.status >= 200 && xhr.status < 400)) {
callback(true);
} else {
callback(false);
}
}
videoLoadedMetaData() {
} catch (e) {
console.log(e)
}
};
xhr.open("HEAD", requsetUrl, true);
xhr.send();
xhr.timeout = 15000;
xhr.onerror = (e) => {
callback(false);
};
xhr.ontimeout = (e) => {
callback(false);
};
} catch (e) {
console.log("Send Get Request error: ", e)
}
}
safeVideoUrl(url) {
const _url = url.replace("_l.", ".");
return this.sanitization.bypassSecurityTrustResourceUrl(_url); // `${url}`;
}
videoLoadedMetaData() {
handleChange(info: UploadChangeParam/* { type: string, file: UploadFile, event: any }*/): void {
}
console.log('info:' , info);
handleChange(info: UploadChangeParam): void {
switch (info.type) {
case 'start':
// this.beforeUpload(info.file);
if (!this.checkSelectFile(info.file)) {
return;
}
this.uploading = true;
this.progress = 0;
break;
case 'success':
let url = info.file.response.url;
url = url.substring(0, url.lastIndexOf(".")) + "_l.mp4";
info.file.response.url = url;
this.uploadSuccess(info.file);
// this.beforeUpload(info.file);
// this.uploadSuccess(info.file);
break;
case 'progress':
this.progress = info.event.percent;
......@@ -125,7 +144,6 @@ export class UploadVideoComponent implements OnChanges, OnDestroy {
}
}
checkSelectFile(file) {
if (!file.lastModified) {
return false;
......@@ -207,5 +225,55 @@ export class UploadVideoComponent implements OnChanges, OnDestroy {
// console.log(Math.floor(p * 100));
this.progress = Math.floor(p * 100);
}
linkInputed (url, name) {
const file = {
response: {url}
};
const vid = document.createElement('video');
vid.addEventListener('loadedmetadata', () => {
const height = vid.videoHeight;
const width = vid.videoWidth;
let duration = vid.duration;
if (duration) {
duration = duration * 1000;
}
file["height"] = height;
file["width"] = width;
file["duration"] = duration;
vid.preload = 'none';
vid.src = '';
vid.remove();
this.videoUploaded.emit(file.response);
});
vid.src = file.response.url;
this.videoUrl = url;
}
handle_dragover(e) {
e.preventDefault();
}
handle_drop(e) {
const dt = e.dataTransfer.getData("text/plain");
console.log("handle_drop===", dt);
if (!dt) {
return;
}
try {
const {url, name} = JSON.parse(dt);
if (url.indexOf("teach")<0 || url.indexOf("cdn")<0) {
return;
}
const white = [".mp4"];
if (!white.includes(url.substr(url.lastIndexOf(".")))) {
return;
}
this.linkInputed(url, name);
} catch (error) {
console.warn("handle_drop拖拽在线视频传递参数不合法,应该是{url:'', name:''}");
}
}
}
import { Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, ApplicationRef, ChangeDetectorRef } from '@angular/core';
import { JsonPipe } from '@angular/common';
@Component({
selector: 'app-form',
templateUrl: './form.component.html',
styleUrls: ['./form.component.css']
})
export class FormComponent implements OnInit, OnChanges, OnDestroy {
import { ApplicationRef, ChangeDetectorRef, ElementRef, ViewChild } from "@angular/core";
export class ComponentBase {
// 储存数据用
saveKey = "dfzx_dds";
saveKey = "";
// 储存对象
item;
constructor(private appRef: ApplicationRef, private changeDetectorRef: ChangeDetectorRef) {
}
createShell() {
this.item.wordList.push({
word: '',
audio: '',
backWord: '',
backWordAudio: '',
});
this.save();
}
removeShell(idx) {
this.item.wordList.splice(idx, 1);
this.save();
}
item: any = {};
ngOnChanges() { }
ngOnDestroy() { }
constructor(private appRef: ApplicationRef, private changeDetectorRef: ChangeDetectorRef) { }
ngOnInit() {
this.item = {};
// 获取存储的数据
(<any>window).courseware.getData((data) => {
if (data) {
this.item = data;
this.itemStr = JSON.stringify(this.item, null, 4).trim();
}
this.init();
this.changeDetectorRef.markForCheck();
this.changeDetectorRef.detectChanges();
this.refresh();
}, this.saveKey);
}
ngOnChanges() {
}
ngOnDestroy() {
}
init() {
console.log('this.item: ', this.item);
if (!this.item.groupArr) {
this.item.groupArr = [];
}
}
addGroupBtnClick() {
this.item.groupArr.push({
ques: '',
optionArr: [],
})
this.save();
}
onBtnDeleteGroup(i) {
this.item.groupArr.splice(i, 1);
this.save();
}
addOptionBtnClick(group) {
group.optionArr.push({
type: 'text',
isRight: '0',
})
@ViewChild("itemTextarea", { static: true }) itemTextarea: ElementRef;
copyData() {
this.itemTextarea.nativeElement.select();
document.execCommand("copy");
}
/**
* 储存图片数据
* @param e
*/
onImageUploadSuccess(e, key, it) {
it[key] = e.url;
onAssetUploadSuccess(e: any, ...key: Array<string>) {
let item = this.item;
for (let i = 0; i < key.length; i++) {
if (i + 1 == key.length) {
item[key[i]] = e.url;
this.save();
return;
}
item = item[key[i]];
}
/**
* 储存音频数据
* @param e
*/
onAudioUploadSuccess(e, key, it) {
it[key] = e.url;
this.save();
}
/**
* 储存数据
*/
save() {
(<any>window).courseware.setData(this.item, null, this.saveKey);
this.itemStr = JSON.stringify(this.item, null, 4).trim();
this.refresh();
console.log('this.item = ' + JSON.stringify(this.item));
}
radioChange(e, option, key) {
option[key] = e;
this.save();
itemStr = "";
load() {
this.itemStr = this.itemTextarea.nativeElement.value;
if (this.isJSON(this.itemStr)) {
this.item = JSON.parse(this.itemStr);
this.init();
this.changeDetectorRef.markForCheck();
this.changeDetectorRef.detectChanges();
this.refresh();
}
onBtnDeleteOption(i, item) {
item.optionArr.splice(i, 1);
this.save();
}
isJSON(str) {
if (typeof str == 'string') {
try {
var obj = JSON.parse(str);
if (typeof obj == 'object' && obj) {
return true;
}
return false;
} catch (e) {
return false;
}
}
return false;
}
/**
......@@ -138,5 +85,5 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.appRef.tick();
}, 1);
}
init() { }
}
......@@ -33,3 +33,30 @@
padding: 10px;
margin: 10px;
}
.button-right {
border-style: dotted;
border-color: rgb(42, 142, 72);
width: 100px;
height: 50px;
color: rgb(42, 142, 72);
background-color: white;
}
.button-wrong {
border-style: dotted;
border-color: rgb(180, 0, 0);
width: 100px;
height: 50px;
color: rgb(180, 0, 0);
background-color: white;
}
.button-disable {
border-style: dotted;
border-color: black;
width: 100px;
height: 50px;
color: black;
background-color: white;
}
\ No newline at end of file
<div class="model-content">
<div style="padding: 10px;">
<div class="border" style="width: 1000px;">
<span style="font-size: 20px;">标题: </span>
<input type="text" nz-input [(ngModel)]="item.title" (blur)="save()">
<span style="font-size: 20px;">题目说明: </span>
<input type="text" nz-input [(ngModel)]="item.questionText" (blur)="save()">
<span style="font-size: 20px;">题目说明音频: </span>
<app-audio-recorder
[audioUrl]="item.questionTextAudio"
(audioUploaded)="onAssetUploadSuccess($event, 'questionTextAudio')"
[_audioName]="item.audioFileName"
(audioName)="saveAudioFileName($event)"
></app-audio-recorder>
</div>
<div class="border" style="width: 1000px;">
<div *ngFor="let question of item.questions; let i = index">
<div class="border" style="width: 950px;">
<span style="font-size: 20px;">选项类型: </span>
<div *ngIf="question.type=='img'">
<button class="button-right">图片</button>
&nbsp;
<button class="button-disable" (click)="question.type='txt'; save();">文字</button>
</div>
<div *ngIf="question.type=='txt'">
<button class="button-disable" (click)="question.type='img'; save();">图片</button>
&nbsp;
<button class="button-right">文字</button>
</div>
<div *ngIf="question.type=='img'">
图片:
<div style="width: 300px;">
<app-upload-image-with-preview [picUrl]="question.image"
(imageUploaded)="onAssetUploadSuccess($event, 'questions', i, 'image')">
</app-upload-image-with-preview>
</div>
</div>
<span>音频: </span>
<app-audio-recorder [audioUrl]="question.audio"
(audioUploaded)="onAssetUploadSuccess($event, 'questions', i, 'audio')">
</app-audio-recorder>
<div *ngIf="question.type=='txt'">
<span>文本: </span>
<input type="text" nz-input [(ngModel)]="question.text" (blur)="save()">
</div>
<br>
<button style="width: 900px; height: 30px; color: red;" (click)="removeQuestion(i)">删除题目</button>
</div>
</div>
<div class="border" style="width: 950px;">
<button style="width: 900px; height: 100px;" (click)="addQuestion()">增加题目</button>
</div>
</div>
</div>
</div>
\ No newline at end of file
import { Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, ApplicationRef, ChangeDetectorRef } from '@angular/core';
import { JsonPipe } from '@angular/common';
import { ComponentBase } from './ComponentBase';
@Component({
selector: 'app-form',
templateUrl: './form.component.html',
styleUrls: ['./form.component.css']
})
export class FormComponent extends ComponentBase implements OnInit, OnChanges, OnDestroy {
// 储存数据用
saveKey = "card_machine";
// 储存对象
item: any = {
title: '',
questionText: '',
questionTextAudio: '',
audioFileName: '',
questions: [],
};
addQuestion() {
this.item.questions.push({
type: 'img',
audio: '',
text: '',
image: ''
});
this.save();
}
removeQuestion(idx) {
this.item.questions.splice(idx, 1);
this.save();
}
saveAudioFileName(name) {
this.item.audioFileName=name;
this.save();
}
handle_dragover(e) {
e.preventDefault();
}
handle_drop(e) {
e.preventDefault();
const dt = e.dataTransfer.getData("text/plain");
console.log("handle_drop===", dt);
// 网络文件 dt 的数据遵循如下格式
// 图片 "http://staging-teach.cdn.ireadabc.com/f38f9928-c3bd-47f8-9ed1-43c0e03d2f30.png";
// 音频(JSON字符串) {url: "http://staging-teach.cdn.ireadabc.com/1c8694612563f4e2da707f1f6a37d066_l.mp3", name: "test.mp3"};
// 视频(JSON字符串) {url: "http://staging-teach.cdn.ireadabc.com/c37a3945121274a1f7d95717327539ec_l.mp4", name: "视频.mp4"};
// 骨骼动画(JSON字符串) {"ske":{"url":"http://staging-teach.cdn.ireadabc.com/3d4a36b83aada60709771fbe15e2b6db.json","name":"飞鸟_ske.json"},"tex":{"url":"http://staging-teach.cdn.ireadabc.com/08a676a5f456634f9c6c90e9efd3c2ea.json","name":"飞鸟_tex.json"},"png":{"url":"http://staging-teach.cdn.ireadabc.com/874393ecf5e0cd42a09f5b34d48854d2.png","name":"飞鸟_tex.png"}};
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment