refactor: 确立独立子工程架构 (backend, admin, mpuniapp) 并同步更新 AGENTS.md 规范
这个提交包含在:
@@ -0,0 +1,28 @@
|
||||
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
|
||||
const isIOS = platformInfo.startsWith('ios')
|
||||
const PAGE_PATH = '/pages/API/base64/base64'
|
||||
|
||||
describe('base64', () => {
|
||||
let page
|
||||
beforeAll(async () => {
|
||||
page = await program.reLaunch(PAGE_PATH)
|
||||
await page.waitFor('view');
|
||||
});
|
||||
|
||||
it('arrayBufferToBase64', async () => {
|
||||
await page.callMethod('arrayBufferToBase64')
|
||||
await page.waitFor(200)
|
||||
const data = await page.data('data')
|
||||
expect(data.arrayBufferToBase64Res).toEqual('CxYh')
|
||||
})
|
||||
if (isIOS) {
|
||||
return
|
||||
}
|
||||
it('base64ToArrayBuffer', async () => {
|
||||
await page.callMethod('base64ToArrayBuffer')
|
||||
await page.waitFor(200)
|
||||
const data = await page.data('data')
|
||||
expect(data.base64ToArrayBufferRes).toEqual('11,22,33')
|
||||
await page.waitFor(3000)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,67 @@
|
||||
<template>
|
||||
<view>
|
||||
<view>
|
||||
<button class="btnstyle" type="primary" @tap="arrayBufferToBase64"> arrayBufferToBase64 </button>
|
||||
<button class="btnstyle" type="primary" @tap="base64ToArrayBuffer"> base64ToArrayBuffer </button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="uts">
|
||||
type DataType = {
|
||||
arrayBufferToBase64Res: string;
|
||||
base64ToArrayBufferRes: string;
|
||||
}
|
||||
|
||||
const data = reactive({
|
||||
arrayBufferToBase64Res: '',
|
||||
base64ToArrayBufferRes: ''
|
||||
} as DataType)
|
||||
|
||||
const arrayBufferToBase64 = () => {
|
||||
const arraybuffer = new ArrayBuffer(3)
|
||||
const uint8 = new Uint8Array(arraybuffer)
|
||||
uint8.set([11, 22, 33])
|
||||
const base64 = uni.arrayBufferToBase64(arraybuffer)
|
||||
console.log(base64) //CxYh
|
||||
data.arrayBufferToBase64Res = base64
|
||||
uni.showToast({
|
||||
title: data.arrayBufferToBase64Res
|
||||
})
|
||||
}
|
||||
|
||||
const base64ToArrayBuffer = () => {
|
||||
const base64 = 'CxYh'
|
||||
const arrayBuffer = uni.base64ToArrayBuffer(base64)
|
||||
const uint8 = new Uint8Array(arrayBuffer)
|
||||
console.log(uint8.toString())//11, 22, 33
|
||||
data.base64ToArrayBufferRes = uint8.toString()
|
||||
uni.showToast({
|
||||
title: data.base64ToArrayBufferRes
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
data,
|
||||
arrayBufferToBase64,
|
||||
base64ToArrayBuffer
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.logo {
|
||||
height: 100px;
|
||||
width: 100px;
|
||||
margin: 100px auto 25px auto;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 18px;
|
||||
color: #8f8f94;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.btnstyle {
|
||||
margin: 4px;
|
||||
}
|
||||
</style>
|
||||
在新工单中引用
屏蔽一个用户