From 5e57deb4c7a53c3307f59b2267127b4dd7fd0b02 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期日, 29 九月 2024 15:05:10 +0800
Subject: [PATCH] ll

---
 wechat_jiaxuan/pages/consult/detail.js |   97 +++++++++++++++++++++++++++++++++++-------------
 1 files changed, 71 insertions(+), 26 deletions(-)

diff --git a/wechat_jiaxuan/pages/consult/detail.js b/wechat_jiaxuan/pages/consult/detail.js
index 5b4e6fb..1cfef91 100644
--- a/wechat_jiaxuan/pages/consult/detail.js
+++ b/wechat_jiaxuan/pages/consult/detail.js
@@ -1,37 +1,89 @@
-// pages/consult/detail.js
+import { actionDo, getProductNewsInfo, getMemberInfo } from '../../api/index'
 Page({
 
   /**
    * 椤甸潰鐨勫垵濮嬫暟鎹�
    */
   data: {
-    navTitle: '璇︽儏'
+    bottomLift: 0,
+    info: {},
+    detail: {},
+
+    origin: '',
+    showShare: false
   },
 
   /**
    * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍔犺浇
    */
+  onLoadLogin(options) {
+    this.getDetail(options.id, options.userId || '')
+  },
+  onShow(){
+    this.setData({ member: wx.getStorageSync('member') })
+  },
   onLoad(options) {
-
+    var app = getApp().globalData
+    this.setData({
+      bottomLift: app.bottomLift
+    })
+    if(options.origin && options.origin == 'b'){
+      this.setData({ origin: 'b' })
+    }
+    // this.getDetail(options.id, options.userId || '')
   },
-
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚
-   */
-  onReady() {
-
+  handleDesign() {
+    const { member, origin, info } = this.data
+    let path = '/pages/design/design'
+    if(origin != 'b' && info.users && info.users.id){
+      path = `/pages/design/design?name=${info.users.iamUsername}`
+    }
+    if (!member.phone) {
+      wx.setStorageSync('tempPath', path)
+      return wx.navigateTo({
+        url: '/pages/auth/auth',
+      })
+    }
+    wx.navigateTo({
+      url: path,
+    })
   },
-
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰鏄剧ず
-   */
-  onShow() {
-
+  onShareAppMessage() {
+    let { info } = this.data
+    console.log('鐐瑰嚮浜嗗垎浜�')
+    return {
+      path: '/pages/consult/detail?id=' + info.id + '&userId=' + info.users.id
+    }
   },
-
-  /**
-   * 鐢熷懡鍛ㄦ湡鍑芥暟--鐩戝惉椤甸潰闅愯棌
-   */
+  getDetail(id, userId) {
+    getProductNewsInfo({ id, salesId: userId || null }).then(res => {
+      this.setData({ info: res.data })
+      wx.setNavigationBarTitle({
+        title: res.data.title
+      })
+      if (userId) {
+        getMemberInfo().then(res => {
+          this.setData({
+            member: res.data
+          })
+          wx.setStorageSync('member', res.data)
+        })
+      }
+    })
+  },
+  openShare() {
+    this.setData({showShare: true})
+  },
+  handleShare() {
+    console.log('鐐瑰嚮浜嗗垎浜�');
+    actionDo({
+      actionType: 'share',
+      id: this.data.info.id
+    })
+  },
+  onClose() {
+    this.setData({showShare: false})
+  },
   onHide() {
 
   },
@@ -54,13 +106,6 @@
    * 椤甸潰涓婃媺瑙﹀簳浜嬩欢鐨勫鐞嗗嚱鏁�
    */
   onReachBottom() {
-
-  },
-
-  /**
-   * 鐢ㄦ埛鐐瑰嚮鍙充笂瑙掑垎浜�
-   */
-  onShareAppMessage() {
 
   }
 })
\ No newline at end of file

--
Gitblit v1.9.3