初始化代码

This commit is contained in:
2025-12-22 17:13:05 +08:00
parent ed0de08e3a
commit 1f7e9d401b
2947 changed files with 526137 additions and 0 deletions

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@@ -0,0 +1 @@
<view data-ref="limepainter" class="lime-painter vue-ref"><block wx:if="{{canvasId&&size}}"><view style="{{(styles)}}"><block wx:if="{{use2dCanvas}}"><canvas class="lime-painter__canvas" style="{{(size)}}" id="{{canvasId}}" type="2d"></canvas></block><block wx:else><canvas class="lime-painter__canvas" style="{{(size)}}" canvas-id="{{canvasId}}" id="{{canvasId}}" width="{{boardWidth*dpr}}" height="{{boardHeight*dpr}}"></canvas></block></view></block><slot></slot></view>

View File

@@ -0,0 +1,2 @@
.lime-painter,
.lime-painter__canvas{width:100%}

View File

@@ -0,0 +1,119 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title></title>
<style type="text/css">
html,
body,
canvas {
padding: 0;
margin: 0;
width: 100%;
height: 100%;
overflow-y: hidden;
background-color: transparent;
}
</style>
</head>
<body>
<canvas id="lime-painter"></canvas>
<script type="text/javascript" src="./uni.webview.1.5.3.js"></script>
<script type="text/javascript" src="./painter.js"></script>
<script>
var cache = [];
var painter = null;
var canvas = null;
var context = null;
var timer = null;
var pixelRatio = 1;
console.log = function (...args) {
postMessage(args);
};
// function stringify(key, value) {
// if (typeof value === 'object' && value !== null) {
// if (cache.indexOf(value) !== -1) {
// return;
// }
// cache.push(value);
// }
// return value;
// };
function emit(event, data) {
postMessage({
event,
data: (typeof data !== 'object' && data !== null ? data : JSON.stringify(data))
});
cache = [];
};
function postMessage(data) {
uni.postMessage({
data
});
};
function init(dpr) {
canvas = document.querySelector('#lime-painter');
context = canvas.getContext('2d');
pixelRatio = dpr || window.devicePixelRatio;
painter = new Painter({
id: 'lime-painter',
context,
canvas,
pixelRatio,
width: canvas.offsetWidth,
height: canvas.offsetHeight,
listen: {
onProgress(v) {
emit('progressChange', v);
},
onEffectFail(err) {
//console.error(err)
emit('fail', err);
}
}
});
emit('inited', true);
};
function save(args) {
delete args.success;
delete args.fail;
clearTimeout(timer);
timer = setTimeout(() => {
const path = painter.save(args);
if (typeof path == 'string') {
const index = Math.ceil(path.length / 8);
for (var i = 0; i < 8; i++) {
if (i == 7) {
emit('success', path.substr(i * index, index));
} else {
emit('file', path.substr(i * index, index));
}
};
} else {
// console.log('canvas no data')
emit('fail', 'canvas no data');
};
}, 30);
};
async function source(args) {
let size = await painter.source(args);
emit('layoutChange', size);
if(!canvas.height) {
console.log('canvas no size')
emit('fail', 'canvas no size');
}
painter.render().catch(err => {
// console.error(err)
emit('fail', err);
});
};
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
{
"disableScroll": true,
"usingComponents": {}
}

View File

@@ -0,0 +1 @@
<view class="mask flex-center"><view class="content botton-radius"><view class="content-top"><text class="content-top-text">{{title}}</text><image class="content-top" style="top:0;" width="100%" height="100%" src="../images/bg_top.png"></image></view><view class="content-header"></view><view class="content-body"><view class="title"><text>{{subTitle}}</text></view><view class="body"><scroll-view class="box-des-scroll" scroll-y="true"><text class="box-des">{{''+contents+''}}</text></scroll-view></view><view class="footer flex-center"><block wx:if="{{isAppStore}}"><button class="content-button" style="border:none;color:#fff;" plain="{{true}}" data-event-opts="{{[['tap',[['jumpToAppStore',['$event']]]]]}}" bindtap="__e">{{''+downLoadBtnTextiOS+''}}</button></block><block wx:else><block wx:if="{{!downloadSuccess}}"><block wx:if="{{downloading}}"><view class="progress-box flex-column"><progress class="progress" border-radius="35" percent="{{downLoadPercent}}" activeColor="#3DA7FF" show-info="{{true}}" stroke-width="10"></progress><view style="width:100%;font-size:28rpx;display:flex;justify-content:space-around;"><text>{{downLoadingText}}</text><text>{{"("+downloadedSize+"/"+packageFileSize+"M)"}}</text></view></view></block><block wx:else><button class="content-button" style="border:none;color:#fff;" plain="{{true}}" data-event-opts="{{[['tap',[['updateApp',['$event']]]]]}}" bindtap="__e">{{''+downLoadBtnText+''}}</button></block></block><block wx:else><block wx:if="{{downloadSuccess&&!installed}}"><button class="content-button" style="border:none;color:#fff;" plain="{{true}}" loading="{{installing}}" disabled="{{installing}}" data-event-opts="{{[['tap',[['installPackage',['$event']]]]]}}" bindtap="__e">{{''+(installing?'正在安装……':'下载完成,立即安装')+''}}</button></block></block><block wx:if="{{installed&&isWGT}}"><button class="content-button" style="border:none;color:#fff;" plain="{{true}}" data-event-opts="{{[['tap',[['restart',['$event']]]]]}}" bindtap="__e">安装完毕,点击重启</button></block></block></view></view><block wx:if="{{!is_mandatory}}"><image class="close-img" src="../images/app_update_close.png" data-event-opts="{{[['tap',[['closeUpdate',['$event']]]]]}}" catchtap="__e"></image></block></view></view>

View File

@@ -0,0 +1 @@
page{background:transparent}.flex-center{display:flex;justify-content:center;align-items:center}.mask{position:fixed;left:0;top:0;right:0;bottom:0;background-color:rgba(0,0,0,.65)}.botton-radius{border-bottom-left-radius:30rpx;border-bottom-right-radius:30rpx}.content{position:relative;top:0;width:600rpx;background-color:#fff;box-sizing:border-box;padding:0 50rpx;font-family:Source Han Sans CN}.text{display:block;line-height:200px;text-align:center;color:#fff}.content-top{position:absolute;top:-195rpx;left:0;width:600rpx;height:270rpx}.content-top-text{font-size:45rpx;font-weight:700;color:#f8f8fa;position:absolute;top:120rpx;left:50rpx;z-index:1}.content-header{height:70rpx}.title{font-size:33rpx;font-weight:700;color:#3da7ff;line-height:38px}.footer{height:150rpx;display:flex;align-items:center;justify-content:space-around}.box-des-scroll{box-sizing:border-box;padding:0 40rpx;height:200rpx;text-align:left}.box-des{font-size:26rpx;color:#000;line-height:50rpx}.progress-box{width:100%}.progress{width:90%;height:40rpx;border-radius:35px}.close-img{width:70rpx;height:70rpx;z-index:1000;position:absolute;bottom:-120rpx;left:calc(50% - 70rpx / 2)}.content-button{text-align:center;flex:1;font-size:30rpx;font-weight:400;color:#fff;border-radius:40rpx;margin:0 18rpx;height:80rpx;line-height:80rpx;background:linear-gradient(90deg,#1785ff,#3da7ff)}.flex-column{display:flex;flex-direction:column;align-items:center}