This commit is contained in:
yanran200730
2022-05-20 11:30:38 +08:00
32 changed files with 199 additions and 119 deletions

View File

@@ -1,57 +1,30 @@
const fsExtra = require('fs-extra')
const path = require('path')
const fs = require('fs')
/**
* 将函数封装成promise
*/
const promisify = fn => {
return function () {
let args = arguments;
return new Promise(function (resolve, reject) {
[].push.call(args, function (err, result) {
if (err) {
console.log(err)
reject(err);
} else {
resolve(result);
}
});
fn.apply(null, args);
});
const {chalkTag, findPages, fs, fsExtra} = require("./tools");
const axios = require("axios");
let apps = {list: [], desc: "用于产品库主页面获取应用使用"}
const getFileInfo = (app, file) => {
let vue = fs.readFileSync(file).toString()
if (/appName/.test(vue)) {
let appName = vue.replace(/[\s\S]*(appName:.+),[\s\S]*/gm, '$1')
app.label = appName.replace(/(appName:|["'])/g, '')?.trim()
if (/customNavigation/.test(vue)) {
app.style = {navigationStyle: "custom"}
} else
app.style = {navigationBarTitleText: app.label}
}
if (/^App/.test(app.name)) {
let {name, label} = app,
path = app.path.replace(/.+[\\\/]([^\\\/]+)[\\\/]([^\\\/]+)$/g, `/apps/$1/$2`)
apps.list.push({id: name, name, label, path, libPath: file?.replace(/\\/g, '/')?.replace(/^src(\/.+)\.vue/, '$1'), type: 'wxwork'})
}
}
const saveApps = app => {
if (app.list.length > 0) {
axios.post("http://192.168.1.87:12525/node/wechatapps/addOrUpdate", app).then(res => {
if (res?.code == 0) chalkTag.done("产品库目录已同步至后台数据库...")
}).catch(() => 0)
}
}
const readdir = promisify(fs.readdir)
const stat = promisify(fs.stat)
/**
* 封装打印工具
*/
const chalk = require('chalk')
const {log} = console
const chalkTag = {
info: msg => log([chalk.bgBlue.black(' INFO '), msg].join(' ')),
done: msg => log([chalk.bgGreen.black(' DONE '), msg].join(' ')),
warn: msg => log([chalk.bgYellow.black(' WARN '), msg].join(' ')),
error: msg => log([chalk.bgRed.black(' ERROR '), msg].join(' ')),
}
/**
* 遍历应用的方法
*/
const findApp = (dir, cb) => {
return readdir(dir).then(apps => {
return Promise.all(apps.map(e => {
let cPath = path.join(dir, e)
return stat(cPath).then(state => {
if (state.isDirectory()) {
return findApp(cPath, cb)
} else if (state.isFile()) {
cb && cb(cPath)
}
})
}) || [])
})
}
const start = () => {
chalkTag.info('开始生成pages.json...')
let json = {
@@ -68,67 +41,51 @@ const start = () => {
navigationStyle: "custom"
}
}
findApp('src/components/pages', file => {
if (/.+\\[^\\]+\\[^\\]+\.vue/g.test(file)) {
let app = {
path: file.replace(/^src\\(.*).vue/g, '$1').replace(/\\/g, '/')
Promise.all([
findPages('src/components/pages', file => {
if (/.+\\[^\\]+\\[^\\]+\.vue/g.test(file)) {
let app = {
path: file.replace(/^src\\(.*).vue/g, '$1').replace(/\\/g, '/')
}
getFileInfo(app, file)
return json.pages.push(app)
}
let vue = fs.readFileSync(file).toString()
if (/appName/.test(vue)) {
let appName = vue.replace(/[\s\S]*(appName:.+),[\s\S]*/gm, '$1'),
title = appName.replace(/(appName:|["'])/g, '')
app.style = {navigationBarTitleText: title.trim()}
}),
findPages('src/apps', file => {
if (/.+\\App[^\\]+\\[^\\]+\.vue/g.test(file)) {
let app = {
name: file.replace(/.*\\([^\\]+).vue/g, '$1'),
path: file.replace(/^src\\(.*).vue/g, '$1').replace(/\\/g, '/')
}
getFileInfo(app, file)
return json.pages.push(app)
}
json.pages.push(app)
}
}).then(() => findApp('src/apps', file => {
if (/.+\\App[^\\]+\\[^\\]+\.vue/g.test(file)) {
let app = {
name: file.replace(/.*\\([^\\]+).vue/g, '$1'),
path: file.replace(/^src\\(.*).vue/g, '$1').replace(/\\/g, '/')
}),
findPages('src/saas', file => {
if (/.+\\App[^\\]+\\[^\\]+\.vue/g.test(file)) {
let app = {
name: file.replace(/.*\\([^\\]+).vue/g, '$1'),
path: file.replace(/^src\\(.*).vue/g, '$1').replace(/\\/g, '/')
}
getFileInfo(app, file)
return json.pages.push(app)
}
let vue = fs.readFileSync(file).toString()
if (/appName/.test(vue)) {
let appName = vue.replace(/[\s\S]*(appName:.+),[\s\S]*/gm, '$1'),
title = appName.replace(/(appName:|["'])/g, '')
app.style = {navigationBarTitleText: title.trim()}
}),
findPages('src/project', file => {
if (/.+\\App[^\\]+\\[^\\]+\.vue/g.test(file)) {
let app = {
name: file.replace(/.*\\([^\\]+).vue/g, '$1'),
path: file.replace(/^src\\(.*).vue/g, '$1').replace(/\\/g, '/')
}
getFileInfo(app, file)
return json.pages.push(app)
}
json.pages.push(app)
}
})).then(() => findApp('src/saas', file => {
if (/.+\\App[^\\]+\\[^\\]+\.vue/g.test(file)) {
let app = {
name: file.replace(/.*\\([^\\]+).vue/g, '$1'),
path: file.replace(/^src\\(.*).vue/g, '$1').replace(/\\/g, '/')
}
let vue = fs.readFileSync(file).toString()
if (/appName/.test(vue)) {
let appName = vue.replace(/[\s\S]*(appName:.+),[\s\S]*/gm, '$1'),
title = appName.replace(/(appName:|["'])/g, '')
app.style = {navigationBarTitleText: title.trim()}
}
json.pages.push(app)
}
})).then(() => findApp('src/project', file => {
if (/.+\\App[^\\]+\\[^\\]+\.vue/g.test(file)) {
let app = {
name: file.replace(/.*\\([^\\]+).vue/g, '$1'),
path: file.replace(/^src\\(.*).vue/g, '$1').replace(/\\/g, '/')
}
let vue = fs.readFileSync(file).toString()
if (/appName/.test(vue)) {
let appName = vue.replace(/[\s\S]*(appName:.+),[\s\S]*/gm, '$1'),
title = appName.replace(/(appName:|["'])/g, '')
app.style = {navigationBarTitleText: title.trim()}
}
json.pages.push(app)
}
})).then(() => {
})
]).then(() => {
saveApps(apps)
fsExtra.outputJson('src/pages.json', json, () => {
chalkTag.done('生成pages.json')
})
})
}
start();

85
bin/tools.js Normal file
View File

@@ -0,0 +1,85 @@
const fsExtra = require('fs-extra')
const path = require('path')
const chalk = require('chalk')
const fs = require('fs')
/**
* 将函数封装成promise
*/
const promisify = fn => {
return function () {
let args = arguments;
return new Promise(function (resolve, reject) {
[].push.call(args, function (err, result) {
if (err) {
console.log(err)
reject(err);
} else {
resolve(result);
}
});
fn.apply(null, args);
});
}
}
const readdir = promisify(fs.readdir)
const stat = promisify(fs.stat)
/**
* 封装打印工具
*/
const {log} = console
const chalkTag = {
info: msg => log([chalk.bgBlue.black(' INFO '), msg].join(' ')),
done: msg => log([chalk.bgGreen.black(' DONE '), msg].join(' ')),
warn: msg => log([chalk.bgYellow.black(' WARN '), msg].join(' ')),
error: msg => log([chalk.bgRed.black(' ERROR '), msg].join(' ')),
}
/**
* 遍历应用的方法
*/
const findApp = (dir, cb) => {
fsExtra.ensureDirSync(dir)
return readdir(dir).then(apps => {
return Promise.all(apps.map(e => {
let cPath = path.join(dir, e)
return stat(cPath).then(state => {
if (state.isDirectory()) {
return findApp(cPath, cb)
} else if (state.isFile()) {
cb && cb(dir)
}
})
}) || [])
})
}
const findPages = (dir, cb) => {
fsExtra.ensureDirSync(dir)
return readdir(dir).then(apps => {
return Promise.all(apps.map(e => {
let cPath = path.join(dir, e)
return stat(cPath).then(state => {
if (state.isDirectory()) {
return findPages(cPath, cb)
} else if (state.isFile()) {
cb && cb(cPath)
}
})
}) || [])
})
}
const copyFiles = (dir, source = 'src/mods') => {
chalkTag.info(`开始扫描${source}...`)
return new Promise(resolve => {
fsExtra.emptyDir(dir, err => {
if (!err) {
fsExtra.copy(source, dir).then(() => {
chalkTag.done(source + ' 扫描完毕')
resolve()
})
}
})
})
}
module.exports = {findApp, chalkTag, fsExtra, copyFiles, fs, path, findPages}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 815 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 803 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 766 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -53,7 +53,7 @@
<div class="plan">
<div class="nav">
<span>办理进度</span>
<span> ({{ $dict.getLabel('clapEventStatus', data.eventStatus) }})</span>
<span> ({{ $dict.getLabel('helpDeclarationStatus', data.status) }})</span>
</div>
<div class="cards" v-for="(item, index) in data.processList" :key="index">

View File

@@ -6,23 +6,23 @@
</div>
<div class="select-box">
<div class="left">
<!-- :areaId="user.areaId" @select="areaSelect" select-root -->
<AiAreaPicker v-model="areaId" :name.sync="areaName" >
<div style="display: flex;">
<span v-if="areaName" style="color:#333;fontSize: 14px;" class="areaName">{{ areaName }}</span>
<AiAreaPicker v-model="areaId" :areaId="user.areaId" :name.sync="areaName" @select="areaSelect" selectRoot>
<div>
<span v-if="areaId" style="color:#333;fontSize: 14px;" class="areaName">{{ areaName }}</span>
<span v-else style="color: #999;fontSize: 14px;" class="areaName">所在地区</span>
<u-icon name="arrow-down" color="#999" size="24" style="margin-left: 4px;width: 14px;display:inline-block;margin-top:18px"></u-icon>
<u-icon name="close-circle" v-if="areaId" color="#999" size="24" style="margin-left: 4px;width: 14px;display:inline-block;margin-top:18px"></u-icon>
<u-icon name="arrow-down" color="#999" size="24" style="margin-left: 4px;width: 14px;display:inline-block;margin-top:18px" @select="areaSelect(e)"></u-icon>
</div>
</AiAreaPicker>
<u-icon name="close-circle" v-if="areaId" @click="clearArea" color="#999" size="24"></u-icon>
</div>
<div class="right">
<AiSelect dict="helpDeclarationReason" v-model="declareReason">
<span v-if="!declareReason" style="color: #999;">风险类型</span>
<span v-else>{{ $dict.getLabel('helpDeclarationReason', declareReason) }}</span>
<u-icon name="arrow-down" color="#999" size="24" style="margin-left: 4px;width: 14px;display:inline-block;"></u-icon>
<u-icon name="close-circle" v-if="declareReason" color="#999" size="24" style="margin-left: 4px;width: 14px;display:inline-block;"></u-icon>
</AiSelect>
<u-icon name="close-circle" v-if="declareReason" @click="clearReason" color="#999" size="24"></u-icon>
<!-- style="margin-left: 4px;width: 14px; display:inline-block;" -->
</div>
</div>
</AiTopFixed>
@@ -52,18 +52,22 @@
</template>
<script>
import { mapState } from 'vuex'
export default {
data() {
return {
tabs: ['全部待办','办理历史'],
tabIndex: 0,
list: [],
current: 1,
areaId: '',
areaName: '',
declareReason: '',
list: [],
}
},
computed: {
...mapState(['user'])
},
onShow() {
this.$dict.load('helpDeclarationStatus').then(() => {
uni.$on('update', () => {
@@ -80,12 +84,35 @@ export default {
this.getList()
},
areaSelect(e) {
console.log(e);
this.areaId =e
this.$nextTick(() => {
this.getList()
})
},
clearArea() {
this.areaId = '',
this.areaName = '',
this.current = 1,
this.list = [],
this.getList()
},
clearReason() {
this.declareReason = '',
this.current = 1,
this.list = [],
this.getList()
},
getList() {
this.$http.post('/app/apphelpdeclarationinfo/listByEw',null,{
params: {
current: this.current,
areaId: this.areaId,
searchType: this.tabIndex,
areaId: this.areaId,
declareReason: this.declareReason // 风险类型
}
}).then((res) => {
@@ -116,6 +143,9 @@ export default {
::v-deep .AiTopFixed .content {
padding: 0;
}
::v-deep .AiSelect .display{
justify-content: center;
}
.tab-select {
width: 100%;
@@ -159,6 +189,14 @@ export default {
flex: 1;
text-align: center !important;
font-size: 28px;
::v-deep .u-icon .uicon-close-circle{
top: -96px !important;
left: 80px;
margin-left: 30px;
width: 14px;
display:inline-block;
}
}
}

View File

@@ -9,7 +9,7 @@
</div>
<div class="right">
<div style="display: flex" v-if="status == 1">
<AiPagePicker type="party" @select="handlePartySelect" single :isFourParty="true">
<AiPagePicker type="sysUser" @select="handlePartySelect" single :isFourParty="true">
<AiMore v-model="doUsername" placeholder="请选择"/>
</AiPagePicker>
</div>
@@ -47,7 +47,6 @@
export default {
data() {
return {
// operation: '',
description: '',
status: '',
files: [],

View File

@@ -58,9 +58,10 @@ export default {
},
methods: {
getList() {
let {current, total, name: con} = this
let {current, total, name: con, $route: {query: {action}}} = this
if (total == 0 || current <= total) {
this.$http.post(`/admin/user/userIntegralList`, null, {
action = decodeURIComponent(action)
this.$http.post(action || `/admin/user/userIntegralList`, null, {
params: {current, size: 20, con}
}).then(res => {
if (res?.data) {