12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- var Parse = getApp().Parse;
- var Nova = getApp().Nova;
- Component({
- behaviors: [],
-
- properties: {
- options: null,
- },
- data: {
- list: [],
- },
- lifetimes: {
-
- attached: function () {
- console.log("diy-icongroup", this.data);
- },
- moved: function () { },
- detached: function () { },
- },
- ready: function () {
-
- console.log("ready");
- this.loadData();
- },
- pageLifetimes: {
-
- show: function () { },
- hide: function () { },
- resize: function () { },
- },
- methods: {
-
- async loadData() {
- await Nova.checkComponentsDataProperties(this);
- let list = await Nova.getBlockData(this.data.options.data);
- let { options } = this.data;
- console.log("图标组", options);
- console.log(list);
- let { data, src, style } = options;
- let { className, filter } = data;
- this.setData({
- list,
- style,
- className,
- filter,
- });
- },
-
- goNovaURL: async function (ev) {
- let item = ev.currentTarget.dataset.item;
- let url = "";
- if (item.url) {
- console.log(item.url);
- if (item.name) {
- url = item.url + '?title=' + item.name;
- } else {
- url = item.url
- }
- Nova.goNovaURL(url);
- return;
- }
- if (item.type == "shop") {
- url = `/nova-shop/pages/shop-list/index?title=${item.name}&cid=${item.objectId}`;
- } else if (item.type == "article") {
- let Article = new Parse.Query("Article");
- Article.select('objectId')
- Article.equalTo("category", item.objectId);
- let articles = await Article.find();
- if (articles && articles.length == 1) {
- url = `/common-page/pages/cates/article-detail/index?title=${item.name}&aid=${articles[0].objectId}`;
- } else if (articles && articles.length > 1) {
- url = `/common-page/pages/cates/article-list/index?title=${item.name}&cid=${item.objectId}`;
- }
- }
- Nova.goNovaURL(url);
- },
- },
- });
|