MCPcopy Create free account
hub / github.com/MankaiHuang/screen-visualization / changeParams

Function changeParams

public/iframe/lib/js/commonFun.js:177–225  ·  view source on GitHub ↗
(method, config, params, multLink, value)

Source from the content-addressed store, hash-verified

175 })
176 },
177 changeParams(method, config, params, multLink, value) {
178 // 根据切换的值改变对应的params或者url
179 if (method === 'get') {
180 // 获取url中type对应的值 typ.a
181 let type = null
182 if (multLink.customKey.includes(',') && Object.prototype.toString.call(value) === '[object Array]') {
183
184 multLink.customKey.split(',').forEach((key, index) => {
185 type = this.GetQueryString(key, config.url)
186 if (this.origin) {
187 // 匹配结果
188 this.sendMsg('linkKeyNotMatch', null, Boolean(type))
189 }
190 config.url = config.url.replace(`${key}=${type}`, `${key}=${value[index]}`)
191 })
192 } else {
193 type = this.GetQueryString(multLink.customKey, config.url)
194 if (multLink.customKey !== '') {
195 config.url = config.url.replace(`${multLink.customKey}=${type}`, `${multLink.customKey}=${value}`)
196 }
197 }
198
199 } else if (params.toString() !== '{}') {
200 if (multLink.customKey.includes(',') && Object.prototype.toString.call(value) === '[object Array]') {
201 multLink.customKey.split(',').forEach((key, index) => {
202 const type = this.objectUrlEval(params, key, false)
203 if (vm.origin) {
204 // 匹配结果
205 this.sendMsg('linkKeyNotMatch', null, Boolean(type))
206 }
207 config.url = config.url.replace(`${key}=${type}`, `${key}=${value[index]}`)
208 this.objectUrlEval(params, key, true, value[index])
209 })
210 } else {
211 if (multLink.customKey !== '') {
212 const result = this.objectUrlEval(params, multLink.customKey, false)
213 if (!result) {
214 const type = this.GetQueryString(multLink.customKey, config.body.request)
215 if (multLink.customKey !== '') {
216 config.body.request = config.body.request.replace(`${multLink.customKey}=${type}`, `${multLink.customKey}=${value}`)
217 }
218 } else {
219 this.objectUrlEval(params, multLink.customKey, true, value)
220 }
221
222 }
223 }
224 }
225 },
226 isHavetab() {
227 // 判断页面是否存在tab组件 若存在tab组件则获取其绑定的值
228 this.templateList.some(item => {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected