From a09205214e5cb6803563cb06c6d9f58d68916b73 Mon Sep 17 00:00:00 2001
From: xusd <hugeinfo123>
Date: Mon, 16 Sep 2024 22:11:21 +0800
Subject: [PATCH] 调整网格调整,修正头部head数据传输逻辑
---
gz-wxparty/pages/homePage/index.js | 202 +++++++++++++++++++++++---------------------------
1 files changed, 93 insertions(+), 109 deletions(-)
diff --git a/gz-wxparty/pages/homePage/index.js b/gz-wxparty/pages/homePage/index.js
index 6dabba8..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
@@ -379,14 +367,10 @@
}
},
});
- let agreement = wx.getStorageSync('agreement');
// 获取弹窗信息提醒
if (app.globalData.token) {
- if (!agreement) {
- this.getAgreement();
- return;
- }
+
if (!$$.userTest('realName', 'bottom')) {
this.setData({
popupMsg: [{
--
Gitblit v1.8.0