123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- <template>
- <view>
- <tabs ref="tabs" typename="renderingstype" @getList="getList" />
- <float-but @onClick="toUpload" />
- <My_listbox ref="List" @getlist="getList" :bottomHeight="70">
- <design-list ref="designList" :list="list" @toDetail="toDetail" />
- </My_listbox>
- </view>
- </template>
- <script>
- import tabs from "./tabs.vue";
- import designList from "../../../../components/designList.vue";
- export default {
- components: { tabs, designList },
- props: {
- pageType: {
- type: String,
- default: "设计",
- },
- },
- name: "design",
- data() {
- return {
- content: {
- where: {
- condition: "",
- style: "",
- space: "",
- spec: "",
- },
- },
- list: [],
- isInitialize: false,
- };
- },
- methods: {
- init() {
- if (this.isInitialize) return;
- this.setTypes();
- this.getList();
- },
- setTypes() {
- let types = [
- {
- value: "1",
- remarks: "全国精选",
- },
- ];
- //经销商和经销商员工
- if ([21, 22].includes(uni.getStorageSync("userMsg").usertype)) {
- types.push({
- value: "2",
- remarks: "门店" + this.pageType,
- });
- } else if (99 == uni.getStorageSync("userMsg").usertype) {
- //消费者
- } else {
- //其他
- types.push({
- value: "2",
- remarks: "门店" + this.pageType,
- });
- types.push({
- value: "3",
- remarks: "全国" + this.pageType,
- });
- }
- this.$refs.tabs.tabs = types;
- this.$refs.tabs.active = types[0].value;
- this.$refs.tabs.setWidths();
- },
- getList(init = false) {
- return new Promise((resolve, reject) => {
- if (this.paging(this.content, init)) return;
- let content = this.content;
- let ref = this.$refs.tabs;
- if (ref.active == null) this.setTypes();
- content.querytype = ref.active;
- content.where = {
- ...content.where,
- ...ref.where,
- type: this.pageType == "设计" ? "4" : "5",
- };
- this.$Http
- .basic({
- id: 20240417144702,
- content: this.content,
- })
- .then((res) => {
- resolve();
- this.$refs.List.RefreshToComplete();
- this.$refs.List.setHeight();
- console.log(`获取${this.pageType}列表`, res);
- if (this.cutoff(res.msg)) return;
- this.isInitialize = true;
- this.$refs.designList.handleList(res.data);
- this.list =
- res.pageNumber == 1 ? res.data : this.list.concat(res.data);
- this.content = this.$refs.List.paging(this.content, res);
- });
- });
- },
- updateList(data = null) {
- if (this.content.pageNumber && this.content.pageNumber >= 2) {
- let that = this;
- let content = this.paging(this.content, true, true);
- this.$Http
- .basic({
- id: "20240417144702",
- content,
- })
- .then((res) => {
- console.log("更新列表", res);
- if (this.cutoff(res.msg)) return;
- res.data = res.data.map((v) => {
- v.cover = v.attinfos.length
- ? this.getSpecifiedImage(
- v.attinfos.find((s) => s.usetype == "sat_sharematerial") ||
- v.attinfos[0]
- )
- : uni.getStorageSync("site").logo || "";
- return v;
- });
- this.list = res.data;
- this.$refs.List.paging(content, res, true);
- if (data) handle();
- });
- function handle() {
- uni.showModal({
- title: "提示",
- content: "新建成功,是否立即查看",
- cancelText: "返回列表",
- confirmText: "查看详情",
- success: ({ confirm }) => {
- if (confirm) {
- let index = that.list.findIndex(
- (v) => v.sat_sharematerialid == data.sat_sharematerialid
- );
- if (index == -1) {
- uni.redirectTo({
- url: `/packageA/fullView/detail?id=${data.sat_sharematerialid}`,
- });
- that.$Http.setCount = null;
- } else {
- that.toDetail(index, 2);
- }
- } else {
- uni.navigateBack();
- }
- },
- });
- }
- }
- },
- toDetail(index, type = 1) {
- let item = this.list[index];
- if (type == 1) {
- uni.navigateTo({
- url: `/packageA/fullView/detail?id=${item.sat_sharematerialid}`,
- });
- } else {
- uni.redirectTo({
- url: `/packageA/fullView/detail?id=${item.sat_sharematerialid}`,
- });
- }
- this.$Http.setCount = function (detail) {
- item.collectcount = detail.collectcount;
- item.commentcount = detail.commentcount;
- item.likecount = detail.likecount;
- item.islike = detail.islike;
- item.iscollect = detail.iscollect;
- this.$set(this.list, index, item);
- }.bind(this);
- },
- toUpload() {
- uni.navigateTo({
- url: "/packageA/fullView/upload?pageType=" + this.pageType,
- });
- this.$Http.updateList = this.updateList.bind(this);
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- page,
- body {
- height: 100vh;
- overflow: hidden;
- }
- </style>
|