forked from aiplat/uniapp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
401 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
class configClass{ | ||
public utils = require('./utils'); | ||
constructor() { | ||
} | ||
async initStart() { | ||
const utilsClass = new this.utils(); | ||
const utilsParams = utilsClass.getParams(); | ||
|
||
const runDir = utilsParams.buildType.includes('build') ? 'build' :'dev'; | ||
utilsParams.shell.rm('-rf', `${utilsParams.currentDir}/dist/${runDir}`); | ||
|
||
const buildsDir = `${utilsParams.currentDir}/src/builds`; | ||
utilsParams.shell.rm('-rf', buildsDir); | ||
utilsParams.shell.mkdir('-p', buildsDir); | ||
|
||
let appTypeName:any = utilsParams.buildType.split(':'); | ||
appTypeName = appTypeName && appTypeName.length > 1 ? appTypeName[1] : 'h5'; | ||
appTypeName = utilsClass.getAppTypeName(appTypeName); | ||
|
||
console.log(''); | ||
const isDevTxt = utilsParams.buildType.includes('build') ? '构建' :'开发'; | ||
console.log(`------${appTypeName}平台-${utilsParams.envTxt[utilsParams.envType]}环境-${isDevTxt}-${utilsParams.type}------`); | ||
console.log(''); | ||
|
||
await utilsClass.writeFile({ | ||
file:`${utilsParams.currentDir}/src/builds/envType.ts`, | ||
content:`const envType:string = '${utilsParams.envType}';export default envType;`, | ||
}); | ||
|
||
utilsClass.buildFile({ | ||
oldFile:`${utilsParams.currentDir}/src/projects/${utilsParams.type}/selftPages.json`, | ||
newFile:`${utilsParams.currentDir}/src/pages.json`, | ||
}); | ||
utilsClass.buildFile({ | ||
oldFile:`${utilsParams.currentDir}/src/projects/${utilsParams.type}/manifest/${utilsParams.envType}/manifest.json`, | ||
newFile:`${utilsParams.currentDir}/src/manifest.json`, | ||
}); | ||
utilsClass.buildFile({ | ||
oldFile:`${utilsParams.currentDir}/src/projects/${utilsParams.type}/selfConfig.ts`, | ||
newFile:`${utilsParams.currentDir}/src/builds/selfConfig.ts`, | ||
}); | ||
console.log(''); | ||
console.log('------Building now------'); | ||
console.log(''); | ||
} | ||
} | ||
|
||
const configClassTarget = new configClass(); | ||
configClassTarget.initStart(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
class electronClass{ | ||
public utils = require('./utils'); | ||
constructor() { | ||
} | ||
async initStart() { | ||
const utilsClass = new this.utils(); | ||
const utilsParams = utilsClass.getParams(); | ||
|
||
utilsClass.buildFile({ | ||
oldFile:`${utilsParams.currentDir}/src/electron/main.js`, | ||
newFile:`${utilsParams.currentDir}/dist/build/h5/main.js`, | ||
}); | ||
utilsClass.buildFile({ | ||
oldFile:`${utilsParams.currentDir}/src/electron/package.json`, | ||
newFile:`${utilsParams.currentDir}/dist/build/h5/package.json`, | ||
}); | ||
utilsClass.buildFile({ | ||
oldFile:`${utilsParams.currentDir}/src/electron/preload.js`, | ||
newFile:`${utilsParams.currentDir}/dist/build/h5/preload.js`, | ||
}); | ||
utilsClass.buildFile({ | ||
oldFile:`${utilsParams.currentDir}/src/electron/utils.js`, | ||
newFile:`${utilsParams.currentDir}/dist/build/h5/utils.js`, | ||
}); | ||
console.log(''); | ||
console.log('------electron build ok------'); | ||
console.log(''); | ||
} | ||
} | ||
|
||
const electronClassTarget = new electronClass(); | ||
electronClassTarget.initStart(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<template> | ||
<div class="cm_pf cm_tl0 cm_w100 cm_z99"> | ||
<div class="cm_pc_12"> | ||
<view v-if="isBack" @click="goToBack"> | ||
<ani-image imgClass="cm_pa cm_tl0 cm_wh3 cm_z99" imgUrl="./static/aiplat/cm_back.png"></ani-image> | ||
</view> | ||
<div class="cm_pc_12 cm_hl3 cm_m0 cm_b0 cm_cf cm_tc" :class="{'cm_pl3': isBack}">{{ title }}</div> | ||
</div> | ||
</div> | ||
</template> | ||
<script lang="ts"> | ||
import Vue from "vue"; | ||
export default Vue.extend({ | ||
props: { | ||
title: { | ||
type: String, | ||
default: "", | ||
}, | ||
isBack: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
}, | ||
data() { | ||
return {}; | ||
}, | ||
methods: { | ||
goToBack() { | ||
this.$cmapp.jumpTo('', 'navigateBack'); | ||
} | ||
} | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<template> | ||
<image :class="imgClass" :src="imgUrl" v-if="isApp||isElectron"/> | ||
<img :class="imgClass" :src="imgUrl" v-else/> | ||
</template> | ||
<script lang="ts"> | ||
import Vue from "vue"; | ||
export default Vue.extend({ | ||
props: { | ||
imgUrl: { | ||
type: String, | ||
default: "", | ||
}, | ||
imgClass: { | ||
type: String, | ||
default: "", | ||
}, | ||
}, | ||
data() { | ||
return {}; | ||
}, | ||
computed: { | ||
isApp() { | ||
const userAgent = window.navigator.userAgent.toLowerCase(); | ||
return userAgent.includes('html5plus') ? 1 : 0; | ||
}, | ||
isElectron() { | ||
const userAgent = window.navigator.userAgent.toLowerCase(); | ||
return userAgent.includes('electron') ? 1 : 0; | ||
} | ||
} | ||
}); | ||
</script> |
File renamed without changes.
Oops, something went wrong.