''
liukangdong
2024-07-29 d2212709606b4e2af14d6a874f5f827767d7411c
''
已添加1个文件
已修改11个文件
已重命名1个文件
180 ■■■■ 文件已修改
wechat_jiaxuan/app.js 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_jiaxuan/package.json 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_jiaxuan/pages/detailDis/case.js 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_jiaxuan/pages/detailDis/product.js 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_jiaxuan/pages/detailDis/realpic.js 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_jiaxuan/pages/index/index.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_jiaxuan/utils/login-sdk.js 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_staff/components/detailFooter/index.less 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_staff/components/detailFooter/index.wxss 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_staff/pages/detailDis/case.wxml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_staff/pages/detailDis/product.js 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_staff/pages/detailDis/realpic.wxml 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
wechat_staff/static/icon/ic_select_sel@2x.png 补丁 | 查看 | 原始文档 | blame | 历史
wechat_jiaxuan/app.js
@@ -1,11 +1,14 @@
import {
  wxLoginCustomer
} from './api/index'
App({
  globalData: {
import CustomHook from 'spa-custom-hooks';
let globalData = {
  token: '',
    primary: '#B08771',
    bottomLift: ''
  },
}
App({
  globalData,
  onLaunch: function (op) {
    console.log('options', op.query.scene)
    let pathMap = [
@@ -23,24 +26,25 @@
    // æŽˆæƒç™»å½•
    wx.login({
      timeout: 5000,
      success(res) {
      success: (res) => {
        if (res.code) {
          //发起网络请求
          wxLoginCustomer({
            code: res.code
          }).then(res => {
            console.log(res)
            if (res && res.data.member) {
              wx.setStorageSync('member', res.data.member)
              wx.setStorageSync('openid', res.data.member.openid)
              wx.setStorageSync('sessionKey', res.data.sessionKey)
              wx.setStorageSync('token', res.data.token)
            this.globalData.token = res.data.token
              if (op.query.scene) {
                let temp = op.query.scene.split('_')
                wx.navigateTo({
                  url: `${pathMap[temp[1]]}?id=${temp[0]}&userId=${temp[2]}`,
                })
              }
            console.log('拿到token了', res.data.token);
            if (res && res.data.member) {
              wx.setStorageSync('member', res.data.member)
              wx.setStorageSync('openid', res.data.member.openid)
              wx.setStorageSync('sessionKey', res.data.sessionKey)
            } else {
              console.log('登录失败!')
            }
@@ -58,3 +62,13 @@
  }
})
CustomHook.install({
  'Login':{
     name:'Login',
     watchKey: 'token',
     onUpdate(val){
       //有token则触发此钩子
       return !!val;
     }
   }
 }, globalData || 'globalData')
wechat_jiaxuan/package.json
@@ -7,6 +7,7 @@
    "@vant/weapp": "^1.11.6",
    "hy-event-store": "^1.3.1",
    "mp-html": "^2.5.0",
    "spa-custom-hooks": "^1.2.2",
    "vant-weapp": "^0.5.28"
  },
  "scripts": {
wechat_jiaxuan/pages/detailDis/case.js
@@ -9,10 +9,13 @@
    origin: '',
    showShare: false
  },
  /**
   * ç”Ÿå‘½å‘¨æœŸå‡½æ•°--监听页面加载
   */
  onLoadLogin(options){
    this.getDetail(options.id, options.userId || '')
    actionDo({
      actionType: 'view',
      id: options.id
    })
  },
  onLoad(options) {
    var app = getApp().globalData
    this.setData({
@@ -21,11 +24,6 @@
    if(options.origin && options.origin == 'b'){
      this.setData({ origin: 'b' })
    }
    this.getDetail(options.id, options.userId || '')
    actionDo({
      actionType: 'view',
      id: options.id
    })
    const member = wx.getStorageSync('member')
    this.setData({id: options.id, member})
  },
wechat_jiaxuan/pages/detailDis/product.js
@@ -1,10 +1,8 @@
import {
  shareContent,
  getProductInfo,
  actionDo
} from '../../api/index'
Page({
  /**
   * é¡µé¢çš„初始数据
   */
@@ -17,9 +15,13 @@
    member: {},
    showShare: false
  },
  /**
   * ç”Ÿå‘½å‘¨æœŸå‡½æ•°--监听页面加载
   */
  onLoadLogin(options){
    this.getDetail(options.id, options.userId || '')
    actionDo({
      actionType: 'view',
      id: options.id
    })
  },
  onLoad(options) {
    var app = getApp().globalData
    this.setData({
@@ -28,11 +30,6 @@
    if(options.origin && options.origin == 'b'){
      this.setData({ origin: 'b' })
    }
    this.getDetail(options.id, options.userId || '')
    actionDo({
      actionType: 'view',
      id: options.id
    })
    const member = wx.getStorageSync('member')
    this.setData({
      id: options.id,
@@ -40,7 +37,6 @@
    })
  },
  bindchange(e) {
    console.log('e', e.detail );
    this.setData({ current: e.detail.current })
  },
  priviewBanner(e) {
wechat_jiaxuan/pages/detailDis/realpic.js
@@ -1,9 +1,5 @@
import { getRealcaseInfo, actionDo } from '../../api/index'
Page({
  /**
   * é¡µé¢çš„初始数据
   */
  data: {
    bottomLift: 0,
    id: '',
@@ -13,9 +9,13 @@
    showShare: false
  },
  /**
   * ç”Ÿå‘½å‘¨æœŸå‡½æ•°--监听页面加载
   */
  onLoadLogin(options){
    this.getDetail(options.id, options.userId || '')
    actionDo({
      actionType: 'view',
      id: options.id
    })
  },
  onLoad(options) {
    var app = getApp().globalData
    this.setData({
@@ -24,11 +24,6 @@
    if(options.origin && options.origin == 'b'){
      this.setData({ origin: 'b' })
    }
    this.getDetail(options.id, options.userId || '')
    actionDo({
      actionType: 'view',
      id: options.id
    })
    const member = wx.getStorageSync('member')
    this.setData({id: options.id, member})
  },
wechat_jiaxuan/pages/index/index.js
@@ -12,6 +12,7 @@
  HYEventBus
} = require('hy-event-store')
const eventBus = new HYEventBus()
const app = getApp()
Page({
  /**
@@ -48,6 +49,11 @@
    HOME_CLASS_B2: '',
    HOME_CLASS_C: '',
  },
  onLoadLogin(options){
    // å·²ç»ç™»å½•,可以走依赖token的逻辑了
    console.log('首页的onLoadLogin',options,`{"token":"${app.globalData.token}"}`);
    this.initData()
  },
  onShow() {
    let that = this
    const member = wx.getStorageSync('member')
@@ -70,9 +76,6 @@
  onLoad(options) {
    const member = wx.getStorageSync('member')
    this.initDictData()
    setTimeout(() => {
      this.initData()
    }, 1200)
  },
  changePath(e) {
    let index = e.currentTarget.dataset.type
wechat_jiaxuan/utils/login-sdk.js
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,67 @@
let isLogin = false;
// å‘布订阅模式
class Publisher {
  constructor() {
    this.map = new Map();
  }
  on(key, callback) {
    let arr = this.map.get(key) || [];
    arr.push(callback);
    this.map.set(key, arr);
  }
  emit(key, data = {}) {
    if (this.map.has(key)) {
      this.map.get(key).forEach((item) => {
        item.call(this, data);
      });
    }
  }
}
let publisher = new Publisher();
// é¡µé¢æ‰©å±•
const oldPage = Page;
Page = function (pageParams) {
  const { onLoad, onShow, onReady } = pageParams;
  pageParams.onLoad = function (params) {
    // åˆ¤æ–­æ˜¯å¦ç™»é™†
    if (isLogin) {
      onLoad && onLoad.call(this, params);
    } else {
      publisher.on("login", () => {
        isLogin = true;
        onLoad && onLoad.call(this, params);
      });
    }
  };
  pageParams.onShow = function () {
    // åˆ¤æ–­æ˜¯å¦ç™»é™†
    if (isLogin) {
      onShow && onShow.call(this);
    } else {
      publisher.on("login", () => {
        onShow && onShow.call(this);
      });
    }
  };
  pageParams.onReady = function () {
    // åˆ¤æ–­æ˜¯å¦ç™»é™†
    if (isLogin) {
      onReady && onReady.call(this);
    } else {
      publisher.on("login", () => {
        onReady && onReady.call(this);
      });
    }
  };
  return oldPage(pageParams);
};
module.exports = {
  publisher,
};
wechat_staff/components/detailFooter/index.less
@@ -67,7 +67,7 @@
    height: 264rpx;
    display: flex;
    align-items: center;
    padding: 0 40rpx;
    padding: 0 60rpx;
    .item{
      display: flex;
      flex-direction: column;
@@ -89,7 +89,7 @@
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1rpx solid #e5e5e5;
    border-top: 1rpx solid #e5e5e5;
  }
}
.shade{
wechat_staff/components/detailFooter/index.wxss
@@ -64,7 +64,7 @@
  height: 264rpx;
  display: flex;
  align-items: center;
  padding: 0 40rpx;
  padding: 0 60rpx;
}
.shade_modal .btns .item {
  display: flex;
@@ -86,7 +86,7 @@
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1rpx solid #e5e5e5;
  border-top: 1rpx solid #e5e5e5;
}
.shade {
  position: fixed;
wechat_staff/pages/detailDis/case.wxml
@@ -1,6 +1,7 @@
<view class="container">
<view>
  <buoyClient showPurpose="1" class="buoyClient"/>
  <detailFooter bindenjoy="handleEnjoy" path="1" info="{{info}}" />
  <view class="container">
  <view class="main_title">{{ info.title }}</view>
  <view class="time">发布时间:{{ info.publishDt }}</view>
  <view class="fullview_wrap">
@@ -23,6 +24,7 @@
      <view class="content">{{ item.spaceDesc }}</view>
    </view>
  </view>
  </view>
  <!-- footer -->
  <view class="footer" style="padding-bottom: {{bottomLift}}px;">
    <view class="btns">
wechat_staff/pages/detailDis/product.js
@@ -97,7 +97,6 @@
    })
  },
  bindchange(e) {
    console.log('e', e.detail );
    this.setData({ current: e.detail.current })
  },
  priviewSpace(e) {
wechat_staff/pages/detailDis/realpic.wxml
@@ -1,11 +1,14 @@
<view class="container">
<view>
  <buoyClient showPurpose="1" class="buoyClient"/>
  <detailFooter bindenjoy="handleEnjoy" path="2" info="{{info}}" />
  <!--  -->
  <view class="container">
  <view class="main_title">{{ info.title }}</view>
  <view class="time">发布时间:{{ info.publishDt }}</view>
  <image data-url="{{ item }}" bindtap="priviewSpace" class="info_item" wx:for="{{ info.contentImgList }}" src="{{ item }}" mode="widthFix"></image>
  <view class="desc">{{ info.contentText || '' }}</view>
  </view>
  <!-- <view class="list">
    <view class="item">
      <image src="" mode="widthFix" />
wechat_staff/static/icon/ic_select_sel@2x.png