| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <template>
- <view></view>
- </template>
- <script>
- import tools from '../../common/tools';
- import cardfunc from '../../common/cardfunc';
- import {
- token,
- ossUrl
- } from '../../common/api';
- export default {
- data() {
- return {
- queryObj: {},
- queryString: "",
- token: "",
- ecId: 0, // 卡片id
- }
- },
- onLoad(query) { // 类型非必填,可自动推导
- console.log("onLoad");
- console.log(query);
- this.queryObj = query;
- this.queryString = tools.objectToQueryString(this.queryObj);
- // console.log(this.queryString);
- this.token = query["token"] ?? token;
- this.ecId = query["id"] ?? 0;
- cardfunc.init(this, this.token, this.ecId);
- cardfunc.userConfigQuery(this.userConfigQueryCallback);
- },
- methods: {
- userConfigQueryCallback(userconfig) {
- // console.log("[userConfigQueryCallback] userconfig:", userconfig);
- userconfig = cardfunc.parseCardConfig(userconfig);
- const tplTypeId = userconfig.tplInfo.tplTypeId; // 模板类型ID
- const ssctId = userconfig.tplInfo.ssctId; // 模板ID
- // const styleId = userconfig.tplInfo.styleId; // 模板样式ID
-
- let tplType = ""; // 模板类型
- let tpl = ""; // 模板
- if (tplTypeId == 1) {
- tplType = "tpl";
- if (ssctId > 0) {
- tpl = "style" + ssctId;
- }
- }
-
- if (tplType != "" && tpl != "") {
- const url = `/pages/${tplType}/${tpl}/index?${this.queryString}`;
- uni.reLaunch({
- url: url
- });
- } else {
- uni.showToast({
- title: `模板参数错误`,
- icon: 'none',
- duration: 3000
- });
- }
- },
- }
- }
- </script>
|