feat: 登录联调

This commit is contained in:
zc 2025-11-05 10:33:46 +08:00
parent 62446e075b
commit d4fecd7e9b
15 changed files with 302 additions and 248 deletions

View File

@ -7,18 +7,18 @@ const envVersion = accountInfo.miniProgram.envVersion || "trial";
const GDEnvs = {
develop: {
web: "https://tlth5.yijiesudai.com/unicom",
web: "https://h5.goudezhao.com",
host: "https://api.1024api.com",
mdHost: "https://tcomlog.yijiesudai.com",
},
trial: {
web: "https://tlth5.yijiesudai.com/unicom",
web: "https://h5.goudezhao.com",
host: "https://api.1024api.com",
mdHost: "https://tcomlog.yijiesudai.com",
},
release: {
web: "https://lth5.blingfintech.com/unicom",
host: "https://lth5.blingfintech.com",
web: "https://h5.goudezhao.com",
host: "https://api.1024api.com",
mdHost: "https://comlog.yijiesudai.com",
},
};

View File

@ -1,56 +1,64 @@
import { httpRequest } from '../../utils/request'
const baseUrl = require('../base').allBaseUrl.GDEnvs.host
import { httpRequest } from "../../utils/request";
const baseUrl = require("../base").allBaseUrl.GDEnvs.host;
// 获取图形验证码
export const apiGetCaptchaImage = () => {
return httpRequest.post<{
data: {
uuid: string
img: string
}
}>(`${baseUrl}/lt-web/xs/xcx/common/captchaImage`, {})
}
uuid: string;
img: string;
};
}>(`${baseUrl}/lt-web/xs/xcx/common/captchaImage`, {});
};
// 获取短信验证码
export const apiSendSms = (data: {
userName: string
imageCode: string
uuid: string
userName: string;
imageCode: string;
uuid: string;
}) => {
return httpRequest.post<{
code: string
msg: string
}>(`${baseUrl}/lt-web/xs/xcx/common/sendSms`, data)
}
code: string;
msg: string;
}>(`${baseUrl}/lt-web/xs/xcx/common/sendSms`, data);
};
// 获取微信唯一编码
export const apiGetWxUserCode = (data: { code: string }) => {
return httpRequest.post<{
code: string;
msg: string;
data: {
openid: string
}
}>(`${baseUrl}/lt-web/xs/xcx/common/getWxUserCode`, data)
}
buyer: { buyerId: number; flag: number; token: string };
};
}>(`${baseUrl}/api-interface/app/user/login`, data);
};
// 登录
type ManualLoginType = { loginType: number, userName: string, smsCode: string, openId: string }
type LoginTypeData = { loginType: number, openId: string, code: string }
export const apiLogin = <T extends LoginTypeData | ManualLoginType>(data: T) => {
type ManualLoginType = {
loginType: number;
userName: string;
smsCode: string;
openId: string;
};
type LoginTypeData = { loginType: number; openId: string; code: string };
export const apiLogin = <T extends LoginTypeData | ManualLoginType>(
data: T
) => {
return httpRequest.post<{
code: string,
msg: string,
code: string;
msg: string;
data: {
userId: string
uniqueCode: string
userName: string,
phone: string
authorizeToken: string
}
}>(`${baseUrl}/lt-web/xs/xcx/common/login`, data)
}
userId: string;
uniqueCode: string;
userName: string;
phone: string;
authorizeToken: string;
};
}>(`${baseUrl}/lt-web/xs/xcx/common/login`, data);
};
// 退出登录
export const apiLogout = () => {
return httpRequest.post(`${baseUrl}/lt-web/xs/xcx/common/logout`, {})
}
return httpRequest.post(`${baseUrl}/lt-web/xs/xcx/common/logout`, {});
};

View File

@ -2,7 +2,7 @@
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "优品尚",
"navigationBarTitleText": "购de着",
"navigationBarTextStyle": "black"
},
"sitemapLocation": "sitemap.json",
@ -12,13 +12,12 @@
"desc": "获取当前的模糊地理位置"
}
},
"requiredPrivateInfos": ["getFuzzyLocation"],
"pages": [
"pages/home/index",
"pages/login/index",
"pages/category/index",
"pages/shopping-cart/index",
"pages/mine/index",
"pages/login/index",
"pages/H5/index",
"pages/setup/index",
"pages/download/index"

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

View File

@ -170,7 +170,7 @@ Page({
onGoCommodity(e: WechatMiniprogram.TouchEvent) {
wx.navigateTo({
url: `/pages/H5/index?url=${encodeURIComponent(
`https://www.baidu.com?id=${e.currentTarget.dataset.id}`
`https://www.goudezhao.com/commodity-detail?id=${e.currentTarget.dataset.id}`
)}`,
});
},

View File

@ -2,6 +2,7 @@
import { apiGetAppCategoryList, apiGetHome } from "../../api/index/index";
import { setGlobalData } from "../../utils/common";
import { onGoH5Page } from "../../utils/getUserInfo";
Page({
data: {
@ -9,7 +10,7 @@ Page({
searchValue: "",
isScrolled: false,
categories: [
{ id: 2, name: "水果鲜花", categoryId: 1, icon: "/icons/fruit.png" },
/* { id: 2, name: "", categoryId: 1, icon: "/icons/fruit.png" },
{
id: 3,
name: "蔬菜豆制品",
@ -22,7 +23,7 @@ Page({
{ id: 7, name: "巧克力", categoryId: 6, icon: "/icons/chocolate.png" },
{ id: 8, name: "薯片", icon: "/icons/chips.png" },
{ id: 9, name: "饮料", icon: "/icons/drink.png" },
{ id: 10, name: "休闲零食", icon: "/icons/snack.png" },
{ id: 10, name: "休闲零食", icon: "/icons/snack.png" }, */
],
flashSaleProducts: [
{
@ -55,7 +56,7 @@ Page({
},
],
recommendedProducts: [
{
/* {
id: 1,
name: "[七夕]吻月粉红雪山玫瑰花束9枝",
price: 79,
@ -87,7 +88,7 @@ Page({
image: "/images/pepsi.jpg",
tags: ["真低价,放心购"],
sales: "800+",
},
}, */
],
},
// 搜索框输入事件
@ -125,12 +126,21 @@ Page({
onGoCommodity(e: any) {
wx.navigateTo({
url: `/pages/H5/index?url=${encodeURIComponent(
`https://www.baidu.com?id=${e.currentTarget.dataset.id}`
`https://h5.goudezhao.com/commodity-detail?id=${e.currentTarget.dataset.id}`
)}`,
});
},
// 添加到购物车
onAddToCart(e: any) {
onGoH5Page({
is_need_login: true,
type: "",
url: `/commodity-detail?id=${e.currentTarget.dataset.id}`,
});
// 这里可以添加购物车逻辑
},
handleGetHomePage() {
apiGetHome().then((res: any) => {
apiGetHome({}).then((res: any) => {
// console.warn("----- my data is res222: ", res);
this.setData({
recommendedProducts: res.data.rows.map((item: any) => ({

View File

@ -62,7 +62,7 @@
<text class="current-price">¥{{item.price}}</text>
<text class="original-price" wx:if="{{item.originalPrice}}">¥{{item.originalPrice}}</text>
</view>
<van-icon name="add" color="#02CE26" size="48rpx" />
<van-icon name="add" color="#02CE26" size="48rpx" catchtap="onAddToCart" data-id="{{item.id}}" />
</view>
<!-- <view class="purchase-info">
<text class="sales" wx:if="{{item.sales}}">{{item.sales}}人付款</text>

View File

@ -1,14 +1,14 @@
.logo {
width: 180rpx;
width: 350rpx;
display: flex;
margin: 0 auto;
margin-top: 120rpx;
margin-top: 80rpx;
}
.buttons {
display: flex;
flex-direction: column;
margin-top: 100rpx;
margin-top: 30rpx;
button {
width: 590rpx;
@ -38,7 +38,7 @@
justify-content: center;
flex-direction: column;
align-items: center;
margin-top: 120rpx;
margin-top: 10rpx;
.lz-input {
@ -111,7 +111,7 @@
display: flex;
justify-content: center;
align-items: center;
margin-top: 78rpx;
margin-top: 28rpx;
font-size: 26rpx;
color: #1e1f20;

View File

@ -1,237 +1,240 @@
import { handleShareAppMsg } from '../../utils/configs'
import { onGoH5Page } from '../../utils/getUserInfo'
import { onMaiDian } from '../../utils/maiDian'
import { apiGetCaptchaImage, apiSendSms, apiGetWxUserCode, apiLogin } from '../../api/login/index'
const H5Link = require('../../api/base').allBaseUrl.GDEnvs.web
import { handleShareAppMsg } from "../../utils/configs";
import { onGoH5Page } from "../../utils/getUserInfo";
import { onMaiDian } from "../../utils/maiDian";
import {
apiGetCaptchaImage,
apiSendSms,
apiGetWxUserCode,
apiLogin,
} from "../../api/login/index";
const H5Link = require("../../api/base").allBaseUrl.GDEnvs.web;
Page({
data: {
logoUrl: '../../assets/images/login/logo.png',
checkedUrl: '../../assets/images/login/icon_check.svg',
errorIconUrl:'../../assets/images/login/error.svg',
codeUrl: '',
logoUrl: "../../assets/images/login/logo.jpg",
checkedUrl: "../../assets/images/login/icon_check.svg",
errorIconUrl: "../../assets/images/login/error.svg",
codeUrl: "",
isChecked: false,
loginType: 'auto',
loginType: "auto",
// manual
time: 60,
phone: '',
code: '',
sms: '',
uuid: '',
phone: "",
code: "",
sms: "",
uuid: "",
phoneError: false,
codeError: false,
smsError: false,
canLogin: false,
firstSend: true
firstSend: true,
},
/** 触发同意单选框 */
handleCheck() {
this.setData({ isChecked: !this.data.isChecked })
this.setData({ isChecked: !this.data.isChecked });
},
/** 获取图形验证码 */
async handleGetCode () {
const res = await apiGetCaptchaImage()
async handleGetCode() {
const res = await apiGetCaptchaImage();
try {
this.setData({ codeUrl: 'data:image/gif;base64,' + res.data.img })
this.setData({ uuid: res.data.uuid })
this.setData({ codeUrl: "data:image/gif;base64," + res.data.img });
this.setData({ uuid: res.data.uuid });
} catch (error) {
console.log(error);
}
},
/** 发送验证码 */
async handleSendSms () {
async handleSendSms() {
if (!this.blurPhone()) {
wx.showToast({ title: '请填写手机号', icon: 'none' })
return
wx.showToast({ title: "请填写手机号", icon: "none" });
return;
}
if (!this.data.firstSend) {
this.handleGetCode()
this.setData({ codeError: true })
this.setData({ firstSend: true })
return
this.handleGetCode();
this.setData({ codeError: true });
this.setData({ firstSend: true });
return;
}
this.setData({ codeError: false })
wx.showLoading({ title: '加载中' })
this.setData({ codeError: false });
wx.showLoading({ title: "加载中" });
const params = {
userName: this.data.phone,
imageCode: this.data.code,
uuid: this.data.uuid
}
const smsResult = await apiSendSms(params)
if (smsResult.code === '1000') {
this.setData({ firstSend: false })
uuid: this.data.uuid,
};
const smsResult = await apiSendSms(params);
if (smsResult.code === "1000") {
this.setData({ firstSend: false });
} else {
this.setData({ codeError: true })
wx.showToast({ title: smsResult.msg, icon: 'none' })
this.setData({ codeError: true });
wx.showToast({ title: smsResult.msg, icon: "none" });
}
wx.hideLoading()
wx.hideLoading();
try {
this.setData({ time: this.data.time - 1 })
this.setData({ time: this.data.time - 1 });
let timer = setInterval(() => {
if (this.data.time === 0) {
clearInterval(timer)
this.setData({ time: 60 })
return
clearInterval(timer);
this.setData({ time: 60 });
return;
}
this.setData({ time: this.data.time - 1 })
}, 1000)
this.setData({ time: this.data.time - 1 });
}, 1000);
} catch (error) {
console.log(error);
}
},
/** 跳转协议页面 */
handelJumpToProtocol(e: any) {
const url = `${H5Link}/operate/dynamic?id=${e.target.dataset.field}`
onGoH5Page({ is_need_login: false, url })
const url = `${H5Link}/operate/dynamic?id=${e.target.dataset.field}`;
onGoH5Page({ is_need_login: false, url });
},
/** 绑定手机号输入 */
handlePhoneInput(e: { detail: { value: string } }) {
this.setData({
phone: e.detail.value
})
if (this.data.sms.length === 6 && this.data.phone.length === 11 && this.data.code.length === 4) {
this.setData({ canLogin: true })
}else{
this.setData({ canLogin: false })
phone: e.detail.value,
});
if (
this.data.sms.length === 6 &&
this.data.phone.length === 11 &&
this.data.code.length === 4
) {
this.setData({ canLogin: true });
} else {
this.setData({ canLogin: false });
}
},
handleBindCode(e: { detail: { value: string } }) {
this.setData({ code: e.detail.value })
if (this.data.sms.length === 6 && this.data.phone.length === 11 && this.data.code.length === 4) {
this.setData({ canLogin: true })
}else{
this.setData({ canLogin: false })
this.setData({ code: e.detail.value });
if (
this.data.sms.length === 6 &&
this.data.phone.length === 11 &&
this.data.code.length === 4
) {
this.setData({ canLogin: true });
} else {
this.setData({ canLogin: false });
}
},
handleBindSms(e: { detail: { value: string } }) {
this.setData({ sms: e.detail.value })
if (this.data.sms.length === 6 && this.data.phone.length === 11 && this.data.code.length === 4) {
this.setData({ canLogin: true })
}else{
this.setData({ canLogin: false })
this.setData({ sms: e.detail.value });
if (
this.data.sms.length === 6 &&
this.data.phone.length === 11 &&
this.data.code.length === 4
) {
this.setData({ canLogin: true });
} else {
this.setData({ canLogin: false });
}
},
/** 手机号输入框失焦检查 */
blurPhone () {
const phone = this.data.phone
const reg = /^[1][3-9][0-9]{9}$/
const res = reg.test(phone)
blurPhone() {
const phone = this.data.phone;
const reg = /^[1][3-9][0-9]{9}$/;
const res = reg.test(phone);
if (!res) {
this.setData({ phoneError: true })
this.setData({ phoneError: true });
} else {
this.setData({ phoneError: false })
this.setData({ phoneError: false });
}
return res
return res;
},
/** 手动登录 */
handleManualLogin () {
onMaiDian('其他手机号登录-曝光')
this.setData({ loginType: 'manual' })
this.handleGetCode()
handleManualLogin() {
onMaiDian("其他手机号登录-曝光");
this.setData({ loginType: "manual" });
this.handleGetCode();
},
/** 手动登录提交 */
async handleManualSubmit () {
if (!this.data.canLogin) return
async handleManualSubmit() {
if (!this.data.canLogin) return;
if (!this.data.isChecked) {
wx.showToast({ title: '请阅读并同意协议', icon: 'none' })
return
wx.showToast({ title: "请阅读并同意协议", icon: "none" });
return;
}
const that = this
wx.showLoading({ title: '加载中' })
const that = this;
wx.showLoading({ title: "加载中" });
wx.login({
success(wxRes) {
console.warn('wxRes', wxRes)
apiGetWxUserCode({ code: wxRes.code }).then(res => {
console.warn("wxRes", wxRes);
apiGetWxUserCode({ code: wxRes.code }).then((res) => {
apiLogin({
loginType: 2,
userName: that.data.phone,
smsCode: that.data.sms,
openId: res.data.openid
}).then(result => {
if (result.code === '1000') {
onMaiDian('其他手机号登录-点击-登录')
openId: res.data.openid,
}).then((result) => {
if (result.code === "1000") {
onMaiDian("其他手机号登录-点击-登录");
wx.setStorage({
key: 'user_info',
key: "user_info",
data: {
token: result.data.authorizeToken,
phone: result.data.phone,
userName: result.data.userName,
userId: result.data.userId,
uniqueCode: result.data.uniqueCode
uniqueCode: result.data.uniqueCode,
},
success() {
wx.hideLoading()
wx.reLaunch({ url: '/pages/index/index' })
}
})
wx.hideLoading();
wx.reLaunch({ url: "/pages/index/index" });
},
});
} else {
that.handleGetCode()
that.setData({ codeError: true })
that.setData({ smsError: true })
that.setData({ firstSend: true })
wx.showToast({ title: result.msg, icon: 'none' })
that.handleGetCode();
that.setData({ codeError: true });
that.setData({ smsError: true });
that.setData({ firstSend: true });
wx.showToast({ title: result.msg, icon: "none" });
}
})
})
});
});
},
fail(wxResFail) {
console.warn('wxResFail', wxResFail)
wx.showModal({ showCancel: true, content: wxResFail.errMsg })
}
})
console.warn("wxResFail", wxResFail);
wx.showModal({ showCancel: true, content: wxResFail.errMsg });
},
});
},
/** 一键登录 */
bindgetrealtimephonenumber(e: any) {
if (e.detail.errno === '1400001') {
wx.showToast({ title: '登录失败,请联系客服', icon: 'error' })
return
if (e.detail.errno === "1400001") {
wx.showToast({ title: "登录失败,请联系客服", icon: "error" });
return;
}
if(!e.detail.code) return
wx.showLoading({ title: '加载中' })
if (!e.detail.code) return;
wx.showLoading({ title: "加载中" });
wx.login({
success(wxRes) {
apiGetWxUserCode({ code: wxRes.code }).then(res => {
apiLogin({
loginType: 1,
openId: res.data.openid,
code: e.detail.code
}).then(result => {
if (result.code === '1000') {
onMaiDian('微信一键登录-点击-登录')
wx.setStorage({
key: 'user_info',
data: {
token: result.data.authorizeToken,
phone: result.data.phone,
userName: result.data.userName,
userId: result.data.userId,
uniqueCode: result.data.uniqueCode
},
success() {
wx.hideLoading()
wx.navigateBack({ delta: 2 })
}
})
} else {
wx.showToast({ title: result.msg, icon: 'none' })
}
})
})
}
})
apiGetWxUserCode({ code: wxRes.code }).then((res) => {
// onMaiDian("微信一键登录-点击-登录");
if (res.code !== "200")
return wx.showToast({ title: res.msg, icon: "none" });
wx.setStorage({
key: "user_info",
data: res.data.buyer,
success() {
wx.hideLoading();
wx.navigateBack({ delta: 2 });
},
});
});
},
});
},
handleUncheck() {
wx.showToast({ title: '请阅读并同意协议', icon: 'none' })
wx.showToast({ title: "请阅读并同意协议", icon: "none" });
},
/**
*
*/
onShareAppMessage() {
handleShareAppMsg()
handleShareAppMsg();
},
onLoad() {
wx.removeStorageSync('user_info')
onMaiDian('微信一键登录-曝光')
}
})
wx.removeStorageSync("user_info");
onMaiDian("微信一键登录-曝光");
},
});

View File

@ -70,4 +70,4 @@
</view>
我已阅读并同意<text bindtap="handelJumpToProtocol" data-field="25">《注册协议》</text>&<text bindtap="handelJumpToProtocol" data-field="26">《隐私协议》</text>
</view>
<view class="tips">本产品不向学生提供贷款服务</view>
<view class="tips">本平台由杭州优品尚电商公司提供技术支持</view>

View File

@ -6,7 +6,7 @@ Page({
isManage: false,
startX: 0,
commodities: [
{
/* {
id: 1,
name: "水果鲜花是非得失发多少覅是范德萨司法的",
icon: "🍎",
@ -16,7 +16,7 @@ Page({
{ id: 3, name: "肉禽蛋", icon: "🥩", active: false },
{ id: 4, name: "海鲜水产", icon: "🐟", active: false },
{ id: 5, name: "乳品烘焙", icon: "🥛", active: false },
{ id: 6, name: "熟食快", icon: "🍱", active: false },
{ id: 6, name: "熟食快", icon: "🍱", active: false }, */
],
},
@ -58,6 +58,22 @@ Page({
});
}
},
onChangeNum(e: any) {
const { type, id } = e.currentTarget.dataset;
const data = this.data.commodities.map((item) => {
if (item.id === id) {
item.num = type === "minus" ? item.num - 1 : item.num + 1;
item.price = item.num * item.singlePrice;
}
return item;
});
this.setData({
commodities: data,
});
},
onChangeCheckbox(e: any) {
// todo
},
// 删除商品
onDeleteItem(e: any) {
const { id } = e.currentTarget.dataset;
@ -73,7 +89,10 @@ Page({
name: item.productName,
icon: item.icon,
originalPrice: item.originalPrice,
price: item.singlePrice,
singlePrice: item.singlePrice,
price: item.allPrice,
num: item.num,
checked: false,
attribute: JSON.parse(item.skuInfo)
.map((item) => item.propertyValue)
.join("-"),

View File

@ -6,7 +6,7 @@
<view class="shopping-cart__container">
<view class="shopping-cart__item {{ item.active ? 'active' : '' }}" wx:for="{{commodities}}" wx:key="id" data-item="{{ item }}" bindtouchstart="handleTouchStart" bindtouchmove="handleTouchMove">
<view class="item__image">
<van-checkbox value="{{ checked }}" bind:change="onChange">
<van-checkbox value="{{ item.checked }}" data-item="{{ item }}" bind:change="onChangeCheckbox">
</van-checkbox>
<image class="image__icon" src="{{item.icon}}" />
</view>
@ -20,9 +20,9 @@
<view class="line__price__origin">¥39.00</view>
</view>
<view class="line__num">
<van-icon name="minus" />
<view class="num__number">1</view>
<van-icon name="plus" />
<van-icon name="minus" data-type="minus" data-id="{{ item.id }}" bindtap="onChangeNum" />
<view class="num__number">{{item.num}}</view>
<van-icon name="plus" data-type="plus" data-id="{{ item.id }}" bindtap="onChangeNum" />
</view>
</view>
</view>
@ -39,6 +39,7 @@
<view class="footer__center">
<view class="footer__center__line">
<view class="footer__center__price">
<!-- ¥<text>50</text>.52 -->
¥<text>50</text>.52
</view>
<text class="footer__center__title">合计:</text>

View File

@ -1,82 +1,96 @@
import { Base64 } from 'js-base64'
import { Base64 } from "js-base64";
export const wxInfo = wx.getSystemInfoSync()
export const mpInfo = wx.getAccountInfoSync()
export const miniProgramVersion = mpInfo.miniProgram.version || '1.0.0'
export const wxInfo = wx.getSystemInfoSync();
export const mpInfo = wx.getAccountInfoSync();
export const miniProgramVersion = mpInfo.miniProgram.version || "1.0.0";
const webUrl = require("../api/base").allBaseUrl.GDEnvs.web;
// 获取微信小程序token
export const getWxToken = async() => {
return new Promise(resolve => {
wx.showLoading({ title: '加载中' })
export const getWxToken = async () => {
return new Promise((resolve) => {
wx.showLoading({ title: "加载中" });
wx.getStorage({
key: 'user_info',
key: "user_info",
async success(res) {
if (res.data.token) {
wx.hideLoading()
const envParams = { linktoken: 'miniProgram' }
wx.hideLoading();
const envParams = { linktoken: "miniProgram" };
// 获取经纬度
const locationDataObj = wx.getStorageSync('locationData')
if (locationDataObj) Object.assign(envParams, { ...locationDataObj })
const locationDataObj = wx.getStorageSync("locationData");
if (locationDataObj) Object.assign(envParams, { ...locationDataObj });
// 获取小程序启动时的参数
const launchOptions = wx.getStorageSync('launch_options')
if (launchOptions) Object.assign(envParams, { wxXcxLaunchOptions: launchOptions })
const launchOptions = wx.getStorageSync("launch_options");
if (launchOptions)
Object.assign(envParams, { wxXcxLaunchOptions: launchOptions });
// 获取系统信息
Object.assign(envParams, {
phoneType: wxInfo.model,
devType: wxInfo.platform === 'ios' ? 0 : 1,
devType: wxInfo.platform === "ios" ? 0 : 1,
devOS: wxInfo.platform,
devOSVersion: wxInfo.system,
devVersion: wxInfo.version,
appVersion: miniProgramVersion.replace(/\./g, '')
})
appVersion: miniProgramVersion.replace(/\./g, ""),
});
const extendParams = {
lzCode: 'CJTG_XCX_LZ',
lzCode: "CJTG_XCX_LZ",
uniqueCode: res.data.uniqueCode,
userName: res.data.userName,
userId: res.data.userId,
token: res.data.token
}
token: res.data.token,
};
wx.getStorage({
key: 'unique_code',
key: "unique_code",
success(res) {
if (res) {
Object.assign(extendParams, { uniqueCode: res })
Object.assign(extendParams, { uniqueCode: res });
}
}
})
const obj = { envParams, extendParams }
const returnDataValue = encodeURIComponent(Base64.encode(JSON.stringify(obj)))
resolve(returnDataValue)
},
});
const obj = { envParams, extendParams };
const returnDataValue = encodeURIComponent(
Base64.encode(JSON.stringify(obj))
);
resolve(returnDataValue);
}
},
fail() {
wx.hideLoading()
wx.navigateTo({ url: '/pages/login/index' })
}
})
})
}
wx.hideLoading();
wx.navigateTo({ url: "/pages/login/index" });
},
});
});
};
// 跳转H5页面
export const onGoH5Page = (params: any) => {
// url跳转链接is_need_login是否需要登录true是、false否type页面类型third三方
const { type, url, is_need_login } = params
const { type, url, is_need_login } = params;
if (is_need_login) {
getWxToken().then((res: any) => {
if (res) {
const targetUrl = `${url}${/\?/.test(url) ? '&' : '?'}returnData=${res}`
wx.navigateTo({ url: `/pages/H5/index?url=${encodeURIComponent(targetUrl)}` })
const targetUrl = `${webUrl}${url}${
/\?/.test(url) ? "&" : "?"
}returnData=${res}`;
wx.navigateTo({
url: `/pages/H5/index?url=${encodeURIComponent(targetUrl)}`,
});
}
})
});
} else {
if (type === 'third') {
wx.navigateTo({ url: `/pages/H5/index?url=${encodeURIComponent(url)}` })
if (type === "third") {
wx.navigateTo({ url: `/pages/H5/index?url=${encodeURIComponent(url)}` });
} else {
const targetUrl = `${url}${/\?/.test(url) ? '&' : '?'}jumpData=${encodeURIComponent(Base64.encode(JSON.stringify({ is_need_login: false })))}`
wx.navigateTo({ url: `/pages/H5/index?url=${encodeURIComponent(targetUrl)}` })
const targetUrl = `${url}${
/\?/.test(url) ? "&" : "?"
}jumpData=${encodeURIComponent(
Base64.encode(JSON.stringify({ is_need_login: false }))
)}`;
wx.navigateTo({
url: `/pages/H5/index?url=${encodeURIComponent(targetUrl)}`,
});
}
}
}
};

View File

@ -39,7 +39,7 @@
"simulatorPluginLibVersion": {},
"condition": {},
"srcMiniprogramRoot": "miniprogram/",
"appid": "wx63bcaf38e587b406",
"appid": "wx75fa59c097bd3dfd",
"libVersion": "2.32.3",
"editorSetting": {
"tabIndent": "insertSpaces",