liukangdong
2024-07-25 6810c281306cae6e02fbbb1478d780c823d08a33
‘’
已添加6个文件
已修改14个文件
477 ■■■■ 文件已修改
wechat_jiaxuan/app.js 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_jiaxuan/components/idCard/index.js 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_jiaxuan/components/idCard/index.json 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_jiaxuan/components/idCard/index.less 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_jiaxuan/components/idCard/index.wxml 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_jiaxuan/components/idCard/index.wxss 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_jiaxuan/pages/detailDis/product.js 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_jiaxuan/pages/detailDis/product.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_jiaxuan/pages/detailDis/product.less 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_jiaxuan/pages/detailDis/product.wxml 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_jiaxuan/pages/detailDis/product.wxss 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_jiaxuan/utils/config.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_staff/components/buoyClient/index.js 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_staff/components/detailFooter/index.js 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_staff/pages/detailDis/product.wxml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_staff/pages/download/index.js 122 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_staff/pages/download/index.less 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_staff/pages/download/index.wxml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_staff/pages/download/index.wxss 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_staff/utils/downloadSaveFile.js 141 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_jiaxuan/app.js
@@ -7,7 +7,7 @@
    bottomLift: ''
  },
  onLaunch: function (op) {
    console.log('options', op.query.scene);
    console.log('options', op.query.scene)
    let pathMap = [
      '/pages/detailDis/product',
      '/pages/detailDis/case',
@@ -18,7 +18,7 @@
    //获取当前设备信息
    const WindowInfo = wx.getWindowInfo()
    if (WindowInfo.safeArea.top > 20) {
      this.globalData.bottomLift = WindowInfo.screenHeight - WindowInfo.safeArea.bottom;
      this.globalData.bottomLift = WindowInfo.screenHeight - WindowInfo.safeArea.bottom
    }
    // æŽˆæƒç™»å½•
    wx.login({
@@ -36,9 +36,9 @@
              wx.setStorageSync('sessionKey', res.data.sessionKey)
              wx.setStorageSync('token', res.data.token)
              if(op.query.scene){
                let temp = op.query.scene.split('&')
                let temp = op.query.scene.split('_')
                wx.navigateTo({
                  url: `${pathMap[temp[1]]}?id=${temp[0]}`,
                  url: `${pathMap[temp[1]]}?id=${temp[0]}&userId=${temp[2]}`,
                })
              }
            } else {
wechat_jiaxuan/components/idCard/index.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,23 @@
// components/idCard/index.js
Component({
  /**
   * ç»„件的属性列表
   */
  properties: {
    users: Object
  },
  /**
   * ç»„件的初始数据
   */
  data: {
  },
  /**
   * ç»„件的方法列表
   */
  methods: {
  }
})
wechat_jiaxuan/components/idCard/index.json
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,4 @@
{
  "component": true,
  "usingComponents": {}
}
wechat_jiaxuan/components/idCard/index.less
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,56 @@
.user {
  width: 750rpx;
  padding: 0 40rpx;
  height: 148rpx;
  background: #FFFFFF;
  border-radius: 8rpx;
  padding: 0 30rpx;
  display: flex;
  align-items: center;
  .content {
    flex: 1;
    .name {
      font-size: 30rpx;
      margin-bottom: 12rpx;
    }
    .desc {
      font-size: 24rpx;
      color: #999999;
    }
  }
  .avatar {
    width: 80rpx;
    height: 80rpx;
    border-radius: 50%;
    margin-right: 24rpx;
  }
  .btns{
    display: flex;
    .item{
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      margin-left: 70rpx;
      .icon{
        width: 44rpx;
        height: 44rpx;
      }
    }
  }
  .btn {
    width: 118rpx;
    height: 56rpx;
    line-height: 52rpx;
    text-align: center;
    background: var(--themeColor);
    border-radius: 8rpx;
    font-weight: 500;
    font-size: 26rpx;
    color: #fff;
  }
}
wechat_jiaxuan/components/idCard/index.wxml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
<view class="user">
    <image class="avatar" src="{{ users.imgurlFull ? users.imgurlFull : '../../static/images/default_avatar.png' }}"></image>
    <view class="content">
      <view class="name">{{ users.name }}</view>
      <view class="desc">导购|{{ users.jobDate || 1 }}年经验</view>
    </view>
    <view class="btns">
      <view class="item">
        <image class="icon" src="../../static/icon/mingpian_bg_nianxian@2x.png"></image>
        <text>名片</text>
      </view>
      <view class="item">
        <image class="icon" src="../../static/icon/mingpian_bg_nianxian@2x.png"></image>
        <text>名片</text>
      </view>
    </view>
  </view>
wechat_jiaxuan/components/idCard/index.wxss
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,52 @@
.user {
  width: 750rpx;
  padding: 0 40rpx;
  height: 148rpx;
  background: #FFFFFF;
  border-radius: 8rpx;
  padding: 0 30rpx;
  display: flex;
  align-items: center;
}
.user .content {
  flex: 1;
}
.user .content .name {
  font-size: 30rpx;
  margin-bottom: 12rpx;
}
.user .content .desc {
  font-size: 24rpx;
  color: #999999;
}
.user .avatar {
  width: 80rpx;
  height: 80rpx;
  border-radius: 50%;
  margin-right: 24rpx;
}
.user .btns {
  display: flex;
}
.user .btns .item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-left: 70rpx;
}
.user .btns .item .icon {
  width: 44rpx;
  height: 44rpx;
}
.user .btn {
  width: 118rpx;
  height: 56rpx;
  line-height: 52rpx;
  text-align: center;
  background: var(--themeColor);
  border-radius: 8rpx;
  font-weight: 500;
  font-size: 26rpx;
  color: #fff;
}
wechat_jiaxuan/pages/detailDis/product.js
@@ -23,7 +23,7 @@
    this.setData({
      bottomLift: app.bottomLift
    })
    this.getDetail(options.id)
    this.getDetail(options.id, options.userId || '')
    actionDo({
      actionType: 'view',
      id: options.id
@@ -52,9 +52,9 @@
      })
    })
  },
  getDetail(id) {
  getDetail(id, userId) {
    getProductInfo({
      id
      id, salesId: userId || null
    }).then(res => {
      this.setData({
        info: res.data
wechat_jiaxuan/pages/detailDis/product.json
@@ -2,6 +2,7 @@
  "usingComponents": {
    "van-popup": "@vant/weapp/popup/index",
    "authCard": "/components/authCard/authCard",
    "idCard": "../../components/idCard/index",
    "mp-html": "mp-html"
  },
  "navigationBarTitleText": ""
wechat_jiaxuan/pages/detailDis/product.less
@@ -7,7 +7,6 @@
  padding: 0 30rpx;
  display: flex;
  align-items: center;
  .content {
    flex: 1;
@@ -24,6 +23,7 @@
  .avatar {
    width: 80rpx;
    height: 80rpx;
    border-radius: 50%;
    margin-right: 24rpx;
  }
@@ -40,7 +40,9 @@
    color: #fff;
  }
}
.container{
  padding-bottom: 200rpx;
}
page {
  background-color: #f7f7f7;
}
wechat_jiaxuan/pages/detailDis/product.wxml
@@ -1,12 +1,6 @@
<view>
  <view class="user" wx:if="{{ false }}">
    <view class="avatar"></view>
    <view class="content">
      <view class="name">丁梓林</view>
      <view class="desc">导购|5年经验</view>
    </view>
    <view class="btn">联系TA</view>
  </view>
<view class="container">
  <!-- åç‰‡ -->
  <idCard users="{{ info.users }}" wx:if="{{ info.users && info.users.id }}" />
  <!-- banner轮播 -->
  <swiper class="banner_swiper" circular indicator-dots autoplay style="height:{{bannerHeight}}rpx" duration>
    <block wx:for="{{ info.bannerImgList }}">
wechat_jiaxuan/pages/detailDis/product.wxss
@@ -21,6 +21,7 @@
}
.user .avatar {
  width: 80rpx;
  height: 80rpx;
  border-radius: 50%;
  margin-right: 24rpx;
}
@@ -35,6 +36,9 @@
  font-size: 26rpx;
  color: #fff;
}
.container {
  padding-bottom: 200rpx;
}
page {
  background-color: #f7f7f7;
}
wechat_jiaxuan/utils/config.js
@@ -1,8 +1,8 @@
// export const baseUrl = 'https://jiaxuan.zbom.com/jx/wechat/' //正式服务器
// export const baseUrl = 'http://192.168.0.135:10027' // æœ¬åœ°
export const baseUrl = 'https://dmtest.ahapp.net/web_interface' //测试服务器
export const baseUrl = 'http://192.168.0.135:10027' // æœ¬åœ°
// export const baseUrl = 'https://dmtest.ahapp.net/web_interface' //测试服务器
// export const imageUrl = 'https://osswebcdn.zbom.com/jiaxuan/images/'
wechat_staff/components/buoyClient/index.js
@@ -29,7 +29,11 @@
          console.log(res.data)
          this.setData({ url: res.data })
          wx.navigateTo({
            url: '/pages/webView/index?link=' + res.data,
            url: '/pages/webView/index',
            success: function(res) {
              // é€šè¿‡eventChannel向被打开页面传送数据
              res.eventChannel.emit('acceptDataFromOpenerPage', { link: res.data })
            }
          })
        }) 
      }
wechat_staff/components/detailFooter/index.js
@@ -1,8 +1,6 @@
import {
  getContentShareImg
} from '../../api/index'
const { HYEventBus } = require('hy-event-store')
const eventBus = new HYEventBus()
Component({
  /**
   * ç»„件的属性列表
@@ -56,7 +54,7 @@
      } = this.data
      let that = this
      getContentShareImg({
        articleId: `${info.id}&${path}&${wx.getStorageSync('member').id}`,
        articleId: `${info.id}_${path}`,
        type: '1',
        // pageUrl: path,
        imgurl: info.coverImage,
@@ -97,6 +95,9 @@
    batchDown() {
      const downloadList = this.data.info.imageurlList || []
      wx.setStorageSync('downloadList', downloadList)
      wx.setStorageSync('downloadConfig', {
        path: this.data.path,id: this.data.info.id
      })
      wx.navigateTo({
        url: '/pages/download/index',
      }, 1000)
wechat_staff/pages/detailDis/product.wxml
@@ -1,6 +1,6 @@
<view class="main_app">
  <buoyClient showPurpose="1" />
  <detailFooter binddown="handleDown" bindenjoy="handleEnjoy" path="0" info="{{info}}" />
  <detailFooter bindenjoy="handleEnjoy" path="0" info="{{info}}" />
  <!-- banner轮播 -->
  <swiper class="banner_swiper" circular indicator-dots autoplay style="height:{{bannerHeight}}rpx" duration>
    <block wx:for="{{ info.bannerImgList }}">
wechat_staff/pages/download/index.js
@@ -1,6 +1,10 @@
// pages/download/index.js
const { HYEventBus } = require('hy-event-store')
const eventBus = new HYEventBus()
import {
  getContentShareImg
} from '../../api/index'
import {
  checkAuth,
  downloadSaveFile
} from '../../utils/downloadSaveFile'
Page({
  /**
@@ -9,6 +13,7 @@
  data: {
    bottomLift: '',
    downloadList: [],
    downloadConfig: {},
    checkedAll: false,
    showParam: false,
    takeQrcode: true
@@ -23,8 +28,68 @@
      bottomLift: app.bottomLift
    })
  },
  subDownload() {
    let that = this
    const downloadList = this.data.downloadList
    const downloadConfig = this.data.downloadConfig
    checkAuth(() => {
      wx.showLoading({
        title: '正在下载',
        mask: true
      })
      downloadList.forEach(item => {
        if (item.checked) {
          item.paddingStatus = 2
        }
      })
      this.setData({ downloadList })
      downloadList.forEach(item => {
        if (item.checked) {
          getContentShareImg({
            articleId: `${downloadConfig.id}_${downloadConfig.path}`,
            type: this.takeQrcode ? 1 : 0,
            imgurl: item.url
          }).then(res => {
            wx.downloadFile({
              url: res.data,
              success: res => {
                if (res.statusCode === 200) {
                  wx.saveImageToPhotosAlbum({
                    filePath: res.tempFilePath,
                    success: res => {
                      item.paddingStatus = 3
                      item.checked = false
                      that.setData({ downloadList })
                      wx.showToast({
                        title: '保存成功',
                        icon: "none"
                      })
                    },
                    fail: res => {
                      item.paddingStatus = 4
                      item.checked = false
                      that.setData({ downloadList })
                      wx.showToast({
                        title: '保存失败',
                        icon: "none"
                      })
                    }
                  })
                }
              }
            })
          })
        }
      })
    })
    this.setData({
      showParam: false
    })
  },
  onShow() {
    const downloadList = wx.getStorageSync('downloadList') || []
    const downloadConfig = wx.getStorageSync('downloadConfig') || {}
    let temp = downloadList.map(i => {
      // paddingStatus: 0未下载1正在下载2等待下载3下载完成
      return {
@@ -33,37 +98,43 @@
        checked: false
      }
    })
    this.setData({ downloadList: temp })
    this.setData({
      downloadList: temp,
      downloadConfig
    })
    setTimeout(() => {
      wx.setStorageSync('downloadList', [])
      wx.setStorageSync('downloadConfig', {})
    },500)
  },
  openParam() {
    const downloadList = this.data.downloadList.filter(i => i.checked)
    if(downloadList.length === 0) return wx.showToast({title: '请先选择要下载的海报', icon: 'none'})
    this.setData({ showParam: true })
    if (downloadList.length === 0) return wx.showToast({
      title: '请先选择要下载的海报',
      icon: 'none'
    })
    this.setData({
      showParam: true
    })
  },
  onClose() {
    this.setData({ showParam: false })
    this.setData({
      showParam: false
    })
  },
  downCheck(e) {
    const takeQrcode = e.currentTarget.dataset.flag
    console.log('takeQrcode', takeQrcode);
    this.setData({ takeQrcode })
  },
  subDownload() {
    const downloadList = this.data.downloadList
    downloadList.forEach(item => {
      if(item.checked){
      }
    this.setData({
      takeQrcode
    })
    this.setData({ showParam: false })
  },
  itemCheck(e) {
    const i = e.currentTarget.dataset.i
    const { downloadList, checkedAll } = this.data
    const {
      downloadList,
      checkedAll
    } = this.data
    let count = 0
    downloadList.forEach((item, index) => {
      if(index === i){
@@ -73,14 +144,23 @@
        count ++
      }
    })
    this.setData({ checkedAll: count == downloadList.length,  downloadList})
    this.setData({
      checkedAll: count == downloadList.length,
      downloadList
    })
  },
  allCheck() {
    const { downloadList, checkedAll } = this.data
    const {
      downloadList,
      checkedAll
    } = this.data
    downloadList.forEach(item => {
      item.checked = !checkedAll
    })
    this.setData({ checkedAll: !checkedAll, downloadList })
    this.setData({
      checkedAll: !checkedAll,
      downloadList
    })
  },
  onHide() {
wechat_staff/pages/download/index.less
@@ -1,7 +1,7 @@
.list{
  display: flex;
  flex-wrap: wrap;
  padding: 40rpx;
  padding: 40rpx 40rpx 200rpx;
  .item{
    width: 210rpx;
    height: 210rpx;
wechat_staff/pages/download/index.wxml
@@ -2,7 +2,7 @@
  <view class="list">
    <view wx:for="{{ downloadList }}" class="item">
      <image class="img" src="{{ item.url }}" mode="scaleToFill"></image>
      <view wx:if="{{ item.paddingStatus }}" class="shade">等待下载</view>
      <view wx:if="{{ item.paddingStatus == 2 }}" class="shade">等待下载</view>
      <image data-i="{{index}}" bindtap="itemCheck" wx:if="{{ item.checked }}" class="check" src="../../static/icon/ic_select_sel@2x.png"></image>
      <image wx:else data-i="{{index}}" bindtap="itemCheck" class="check" src="../../static/icon/ic_select.png"></image>
    </view>
wechat_staff/pages/download/index.wxss
@@ -1,7 +1,7 @@
.list {
  display: flex;
  flex-wrap: wrap;
  padding: 40rpx;
  padding: 40rpx 40rpx 200rpx;
}
.list .item {
  width: 210rpx;
wechat_staff/utils/downloadSaveFile.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,141 @@
// å°è£…一个方法 åœ¨utils中 åä¸º downloadSaveFile.js
// ä½¿ç”¨æ—¶ å¼•入(按照自己的路劲写)  import { downloadFiles} from '../../utils/downloadSaveFile'
function downloadFiles(type, urls) {
  checkAuth(() => {
    wx.showLoading({
      title: '正在下载',
      mask: true
    })
    for (let i = 0; i < urls.length; i++) {
      downloadSaveFile(
        urls[i],
      );
    }
  })
}
//下载文件
function downloadSaveFile(url, successc) {
  let isimg = 'bmp,jpg,png,tif,gif,pcx,tga,exif,fpx,svg,psd,cdr,pcd,dxf,ufo,eps,ai,raw,wmf, jpeg'.includes(url.split('.').slice(-1))
  if (isimg) {
  // å¦‚果是图片类型
    wx.downloadFile({
      url: url,
      success: res => {
        if (res.statusCode === 200) {
          wx.saveImageToPhotosAlbum({
            filePath: res.tempFilePath,
            success: res => {
              wx.showToast({
                title: '保存成功',
                icon: "none"
              })
            },
            fail: res => {
              wx.showToast({
                title: '保存失败',
                icon: "none"
              })
            }
          })
        }
      }
    })
  } else {
  // å¦‚果是视频类型
    wx.downloadFile({
      url: url,
      success: res => {
        if (res.statusCode === 200) {
          wx.saveVideoToPhotosAlbum({
            filePath: res.tempFilePath,
            success: res => {
              // successc && successc();
              wx.showToast({
                title: '保存成功',
                icon: "none"
              })
            },
            fail: res => {
                wx.showToast({
                title: '保存失败',
                icon: "none"
              })
            }
          })
        }
      }
    })
  }
}
//检查权限
function checkAuth(gotc) {
  //查询权限
  wx.showLoading({
    title: '检查授权情况',
    mask: true
  })
  wx.getSetting({
    success(res) {
      wx.hideLoading();
      if (!res.authSetting['scope.writePhotosAlbum']) {
        //请求授权
        wx.authorize({
          scope: 'scope.writePhotosAlbum',
          success() {
            //获得授权,开始下载
            gotc && gotc();
          },
          fail() {
            wx.showModal({
              title: '',
              content: '保存到系统相册需要授权',
              confirmText: '授权',
              success(res) {
                if (res.confirm) {
                  wx.openSetting({
                    success(res) {
                      if (res.authSetting['scope.writePhotosAlbum'] === true) {
                        gotc && gotc();
                      }
                    }
                  })
                }
              },
              fail() {
                wx.showToast({
                  title: '打开设置页失败',
                  icon: 'none',
                })
              }
            })
          }
        })
      } else {
        //已有授权
        gotc && gotc();
      }
    },
    fail() {
      wx.hideLoading();
      wx.showToast({
        title: '获取授权失败',
        icon: 'none',
      })
    }
  })
}
module.exports = {
  downloadFiles,
  checkAuth,
  downloadSaveFile
};