master
yujialong 2 years ago
parent bc6f953a59
commit 49e09732fc
  1. 36
      src/api/index.js
  2. 2
      src/components/img-upload/Cropper.vue
  3. 14
      src/pages/account/login/index.vue
  4. 6
      src/pages/annex/list/index.vue
  5. 34
      src/pages/article/add/index.vue
  6. 1
      src/pages/article/list/index.vue
  7. 117
      src/pages/column/add/index.vue
  8. 42
      src/pages/column/list/index.vue
  9. 12
      src/pages/setting/list/index.vue
  10. 67
      src/pages/setting/list/info.vue
  11. 55
      src/pages/user/list/index.vue
  12. 2
      src/setting.js
  13. 3
      src/styles/common.scss

@ -1,6 +1,6 @@
import Setting from '@/setting' import Setting from '@/setting'
const host = Setting.apiBaseURL const host = Setting.apiBaseURL
const host1 = 'http://192.168.31.151:10000/' const host1 = 'http://192.168.31.136:10000/'
export default { export default {
logins: `iasf/sys/user/login`, logins: `iasf/sys/user/login`,
@ -13,6 +13,9 @@ export default {
depts: `iasf/sys/dept/tree`, depts: `iasf/sys/dept/tree`,
users: `iasf/sys/users`, users: `iasf/sys/users`,
user: `iasf/sys/user`, user: `iasf/sys/user`,
sendPhoneOrEmailCode: `iasf/sys/sendPhoneOrEmailCode`,
updatePhoneOrEmail: `iasf/sys/updatePhoneOrEmail`,
updateUserAvatars: `${host}iasf/sys/updateUserAvatars`,
staffTemplate: `http://192.168.31.136/用户导入模板.xlsx`, staffTemplate: `http://192.168.31.136/用户导入模板.xlsx`,
checkJobNumber: `iasf/sys/checkJobNumber`, checkJobNumber: `iasf/sys/checkJobNumber`,
checkUsername: `iasf/sys/checkUsername`, checkUsername: `iasf/sys/checkUsername`,
@ -28,18 +31,21 @@ export default {
groupUpdate: `iasf/sys/userGroup/update`, groupUpdate: `iasf/sys/userGroup/update`,
site: `iasf/sys/site/list`, site: `iasf/sys/site/list`,
updateSite: `iasf/sys/site/update`, updateSite: `iasf/sys/site/update`,
listWithTree: `${host1}iasf/sysColumn/listWithTree`, listWithTree: `iasf/sysColumn/listWithTree`,
saveColumn: `${host1}iasf/sysColumn/save`, saveColumn: `iasf/sysColumn/save`,
updateColumn: `${host1}iasf/sysColumn/update`, updateColumn: `iasf/sysColumn/update`,
findColumn: `${host1}iasf/sysColumn/findById`, findColumn: `iasf/sysColumn/findById`,
deleteColumn: `${host1}iasf/sysColumn/delete`, deleteColumn: `iasf/sysColumn/delete`,
sameLevelJudgment: `${host1}iasf/sysColumn/sameLevelJudgment`, sameLevelJudgment: `iasf/sysColumn/sameLevelJudgment`,
sortByColumn: `${host1}iasf/sysColumn/sortByColumn`, sortByColumn: `iasf/sysColumn/sortByColumn`,
checkIfTheTitleIsRepeat: `${host1}iasf/sysContent/checkIfTheTitleIsRepeat`, checkIfTheTitleIsRepeat: `iasf/sysContent/checkIfTheTitleIsRepeat`,
deleteArticle: `${host1}iasf/sysContent/delete`, deleteArticle: `iasf/sysContent/delete`,
findArticle: `${host1}iasf/sysContent/findById`, findArticle: `iasf/sysContent/findById`,
queryArticle: `${host1}iasf/sysContent/pagingQuery`, queryArticle: `iasf/sysContent/pagingQuery`,
saveArticle: `${host1}iasf/sysContent/save`, saveArticle: `iasf/sysContent/save`,
updateArticle: `${host1}iasf/sysContent/update`, updateArticle: `iasf/sysContent/update`,
longPageColumnList: `${host1}iasf/pageManagement/longPageColumnList`, longPageColumnList: `iasf/pageManagement/longPageColumnList`,
searchAllBySite: `iasf/sysNavigationStyle/searchAllBySite`,
updateStyle: `iasf/sysNavigationStyle/update`,
saveStyle: `iasf/sysNavigationStyle/save`,
} }

@ -84,7 +84,7 @@ export default {
img: '', // () img: '', // ()
size: 0.8, // (:1) size: 0.8, // (:1)
full: true, // true (:false) full: true, // true (:false)
outputType: 'jpeg', // (:jpg) outputType: 'jpg', // (:jpg)
canMove: true, // (:true) canMove: true, // (:true)
original: false, // (:false) original: false, // (:false)
canMoveBox: true, // (:true) canMoveBox: true, // (:true)

@ -68,21 +68,17 @@ export default {
...mapMutations('user', [ ...mapMutations('user', [
'setUserId', 'setUserName' 'setUserId', 'setUserName'
]), ]),
getVerImg() { // //
this.loginForm.random = Math.floor(Math.random() * 999999999); getVerImg() {
this.verificationIMG = this.api.verification + "?random=" + `${this.loginForm.random}`; this.loginForm.random = Math.floor(Math.random() * 999999999);
}, this.verificationIMG = this.api.verification + "?random=" + `${this.loginForm.random}`;
handleClick(tab, event) { //
this.loginForm.username = "";
this.$refs.loginForm.clearValidate();
this.loginRules.username[0].message = tab.index === "1" ? "请输入账号" : "请输入手机号/邮箱";
}, },
submit() { submit() {
this.$post(this.api.logins, this.loginForm).then(({ data }) => { this.$post(this.api.logins, this.loginForm).then(({ data }) => {
util.local.set(Setting.tokenKey, data.accessToken, Setting.tokenExpires) util.local.set(Setting.tokenKey, data.accessToken, Setting.tokenExpires)
addRoutes(data.permissionList[0].children) addRoutes(data.permissionList[0].children)
util.successMsg('登录成功') util.successMsg('登录成功')
this.setUserId(data.id) this.setUserId(data.id || 1)
this.setUserName(data.username) this.setUserName(data.username)
this.$router.push('/site') this.$router.push('/site')
}).catch(res => { }).catch(res => {

@ -58,7 +58,11 @@
</el-table-column> </el-table-column>
<el-table-column prop="createDate" label="上传时间" min-width="150"></el-table-column> <el-table-column prop="createDate" label="上传时间" min-width="150"></el-table-column>
<el-table-column prop="uploader" label="上传人" min-width="100"></el-table-column> <el-table-column prop="uploader" label="上传人" min-width="100"></el-table-column>
<el-table-column prop="quote" label="文章名称" min-width="180"></el-table-column> <el-table-column prop="quote" label="文章名称" min-width="180">
<template slot-scope="scope">
{{ scope.row.quote || '--' }}
</template>
</el-table-column>
<el-table-column prop="deleted" label="是否使用" min-width="100"> <el-table-column prop="deleted" label="是否使用" min-width="100">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.quote ? '是' : '否' }} {{ scope.row.quote ? '是' : '否' }}

@ -112,20 +112,22 @@
<img slot="reference" class="info" src="@/assets/img/ques.png" alt=""> <img slot="reference" class="info" src="@/assets/img/ques.png" alt="">
</el-popover> </el-popover>
<el-switch <el-switch
v-model="form.useArticleTemplate" v-model="form.templateStatus"
:active-value="1" :active-value="1"
:inactive-value="0"> :inactive-value="0">
</el-switch> </el-switch>
<ul v-if="form.useArticleTemplate" class="styles"> <ul v-if="form.templateStatus" class="styles">
<li v-for="(item, i) in detailStyle" :key="i" @click="form.articleTemplate = item.id"> <template v-for="(item, i) in detailStyle">
<div class="review"> <li v-if="item.id !== column.detailStyle" :key="i" @click="form.articleTemplate = item.id">
<img :src="require('@/assets/img/article' + item.id + '.png')" alt=""> <div class="review">
</div> <img :src="require('@/assets/img/article' + item.id + '.png')" alt="">
<el-radio v-model="form.articleTemplate" :label="item.id">{{ item.name }}</el-radio> </div>
</li> <el-radio v-model="form.articleTemplate" :label="item.id">{{ item.name }}</el-radio>
</li>
</template>
</ul> </ul>
</el-form-item> </el-form-item>
<template v-if="form.articleTemplate === 1 || form.articleTemplate === 2"> <template v-if="!form.templateStatus || (form.templateStatus && form.articleTemplate === 2)">
<el-form-item prop="mainBody" label="正文"> <el-form-item prop="mainBody" label="正文">
<Editor api-key='rnk6zw9v267xqz7pf98twt1vmrvltmd436je7a642pckltda' v-model="form.mainBody" :init="editorConfig" /> <Editor api-key='rnk6zw9v267xqz7pf98twt1vmrvltmd436je7a642pckltda' v-model="form.mainBody" :init="editorConfig" />
</el-form-item> </el-form-item>
@ -202,7 +204,7 @@
<el-button type="primary" @click="submit(1)">发布</el-button> <el-button type="primary" @click="submit(1)">发布</el-button>
<el-button @click="preview">预览</el-button> <el-button @click="preview">预览</el-button>
<el-button @click="submit(0)">保存草稿</el-button> <el-button @click="submit(0)">保存草稿</el-button>
<el-button @click="$router.back()">取消</el-button> <el-button @click="$router.push('/article')">取消</el-button>
</div> </div>
</div> </div>
</template> </template>
@ -216,7 +218,6 @@ export default {
data() { data() {
return { return {
site: this.$store.state.content.site, site: this.$store.state.content.site,
headers: {},
nameRepeat: false, nameRepeat: false,
types: ColumnConst.types, types: ColumnConst.types,
templates: ColumnConst.templates, templates: ColumnConst.templates,
@ -234,8 +235,8 @@ export default {
id: this.$route.query.id || '', id: this.$route.query.id || '',
founderId: this.$store.state.user.userId, founderId: this.$store.state.user.userId,
editorId: this.$store.state.user.userId, editorId: this.$store.state.user.userId,
useArticleTemplate: 0, templateStatus: 0,
articleTemplate: this.$route.query.columnId ? this.$store.state.content.column.detailStyle : '', articleTemplate: '',
author: '', author: '',
bannerImg: '', bannerImg: '',
columnId: +this.$route.query.columnId, columnId: +this.$route.query.columnId,
@ -277,6 +278,9 @@ export default {
computed: { computed: {
...mapState('user', [ ...mapState('user', [
'userName' 'userName'
]),
...mapState('content', [
'column'
]) ])
}, },
components: { components: {
@ -296,7 +300,6 @@ export default {
if (this.submiting) { if (this.submiting) {
next() next()
} else { } else {
const { id } = this.form
const { updateTime } = this const { updateTime } = this
// //
if (updateTime > 2) { if (updateTime > 2) {
@ -340,6 +343,7 @@ export default {
columnName: '', columnName: '',
templateId: '', templateId: '',
typeId : '', typeId : '',
isSort: 0
}).then(({ data }) => { }).then(({ data }) => {
this.columns = data this.columns = data
let { columnId } = this.$route.query let { columnId } = this.$route.query
@ -459,7 +463,7 @@ export default {
if (!links.length && form.connectionType === 3 && isRelease) return util.errorMsg('请选择栏目') if (!links.length && form.connectionType === 3 && isRelease) return util.errorMsg('请选择栏目')
form.linkAddress = links.join() form.linkAddress = links.join()
} }
if (form.articleTemplate !== 3 && !form.mainBody && isRelease) return util.errorMsg('请输入正文') if (((form.templateStatus && form.articleTemplate === 2) || !form.templateStatus) && !form.mainBody && isRelease) return util.errorMsg('请输入正文')
const { columnId } = form const { columnId } = form
if (typeof columnId === 'object') form.columnId = columnId[columnId.length - 1] if (typeof columnId === 'object') form.columnId = columnId[columnId.length - 1]
form.isRelease = isRelease form.isRelease = isRelease

@ -193,6 +193,7 @@ export default {
columnName: '', columnName: '',
templateId: '', templateId: '',
typeId : '', typeId : '',
isSort: 0
}).then(({ data }) => { }).then(({ data }) => {
this.columns = data this.columns = data
this.$nextTick(() => { this.$nextTick(() => {

@ -1,5 +1,5 @@
<template> <template>
<div class="page"> <div class="page" v-show="loaded">
<p class="page-name mb">栏目</p> <p class="page-name mb">栏目</p>
<el-form :model="form" :rules="rules" class="input-form model" label-width="120px"> <el-form :model="form" :rules="rules" class="input-form model" label-width="120px">
<div class="item-line"> <div class="item-line">
@ -70,6 +70,14 @@
</div> </div>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
<el-form-item prop="subtitle" label="栏目副标题">
<el-input
type="textarea"
placeholder="请输入栏目副标题"
v-model.trim="form.subtitle"
@change="nameChange"
></el-input>
</el-form-item>
<el-form-item prop="templateId" label="栏目模板"> <el-form-item prop="templateId" label="栏目模板">
<el-select v-model="form.templateId"> <el-select v-model="form.templateId">
<el-option <el-option
@ -218,18 +226,29 @@
</el-form> </el-form>
<div class="btns"> <div class="btns">
<el-button type="primary" @click="submit(0)">确定</el-button> <el-button type="primary" @click="submit(0)">确定</el-button>
<el-button @click="$router.back()">取消</el-button> <el-button @click="$router.push('/column')">取消</el-button>
</div> </div>
<!-- 剪裁组件弹窗 -->
<el-dialog append-to-body :visible.sync="cropperModel" width="1100px">
<Cropper
ref="vueCropper"
:is-upload="isUpload"
:img-file="file"
:fixed="true"
@upload="customUpload" />
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import util from "@/libs/util"; import util from "@/libs/util";
import ColumnConst from '@/const/column' import ColumnConst from '@/const/column'
import { mapState } from 'vuex' import { mapState } from 'vuex'
import ImgUpload from '@/components/img-upload' import Cropper from '@/components/img-upload/Cropper'
import Axios from 'axios'
export default { export default {
data() { data() {
return { return {
loaded: false,
site: this.$store.state.content.site, site: this.$store.state.content.site,
isEdit: this.$route.query.type === 'edit', isEdit: this.$route.query.type === 'edit',
nameRepeat: false, nameRepeat: false,
@ -261,6 +280,7 @@ export default {
pageSize: 10, pageSize: 10,
menuVisible: 0, menuVisible: 0,
columnBanner: '', columnBanner: '',
subtitle: '',
templateId: 1, templateId: 1,
listStyleId: 1, listStyleId: 1,
detailStyle: 1, detailStyle: 1,
@ -296,11 +316,14 @@ export default {
], ],
}, },
submiting: false, // submiting: false, //
updateTime: 0 updateTime: 0,
cropperModel: false,
isUpload: false,
file: {}, //
}; };
}, },
components: { components: {
ImgUpload Cropper
}, },
computed: { computed: {
...mapState('user', [ ...mapState('user', [
@ -356,7 +379,6 @@ export default {
next() next()
} }
} }
console.log("🚀 ~ file: index.vue ~ line 336 ~ beforeRouteLeave ~ to", to, this.updateTime)
}, },
methods: { methods: {
// //
@ -366,11 +388,24 @@ export default {
columnName: '', columnName: '',
templateId: '', templateId: '',
typeId : '', typeId : '',
isSort: 0
}).then(({ data }) => { }).then(({ data }) => {
this.columns = data this.columns = data
this.isEdit && this.getData() if (this.isEdit) {
this.getData()
this.handleId(data)
} else {
this.loaded = true
}
}).catch(err => {}) }).catch(err => {})
}, },
// disabled
handleId(list) {
list.forEach(e => {
if (this.isEdit && e.id == this.form.id) e.disabled = true
e.children.length ? this.handleId(e.children) : delete e.children
})
},
// //
getArticle() { getArticle() {
// / // /
@ -390,14 +425,14 @@ export default {
this.$post(`${this.api.findColumn}?id=${this.form.id}`).then(({ data }) => { this.$post(`${this.api.findColumn}?id=${this.form.id}`).then(({ data }) => {
this.form = data this.form = data
if (data.typeId === 2) { if (data.typeId === 2) {
let link = data.linkAddress if (data.linkAddress) {
if (link) { const columnArticle = data.linkAddress.split('-')
link = link.split(',').map(e => +e) const column = columnArticle[0].split(',').map(e => +e)
const article = +link.splice(link.length - 1, 1) // ididlinkAddressid const article = columnArticle[1] || '' // ididlinkAddressid
// //
this.$post(this.api.queryArticle, { this.$post(this.api.queryArticle, {
siteId: this.site.id, siteId: this.site.id,
columnIds: [link[link.length - 1]], // ididid columnIds: [column[column.length - 1]], // ididid
pageNum: 1, pageNum: 1,
pageSize: 1000, pageSize: 1000,
title: '' title: ''
@ -405,16 +440,22 @@ export default {
this.articles = res.data.records this.articles = res.data.records
// / // /
if (data.connectionType === 1) { if (data.connectionType === 1) {
this.links = link this.links = column
this.form.linkAddress = '' this.form.linkAddress = ''
this.article = article if (article) this.article = +article
} else if (data.connectionType === 3) { } else if (data.connectionType === 3) {
this.otherLink = link this.otherLink = column
this.form.linkAddress = '' this.form.linkAddress = ''
this.otherArticle = article if (article) this.otherArticle = +article
} }
this.$nextTick(() => {
this.updateTime = 1
})
this.loaded = true
}).catch(err => {}) }).catch(err => {})
} }
} else {
this.loaded = true
} }
}).catch(err => {}) }).catch(err => {})
}, },
@ -446,6 +487,42 @@ export default {
this.nameRepeat = false this.nameRepeat = false
} }
}, },
customUpload(data) {
// upload
// console.log(data);
// let _data = this.compress(img);
const blob = this.dataURItoBlob(data)
const formData = new FormData()
formData.append('file', blob, this.file.name) //
this.imgUpload(formData)
},
imgUpload(formData) {
this.isUpload = true
Axios({
method: 'post',
url: this.api.upload,
data: formData,
headers: {
'Content-Type': 'multipart/form-data'
},
}).then(({ data }) => {
}).catch(res => {})
// this.$api[this.uploadMethodName]({
// data: formData,
// showLoading: false
// }).then(res => {
// //
// console.log(this.uploadList)
// this.uploadList = this.isSingle ? res : this.uploadList.concat(res)
// this.uploadList.forEach(item => {
// item.name = item.fileId
// item.url = `/common-service/file/downloadFileFromOSS?key=${item.fileId}`
// })
// }).catch(() => {})
this.isUpload = false
this.cropperModel = false
},
// //
beforeUpload(file) { beforeUpload(file) {
const { size, name } = file const { size, name } = file
@ -490,13 +567,13 @@ export default {
const { links, article, otherLink, otherArticle } = this const { links, article, otherLink, otherArticle } = this
if (form.connectionType === 1) { if (form.connectionType === 1) {
if (!links.length) return util.errorMsg('请选择站内链接') if (!links.length) return util.errorMsg('请选择站内链接')
if (!article) return util.errorMsg('请选择文章') form.linkAddress = links.join()
form.linkAddress = links.join() + ',' + article if (article) form.linkAddress += '-' + article
} }
if (form.connectionType === 3) { if (form.connectionType === 3) {
if (!otherLink.length) return util.errorMsg('请选择栏目') if (!otherLink.length) return util.errorMsg('请选择栏目')
if (!otherArticle) return util.errorMsg('请选择文章') form.linkAddress = otherLink.join()
form.linkAddress = otherLink.join() + ',' + otherArticle if (otherArticle) form.linkAddress += '-' + otherArticle
} }
} }
this.submiting = true this.submiting = true

@ -98,7 +98,7 @@
<el-dialog title="导航样式设置" :visible.sync="styleVisible" width="850px" :close-on-click-modal="false"> <el-dialog title="导航样式设置" :visible.sync="styleVisible" width="850px" :close-on-click-modal="false">
<el-form class="input-form" label-width="100px"> <el-form class="input-form" label-width="100px">
<el-form-item label="导航样式"> <el-form-item label="导航样式">
<el-select v-model="form.typeId"> <el-select v-model="form.navigationStyle">
<el-option <el-option
v-for="item in styleTypes" v-for="item in styleTypes"
:key="item.id" :key="item.id"
@ -113,13 +113,13 @@
<div class="review"> <div class="review">
<img src="@/assets/img/style1.png" alt=""> <img src="@/assets/img/style1.png" alt="">
</div> </div>
<el-radio v-model="form.listStyleId" :label="1">竖行导航</el-radio> <el-radio v-model="form.styleTemplate" :label="1">竖行导航</el-radio>
</li> </li>
<li> <li>
<div class="review"> <div class="review">
<img src="@/assets/img/style2.png" alt=""> <img src="@/assets/img/style2.png" alt="">
</div> </div>
<el-radio v-model="form.listStyleId" :label="2">横向导航</el-radio> <el-radio v-model="form.styleTemplate" :label="2">横向导航</el-radio>
</li> </li>
</ul> </ul>
</el-form-item> </el-form-item>
@ -138,6 +138,7 @@ import util from "@/libs/util";
export default { export default {
data() { data() {
return { return {
siteId: this.$store.state.content.site.id,
siteName: this.$store.state.content.site.siteName, siteName: this.$store.state.content.site.siteName,
types: ColumnConst.types, types: ColumnConst.types,
templates: ColumnConst.templates, templates: ColumnConst.templates,
@ -156,7 +157,10 @@ export default {
} }
], ],
form: { form: {
typeId: 1 id: '',
navigationStyle: 1,
styleTemplate: 1,
siteId: this.$store.state.content.site.id
}, },
originSettings: [], originSettings: [],
settings: [ settings: [
@ -225,10 +229,11 @@ export default {
methods: { methods: {
getData() { getData() {
this.$post(this.api.listWithTree, { this.$post(this.api.listWithTree, {
siteId: this.$store.state.content.site.id, siteId: this.siteId,
columnName: this.keyword, columnName: this.keyword,
templateId: '', templateId: '',
typeId : '', typeId : '',
isSort: 0
}).then(({ data }) => { }).then(({ data }) => {
this.list = data this.list = data
this.listLoading = false this.listLoading = false
@ -303,7 +308,15 @@ export default {
}, },
// //
sort() { sort() {
this.sortColumns = JSON.parse(JSON.stringify(this.list)) this.$post(this.api.listWithTree, {
siteId: this.siteId,
columnName: '',
templateId: '',
typeId : '',
isSort: 1
}).then(({ data }) => {
this.sortColumns = data
}).catch(err => {})
this.sortVisible = true this.sortVisible = true
}, },
// //
@ -336,10 +349,25 @@ export default {
// //
styleSet() { styleSet() {
this.styleVisible = true this.styleVisible = true
this.$post(`${this.api.searchAllBySite}?siteId=${this.siteId}`).then(({ data }) => {
// id
if (data.length) {
this.form = data[0]
} else {
this.$post(this.api.saveStyle, this.form).then(res => {
this.$post(`${this.api.searchAllBySite}?siteId=${this.siteId}`).then(({ data }) => {
this.form = data[0]
}).catch(res => {})
}).catch(res => {})
}
}).catch(res => {})
}, },
// //
styleSubmit() { styleSubmit() {
this.$post(this.api.updateStyle, this.form).then(res => {
util.successMsg('修改成功')
this.styleVisible = false
}).catch(res => {})
} }
} }
}; };

@ -4,7 +4,7 @@
<div class="inner"> <div class="inner">
<div class="text-center"> <div class="text-center">
<img :src="avatar" class="avatar" /> <img :src="avatar" class="avatar" />
<el-upload :headers="{token}" :action="this.api.uploadUserAvatars" name="file" :limit="10" :show-file-list="false" :on-success="changeAvatar"> <el-upload :action="this.api.updateUserAvatars" name="file" :data="{ userId }" :limit="10" :show-file-list="false" :on-success="changeAvatar">
<el-button type="text" size="small">点击更换头像</el-button> <el-button type="text" size="small">点击更换头像</el-button>
</el-upload> </el-upload>
</div> </div>
@ -22,13 +22,12 @@
<script> <script>
import Setting from '@/setting' import Setting from '@/setting'
import { mapState,mapActions } from 'vuex' import { mapState,mapActions, mapMutations } from 'vuex'
import info from './info' import info from './info'
import util from '@/libs/util' import util from '@/libs/util'
export default { export default {
data() { data() {
return { return {
token: util.local.get(Setting.tokenKey),
typeList: [ typeList: [
{ {
index: '1', index: '1',
@ -42,18 +41,19 @@ export default {
components: { info }, components: { info },
computed: { computed: {
...mapState('user', [ ...mapState('user', [
'avatar' 'avatar', 'userId'
]), ]),
}, },
mounted() { mounted() {
}, },
methods: { methods: {
...mapActions('user', [ ...mapMutations('user', [
'setAvatar' 'setAvatar'
]), ]),
changeAvatar(res) { changeAvatar(res) {
this.setAvatar(res.message) console.log("🚀 ~ file: index.vue ~ line 55 ~ changeAvatar ~ res", res)
this.setAvatar(res.data)
}, },
updateStatus(status){ updateStatus(status){
this.edited = status this.edited = status

@ -23,12 +23,12 @@
<label>工号</label> <label>工号</label>
<el-input size="small" v-model="form.jobNumber" clearable></el-input> <el-input size="small" v-model="form.jobNumber" clearable></el-input>
</li> </li>
<li> <!-- <li>
<label>邮箱</label> <label>邮箱</label>
<el-input class="m-r-10" size="small" v-model="form.email" disabled></el-input> <el-input class="m-r-10" size="small" v-model="form.email" disabled></el-input>
<el-button v-if="form.email" type="text" size="small" @click="bindEmail">更换</el-button> <el-button v-if="form.email" type="text" size="small" @click="bindEmail">更换</el-button>
<el-button v-else type="text" size="small" @click="bindEmail">添加</el-button> <el-button v-else type="text" size="small" @click="bindEmail">添加</el-button>
</li> </li> -->
<li> <li>
<label>手机号</label> <label>手机号</label>
<el-input class="m-r-10" type="text" size="small" v-model="form.phone" disabled></el-input> <el-input class="m-r-10" type="text" size="small" v-model="form.phone" disabled></el-input>
@ -38,7 +38,7 @@
<li> <li>
<label>密码</label> <label>密码</label>
<el-input class="m-r-10" size="small" value="******" disabled></el-input> <el-input class="m-r-10" size="small" value="******" disabled></el-input>
<el-button type="text" size="small" @click="bindPassword">更换</el-button> <!-- <el-button type="text" size="small" @click="bindPassword">更换</el-button> -->
</li> </li>
</ul> </ul>
</div> </div>
@ -263,7 +263,7 @@ export default {
if (this.passwordForm.password === this.passwordForm.newPassword) return util.warningMsg("原密码跟新密码不能一致") if (this.passwordForm.password === this.passwordForm.newPassword) return util.warningMsg("原密码跟新密码不能一致")
let data = this.passwordForm let data = this.passwordForm
data.userid = this.userId data.userid = this.userId
this.$post(this.api.examinePassword, data).then(res => { this.$put(this.api.examinePassword, data).then(res => {
util.successMsg("更换成功") util.successMsg("更换成功")
this.passwordVisible = false this.passwordVisible = false
}).catch(err => {}) }).catch(err => {})
@ -324,40 +324,35 @@ export default {
} }
}, },
sendEmailCode() { sendEmailCode() {
if (!this.email) return util.warningMsg("请输入邮箱"); if (!this.email) return util.warningMsg("请输入邮箱")
if (!/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(this.email)) return util.warningMsg("请输入正确的邮箱"); if (!/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(this.email)) return util.warningMsg("请输入正确的邮箱")
let data = { this.$post(this.api.sendPhoneOrEmailCode, {
userId: this.userId, email: this.email,
email: this.email, types: 1
types: 1 }).then(res => {
}; if (res.message.opener) {
this.$post(this.api.sendPhoneOrEmailCode, data).then(res => { this.emailCountdown();
if (res.message.opener) { this.emailOpener = res.message.opener;
this.emailCountdown(); } else {
this.emailOpener = res.message.opener; util.errorMsg(res.message);
} else { }
util.errorMsg(res.message); }).catch(res => {})
}
}).catch(res => {
});
}, },
emailSubmit() { emailSubmit() {
if (!this.email) return util.warningMsg("请输入邮箱"); if (!this.email) return util.warningMsg("请输入邮箱")
if (!/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(this.email)) return util.warningMsg("请输入正确的邮箱"); if (!/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(this.email)) return util.warningMsg("请输入正确的邮箱")
if (!this.emailCode) return util.warningMsg("请输入验证码"); if (!this.emailCode) return util.warningMsg("请输入验证码")
let data = { this.$put(this.api.bindPhoneOrEmail, {
userId: this.userId, userId: this.userId,
email: this.email, email: this.email,
types: 1, types: 1,
code: this.emailCode, code: this.emailCode,
opener: this.emailOpener opener: this.emailOpener
}; }).then(res => {
this.$put(this.api.bindPhoneOrEmail, data).then(res => { util.successMsg("绑定成功")
util.successMsg("绑定成功"); this.form.email = this.email
this.form.email = this.email; this.emailVisible = false
this.emailVisible = false; }).catch(res => {})
}).catch(res => {
});
}, },
closePhone() { closePhone() {
if (!this.emailDisabled) { if (!this.emailDisabled) {

@ -154,9 +154,9 @@
<el-form-item prop="phone" label="手机号"> <el-form-item prop="phone" label="手机号">
<el-input v-model.trim="form.phone" placeholder="请输入手机号" maxlength="11"></el-input> <el-input v-model.trim="form.phone" placeholder="请输入手机号" maxlength="11"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="email" label="邮箱"> <!-- <el-form-item prop="email" label="邮箱">
<el-input v-model.trim="form.email" placeholder="请输入邮箱"></el-input> <el-input v-model.trim="form.email" placeholder="请输入邮箱"></el-input>
</el-form-item> </el-form-item> -->
<el-form-item prop="groupId" label="用户组"> <el-form-item prop="groupId" label="用户组">
<el-select v-model="form.groupId" style="width: 100%"> <el-select v-model="form.groupId" style="width: 100%">
<template v-for="item in userGroups"> <template v-for="item in userGroups">
@ -209,7 +209,6 @@
<script> <script>
import util from '@/libs/util' import util from '@/libs/util'
import Setting from '@/setting' import Setting from '@/setting'
import { mapState } from 'vuex'
export default { export default {
data() { data() {
const accountPass = (rule, value, callback) => { const accountPass = (rule, value, callback) => {
@ -484,30 +483,30 @@ export default {
}, },
// / // /
orgSubmit() { orgSubmit() {
this.$refs.orgForm.validate((valid) => { this.$refs.orgForm.validate((valid) => {
if (valid) { if (valid) {
const form = this.orgForm const form = this.orgForm
const cas = this.cascaderValue const cas = this.cascaderValue
const len = cas.length const len = cas.length
if (cas && len) { if (cas && len) {
this.orgForm.pid = cas[len - 1] this.orgForm.pid = cas[len - 1]
} }
debugger debugger
if (!form.id) { if (!form.id) {
// //
this.$post(this.api.dept, form).then(res => { this.$post(this.api.dept, form).then(res => {
util.successMsg("新增成功!") util.successMsg("新增成功!")
this.closeOrg() this.closeOrg()
}).catch(err => {}) }).catch(err => {})
} else { } else {
// //
this.$put(this.api.dept, form).then(res => { this.$put(this.api.dept, form).then(res => {
util.successMsg("编辑成功!") util.successMsg("编辑成功!")
this.closeOrg() this.closeOrg()
}).catch(err => {}) }).catch(err => {})
} }
} }
}) })
}, },
// //
handleNodeClick(data) { handleNodeClick(data) {
@ -622,7 +621,7 @@ export default {
if (ids.length) { if (ids.length) {
let has = false // let has = false //
for (const i in ids) { for (const i in ids) {
if (list.find(n => n.id === ids[i])) { if (list.find(n => n.id == ids[i])) {
has = true has = true
break break
} }

@ -7,7 +7,7 @@ const isPro = url.includes("occupationlab.com"); //是否生产
let host = `${location.origin}:10000/` let host = `${location.origin}:10000/`
if (isDev) { if (isDev) {
host = 'http://192.168.31.136:10000/' // 测试服 host = 'http://192.168.31.136:10000/' // 测试服
host = 'http://192.168.31.151:10000/' // 榕 // host = 'http://192.168.31.151:10000/' // 榕
// host = 'http://192.168.31.137:10000/' // 赓 // host = 'http://192.168.31.137:10000/' // 赓
} }

@ -134,6 +134,9 @@
.el-input, .el-select { .el-input, .el-select {
width: 300px; width: 300px;
} }
.el-textarea {
width: 550px;
}
.auto, .auto .el-input { .auto, .auto .el-input {
width: auto; width: auto;
} }

Loading…
Cancel
Save