From 16d22b5c055e6221c5a9d8a1904f52264a3dcfcb Mon Sep 17 00:00:00 2001
From: zhangyongtian <1181606322@qq.com>
Date: Fri, 13 Sep 2024 20:53:37 +0800
Subject: [PATCH] Merge branch 'master' of http://120.79.193.119:9090/r/gzzfw/frontEnd/gzDyh

---
 gz-wxparty/pages/homePage/index.js |  196 +++++++++++++++++++++++--------------------------
 1 files changed, 92 insertions(+), 104 deletions(-)

diff --git a/gz-wxparty/pages/homePage/index.js b/gz-wxparty/pages/homePage/index.js
index f101002..e2e201e 100644
--- a/gz-wxparty/pages/homePage/index.js
+++ b/gz-wxparty/pages/homePage/index.js
@@ -53,7 +53,14 @@
     imgUrl: $$.url.img,
     agreementMsg: '', // 服务协议
     popupVisible: false,
-    banner: [`${$$.url.img}banner-1.png`, `${$$.url.img}banner-2.jpg`, `${$$.url.img}banner-3.jpg`], // 轮播图
+    banner: [{
+      image: `${$$.url.img}Banner1.png`,
+      image1: `${$$.url.img}banner4.png`
+    }, {
+      image: `${$$.url.img}Banner2.png`,
+      image1: `${$$.url.img}banner3.png`
+    }], // 轮播图
+    // banner: [`${$$.url.img}Banner1.png`, `${$$.url.img}Banner2.png`, `${$$.url.img}banner3.png`, `${$$.url.img}banner4.png`], // 轮播图
     countUnitData: {}, //化解资源
     userInfo: {}, //用户信息
     video: [], // 热门视频
@@ -74,6 +81,7 @@
   // 跳转资讯链接
   goSeeMessage(e) {
     let url = e.currentTarget.dataset.url;
+    console.log('url', url);
     wx.navigateTo({
       url: '../webview/index?showUrl=' + url
     });
@@ -232,112 +240,74 @@
     }
   },
 
-  async dd() {
-    $$.showLoading();
-    wx.login({
-      async success(res) {
-        if (res.code) {
-          const accountInfo = wx.getAccountInfoSync();
-          const submitData = {
-            appid: accountInfo.miniProgram.appId,
-            code: res.code,
-          }
-          const res1 = await loginApi(submitData);
-          if (res1.type) {
-            console.log(res1.data, 'res1111')
-            if (res1.data.state === '1') {
-              $$.hideLoading();
-              console.log(res1, 'res1');
-              wx.setStorage({
-                key: 'userInfo',
-                data: res1.data
-              });
-              app.globalData.token = res1.data.token;
-              $$.showToast({
-                title: '登录成功',
-                icon: 'success'
-              });
-              await $$.sleep();
-              wx.reLaunch({
-                url: '../../pages/homePage/index',
-              });
+  // 前往查看
+  AiModalClick(e) {
+    let item = e.currentTarget.dataset.item;
+    wx.navigateTo({
+      url: '../../pages/AIAide/index?caseDes=' + item.caseDes + '&caseClaim=' + item.caseClaim + '&caseId=' + item.caseId
+    });
+    this.setData({
+      AiModal: false
+    })
+  },
 
-            } else {
-              $$.hideLoading();
-              app.globalData.access_token = wx.getStorageSync('access_token');
-              $$.showModal({
-                title: '提示',
-                content: '您尚未注册,是否前往注册?',
-                cancelText: '取消',
-                confirmText: '前往',
-                success: (res) => {
-                  if (res.confirm) {
-                    $$.showLoading();
-                    wx.getUserProfile({
-                      desc: '完善用户信息',
-                      complete(res) {
-                        if (res.errMsg === 'getUserProfile:ok') {
-                          wx.login({
-                            async success(res2) {
-                              if (res2.code) {
-                                const accountInfo = wx.getAccountInfoSync();
-                                const submitData = {
-                                  appid: accountInfo.miniProgram.appId,
-                                  code: res2.code,
-                                  avatar: res?.userInfo.avatarUrl,
-                                  encryptedData: res.encryptedData,
-                                  ivStr: res.iv,
-                                };
-                                const res3 = await registerApi(submitData);
-                                $$.hideLoading();
-                                if (res3.type) {
-                                  wx.setStorage({
-                                    key: 'userInfo',
-                                    data: res3.data
-                                  });
-                                  app.globalData.token = res3.data.token;
-                                  $$.showToast({
-                                    title: '登录成功',
-                                    icon: 'success'
-                                  });
-                                  await $$.sleep();
-                                  wx.reLaunch({
-                                    url: '../../pages/homePage/index',
-                                  });
-                                }
-                              } else {
-                                $$.hideLoading();
-                                $$.showToast('登录失败,请稍后重试');
-                              }
-                            },
-                          });
-                        } else {
-                          $$.hideLoading();
-                          $$.showToast({
-                            title: '抱歉!授权失败'
-                          });
-                        }
-                      },
-                    });
+  // 关闭AI弹窗
+  addClosePopup() {
+    this.setData({
+      AiModal: false
+    })
+  },
 
-                    // wx.navigateTo({
-                    //     url: '../../pages/login/index',
-                    // });
-                  } else {
-                    wx.navigateBack({
-                      delta: 1,
-                    });
-                  }
-                },
-              });
-            }
-          }
+  // 登录,获取用户信息
+  async handleGetUserInfo() {
+
+    wx.getUserProfile({
+      desc: '完善用户信息',
+      complete(res) {
+        if (res.errMsg === 'getUserProfile:ok') {
+          wx.login({
+            async success(res2) {
+              if (res2.code) {
+                const accountInfo = wx.getAccountInfoSync();
+                const submitData = {
+                  appid: accountInfo.miniProgram.appId,
+                  code: res2.code,
+                  avatar: res?.userInfo.avatarUrl,
+                  encryptedData: res.encryptedData,
+                  ivStr: res.iv,
+                };
+                $$.showLoading();
+                const res3 = await registerApi(submitData);
+                $$.hideLoading();
+                if (res3.type) {
+                  wx.setStorage({
+                    key: 'userInfo',
+                    data: res3.data
+                  });
+                  app.globalData.token = res3.data.token;
+                  $$.showToast({
+                    title: '登录成功',
+                    icon: 'success'
+                  });
+                  await $$.sleep();
+                  wx.reLaunch({
+                    url: '../../pages/homePage/index',
+                  });
+                }
+              } else {
+                $$.hideLoading();
+                $$.showToast('登录失败,请稍后重试');
+              }
+            },
+          });
         } else {
           $$.hideLoading();
-          $$.showToast('登录失败,请稍后重试');
+          $$.showToast({
+            title: '抱歉!授权失败'
+          });
         }
-      }
-    })
+      },
+    });
   },
 
   /**
@@ -346,10 +316,28 @@
   onLoad: function (options) {},
 
   onShow(options) {
-    if (!$$.userTest('login')) {
-      return
+    if (!app.globalData.token) {
+      $$.showModal({
+        content: '抱歉您未登录,是否前往登录?',
+        success: (res) => {
+          if (res.confirm) {
+            this.handleGetUserInfo();
+          }
+        },
+      });
+      return;
     }
+    // this.getUserInfo()
     let userInfo = wx.getStorageSync('userInfo') || {};
+    let AICase = wx.getStorageSync('AICase') || '';
+    if (AICase) {
+      this.setData({
+        AiModal: AICase
+      })
+      wx.removeStorage({
+        key: 'AICase'
+      })
+    }
     let appid = wx.getAccountInfoSync().miniProgram.appId;
     this.setData({
       userInfo

--
Gitblit v1.8.0