scanner: Add redirect option to index page
This commit is contained in:
parent
361be2ac19
commit
0b8e93c94b
@ -1245,6 +1245,10 @@ def mini_prog_entry_redirect(code, tid):
|
||||
key = 'mini-prog-entry.' + query
|
||||
path = sc.batch.mini_prog_entry_path or 'pages/index/index'
|
||||
env_version = sc.batch.mini_prog_entry_env_version or 'release'
|
||||
if path != "/pages/index/index":
|
||||
# the mplink path setting may not work for some reason, so we use
|
||||
# redirect param of the index page as a fallback
|
||||
query += '&redirect=' + path
|
||||
url = cache.get_or_set(key, lambda: mplink(query, path, env_version), 300)
|
||||
return redirect(url)
|
||||
|
||||
|
||||
@ -82,6 +82,13 @@ Page({
|
||||
gd.debug = true;
|
||||
}
|
||||
gd.tenant = options.tenant;
|
||||
if (options.redirect && options.redirect.length > 0) {
|
||||
console.log("Redirecting to", options.redirect);
|
||||
wx.redirectTo({
|
||||
url: options.redirect,
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.load_content(options.tenant);
|
||||
},
|
||||
|
||||
|
||||
@ -2,6 +2,13 @@
|
||||
"condition": {
|
||||
"miniprogram": {
|
||||
"list": [
|
||||
{
|
||||
"name": "index-redirect-to-chat",
|
||||
"pathName": "pages/index/index",
|
||||
"query": "redirect=/pages/chat/chat",
|
||||
"launchMode": "default",
|
||||
"scene": null
|
||||
},
|
||||
{
|
||||
"name": "chat",
|
||||
"pathName": "pages/chat/chat",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user