123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- const getHeight = require("../../../../utils/getRheRemainingHeight");
- const _Http = getApp().globalData.http;
- Component({
-
- properties: {
- },
- options: {
- addGlobalClass: true
- },
- lifetimes: {
- ready() {
- this.getList();
- getHeight.getHeight('.tabs', this).then(res => {
- this.setData({
- listHeight: res
- })
- });
- }
- },
-
- data: {
- listHeight: 0,
- tabActiveTitle: "列表",
- show: false,
- fileSelected: {},
- content: {
- "pageNumber": 1,
- "pageSize": 20,
- "parentid": 1,
- "pageTotal": 1,
- "where": {
- "condition": "",
- "sorttype": 2
- }
- },
- list: [],
- inTotal: 0,
- },
-
- methods: {
-
- getList(init = false) {
- if (init.detail != undefined) init = init.detail;
- if (init) this.setData({
- ['content.pageNumber']: 1
- })
- if (this.data.content.pageNumber > this.data.content.pageTotal) return;
- _Http.basic({
- "classname": "saletool.salematerial.salematerial",
- "method": (this.data.tabActiveTitle == '列表') ? "selectList" : "selectMyList",
- "content": this.data.content
- }).then(res => {
- this.selectComponent('#ListBox').RefreshToComplete();
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: "none"
- })
- this.setData({
- list: (res.pageNumber == 1) ? res.data : this.data.list.concat(res.data),
- ['content.pageNumber']: res.pageNumber + 1,
- ['content.pageTotal']: res.pageTotal,
- inTotal: res.total
- })
-
- })
- },
-
- searchInput({
- detail
- }) {
- this.setData({
- ['content.where.condition']: detail.trim()
- })
- this.getList(true)
- },
-
- searchClear() {
- this.setData({
- ['content.where.condition']: ""
- })
- },
-
- tabsChange({
- detail
- }) {
- this.setData({
- tabActiveTitle: detail.title
- })
- this.getList(true);
- },
-
- changeSwitch({
- detail
- }) {
- this.setData({
- ["content.where.sorttype"]: detail == '最新' ? 2 : 1
- })
- this.getList(true);
- },
-
- changeParentid(id) {
- this.setData({
- ['content.parentid']: id
- })
- },
-
- changeId({
- detail
- }) {
- console.log(detail)
- this.setData({
- fileSelected: detail,
- show: true
- })
- },
-
- closeShow() {
- this.setData({
- fileSelected: {},
- show: false
- })
- },
- addToFavorites() {
- console.log(this.data.fileSelected)
- _Http.basic({
- "classname": "system.attachment.MediaCenter",
- "method": "collectAttachment",
- "content": {
- "collecttype": "媒体中心",
- "attachmentid": this.data.fileSelected.attachmentid
- }
- }).then(res => {
- console.log(res)
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: "none"
- })
- this.closeShow();
- wx.showToast({
- title: '收藏成功',
- })
- })
- },
- }
- })
|