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 MainContent from "./components/mainContent";
import HeaderNav from "./components/headerNav";
import {mapMutations, mapState} from "vuex";
import {mapActions, mapMutations, mapState} from "vuex";
export default {
name: 'app',
@@ -42,7 +42,8 @@ export default {
}
},
methods: {
...mapMutations(['setToken']),
...mapMutations(['setToken', 'setFinanceUser']),
...mapActions(['getUserInfo']),
getToken(params) {
if (params.access_token) {
this.setToken([params.token_type, params.access_token].join(' '))
@@ -52,16 +53,6 @@ export default {
} 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() {
this.$axios.delete("/auth/token/logout").finally(() => {
this.dialog = true
@@ -69,8 +60,12 @@ export default {
},
},
created() {
if (this.user.token) this.getUserInfo()
wx = jWeixin
if (this.user.token) this.getUserInfo().then(() => {
if (/^\/project\/xiushan/.test(location.pathname)) {
this.setFinanceUser()
}
})
}
}
</script>

View File

@@ -2,56 +2,28 @@ import Vue from 'vue'
import Vuex from 'vuex'
import preState from 'vuex-persistedstate'
import request from '../router/axios'
import * as modules from "dvcp-ui/lib/js/modules"
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({
state: {
dicts: [],
apps: []
},
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) {
state.apps.push(app)
},
cleanApps(state) {
state.apps = []
}
},
modules: {user},
setFinanceUser(state) {
request.post("appfinancialorganizationuser/checkUser").then(res => {
state.user.financeUser = res.data
})
},
},
modules,
plugins: [preState()]
})

View File

@@ -36,13 +36,13 @@
</el-tooltip>
</div>
</el-form-item>
<el-form-item label="发送内容" prop="departmentName" 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-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.content"></el-input>
<div class="add">
<div class="fileList" v-if="fileList.length">
<div class="add-item" v-for="(item, index) in fileList" :key="index">
<div class="left">
<img :src="mapIcon(item.media.type)" />
<img :src="mapIcon(item.msgType)" />
<span>{{ item.name }}</span>
</div>
<i @click="removeFile(index)">删除</i>
@@ -67,7 +67,7 @@
:limit="9"
action="/app/wxcp/upload/uploadFile"
accept=".jpg,.png,.jpeg"
:http-request="v => submitUpload(v, 'image')">
:http-request="v => submitUpload(v, '1')">
<div class="content-item" trigger>
<img src="https://cdn.cunwuyun.cn/dvcp/announce/big-img.png" />
<p>图片</p>
@@ -82,17 +82,28 @@
:limit="9"
action="/app/wxcp/upload/uploadFile"
accept=".mp4"
:http-request="v => submitUpload(v, 'video')">
:http-request="v => submitUpload(v, '2')">
<div class="content-item" trigger>
<img src="https://cdn.cunwuyun.cn/dvcp/announce/big-video.png" />
<p>视频</p>
</div>
</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" />
<p>文件</p>
</div>
<div class="content-item">
</el-upload>
<div class="content-item" @click="isShowAddLink = true">
<img src="https://cdn.cunwuyun.cn/dvcp/announce/site.png" />
<p>网页</p>
</div>
@@ -133,6 +144,41 @@
</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>
</template>
<template #footer>
@@ -158,9 +204,17 @@
info: {},
department: [],
fileList: [],
isShowAddLink: false,
linkForm: {
linkPicUrl: [],
linkDesc: '',
linkTitle: '',
linkUrl: ''
},
form: {
content: '',
choiceTime: '',
contents: {},
contents: [],
enableExamine: '0',
examines: [],
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) {
this.fileList.splice(index, 1)
},
mapIcon (type) {
return {
image: 'https://cdn.cunwuyun.cn/dvcp/announce/img.png',
video: 'https://cdn.cunwuyun.cn/dvcp/announce/video.png',
folder: 'https://cdn.cunwuyun.cn/dvcp/announce/folder.png',
site: 'https://cdn.cunwuyun.cn/dvcp/announce/site.png',
miniapp: 'https://cdn.cunwuyun.cn/dvcp/announce/miniapp.png'
1: 'https://cdn.cunwuyun.cn/dvcp/announce/img.png',
2: 'https://cdn.cunwuyun.cn/dvcp/announce/video.png',
3: 'https://cdn.cunwuyun.cn/dvcp/announce/folder.png',
4: 'https://cdn.cunwuyun.cn/dvcp/announce/site.png',
5: 'https://cdn.cunwuyun.cn/dvcp/announce/miniapp.png'
}[type]
},
@@ -247,16 +322,22 @@
},
submitUpload (file, type) {
const fileType = {
'1': 'image',
'2': 'video',
'3': 'file'
}[type]
let formData = new FormData()
formData.append('file', file.file)
formData.append('type', type)
formData.append('type', fileType)
this.instance.post(`/app/wxcp/upload/uploadFile`, formData, {
withCredentials: false
}).then(res => {
if (res.code == 0) {
this.fileList.push({
...res.data.file,
media: res.data.media
media: res.data.media,
msgType: type
})
this.$message.success('上传成功')
@@ -282,10 +363,6 @@
})
},
onClose () {
this.form.explain = ''
},
confirm () {
this.$refs.form.validate((valid) => {
if (valid) {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -10,7 +10,7 @@ module.exports = {
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) => {
config.module
.rule('js')