修改优惠券的编辑功能, 增加viewport的meta

This commit is contained in:
zhl 2021-05-20 15:34:36 +08:00
parent 50130eae38
commit 268eb1d959
2 changed files with 5 additions and 0 deletions

View File

@ -2,6 +2,7 @@
import request from '@/utils/request'
export interface IRewardData {
_id?: string
id?: number
rank?: number
rankEnd?: number

View File

@ -247,6 +247,10 @@ export default class extends Vue {
try {
await this.$refs.postForm.validate()
this.loading = true
if (this.postForm.content.search(/meta name=.+?viewport/) === -1) {
const metaStr = '\n<meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />\n'
this.postForm.content = this.postForm.content.replace('<head>', `<head>${metaStr}`)
}
const { data } = await saveCoupon(this.postForm)
this.postForm = data
if (this.postForm.validBegin && this.postForm.validEnd) {