Commit 4e1068ed by 杨北旺

小程序短链添加校验

1 parent 70dfa281
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div class="short-link-container"> <div class="short-link-container">
<div class="title">小程序短链</div> <div class="title">小程序短链</div>
<div class="wrapper"> <div class="wrapper">
<glsxCombiForm :isInline="false" labelWidth="154px" defaultWidth="474px" :formObj="editForm" :formData="editFormDataPro"> <glsxCombiForm :isInline="false" :formRules="editRule" labelWidth="154px" defaultWidth="474px" :formObj="editForm" :formData="editFormDataPro">
<div slot="tip" class="tip_widget"> <div slot="tip" class="tip_widget">
<div class="left">常用页面路径:</div> <div class="left">常用页面路径:</div>
<div class="right"> <div class="right">
...@@ -46,7 +46,7 @@ const MINI = [ ...@@ -46,7 +46,7 @@ const MINI = [
}, },
{ {
confId: DJ_MINI_APPID, confId: DJ_MINI_APPID,
confName: '嘀加智享车生活' confName: '车生活助手'
}, },
{ {
confId: DJ_MINI_BEAT_APPID, confId: DJ_MINI_BEAT_APPID,
...@@ -125,6 +125,7 @@ export default { ...@@ -125,6 +125,7 @@ export default {
optionList: MINI, optionList: MINI,
changeAttr: val => { changeAttr: val => {
this.resetShortLink() this.resetShortLink()
this.resetPartQuery()
} }
}, },
{ {
...@@ -149,9 +150,9 @@ export default { ...@@ -149,9 +150,9 @@ export default {
inputBlur:(e)=>{ inputBlur:(e)=>{
let target = MINIPAGELIST.find(item => (item.confId==this.editForm.path && item.pageType==1)) let target = MINIPAGELIST.find(item => (item.confId==this.editForm.path && item.pageType==1))
const href = window.location.host const href = window.location.host
this.editForm.query = (target && href.indexOf('cgacar') == -1) ? target.params : '' this.editForm.query = (target && this.editForm.miniPrograme!=GH_MINI_APPID) ? target.params : ''
const queryTarget = this.editFormDataPro.find(item => item.name==='query') const queryTarget = this.editFormDataPro.find(item => item.name==='query')
queryTarget.isDisabled = target && href.indexOf('cgacar') == -1 queryTarget.isDisabled = target && this.editForm.miniPrograme!=GH_MINI_APPID
} }
}, },
{ {
...@@ -163,7 +164,8 @@ export default { ...@@ -163,7 +164,8 @@ export default {
label: '商户号', label: '商户号',
name: 'merchantId', name: 'merchantId',
type: 'input', type: 'input',
isClear: true isClear: true,
maxlength:8
}, },
{ {
label: '页面参数', label: '页面参数',
...@@ -182,7 +184,21 @@ export default { ...@@ -182,7 +184,21 @@ export default {
name: 'links', name: 'links',
addHtml: 'links' addHtml: 'links'
}, },
] ],
editRule:{
miniPrograme:[{ required: true, message: '请选择小程序', trigger: 'change' }],
env:[{ required: true, message: '请选择小程序环境', trigger: 'change' }],
path:[{ required: true, message: '请输入小程序页面路径', trigger: 'change' }],
merchantId:[
{ required: true, message: '请输入小程序商户号', trigger: 'change' },
{
validator: (rule, value, callback) => {
return /^[-\\+]?([0-9]+\\.?)?[0-9]{8}$/.test(value) ? callback() : callback(new Error('请输入8位数字'))
},
trigger: 'change'
}
],
}
} }
}, },
watch: { watch: {
...@@ -200,7 +216,15 @@ export default { ...@@ -200,7 +216,15 @@ export default {
mounted() { mounted() {
}, },
methods: { methods: {
// 切换小程序appID重置参数
resetPartQuery(){
this.editForm.path = ''
this.editForm.query = ''
this.editForm.env = ''
this.editForm.merchantId = ''
const queryTarget = this.editFormDataPro.find(item => item.name==='query')
queryTarget.isDisabled = false
},
// 重置页面 // 重置页面
resetParam() { resetParam() {
this.editForm = { this.editForm = {
...@@ -212,6 +236,7 @@ export default { ...@@ -212,6 +236,7 @@ export default {
} }
this.shortLink = '' this.shortLink = ''
this.editFormDataPro[1].isDisabled = false this.editFormDataPro[1].isDisabled = false
this.resetPartQuery()
}, },
resetShortLink() { resetShortLink() {
this.shortLink = null this.shortLink = null
...@@ -236,6 +261,8 @@ export default { ...@@ -236,6 +261,8 @@ export default {
if (!env) return this.toastMessage('请选择环境') if (!env) return this.toastMessage('请选择环境')
if (!path) return this.toastMessage('请输入小程序页面路径') if (!path) return this.toastMessage('请输入小程序页面路径')
if (!merchantId) return this.toastMessage('请输入商户号') if (!merchantId) return this.toastMessage('请输入商户号')
if(merchantId.length<8)return this.toastMessage('请输入8位数的商户号')
if(!(/^[-\\+]?([0-9]+\\.?)?[0-9]{8}$/.test(merchantId)))return this.toastMessage('请输入8位数字的商户号')
let base_info = `merchantId=${merchantId}` let base_info = `merchantId=${merchantId}`
// if (miniPrograme == GH_MINI_APPID && !storeCode) return this.toastMessage('广汇小程序必须填入门店对应的sapCode') // if (miniPrograme == GH_MINI_APPID && !storeCode) return this.toastMessage('广汇小程序必须填入门店对应的sapCode')
// if (miniPrograme == GH_MINI_APPID && env == 3) return this.toastMessage('广汇小程序暂时没有预发布环境') // if (miniPrograme == GH_MINI_APPID && env == 3) return this.toastMessage('广汇小程序暂时没有预发布环境')
...@@ -244,7 +271,7 @@ export default { ...@@ -244,7 +271,7 @@ export default {
// } // }
let target = MINIPAGELIST.find(item => (item.confId==this.editForm.path && item.pageType==1)) let target = MINIPAGELIST.find(item => (item.confId==this.editForm.path && item.pageType==1))
const href = window.location.host const href = window.location.host
let otherPath = (target && href.indexOf('cgacar') == -1) ? target.djConfId : path let otherPath = (target && this.editForm.miniPrograme!=GH_MINI_APPID) ? target.djConfId : path
const params = { const params = {
envVersion: ENVVersion[env - 1], envVersion: ENVVersion[env - 1],
appId: miniPrograme, appId: miniPrograme,
...@@ -309,7 +336,7 @@ export default { ...@@ -309,7 +336,7 @@ export default {
border-radius: 4px; border-radius: 4px;
box-sizing: border-box; box-sizing: border-box;
padding: 10px 20px; padding: 10px 20px;
margin: 10px 0 0px 0; margin: 20px 0 0px 0;
// display: flex; // display: flex;
.left, .left,
.right_page_title { .right_page_title {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!