diff --git a/public/editor.css b/public/editor.css
new file mode 100644
index 0000000..9c8759c
--- /dev/null
+++ b/public/editor.css
@@ -0,0 +1,61 @@
+.mce-content-body:not([dir=rtl]) blockquote {
+ padding: 8px 15px;
+ border-left: 0;
+ background-color: #ededed;
+}
+.tiny-wrap {
+ width: 900px;
+ margin: 0 auto;
+}
+.tiny-wrap blockquote p {
+ margin: 0;
+ font-style: italic;
+}
+.tiny-wrap .block {
+ margin-bottom: 20px;
+ overflow: hidden;
+}
+.tiny-wrap .block .fl {
+ float: left;
+ margin: 0 20px 0 0;
+}
+.tiny-wrap .block .fr {
+ float: right;
+ margin: 0 0 0 20px;
+}
+.tiny-wrap .block p {
+ margin: 0 0 10px;
+ font-size: 19px;
+ font-family: PingFangSC-Regular, PingFang SC;
+ font-weight: 400;
+ color: #101010;
+ line-height: 32px;
+}
+.tiny-wrap .block .tiny-title {
+ margin: 10px 0;
+ font-size: 24px;
+ font-family: PingFangSC-Medium, PingFang SC;
+ font-weight: 500;
+ color: #101010;
+ line-height: 32px;
+}
+.tiny-wrap .quote {
+ padding: 15px;
+ font-size: 14px;
+ font-style: italic;
+ border: 1px solid #e3e3e3;
+ background-color: #f1f1f1;
+}
+.tiny-wrap .img-wrap {
+ text-align: center;
+}
+.tiny-wrap .img-wrap img {
+ max-width: 600px;
+ max-height: 600px;
+}
+.tiny-wrap .block .img-des {
+ margin: 10px 0 0;
+ font-size: 14px;
+ color: #8d8d8d;
+ text-align: center;
+}
\ No newline at end of file
diff --git a/src/components/img-upload/Cropper.vue b/src/components/img-upload/Cropper.vue
index 22854fa..93b7cf4 100644
--- a/src/components/img-upload/Cropper.vue
+++ b/src/components/img-upload/Cropper.vue
@@ -16,8 +16,8 @@
:auto-crop="option.autoCrop"
:auto-crop-width="option.autoCropWidth"
:auto-crop-height="option.autoCropHeight"
- :fixed-box="fixedBox"
- :fixed="fixed"
+ :fixed-box="option.fixedBox"
+ :fixed="option.fixed"
:fixed-number="fixedNumber"
@realTime="realTime" />
@@ -46,7 +46,7 @@
:loading="isUpload"
:disabled="isDisabled"
@click.prevent="uploadImg('base64')">
- {{ '上传' | transLoading(isUpload) }}
+ 上传
@@ -75,6 +75,11 @@ export default {
default: () => {
return { url: '', size: 10 }
}
+ },
+ // 截图框比例
+ fixedNumber: {
+ type: Array,
+ default: [1, 0.26]
}
},
data() {
@@ -89,11 +94,11 @@ export default {
original: false, // 上传图片按照原始比例渲染 (默认:false)
canMoveBox: true, // 截图框能否拖动 (默认:true)
autoCrop: true, // 是否默认生成截图框 (默认:false)
- // autoCropWidth: 480, // 默认生成截图框宽度 (默认:80%)
- // autoCropHeight: 320, // 默认生成截图框高度 (默认:80%)
+ autoCropWidth: 480, // 默认生成截图框宽度 (默认:80%)
+ autoCropHeight: 124, // 默认生成截图框高度 (默认:80%)
fixedBox: false, // 固定截图框大小 不允许改变 (默认:false)
fixed: true, // 是否开启截图框宽高固定比例 (默认:true)
- fixedNumber: [1.5, 1], // 截图框比例 (默认:[1:1])
+ fixedNumber: [1, 0.26], // 截图框比例 (默认:[1:1])
enlarge: 1
},
isDisabled: false
@@ -113,9 +118,9 @@ export default {
// 向右旋转
this.$refs.cropper.rotateRight()
},
- updateImg() {
- this.option.img = this.imgFile.url
- this.option.size = this.imgFile.size / 1024 > 200 ? 0.9 : 0.95
+ updateImg(file) {
+ this.option.img = file.url
+ this.option.size = file.size / 1024 > 200 ? 0.9 : 0.95
},
realTime(data) {
// 实时预览
diff --git a/src/components/modules/content.vue b/src/components/modules/content.vue
index 5855307..7d78745 100644
--- a/src/components/modules/content.vue
+++ b/src/components/modules/content.vue
@@ -2,10 +2,10 @@
-
+
-
+
e.id == data.articleId)
+ name = item ? item.title : ''
+ } else {
+ name = el.$refs.column.getCheckedNodes()[0].pathLabels.join('/')
}
- if (data.connectionType === 3) {
- if (!data.otherColumnId.length) return Util.errorMsg('请选择栏目')
+ } else if (data.connectionType === 3) { // 其他站点链接
+ if (!data.otherColumnId.length) return Util.errorMsg('请选择栏目')
+ // 如果选择了文章,则取文章标题作为链接名称,否则取栏目标题
+ if (data.otherArticleId) {
+ const item = el.articles.find(e => e.id == data.otherArticleId)
+ name = item ? item.title : ''
+ } else {
+ name = el.$refs.otherColumn.getCheckedNodes()[0].pathLabels.join('/')
}
+ } else { // 站外链接
+ if (!data.linkAddress) return Util.errorMsg('请输入站外链接')
+ name = data.linkAddress
}
- data.linkName = linkEle ? linkEle.getCheckedNodes()[0].pathLabels.join('/') : data.linkAddress
- console.log("🚀 ~ file: module.vue ~ line 296 ~ linkSubmit ~ data", this.data)
+ data.linkName = name
this.linkVisible = false
},
// 模块设置提交
diff --git a/src/components/modules/link.vue b/src/components/modules/link.vue
index b0e4ee5..43fb1a8 100644
--- a/src/components/modules/link.vue
+++ b/src/components/modules/link.vue
@@ -1,7 +1,7 @@
-
+
@@ -18,7 +18,6 @@
v-model="data.columnId"
:options="columns"
:props="columnProps"
- clearable
@change="columnChange">
@@ -40,8 +39,8 @@
>
-
-
+
+
@@ -178,6 +176,9 @@ export default {
this.sites = data.records
}).catch(e => {})
},
+ close() {
+ this.$emit('update:visible', false)
+ },
// 链接设置提交
linkSubmit() {
this.$emit('linkSubmit')
diff --git a/src/components/modules/module.vue b/src/components/modules/module.vue
index 9ab2c49..2d79ba1 100644
--- a/src/components/modules/module.vue
+++ b/src/components/modules/module.vue
@@ -1,7 +1,7 @@
-
+
@@ -41,7 +41,7 @@
-
+
-
+
-
+
+ clearable
+ @change="columnChange">
@@ -118,7 +119,7 @@
默认读取关联栏目
-
+
@@ -204,9 +205,11 @@ export default {
methods: {
// 处理form表单参数
handleForm() {
- const { type, forms } = this.data
+ const { type, forms, form } = this.data
+ console.log("🚀 ~ file: module.vue ~ line 209 ~ handleForm ~ type", this.data, form)
if (type === 'form') {
forms.map(e => {
+ // 加必填
if (e.required) {
this.rules[e.prop] = [
{
@@ -218,6 +221,8 @@ export default {
}
})
}
+
+ form && form.site && this.siteChange(form.site)
},
// 站点切换回调
siteChange(siteId) {
@@ -231,9 +236,17 @@ export default {
this.columns = data
}).catch(err => {})
},
+ // 栏目切换回调
+ columnChange(val) {
+ this.data.form.columnName = this.$refs.links.getCheckedNodes()[0].label
+ },
// 添加行
addRow() {
- this.data.list.push(JSON.parse(JSON.stringify(this.data.originForm)))
+ if (this.data.type === 'banner') {
+ this.data.list.push(JSON.parse(JSON.stringify(this.data.originForm)))
+ } else {
+ this.editIntro(this.data.originForm, -1)
+ }
},
close() {
this.$emit('update:visible', false)
@@ -270,32 +283,45 @@ export default {
contentSubmit() {
this.contentVisible = false
const { form } = this.data
- const list = this.data.list[this.curModule]
- for (const i in form) {
- this.$set(list, i, form[i])
+ if (this.curModule === -1) {
+ this.data.list.push(JSON.parse(JSON.stringify(this.data.form)))
+ } else {
+ const list = this.data.list[this.curModule]
+ for (const i in form) {
+ this.$set(list, i, form[i])
+ }
}
this.data.form = JSON.parse(JSON.stringify(this.data.originForm))
- console.log("🚀 ~ file: module.vue ~ line 267 ~ contentSubmit ~ list", this.data)
},
// 链接设置提交
linkSubmit() {
const el = this.$refs.link
const data = this.data.form ? this.data.form.link : this.data.list[this.curIndex].link
- const linkEle = data.connectionType === 1 ?
- el.$refs.column :
- data.connectionType === 3 ?
- el.$refs.otherColumn :
- null
- if (data.connectionType !== 2) {
- if (data.connectionType === 1) {
- if (!data.columnId.length) return Util.errorMsg('请选择站内链接')
+ let name
+ // 站内链接
+ if (data.connectionType === 1) {
+ if (!data.columnId.length) return Util.errorMsg('请选择站内链接')
+ // 如果选择了文章,则取文章标题作为链接名称,否则取栏目标题
+ if (data.articleId) {
+ const item = el.articles.find(e => e.id == data.articleId)
+ name = item ? item.title : ''
+ } else {
+ name = el.$refs.column.getCheckedNodes()[0].pathLabels.join('/')
}
- if (data.connectionType === 3) {
- if (!data.otherColumnId.length) return Util.errorMsg('请选择栏目')
+ } else if (data.connectionType === 3) { // 其他站点链接
+ if (!data.otherColumnId.length) return Util.errorMsg('请选择栏目')
+ // 如果选择了文章,则取文章标题作为链接名称,否则取栏目标题
+ if (data.otherArticleId) {
+ const item = el.articles.find(e => e.id == data.otherArticleId)
+ name = item ? item.title : ''
+ } else {
+ name = el.$refs.otherColumn.getCheckedNodes()[0].pathLabels.join('/')
}
+ } else { // 站外链接
+ if (!data.linkAddress) return Util.errorMsg('请输入站外链接')
+ name = data.linkAddress
}
- data.linkName = linkEle ? linkEle.getCheckedNodes()[0].pathLabels.join('/') : data.linkAddress
- console.log("🚀 ~ file: module.vue ~ line 296 ~ linkSubmit ~ data", this.data)
+ data.linkName = name
this.linkVisible = false
},
// 模块设置提交
diff --git a/src/const/column.js b/src/const/column.js
index 88ffb09..9d76159 100644
--- a/src/const/column.js
+++ b/src/const/column.js
@@ -88,12 +88,12 @@ export default {
{
id: 5,
path: 'news',
- name: 'NEWS&Events'
+ name: 'NEWS&EVENTS'
},
{
id: 6,
path: 'newsPress',
- name: 'NEWS&Events-press room'
+ name: 'NEWS&EVENTS-PRESS ROOM'
}
],
}
\ No newline at end of file
diff --git a/src/mixins/page/index.js b/src/mixins/page/index.js
index ec155ca..80725a1 100644
--- a/src/mixins/page/index.js
+++ b/src/mixins/page/index.js
@@ -25,8 +25,9 @@ export default {
methods: {
// 获取详情
getInfo() {
+ const siteId = this.$store.state.content.site.id
this.modules.map(e => {
- const { type, list } = e
+ const { type, list, form } = e
// 克隆一个原始row,方便添加
if (type === 'banner' || type === 'introduce') {
const data = JSON.parse(JSON.stringify(e.form || e.list[0]))
@@ -34,22 +35,14 @@ export default {
if (typeof data[i] === 'string') data[i] = ''
}
e.originForm = data
- } else if (type === 'columns') {
- if (!list.length) {
- // 克隆6个栏目
- for (let i = 0; i < 6; i++) {
- e.list.push(JSON.parse(JSON.stringify(e.form)))
- }
- }
}
- // 克隆一个空值的form
- // if (e.form) {
- // const form = JSON.parse(JSON.stringify(e.form))
- // for (const i in form) {
- // if (typeof e.form[i] !== 'object') form[i] = ''
- // }
- // e.originForm = form
- // }
+ // 站点id默认设置为当前站点
+ e.list && e.list.map(e => {
+ if (e.link && !e.link.site) e.link.site = siteId
+ if (type === 'columns' && !e.site) e.site = siteId
+ })
+ if (form && form.link && !form.link.site) form.link.site = siteId
+ if (form && type === 'column' && !form.site) form.site = siteId
})
// 查询页面详情
this.$post(`${this.api.findPage}?columnId=${this.columnId}`).then(({ data }) => {
@@ -71,14 +64,28 @@ export default {
this.diaVisible = true
},
// 模块设置提交
- moduleSubmit() {
+ moduleSubmited() {
this.diaVisible = false
if (this.curData.type === 'columns') {
- this.modules[this.curModule].list[this.curListIndex] = JSON.parse(JSON.stringify(this.curData.form))
+ const form = this.curData.form
+ if (form.columnTitle === 2) form.columnName = form.columnTitleCustom
+ this.modules[this.curModule].list[this.curListIndex] = JSON.parse(JSON.stringify(form))
} else {
this.modules[this.curModule] = this.curData
}
},
+ // 模块设置提交验证
+ moduleSubmit() {
+ const formEle = this.$refs.module.$refs.form
+ // 有表单的要验证必填,没有的直接关闭弹框
+ if (formEle) {
+ formEle.validate((valid) => {
+ valid && this.moduleSubmited()
+ })
+ } else {
+ this.moduleSubmited()
+ }
+ },
// 处理预览和保存的json
handleJson() {
return JSON.stringify(this.modules)
diff --git a/src/pages/account/login/index.vue b/src/pages/account/login/index.vue
index 007ed55..aa51997 100644
--- a/src/pages/account/login/index.vue
+++ b/src/pages/account/login/index.vue
@@ -36,117 +36,117 @@ import util from '@/libs/util'
import Setting from '@/setting'
import addRoutes from '@/libs/route/addRoutes'
export default {
- data: function() {
- return {
- loginForm: {
- username: "",
- password: "",
- captcha: "", // 验证码
- },
- loginRules: {
- username: [{ required: true, message: "请输入账号", trigger: "blur" }],
- password: [{ required: true, message: "请输入密码", trigger: "blur" }],
- captcha: [{ required: true, message: "请输入验证码", trigger: "blur" }]
- },
- verificationIMG: "",
- phone: "",
- phoneCode: "",
- phoneDisabled: false,
- phoneTimer: null,
- phoneBtnText: "发送验证码"
- };
+ data: function() {
+ return {
+ loginForm: {
+ username: "",
+ password: "",
+ captcha: "", // 验证码
+ },
+ loginRules: {
+ username: [{ required: true, message: "请输入账号", trigger: "blur" }],
+ password: [{ required: true, message: "请输入密码", trigger: "blur" }],
+ captcha: [{ required: true, message: "请输入验证码", trigger: "blur" }]
+ },
+ verificationIMG: "",
+ phone: "",
+ phoneCode: "",
+ phoneDisabled: false,
+ phoneTimer: null,
+ phoneBtnText: "发送验证码"
+ };
+ },
+ mounted() {
+ this.getVerImg()
+ // 页面离开的时候销毁手机和邮箱验证码定时器
+ this.$once("hook:beforeDestroy", function() {
+ clearInterval(this.phoneTimer)
+ this.phoneTimer = null
+ })
+ },
+ methods: {
+ ...mapMutations('user', [
+ 'setUserId', 'setUserName'
+ ]),
+ // 获取验证码图片
+ getVerImg() {
+ this.loginForm.random = Math.floor(Math.random() * 999999999);
+ this.verificationIMG = this.api.verification + "?random=" + `${this.loginForm.random}`;
},
- mounted() {
- this.getVerImg()
- // 页面离开的时候销毁手机和邮箱验证码定时器
- this.$once("hook:beforeDestroy", function() {
- clearInterval(this.phoneTimer)
- this.phoneTimer = null
+ submit() {
+ this.$post(this.api.logins, this.loginForm).then(({ data }) => {
+ util.local.set(Setting.tokenKey, data.accessToken, Setting.tokenExpires)
+ addRoutes(data.permissionList[0].children)
+ util.successMsg('登录成功')
+ this.setUserId(data.id || 1)
+ this.setUserName(data.username)
+ this.$router.push('/site')
+ }).catch(res => {
+ this.getVerImg()
+ this.loginForm.captcha = ''
})
},
- methods: {
- ...mapMutations('user', [
- 'setUserId', 'setUserName'
- ]),
- // 获取验证码图片
- getVerImg() {
- this.loginForm.random = Math.floor(Math.random() * 999999999);
- this.verificationIMG = this.api.verification + "?random=" + `${this.loginForm.random}`;
- },
- submit() {
- this.$post(this.api.logins, this.loginForm).then(({ data }) => {
- util.local.set(Setting.tokenKey, data.accessToken, Setting.tokenExpires)
- addRoutes(data.permissionList[0].children)
- util.successMsg('登录成功')
- this.setUserId(data.id || 1)
- this.setUserName(data.username)
- this.$router.push('/site')
- }).catch(res => {
- this.getVerImg()
- this.loginForm.captcha = ''
- })
- },
- phoneCountdown() {
- let count = 60;
- if (!this.phoneTimer) {
- this.phoneDisabled = true;
- this.phoneTimer = setInterval(() => {
- console.log("倒计时中");
- if (count > 0) {
- count--;
- this.phoneBtnText = `${count}秒后重试`;
- } else {
- this.phoneDisabled = false;
- clearInterval(this.phoneTimer);
- this.phoneTimer = null;
- this.phoneBtnText = `发送验证码`;
- }
- }, 1000);
- }
- },
- sendPhoneCode() {
- if (!this.phone) return util.warningMsg("请输入手机号");
- if (!/^1[3456789]\d{9}$/.test(this.phone)) return util.warningMsg("请输入正确的手机号");
- let data = {
- platform: Setting.platformId,
- phone: this.phone,
- types: 2
- };
- this.$post(this.api.sendPhoneOrEmailCode, data).then(res => {
- if (res.message.opener) {
- this.phoneCountdown();
- this.phoneOpener = res.message.opener;
- } else {
- util.errorMsg(res.message);
- }
- }).catch(res => {});
- },
- phoneSubmit() {
- if (!this.phone) return util.warningMsg("请输入手机号");
- if (!/^1[3456789]\d{9}$/.test(this.phone)) return util.warningMsg("请输入正确的手机号");
- if (!this.phoneCode) return util.warningMsg("请输入验证码");
- let data = {
- phone: this.phone,
- types: 2,
- captcha: this.phoneCode,
- opener: this.phoneOpener,
- platform: Setting.platformId,
- username: this.loginForm.username
- };
- this.$post(this.api.bindPhoneOrEmail, data).then(res => {
- util.successMsg("绑定成功");
- this.loginForm.phone = this.phone;
- this.phoneVisible = false;
+ phoneCountdown() {
+ let count = 60;
+ if (!this.phoneTimer) {
+ this.phoneDisabled = true;
+ this.phoneTimer = setInterval(() => {
+ console.log("倒计时中");
+ if (count > 0) {
+ count--;
+ this.phoneBtnText = `${count}秒后重试`;
+ } else {
+ this.phoneDisabled = false;
+ clearInterval(this.phoneTimer);
+ this.phoneTimer = null;
+ this.phoneBtnText = `发送验证码`;
+ }
+ }, 1000);
+ }
+ },
+ sendPhoneCode() {
+ if (!this.phone) return util.warningMsg("请输入手机号");
+ if (!/^1[3456789]\d{9}$/.test(this.phone)) return util.warningMsg("请输入正确的手机号");
+ let data = {
+ platform: Setting.platformId,
+ phone: this.phone,
+ types: 2
+ };
+ this.$post(this.api.sendPhoneOrEmailCode, data).then(res => {
+ if (res.message.opener) {
+ this.phoneCountdown();
+ this.phoneOpener = res.message.opener;
+ } else {
+ util.errorMsg(res.message);
+ }
+ }).catch(res => {});
+ },
+ phoneSubmit() {
+ if (!this.phone) return util.warningMsg("请输入手机号");
+ if (!/^1[3456789]\d{9}$/.test(this.phone)) return util.warningMsg("请输入正确的手机号");
+ if (!this.phoneCode) return util.warningMsg("请输入验证码");
+ let data = {
+ phone: this.phone,
+ types: 2,
+ captcha: this.phoneCode,
+ opener: this.phoneOpener,
+ platform: Setting.platformId,
+ username: this.loginForm.username
+ };
+ this.$post(this.api.bindPhoneOrEmail, data).then(res => {
+ util.successMsg("绑定成功");
+ this.loginForm.phone = this.phone;
+ this.phoneVisible = false;
- util.local.set(Setting.tokenKey, res.token, Setting.tokenExpires);
- let redirect = this.$route.query.redirect ? decodeURIComponent(this.$route.query.redirect) : "/index";
- this.$router.replace(redirect);
- util.successMsg("登录成功");
- this.queryCustomer();
- }).catch(res => {
- });
- }
+ util.local.set(Setting.tokenKey, res.token, Setting.tokenExpires);
+ let redirect = this.$route.query.redirect ? decodeURIComponent(this.$route.query.redirect) : "/index";
+ this.$router.replace(redirect);
+ util.successMsg("登录成功");
+ this.queryCustomer();
+ }).catch(res => {
+ });
}
+ }
};