提交 3c36a0da 编写于 作者: tony001's avatar tony001

update:更新

上级 ab6b64ca
const fs = require("fs");
const path = require('path');
function copyFolder(copiedPath, resultPath, direct) {
if (!direct) {
copiedPath = path.join(__dirname, copiedPath);
resultPath = path.join(__dirname, resultPath);
}
if (fs.existsSync(copiedPath)) {
const files = fs.readdirSync(copiedPath, { withFileTypes: true });
for (let i = 0; i < files.length; i++) {
const cf = files[i]
if (cf.name !== 'custom.txt') {
const ccp = path.join(copiedPath, cf.name);
const crp = path.join(resultPath, cf.name);
if (cf.isFile()) {
const readStream = fs.createReadStream(ccp);
const writeStream = fs.createWriteStream(crp);
readStream.pipe(writeStream);
console.log(`form ${ccp} copy to ${crp}`);
} else {
try {
fs.accessSync(path.join(crp, '..'), fs.constants.W_OK);
copyFolder(ccp, crp, true);
} catch (error) {
console.log('folder write error:', error);
}
}
}
}
} else {
console.log('do not exist path: ', copiedPath);
}
}
console.log(`start copy custom code...`);
copyFolder('user', 'src', false);
console.log(`complete copy custom code...`);
\ No newline at end of file
...@@ -28,8 +28,9 @@ ...@@ -28,8 +28,9 @@
</template> </template>
<script lang = 'ts'> <script lang = 'ts'>
import { Environment } from '@/environments/environment'; import AppCenterService from '@/service/app/app-center-service';
import { Http } from '@/utils'; import { Http } from '@/utils';
import { Subscription } from 'rxjs';
import { Component, Vue } from 'vue-property-decorator'; import { Component, Vue } from 'vue-property-decorator';
@Component({ @Component({
...@@ -65,12 +66,30 @@ export default class AppTodoList extends Vue { ...@@ -65,12 +66,30 @@ export default class AppTodoList extends Vue {
* 排序字段 * 排序字段
*/ */
public sort: string = ''; public sort: string = '';
/**
* 应用状态事件
*
* @public
* @type {(Subscription | undefined)}
*/
public appStateEvent: Subscription | undefined;
/** /**
* vue创建 * vue创建
*/ */
created(): void { created(): void {
this.getMyTasks(); this.getMyTasks();
if(AppCenterService && AppCenterService.getMessageCenter()){
this.appStateEvent = AppCenterService.getMessageCenter().subscribe(({ name, action, data }) =>{
if(!Object.is(name,"srfwftodo")){
return;
}
if(Object.is(action,'appRefresh')){
this.getMyTasks();
}
})
}
} }
/** /**
...@@ -154,6 +173,17 @@ export default class AppTodoList extends Vue { ...@@ -154,6 +173,17 @@ export default class AppTodoList extends Vue {
this.getMyTasks(); this.getMyTasks();
} }
/**
* 组件销毁
*
* @memberof MainBase
*/
public destroyed() {
if(this.appStateEvent){
this.appStateEvent.unsubscribe();
}
}
} }
</script> </script>
......
# 说明
1.用户自定义代码文件存放目录
2.user目录映射src目录,重写文件时需保证文件路径一致
3.开发提交代码在此文件夹提交
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册