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 {chalkTag, findPages, fs, fsExtra} = require("./tools");
const path = require('path') const axios = require("axios");
const fs = require('fs') let apps = {list: [], desc: "用于产品库主页面获取应用使用"}
/** const getFileInfo = (app, file) => {
* 将函数封装成promise let vue = fs.readFileSync(file).toString()
*/ if (/appName/.test(vue)) {
const promisify = fn => { let appName = vue.replace(/[\s\S]*(appName:.+),[\s\S]*/gm, '$1')
return function () { app.label = appName.replace(/(appName:|["'])/g, '')?.trim()
let args = arguments; if (/customNavigation/.test(vue)) {
return new Promise(function (resolve, reject) { app.style = {navigationStyle: "custom"}
[].push.call(args, function (err, result) { } else
if (err) { app.style = {navigationBarTitleText: app.label}
console.log(err) }
reject(err); if (/^App/.test(app.name)) {
} else { let {name, label} = app,
resolve(result); 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'})
}); }
fn.apply(null, args); }
}); 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 = () => { const start = () => {
chalkTag.info('开始生成pages.json...') chalkTag.info('开始生成pages.json...')
let json = { let json = {
@@ -68,67 +41,51 @@ const start = () => {
navigationStyle: "custom" navigationStyle: "custom"
} }
} }
findApp('src/components/pages', file => { Promise.all([
if (/.+\\[^\\]+\\[^\\]+\.vue/g.test(file)) { findPages('src/components/pages', file => {
let app = { if (/.+\\[^\\]+\\[^\\]+\.vue/g.test(file)) {
path: file.replace(/^src\\(.*).vue/g, '$1').replace(/\\/g, '/') 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)) { findPages('src/apps', file => {
let appName = vue.replace(/[\s\S]*(appName:.+),[\s\S]*/gm, '$1'), if (/.+\\App[^\\]+\\[^\\]+\.vue/g.test(file)) {
title = appName.replace(/(appName:|["'])/g, '') let app = {
app.style = {navigationBarTitleText: title.trim()} 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) }),
} findPages('src/saas', file => {
}).then(() => findApp('src/apps', file => { if (/.+\\App[^\\]+\\[^\\]+\.vue/g.test(file)) {
if (/.+\\App[^\\]+\\[^\\]+\.vue/g.test(file)) { let app = {
let app = { name: file.replace(/.*\\([^\\]+).vue/g, '$1'),
name: file.replace(/.*\\([^\\]+).vue/g, '$1'), path: file.replace(/^src\\(.*).vue/g, '$1').replace(/\\/g, '/')
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)) { findPages('src/project', file => {
let appName = vue.replace(/[\s\S]*(appName:.+),[\s\S]*/gm, '$1'), if (/.+\\App[^\\]+\\[^\\]+\.vue/g.test(file)) {
title = appName.replace(/(appName:|["'])/g, '') let app = {
app.style = {navigationBarTitleText: title.trim()} 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(() => {
})).then(() => findApp('src/saas', file => { saveApps(apps)
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(() => {
fsExtra.outputJson('src/pages.json', json, () => { fsExtra.outputJson('src/pages.json', json, () => {
chalkTag.done('生成pages.json') chalkTag.done('生成pages.json')
}) })
}) })
} }
start(); 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="plan">
<div class="nav"> <div class="nav">
<span>办理进度</span> <span>办理进度</span>
<span> ({{ $dict.getLabel('clapEventStatus', data.eventStatus) }})</span> <span> ({{ $dict.getLabel('helpDeclarationStatus', data.status) }})</span>
</div> </div>
<div class="cards" v-for="(item, index) in data.processList" :key="index"> <div class="cards" v-for="(item, index) in data.processList" :key="index">

View File

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

View File

@@ -58,9 +58,10 @@ export default {
}, },
methods: { methods: {
getList() { getList() {
let {current, total, name: con} = this let {current, total, name: con, $route: {query: {action}}} = this
if (total == 0 || current <= total) { 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} params: {current, size: 20, con}
}).then(res => { }).then(res => {
if (res?.data) { if (res?.data) {