This commit is contained in:
liuye
2022-07-19 15:24:32 +08:00
18 changed files with 150 additions and 106 deletions

View File

@@ -22,7 +22,7 @@
import SliderNav from "./components/sliderNav"; import SliderNav from "./components/sliderNav";
import MainContent from "./components/mainContent"; import MainContent from "./components/mainContent";
import HeaderNav from "./components/headerNav"; import HeaderNav from "./components/headerNav";
import {mapMutations, mapState} from "vuex"; import {mapActions, mapMutations, mapState} from "vuex";
export default { export default {
name: 'app', name: 'app',
@@ -42,7 +42,8 @@ export default {
} }
}, },
methods: { methods: {
...mapMutations(['setToken']), ...mapMutations(['setToken', 'setFinanceUser']),
...mapActions(['getUserInfo']),
getToken(params) { getToken(params) {
if (params.access_token) { if (params.access_token) {
this.setToken([params.token_type, params.access_token].join(' ')) this.setToken([params.token_type, params.access_token].join(' '))
@@ -52,16 +53,6 @@ export default {
} else this.$message.error(params.msg || "登录失败!") } else this.$message.error(params.msg || "登录失败!")
}, },
getUserInfo() {
this.$axios.post("/admin/user/detail-phone").then(res => {
if (res?.data) {
this.$store.commit("setUserInfo", res.data)
if (/^\/project\/xiushan/.test(location.pathname)) {
this.$store.commit("setFinanceUser")
}
}
})
},
handleLogin() { handleLogin() {
this.$axios.delete("/auth/token/logout").finally(() => { this.$axios.delete("/auth/token/logout").finally(() => {
this.dialog = true this.dialog = true
@@ -69,8 +60,12 @@ export default {
}, },
}, },
created() { created() {
if (this.user.token) this.getUserInfo()
wx = jWeixin wx = jWeixin
if (this.user.token) this.getUserInfo().then(() => {
if (/^\/project\/xiushan/.test(location.pathname)) {
this.setFinanceUser()
}
})
} }
} }
</script> </script>

View File

@@ -2,56 +2,28 @@ import Vue from 'vue'
import Vuex from 'vuex' import Vuex from 'vuex'
import preState from 'vuex-persistedstate' import preState from 'vuex-persistedstate'
import request from '../router/axios' import request from '../router/axios'
import * as modules from "dvcp-ui/lib/js/modules"
Vue.use(Vuex) Vue.use(Vuex)
const user = {
state: {
info: {},
token: '',
financeUser: {}
},
mutations: {
setFinanceUser(state) {
request.post("appfinancialorganizationuser/checkUser").then(res => {
state.financeUser = res.data
})
},
setUserInfo(state, userInfo) {
state.info = userInfo
},
setToken(state, token) {
state.token = token
}
}
}
export default new Vuex.Store({ export default new Vuex.Store({
state: { state: {
dicts: [], dicts: [],
apps: [] apps: []
}, },
mutations: { mutations: {
setDicts(state, payload) {
if (payload) {
payload.map(p => {
if (state.dicts.some(d => d.key == p.key)) {
const index = state.dicts.findIndex(d => d.key == p.key)
state.dicts.splice(index, 1)
state.dicts.push(p)
} else {
state.dicts.push(p)
}
})
}
},
addApp(state, app) { addApp(state, app) {
state.apps.push(app) state.apps.push(app)
}, },
cleanApps(state) { cleanApps(state) {
state.apps = [] state.apps = []
}
}, },
modules: {user}, setFinanceUser(state) {
request.post("appfinancialorganizationuser/checkUser").then(res => {
state.user.financeUser = res.data
})
},
},
modules,
plugins: [preState()] plugins: [preState()]
}) })

View File

@@ -36,13 +36,13 @@
</el-tooltip> </el-tooltip>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item label="发送内容" prop="departmentName" style="width: 100%;" :rules="[{ required: true, message: '请选择部门', trigger: 'change' }]"> <el-form-item label="发送内容" prop="content" style="width: 100%;" :rules="[{ required: true, message: '请选择部门', trigger: 'change' }]">
<el-input size="small" type="textarea" :rows="6" placeholder="请输入文本内容..." v-model="form.departmentName"></el-input> <el-input size="small" type="textarea" :rows="6" placeholder="请输入文本内容..." v-model="form.content"></el-input>
<div class="add"> <div class="add">
<div class="fileList" v-if="fileList.length"> <div class="fileList" v-if="fileList.length">
<div class="add-item" v-for="(item, index) in fileList" :key="index"> <div class="add-item" v-for="(item, index) in fileList" :key="index">
<div class="left"> <div class="left">
<img :src="mapIcon(item.media.type)" /> <img :src="mapIcon(item.msgType)" />
<span>{{ item.name }}</span> <span>{{ item.name }}</span>
</div> </div>
<i @click="removeFile(index)">删除</i> <i @click="removeFile(index)">删除</i>
@@ -67,7 +67,7 @@
:limit="9" :limit="9"
action="/app/wxcp/upload/uploadFile" action="/app/wxcp/upload/uploadFile"
accept=".jpg,.png,.jpeg" accept=".jpg,.png,.jpeg"
:http-request="v => submitUpload(v, 'image')"> :http-request="v => submitUpload(v, '1')">
<div class="content-item" trigger> <div class="content-item" trigger>
<img src="https://cdn.cunwuyun.cn/dvcp/announce/big-img.png" /> <img src="https://cdn.cunwuyun.cn/dvcp/announce/big-img.png" />
<p>图片</p> <p>图片</p>
@@ -82,17 +82,28 @@
:limit="9" :limit="9"
action="/app/wxcp/upload/uploadFile" action="/app/wxcp/upload/uploadFile"
accept=".mp4" accept=".mp4"
:http-request="v => submitUpload(v, 'video')"> :http-request="v => submitUpload(v, '2')">
<div class="content-item" trigger> <div class="content-item" trigger>
<img src="https://cdn.cunwuyun.cn/dvcp/announce/big-video.png" /> <img src="https://cdn.cunwuyun.cn/dvcp/announce/big-video.png" />
<p>视频</p> <p>视频</p>
</div> </div>
</el-upload> </el-upload>
<div class="content-item"> <el-upload
ref="upload"
multiple
:file-list="fileList"
:show-file-list="false"
:before-upload="v => handleChange(v, 10, '.zip、.rar、.doc、.docx、.xls、.xlsx、.ppt、.pptx、.pdf、.txt')"
:limit="9"
action="/app/wxcp/upload/uploadFile"
accept=".zip.rar.doc.docx.xls.xlsx.ppt.pptx.pdf.txt"
:http-request="v => submitUpload(v, '3')">
<div class="content-item" trigger>
<img src="https://cdn.cunwuyun.cn/dvcp/announce/folder.png" /> <img src="https://cdn.cunwuyun.cn/dvcp/announce/folder.png" />
<p>文件</p> <p>文件</p>
</div> </div>
<div class="content-item"> </el-upload>
<div class="content-item" @click="isShowAddLink = true">
<img src="https://cdn.cunwuyun.cn/dvcp/announce/site.png" /> <img src="https://cdn.cunwuyun.cn/dvcp/announce/site.png" />
<p>网页</p> <p>网页</p>
</div> </div>
@@ -133,6 +144,41 @@
</div> </div>
</div> </div>
<ai-dialog
:visible.sync="isShowAddLink"
width="920px"
title="链接消息"
@close="onClose"
@onConfirm="onLinkConfirm">
<el-form ref="linkForm" :model="linkForm" label-width="110px" label-position="right">
<div class="ai-form">
<el-form-item label="标题" style="width: 100%;" prop="linkTitle" :rules="[{ required: true, message: '请输入标题', trigger: 'blur' }]">
<el-input
size="small"
placeholder="请输入标题"
v-model="linkForm.linkTitle">
</el-input>
</el-form-item>
<el-form-item label="链接" style="width: 100%;" prop="linkUrl" :rules="[{ required: true, message: '请输入链接', trigger: 'blur' }]">
<el-input
size="small"
placeholder="请输入链接"
v-model="linkForm.linkUrl">
</el-input>
</el-form-item>
<el-form-item label="描述" style="width: 100%;" prop="linkDesc" :rules="[{ required: true, message: '请输入描述', trigger: 'blur' }]">
<el-input
size="small"
placeholder="请输入描述"
v-model="linkForm.linkDesc">
</el-input>
</el-form-item>
<el-form-item label="封面图" prop="linkPicUrl" style="width: 100%;" :rules="[{ required: true, message: '请上传封面图', trigger: 'change' }]">
<ai-uploader :instance="instance" v-model="form.linkPicUrl" :limit="1"></ai-uploader>
</el-form-item>
</div>
</el-form>
</ai-dialog>
</div> </div>
</template> </template>
<template #footer> <template #footer>
@@ -158,9 +204,17 @@
info: {}, info: {},
department: [], department: [],
fileList: [], fileList: [],
isShowAddLink: false,
linkForm: {
linkPicUrl: [],
linkDesc: '',
linkTitle: '',
linkUrl: ''
},
form: { form: {
content: '',
choiceTime: '', choiceTime: '',
contents: {}, contents: [],
enableExamine: '0', enableExamine: '0',
examines: [], examines: [],
wxGroups: [], wxGroups: [],
@@ -206,17 +260,38 @@
}) })
}, },
onLinkConfirm () {
this.$refs.linkForm.validate((valid) => {
if (valid) {
this.fileList.push({
...this.linkForm,
linkPicUrl: this.linkPicUrl[0].url,
msgType: '4'
})
this.isShowAddLink = false
}
})
},
onClose () {
this.linkForm.linkPicUrl = []
this.linkForm.linkDesc = ''
this.linkForm.linkTitle = ''
this.linkForm.linkUrl = ''
},
removeFile (index) { removeFile (index) {
this.fileList.splice(index, 1) this.fileList.splice(index, 1)
}, },
mapIcon (type) { mapIcon (type) {
return { return {
image: 'https://cdn.cunwuyun.cn/dvcp/announce/img.png', 1: 'https://cdn.cunwuyun.cn/dvcp/announce/img.png',
video: 'https://cdn.cunwuyun.cn/dvcp/announce/video.png', 2: 'https://cdn.cunwuyun.cn/dvcp/announce/video.png',
folder: 'https://cdn.cunwuyun.cn/dvcp/announce/folder.png', 3: 'https://cdn.cunwuyun.cn/dvcp/announce/folder.png',
site: 'https://cdn.cunwuyun.cn/dvcp/announce/site.png', 4: 'https://cdn.cunwuyun.cn/dvcp/announce/site.png',
miniapp: 'https://cdn.cunwuyun.cn/dvcp/announce/miniapp.png' 5: 'https://cdn.cunwuyun.cn/dvcp/announce/miniapp.png'
}[type] }[type]
}, },
@@ -247,16 +322,22 @@
}, },
submitUpload (file, type) { submitUpload (file, type) {
const fileType = {
'1': 'image',
'2': 'video',
'3': 'file'
}[type]
let formData = new FormData() let formData = new FormData()
formData.append('file', file.file) formData.append('file', file.file)
formData.append('type', type) formData.append('type', fileType)
this.instance.post(`/app/wxcp/upload/uploadFile`, formData, { this.instance.post(`/app/wxcp/upload/uploadFile`, formData, {
withCredentials: false withCredentials: false
}).then(res => { }).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.fileList.push({ this.fileList.push({
...res.data.file, ...res.data.file,
media: res.data.media media: res.data.media,
msgType: type
}) })
this.$message.success('上传成功') this.$message.success('上传成功')
@@ -282,10 +363,6 @@
}) })
}, },
onClose () {
this.form.explain = ''
},
confirm () { confirm () {
this.$refs.form.validate((valid) => { this.$refs.form.validate((valid) => {
if (valid) { if (valid) {

View File

@@ -131,7 +131,7 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.loading = false this.loading = false
this.$initWxOpenData() this.$store.dispatch('initOpenData')
}) })
} else { } else {
this.loading = false this.loading = false

View File

@@ -185,7 +185,7 @@
} }
}, },
created() { created() {
this.$initWxOpenData() this.$store.dispatch('initOpenData')
var year = this.calendarDate.getFullYear(); var year = this.calendarDate.getFullYear();
var month = this.calendarDate.getMonth() + 1; var month = this.calendarDate.getMonth() + 1;
var date = this.calendarDate.getDate() var date = this.calendarDate.getDate()

View File

@@ -574,7 +574,7 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.loading = false this.loading = false
this.$initWxOpenData() this.$store.dispatch('initOpenData')
}) })
} else { } else {
this.loading = false this.loading = false

View File

@@ -346,7 +346,7 @@
this.list = res.data.records this.list = res.data.records
this.total = res.data.total this.total = res.data.total
this.$initWxOpenData() this.$store.dispatch('initOpenData')
this.loading = false this.loading = false
} else { } else {
this.loading = false this.loading = false

View File

@@ -247,7 +247,7 @@
if (res.code == 0) { if (res.code == 0) {
this.tableData = res.data.records this.tableData = res.data.records
this.total = res.data.total this.total = res.data.total
this.$initWxOpenData() this.$store.dispatch('initOpenData')
} }
}) })
}, },
@@ -322,7 +322,7 @@
this.targetList = res.data.fields.map(item => { this.targetList = res.data.fields.map(item => {
return JSON.parse(item.fieldInfo) return JSON.parse(item.fieldInfo)
}) })
this.$initWxOpenData() this.$store.dispatch('initOpenData')
} }
}) })
}, },

View File

@@ -142,7 +142,7 @@
if (res.code == 0) { if (res.code == 0) {
this.tableData = res.data.records this.tableData = res.data.records
this.total = res.data.total this.total = res.data.total
this.$initWxOpenData() this.$store.dispatch('initOpenData')
} }
}) })
}, },

View File

@@ -246,7 +246,7 @@ export default {
if (res?.data) { if (res?.data) {
this.info.attendees = res.data.records; this.info.attendees = res.data.records;
this.total = res.data.total; this.total = res.data.total;
this.$initWxOpenData() this.$store.dispatch('initOpenData')
} }
}); });
}, },

View File

@@ -135,7 +135,7 @@ export default {
if (res && res.data) { if (res && res.data) {
this.tableData = res.data.records; this.tableData = res.data.records;
this.total = res.data.total; this.total = res.data.total;
this.$initWxOpenData() this.$store.dispatch('initOpenData')
} }
}); });
}, },

View File

@@ -108,7 +108,7 @@ export default {
if (res?.data) { if (res?.data) {
this.tableData = res.data.records this.tableData = res.data.records
this.page.total = res.data.total this.page.total = res.data.total
this.$initWxOpenData() this.$store.dispatch('initOpenData')
} }
}) })
}, },

View File

@@ -138,7 +138,7 @@
if(res && res.data){ if(res && res.data){
Object.keys(this.form).map(e=>this.form[e] = res.data[e]); Object.keys(this.form).map(e=>this.form[e] = res.data[e]);
this.form.type = res.data.releaseTime ? 1 : 0; this.form.type = res.data.releaseTime ? 1 : 0;
this.$initWxOpenData() this.$store.dispatch('initOpenData')
} }
}) })
}, },

View File

@@ -56,7 +56,7 @@
}).then(res => { }).then(res => {
if (res && res.data) { if (res && res.data) {
this.detailObj = res.data; this.detailObj = res.data;
this.$initWxOpenData() this.$store.dispatch('initOpenData')
} }
}) })
} }

View File

@@ -156,7 +156,7 @@
}).then(res => { }).then(res => {
if (res && res.data) { if (res && res.data) {
this.detailObj = res.data; this.detailObj = res.data;
this.$initWxOpenData() this.$store.dispatch('initOpenData')
} }
}) })
}, },

View File

@@ -197,7 +197,7 @@
if(res && res.data){ if(res && res.data){
this.readObj = res.data; this.readObj = res.data;
this.visible = true; this.visible = true;
this.$initWxOpenData() this.$store.dispatch('initOpenData')
} }
}) })
}, },
@@ -213,7 +213,7 @@
if(res && res.data){ if(res && res.data){
this.tableData = res.data.records; this.tableData = res.data.records;
this.total = res.data.total; this.total = res.data.total;
this.$initWxOpenData() this.$store.dispatch('initOpenData')
} }
}) })
} }

View File

@@ -112,7 +112,7 @@
if (res && res.data) { if (res && res.data) {
this.tableData = res.data.records; this.tableData = res.data.records;
this.total = res.data.total; this.total = res.data.total;
this.$initWxOpenData() this.$store.dispatch('initOpenData')
} }
}); });
}, },

View File

@@ -10,7 +10,7 @@ module.exports = {
filename: 'index.html' filename: 'index.html'
} }
}, },
transpileDependencies: [/node_modules[/\\]dvcp-ui(.+)utils.js/], transpileDependencies: [/node_modules[/\\]dvcp-ui(.+)utils.js/, /node_modules[/\\]dvcp-ui(.+)modules.js/],
chainWebpack: (config) => { chainWebpack: (config) => {
config.module config.module
.rule('js') .rule('js')