浏览代码

产品图片多种修改为轮播图

zhaoxiaohai 3 年之前
父节点
当前提交
802300ce4d

+ 17 - 3
components/My_MembersAndProducts/index.js

@@ -10,8 +10,8 @@ Component({
         },
         /* 图片 */
         attinfos: {
-            type: Object,
-            value:{}
+            type: Array,
+            value: []
         },
         /* 标题 */
         title: {
@@ -34,7 +34,7 @@ Component({
         radius: {
             type: String,
             value: '50%'
-        }
+        },
     },
     options: {
         addGlobalClass: true,
@@ -53,6 +53,20 @@ Component({
         /* 修改成员信息 */
         changeMessage() {
             this.triggerEvent("changeMessage")
+        },
+        /* 预览图片 */
+        viewImg(e) {
+            const {
+                index
+            } = e.target.dataset;
+            let data = [];
+            for (let i = 0; i < this.data.attinfos.length; i++) {
+                data[i] = this.data.attinfos[i].fobsurl
+            };
+            wx.previewImage({
+                current: index,
+                urls: data,
+            })
         }
     }
 })

+ 7 - 2
components/My_MembersAndProducts/index.wxml

@@ -1,10 +1,15 @@
 <view class="grey_rectangle" style="padding: 14rpx 30rpx;">
     <view class="grey_rectangle_box">
         <!-- 图片 -->
-        <view class="grey_rectangle_image" style="height: {{imgSize}}; width:{{imgSize}}; border-radius: {{radius}};">
-            <image wx:if="{{attinfos.fobsurl}}" src="{{attinfos.fobsurl}}" mode="aspectFill"></image>
+        <view class="grey_rectangle_image" wx:if="{{attinfos.length<=1}}" style="height: {{imgSize}}; width:{{imgSize}}; border-radius: {{radius}};">
+            <image wx:if="{{attinfos[0].fobsurl}}" src="{{attinfos[0].fobsurl}}" mode="aspectFill" data-index="0" catchtap="viewImg"></image>
             <image wx:else src="/static/tacitly-approve/MRproduct.png" mode="aspectFit"></image>
         </view>
+        <swiper wx:else class="grey_rectangle_image" autoplay circular style="height: {{imgSize}}; width:{{imgSize}}; border-radius: {{radius}};">
+            <swiper-item wx:for="{{attinfos}}">
+                <image src="{{item.fobsurl}}" data-index='{{index}}' catchtap="viewImg" mode="aspectFill"></image>
+            </swiper-item>
+        </swiper>
         <!-- 文本信息 -->
         <view class="grey_rectangle_text">
             <view class="grey_rectangle_text_title u-line-1">

+ 7 - 0
components/My_MembersAndProducts/index.wxss

@@ -17,6 +17,13 @@
     height: 100%;
 }
 
+.grey_rectangle_image swiper-item,
+.grey_rectangle_image swiper-item>image {
+    width: 100%;
+    height: 100%;
+}
+
+
 /* 文本 */
 .grey_rectangle_text {
     width: 360rpx;

+ 7 - 0
components/My_SearchInputBox/index.js

@@ -36,6 +36,10 @@ Component({
         invitation: {
             type: Boolean,
             value: false
+        },
+        /* 开启刷新 */
+        isOnShow: {
+            type: Function
         }
     },
 
@@ -66,10 +70,12 @@ Component({
         /* 跳转页面 */
         itemAdd() {
             if (this.data.route == 'product') {
+                this.triggerEvent("isOnShow");
                 wx.navigateTo({
                     url: '/pages/productManagement/change',
                 })
             } else if (this.data.route == 'team') {
+                this.triggerEvent("isOnShow");
                 wx.navigateTo({
                     url: '/pages/teamManagement/change',
                 })
@@ -81,6 +87,7 @@ Component({
         },
         /* 团队成员邀请 */
         InvitedToEnter() {
+            this.triggerEvent("isOnShow");
             wx.navigateTo({
                 url: '/pages/teamManagement/applyFor',
             })

+ 0 - 1
components/My_navBar/index.js

@@ -16,7 +16,6 @@ Component({
             const that = this;
             setTimeout(() => {
                 let data = getApp().globalData.account_list[wx.getStorageSync('userData').index];
-                console.log(data)
                 let userName = '';
                 (data.fbrand != null && data.fbrand != undefined) ? userName = data.fbrand + '-': userName = data.fname + '-';
                 userName += (data.frole ? data.frole : '未知');

+ 7 - 7
pages/login/index.js

@@ -411,7 +411,10 @@ Page({
             "errTips.fphonenumber": true
         });
         /* 倒计时中阻止 */
-        if (this.data.countDownTime != 60) return;
+        if (this.data.countDownTime != 60) return wx.showToast({
+            title: '请勿重复获取验证码',
+            icon: "none"
+        });
         this.setData({
             countDownTime: this.data.countDownTime - 1
         })
@@ -419,10 +422,7 @@ Page({
             "phonenumber": this.data.fphonenumber,
             "client": "wechat_customer"
         }).then(res => {
-            console.log(res)
-            this.setData({
-                password: res.msg.substring(res.msg.length - 6)
-            })
+            console.log("验证码", res)
             countDownTime1 = setInterval(() => {
                 if (this.data.countDownTime != 0) {
                     this.setData({
@@ -436,9 +436,9 @@ Page({
                 }
             }, 1000);
             wx.showToast({
-                title: res.msg.substring(res.msg.length - 6),
+                title: res.msg,
                 icon: "none",
-                duration: 8000
+                duration: 5000
             })
         })
     },

+ 1 - 1
pages/productManagement/change.js

@@ -155,7 +155,7 @@ Page({
         }
         /* 验证附件列表  */
         if (!_Verify.required(this.data.attinfos, "请上传产品图片")) {
-            errTips.fprodnum = true;
+            verify = false;
         }
         this.setData({
             errTips

+ 25 - 7
pages/productManagement/index.js

@@ -3,7 +3,6 @@ import {
 } from "../../utils/api";
 const _Http = new ApiModel();
 Page({
-
     /**
      * 页面的初始数据
      */
@@ -15,12 +14,14 @@ Page({
         loadMore: true, //加载更多
         fisadministrator: false, //是否主账号
         searchContent: "", //模糊搜索字段
+        onShowFlush: false, //是否触发onShow刷新
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
+        this.gettingData(this.data.active);
         this.setData({
             fisadministrator: (wx.getStorageSync('userData').fisadministrator == 1) ? true : false
         })
@@ -56,7 +57,8 @@ Page({
             active: e.detail.index,
             pageNumber: 1, //请求页号
             pageTotal: 1, //总页码
-            loadMore: true //加载更多
+            loadMore: true, //加载更多
+            productList: [],
         })
         this.gettingData(index, this.data.searchContent)
     },
@@ -84,12 +86,14 @@ Page({
             "content": {
                 "getdatafromdbanyway": true,
                 "pageNumber": this.data.pageNumber,
-                "pageSize": 20,
+                "pageSize": 8,
                 "where": where
             }
         }).then(res => {
-            if (res.msg != '成功') return;
-            console.log(res)
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            })
             /* 拼接列表 */
             let productList = [];
             if (this.data.pageNumber != 1) {
@@ -110,6 +114,8 @@ Page({
             index
         } = e.currentTarget.dataset;
         const data = JSON.stringify(this.data.productList[index])
+        //刷新页面
+        this.isOnShow();
         wx.navigateTo({
             url: '/pages/productManagement/change?data=' + data,
         })
@@ -120,12 +126,24 @@ Page({
     onReady: function () {
 
     },
-
+    //允许onshow刷新
+    isOnShow() {
+        console.log("调用")
+        this.setData({
+            onShowFlush: true
+        })
+    },
     /**
      * 生命周期函数--监听页面显示
      */
     onShow: function () {
-        this.gettingData(this.data.active)
+        //重新获取数据列表
+        if (this.data.onShowFlush) {
+            this.gettingData(this.data.active)
+            this.setData({
+                onShowFlush: false
+            })
+        }
     },
 
     /**

+ 9 - 34
pages/productManagement/index.wxml

@@ -1,49 +1,24 @@
 <!-- 搜索 -->
-<My_SearchInputBox bind:searchQuery="searchQuery" route="product" fisadministrator="{{fisadministrator}}"></My_SearchInputBox>
+<My_SearchInputBox bind:searchQuery="searchQuery" route="product" fisadministrator="{{fisadministrator}}" bindisOnShow='isOnShow'></My_SearchInputBox>
 <!-- 列表 -->
 <My_GeneralTemplate padBot="20rpx">
     <view class="product_list">
         <!-- tabs -->
         <van-tabs swipeable active="{{ active }}" bind:change="tabsChange" color="#4BBECF" title-active-color='#4BBECF'>
             <van-tab title="全部">
-                <!-- 占位 -->
-                <view style="height: 30rpx;"></view>
-                <!-- 滚动区域 -->
-                <scroll-view scroll-y="true" style="max-height: 60vh;" lower-threshold="500px" scroll-top="0px" bindscrolltolower="scrolltolower">
-                    <!-- 产品列表 -->
-                    <My_MembersAndProducts wx:for="{{productList}}" wx:key="{{item.tagents_productid}}" bind:changeMessage="changeProductMessage" data-index="{{index}}" attinfos="{{item.attinfos[0]}}" imgSize="120rpx" radius="8rpx" title="{{item.fprodname}}" twoRow="{{item.fintroduction}}" threeRow="{{item.ftag}}" fisadministrator="{{fisadministrator}}"></My_MembersAndProducts>
-                    <!-- 上拉到底,加载中样式 -->
-                    <van-loading wx:if="{{pageTotal>pageNumber}}" style="width: 100%;display: flex; justify-content: center;" size="24px" color="#4BBECF">加载中...</van-loading>
-                    <!-- 全部加载完成 -->
-                    <van-divider wx:else contentPosition="center">我也是有底线的</van-divider>
-                </scroll-view>
             </van-tab>
             <van-tab title="上架中">
-                <!-- 占位 -->
-                <view style="height: 30rpx;"></view>
-                <!-- 滚动区域 -->
-                <scroll-view scroll-y="true" style="max-height: 60vh;" bindscrolltolower="scrolltolower">
-                    <!-- 产品列表 -->
-                    <My_MembersAndProducts wx:for="{{productList}}" wx:key="{{item.tagents_productid}}" bind:changeMessage="changeProductMessage" data-index="{{index}}" attinfos="{{item.attinfos[0]}}" imgSize="120rpx" radius="8rpx" title="{{item.fprodname}}" twoRow="{{item.fintroduction}}" threeRow="{{item.ftag}}" fisadministrator="{{fisadministrator}}"></My_MembersAndProducts>
-                    <!-- 上拉到底,加载中样式 -->
-                    <van-loading wx:if="{{pageTotal>pageNumber}}" style="width: 100%;display: flex; justify-content: center;" size="24px" color="#4BBECF">加载中...</van-loading>
-                    <!-- 全部加载完成 -->
-                    <van-divider wx:else contentPosition="center">我也是有底线的</van-divider>
-                </scroll-view>
             </van-tab>
             <van-tab title="已下架">
-                <!-- 占位 -->
-                <view style="height: 30rpx;"></view>
-                <!-- 滚动区域 -->
-                <scroll-view scroll-y="true" style="max-height: 60vh;" bindscrolltolower="scrolltolower">
-                    <!-- 产品列表 -->
-                    <My_MembersAndProducts wx:for="{{productList}}" wx:key="{{item.tagents_productid}}" bind:changeMessage="changeProductMessage" data-index="{{index}}" attinfos="{{item.attinfos[0]}}" imgSize="120rpx" radius="8rpx" title="{{item.fprodname}}" twoRow="{{item.fintroduction}}" threeRow="{{item.ftag}}" fisadministrator="{{fisadministrator}}"></My_MembersAndProducts>
-                    <!-- 上拉到底,加载中样式 -->
-                    <van-loading wx:if="{{pageTotal>pageNumber}}" style="width: 100%;display: flex; justify-content: center;" size="24px" color="#4BBECF">加载中...</van-loading>
-                    <!-- 全部加载完成 -->
-                    <van-divider wx:else contentPosition="center">我也是有底线的</van-divider>
-                </scroll-view>
             </van-tab>
         </van-tabs>
+        <!-- 占位 -->
+        <view style="height: 30rpx;"></view>
+        <!-- 滚动区域 -->
+        <scroll-view scroll-y="true" style="max-height: 60vh;" scroll-top='500rpx' bindscrolltolower="scrolltolower">
+            <!-- 产品列表 -->
+            <My_MembersAndProducts wx:for="{{productList}}" wx:key="{{item.tagents_productid}}" bind:changeMessage="changeProductMessage" data-index="{{index}}" attinfos="{{item.attinfos}}" imgSize="120rpx" radius="8rpx" title="{{item.fprodname}}" twoRow="{{item.fintroduction}}" threeRow="{{item.ftag}}" fisadministrator="{{fisadministrator}}"></My_MembersAndProducts>
+            <My_pageReachBottom dummyStatus="{{productList.length>=1}}" loadMore="{{pageNumber>=pageTotal}}"></My_pageReachBottom>
+        </scroll-view>
     </view>
 </My_GeneralTemplate>

+ 4 - 0
pages/productManagement/index.wxss

@@ -1,3 +1,7 @@
 .product_list {
     padding: 0 30rpx;
 }
+
+page {
+    padding-bottom: 0;
+}

+ 22 - 3
pages/teamManagement/index.js

@@ -12,17 +12,21 @@ Page({
     data: {
         memberList: [], //成员列表
         fisadministrator: false, //是否主账号
+        onShowFlush: false
     },
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad: function (options) {},
+    onLoad: function (options) {
+        this.userList()
+    },
     /* 修改成员信息 */
     changeMemberMessage(e) {
         const {
             index
         } = e.currentTarget.dataset;
         const data = JSON.stringify(this.data.memberList[index]);
+        this.isOnShow();
         wx.navigateTo({
             url: './change?data=' + data,
         })
@@ -37,8 +41,15 @@ Page({
     /**
      * 生命周期函数--监听页面显示
      */
-    onShow: function () {
-        //获取成员列表
+    //允许onshow刷新
+    isOnShow() {
+        console.log("调用")
+        this.setData({
+            onShowFlush: true
+        })
+    },
+    //获取成员列表
+    userList() {
         _Http.basic({
             "accesstoken": wx.getStorageSync('userData').token,
             "classname": "customer.usercenter.teammsg.teammsg",
@@ -55,6 +66,14 @@ Page({
             })
         })
     },
+    onShow: function () {
+        if (this.data.onShowFlush) {
+            this.userList();
+            this.setData({
+                onShowFlush: false
+            })
+        }
+    },
     /* 排序 */
     compare(data) {
         return function (a, b) {

+ 2 - 2
pages/teamManagement/index.wxml

@@ -1,9 +1,9 @@
 <!-- 搜索 -->
-<My_SearchInputBox route="team" invitation fisadministrator="{{fisadministrator}}"></My_SearchInputBox>
+<My_SearchInputBox route="team" invitation fisadministrator="{{fisadministrator}}" bindisOnShow='isOnShow'></My_SearchInputBox>
 <!-- 列表 -->
 <My_GeneralTemplate>
     <view class="member_list">
-        <My_MembersAndProducts wx:for="{{memberList}}" data-index="{{index}}" bind:changeMessage="changeMemberMessage" title="{{item.fname}}" twoRow="身份/职位:{{item.frole!=null?item.frole:'未设置'}}" threeRow="{{'手机:'+item.fphonenumber}}" fisadministrator="{{fisadministrator}}" attinfos="{{item.attinfos[0]}}"></My_MembersAndProducts>
+        <My_MembersAndProducts wx:for="{{memberList}}" data-index="{{index}}" bind:changeMessage="changeMemberMessage" title="{{item.fname}}" twoRow="身份/职位:{{item.frole!=null?item.frole:'未设置'}}" threeRow="{{'手机:'+item.fphonenumber}}" fisadministrator="{{fisadministrator}}" attinfos="{{item.attinfos}}"></My_MembersAndProducts>
     </view>
     <van-empty wx:if="{{!memberList.length>=1}}" description="暂无数据" />
 </My_GeneralTemplate>