Commit 268c6669 authored by wangxuelai's avatar wangxuelai

'分享海报生成日签修改未完成成长记录和成就海报'

parent d7363f84
import { import {
LocalStorage, LocalStorage,
scenQueryGet scenQueryGet,
newScenQueryGet
} from '../../../utilities/index.js'; } from '../../../utilities/index.js';
import { import {
userShow, userShow,
...@@ -45,14 +46,23 @@ Page({ ...@@ -45,14 +46,23 @@ Page({
*/ */
onLoad: function (options) { onLoad: function (options) {
if (options.scene) { if (options.scene) {
let sceneQuery = scenQueryGet(options.scene); let sceneQuery = newScenQueryGet(options.scene);
const {t, ctd, d,p} = sceneQuery; if (sceneQuery.type == 1) {
this.setData({ const {t, ctd, d,p} = sceneQuery.queryObj;
tid: t, this.setData({
consumerId: ctd, tid: t,
d: d || '', consumerId: ctd,
p:p || '' d: d || '',
}) p:p || ''
})
} else if (sceneQuery.type == 2) {
this.setData({
tid: sceneQuery.queryObj[2],
consumerId: sceneQuery.queryObj[1],
d: '',
p: sceneQuery.queryObj[0]
})
}
} else { } else {
const { const {
tid, tid,
...@@ -65,6 +75,7 @@ Page({ ...@@ -65,6 +75,7 @@ Page({
d: d || '' d: d || ''
}) })
} }
console.log(this.data.p, this.data.p);
this.getThemeDetail(); this.getThemeDetail();
}, },
...@@ -121,7 +132,7 @@ Page({ ...@@ -121,7 +132,7 @@ Page({
}, },
getThemeDetail () { getThemeDetail () {
wx.showLoading(); wx.showLoading();
if(this.data.p){ if(this.data.p != 0){
unlockmodesdetail( this.data.tid).then((res) => { unlockmodesdetail( this.data.tid).then((res) => {
const {code, data} = res; const {code, data} = res;
wx.hideLoading(); wx.hideLoading();
...@@ -228,7 +239,7 @@ Page({ ...@@ -228,7 +239,7 @@ Page({
} }
}, },
goThemeIndex () { goThemeIndex () {
if(this.data.p){ if(this.data.p != 0){
wx.reLaunch({ wx.reLaunch({
url: `/src/pages/morethemeindex/index?id=${this.data.themeDetail.class_id}&tid=${this.data.tid}` url: `/src/pages/morethemeindex/index?id=${this.data.themeDetail.class_id}&tid=${this.data.tid}`
}) })
......
...@@ -28,7 +28,8 @@ import { ...@@ -28,7 +28,8 @@ import {
audioorigin, audioorigin,
scenQueryGet, scenQueryGet,
LocalStorage, LocalStorage,
imagify imagify,
newScenQueryGet
} from '../../../utilities/index.js'; } from '../../../utilities/index.js';
import { import {
unlockmodesdetail, unlockmodesdetail,
...@@ -160,19 +161,27 @@ Page({ ...@@ -160,19 +161,27 @@ Page({
const launchOptions = wx.getLaunchOptionsSync(); const launchOptions = wx.getLaunchOptionsSync();
const visitor = LocalStorage.getItem('visitor'); const visitor = LocalStorage.getItem('visitor');
if (options.scene) { if (options.scene) {
let sceneQuery = scenQueryGet(options.scene); // let sceneQuery = scenQueryGet(options.scene);
const { let sceneQuery = newScenQueryGet(options.scene);
t, if (sceneQuery.type == 1) {
c, const {
p t,
} = sceneQuery; c,
if (p == 7) {} p
this.setData({ } = sceneQuery.queryObj;
tid: t, if (p == 7) {}
cid: c, this.setData({
isQrcodeIn: true tid: t,
}) cid: c,
isQrcodeIn: true
})
} else if (sceneQuery.type == 2) {
this.setData({
tid: sceneQuery.queryObj[1],
cid: sceneQuery.queryObj[0],
isQrcodeIn: true
})
}
} else { } else {
const { const {
tid, tid,
......
...@@ -2,7 +2,8 @@ import { ...@@ -2,7 +2,8 @@ import {
LocalStorage, LocalStorage,
scenQueryGet, scenQueryGet,
audioorigin, audioorigin,
imagify imagify,
newScenQueryGet
} from '../../../utilities/index.js'; } from '../../../utilities/index.js';
import { import {
wxPreviewImage wxPreviewImage
...@@ -63,13 +64,20 @@ Page({ ...@@ -63,13 +64,20 @@ Page({
onLoad: function (options) { // Do some initialize when page load. onLoad: function (options) { // Do some initialize when page load.
const that = this; const that = this;
if (options.scene) { if (options.scene) {
let sceneQuery = scenQueryGet(options.scene); let sceneQuery = newScenQueryGet(options.scene);
const { if (sceneQuery.type == 1) {
t, const {
} = sceneQuery; t,
this.setData({ } = sceneQuery.queryObj;
tid: t || 0 this.setData({
}) tid: t || 0
})
} else if (sceneQuery.type == 2) {
this.setData({
tid: sceneQuery.queryObj[0] || 0
})
}
} else { } else {
const { const {
tid tid
......
...@@ -365,6 +365,27 @@ function scenQueryGet(str) { ...@@ -365,6 +365,27 @@ function scenQueryGet(str) {
} }
return queryObj; return queryObj;
} }
function newScenQueryGet(str) {
let _str = decodeURIComponent(str);
if (_str.indexOf('_') != -1) { // 海报生成新的scene
let queryArr = _str.split('_');
return {
type: 2,
queryObj: queryArr
};
} else { // 老的海报生成方式
let queryArr = _str.split('&');
let queryObj = {};
for (let i = 0, _length = queryArr.length; i < _length; i++) {
let arr = queryArr[i].split('=');
queryObj[arr[0]] = arr[1]
}
return {
type: 1,
queryObj
};
}
}
// 违规词 // 违规词
function matchBlacklist(text) { function matchBlacklist(text) {
const matched = []; const matched = [];
...@@ -548,4 +569,5 @@ export { ...@@ -548,4 +569,5 @@ export {
mediaimagify, mediaimagify,
transformOssVideofy, transformOssVideofy,
deepCopy, deepCopy,
newScenQueryGet,
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment