对接支付功能

This commit is contained in:
gyq
2025-04-29 20:42:22 +08:00
parent 791d82b9e3
commit 0844db0c57
20 changed files with 11013 additions and 5909 deletions

6185
App.vue

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name" : "ShopXO",
"appid" : "__UNI__50E3C11",
"appid" : "__UNI__F095115",
"description" : "ShopXO开源商城、MIT协议、可商用、可二次开发、满足99%电商运营需求",
"versionName" : "1.0.0",
"versionCode" : 100,
@@ -186,19 +186,18 @@
}
},
"__usePrivacyCheck__" : true,
"plugins" : {
// 腾讯地图路线规划插件(需要到小程序后台设置->第三方设置->插件管理里面添加【腾讯位置服务路线规划】插件,教程 https://mp.weixin.qq.com/wxopen/plugindevdoc?appid=wx50b5593e81dd937a
// "routePlan" : {
// "version" : "1.0.19",
// "provider" : "wx50b5593e81dd937a"
// },
// 直播(需要到小程序后台设置->第三方设置->插件管理里面添加【小程序直播组件】插件,教程 https://mp.weixin.qq.com/wxopen/pluginbasicprofile?action=intro&appid=wx2b03c6e691cd7370
// "live-player-plugin" : {
// "version" : "1.3.5",
// "provider" : "wx2b03c6e691cd7370"
// }
}
"plugins" : {}
},
// 腾讯地图路线规划插件(需要到小程序后台设置->第三方设置->插件管理里面添加【腾讯位置服务路线规划】插件,教程 https://mp.weixin.qq.com/wxopen/plugindevdoc?appid=wx50b5593e81dd937a
// "routePlan" : {
// "version" : "1.0.19",
// "provider" : "wx50b5593e81dd937a"
// },
// 直播(需要到小程序后台设置->第三方设置->插件管理里面添加【小程序直播组件】插件,教程 https://mp.weixin.qq.com/wxopen/pluginbasicprofile?action=intro&appid=wx2b03c6e691cd7370
// "live-player-plugin" : {
// "version" : "1.3.5",
// "provider" : "wx2b03c6e691cd7370"
// }
"mp-alipay" : {
"usingComponents" : true,
"appid" : "2021001173639600"
@@ -245,15 +244,36 @@
},
"devServer" : {
"https" : false,
"port" : 8082
"port" : 8082,
"proxy" : {
"/api" : {
// "target": "http://192.168.1.43:7777/",
"target" : "https://store.sxczgkj.com/",
"changeOrigin" : "true",
"pathRewrite" : {
"^/api" : ""
}
}
}
},
"router" : {
"mode" : "hash",
"base" : "./"
"mode" : "history",
"base" : "/h5_store/"
},
"title" : "ShopXO",
"title" : "czg_shop",
"template" : "template.h5.html"
},
"app" : {
"router" : {
"mode" : "history"
}
},
"vueVersion" : "2",
"locale" : "auto"
}
// 匹配以 /api 开头的请求
// target: 'https://test.invoice.sxczgkj.cn/', // 替换为你的后端 API 域名
//192.168.1.43:7777/', // 替换为你的后端 API 域名
// 允许跨域
// 重写路径,去掉 /api 前缀

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Yanxi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,36 @@
微信官方 js-sdk
----
说明: 仅将官方 js-sdk 发布到 npm支持 CommonJS便于 browserify, webpack 等直接使用,支持 TypeScript。
官方 JS 源码: https://res.wx.qq.com/open/js/jweixin-1.6.0.js
官方使用说明: https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html
安装:
```shell
npm install weixin-js-sdk
```
使用:
```javascript
// commonjs
var wx = require('weixin-js-sdk');
// es module
import wx from 'weixin-js-sdk'
```
### Old versions
* [1.0.0](https://github.com/yanxi123-com/weixin-js-sdk/tree/1.0.0)
* [1.2.0](https://github.com/yanxi123-com/weixin-js-sdk/tree/1.2.0)
### 个人主页
* [https://yanxi123.com/](https://yanxi123.com/)
### 感谢
TypeScript 定义文件来自 [wx-jssdk-ts](https://github.com/zhaoky/wx-jssdk-ts/blob/master/index.d.ts)

View File

@@ -0,0 +1,601 @@
// Type definitions for weixin jssdk 1.6.0
// Project: https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace wx {
type ImageSizeType = "original" | "compressed";
type ImageSourceType = "album" | "camera";
type VideoSourceType = "album" | "camera";
type ApiMethod =
| "onMenuShareTimeline"
| "onMenuShareAppMessage"
| "onMenuShareQQ"
| "onMenuShareWeibo"
| "onMenuShareQZone"
| "updateAppMessageShareData"
| "updateTimelineShareData"
| "startRecord"
| "stopRecord"
| "onVoiceRecordEnd"
| "playVoice"
| "pauseVoice"
| "stopVoice"
| "onVoicePlayEnd"
| "uploadVoice"
| "downloadVoice"
| "chooseImage"
| "previewImage"
| "uploadImage"
| "downloadImage"
| "translateVoice"
| "getNetworkType"
| "openLocation"
| "getLocation"
| "hideOptionMenu"
| "showOptionMenu"
| "hideMenuItems"
| "showMenuItems"
| "hideAllNonBaseMenuItem"
| "showAllNonBaseMenuItem"
| "closeWindow"
| "scanQRCode"
| "chooseWXPay"
| "openProductSpecificView"
| "addCard"
| "chooseCard"
| "openCard";
// 所有JS接口列表
type jsApiList = ApiMethod[];
// 开放标签列表
// https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_Open_Tag.html
type openTag = "wx-open-launch-weapp" | "wx-open-launch-app" | "wx-open-subscribe" | "wx-open-audio"
type openTagList = openTag[];
// 所有菜单项列表
// 基本类
type menuBase =
| "menuItem:exposeArticle" // 举报
| "menuItem:setFont" // 调整字体
| "menuItem:dayMode" // 日间模式
| "menuItem:nightMode" // 夜间模式
| "menuItem:refresh" // 刷新
| "menuItem:profile" // 查看公众号(已添加)
| "menuItem:addContact"; // 查看公众号(未添加)
// 传播类
type menuShare =
| "menuItem:share:appMessage" // 发送给朋友
| "menuItem:share:timeline" // 分享到朋友圈
| "menuItem:share:qq" // 分享到QQ
| "menuItem:share:weiboApp" // 分享到Weibo
| "menuItem:favorite" // 收藏
| "menuItem:share:facebook" // 分享到FB
| "menuItem:share:QZone"; // 分享到 QQ 空间
// 保护类
type menuProtected =
| "menuItem:editTag" // 编辑标签
| "menuItem:delete" // 删除
| "menuItem:copyUrl" // 复制链接
| "menuItem:originPage" // 原网页
| "menuItem:readMode" // 阅读模式
| "menuItem:openWithQQBrowser" // 在QQ浏览器中打开
| "menuItem:openWithSafari" // 在Safari中打开
| "menuItem:share:email" // 邮件
| "menuItem:share:brand"; // 一些特殊公众号
type menuList = Array<menuBase | menuProtected | menuShare>;
function config(conf: {
debug?: boolean; // 开启调试模式,调用的所有api的返回值会在客户端alert出来若要查看传入的参数可以在pc端打开参数信息会通过log打出仅在pc端时才会打印。
appId: string; // 必填,公众号的唯一标识
timestamp: number; // 必填,生成签名的时间戳
nonceStr: string; // 必填,生成签名的随机串
signature: string; // 必填签名见附录1
jsApiList?: jsApiList; // 必填需要使用的JS接口列表所有JS接口列表见附录2
openTagList?: openTagList;
}): void;
interface Resouce {
localId: string;
}
interface BaseParams {
success?(...args: any[]): void;
/** 接口调用失败的回调函数 */
fail?(...args: any[]): void;
/** 接口取消调用的回调函数 */
cancel?(...args: any[]): void;
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?(...args: any[]): void;
}
function ready(fn: () => void): void;
function error(fn: (err: { errMsg: string }) => void): void;
interface IcheckJsApi extends BaseParams {
jsApiList: jsApiList; // 需要检测的JS接口列表所有JS接口列表见附录2,
// 以键值对的形式返回可用的api值true不可用为false
// 如:{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
success(res: {
checkResult: { [api: string]: boolean };
errMsg: string;
}): void;
}
/**
* 判断当前客户端版本是否支持指定JS接口
* 备注checkJsApi接口是客户端6.0.2新引入的一个预留接口第一期开放的接口均可不使用checkJsApi来检测。
*/
function checkJsApi(params: IcheckJsApi): void;
interface IonMenuShareTimeline extends BaseParams {
title: string; // 分享标题
link: string; // 分享链接
imgUrl: string; // 分享图标
// 用户确认分享后执行的回调函数
success(): void;
// 用户取消分享后执行的回调函数
cancel(): void;
}
/*=============================基础接口================================*/
/**
* 获取“分享到朋友圈”按钮点击状态及自定义分享内容接口
*/
function onMenuShareTimeline(params: IonMenuShareTimeline): void;
interface IonMenuShareAppMessage extends BaseParams {
title: string; // 分享标题
desc: string; // 分享描述
link: string; // 分享链接
imgUrl: string; // 分享图标
type?: "music" | "video或link" | "link"; // 分享类型,music、video或link不填默认为link
dataUrl?: string; // 如果type是music或video则要提供数据链接默认为空
// 用户确认分享后执行的回调函数
success(): void;
// 用户取消分享后执行的回调函数
cancel(): void;
}
/**
* 获取“分享给朋友”按钮点击状态及自定义分享内容接口
*/
function onMenuShareAppMessage(params: IonMenuShareAppMessage): void;
interface IonMenuShareQQ extends BaseParams {
title: string; // 分享标题
desc: string; // 分享描述
link: string; // 分享链接
imgUrl: string; // 分享图标
// 用户确认分享后执行的回调函数
success(): void;
// 用户取消分享后执行的回调函数
cancel(): void;
}
/**
* 获取“分享到QQ”按钮点击状态及自定义分享内容接口
*/
function onMenuShareQQ(params: IonMenuShareQQ): void;
interface IonMenuShareWeibo extends BaseParams {
title: string; // 分享标题
desc: string; // 分享描述
link: string; // 分享链接
imgUrl: string; // 分享图标
// 用户确认分享后执行的回调函数
success(): void;
// 用户取消分享后执行的回调函数
cancel(): void;
}
/**
* 获取“分享到腾讯微博”按钮点击状态及自定义分享内容接口
*/
function onMenuShareWeibo(params: IonMenuShareWeibo): void;
interface IonMenuShareQZone extends BaseParams {
title: string; // 分享标题
desc: string; // 分享描述
link: string; // 分享链接
imgUrl: string; // 分享图标
// 用户确认分享后执行的回调函数
success(): void;
// 用户取消分享后执行的回调函数
cancel(): void;
}
/**
* 获取“分享到QQ空间”按钮点击状态及自定义分享内容接口
*/
function onMenuShareQZone(params: IonMenuShareQZone): void;
interface IupdateAppMessageShareData extends BaseParams {
title: string; // 分享标题
desc: string; // 分享描述
link: string; // 分享链接
imgUrl: string; // 分享图标
// 用户确认分享后执行的回调函数
success(): void;
}
/**
* 获取“分享给朋友”及“分享到QQ”按钮点击状态及自定义分享内容接口
*/
function updateAppMessageShareData(params: IupdateAppMessageShareData): void;
interface IupdateTimelineShareData extends BaseParams {
title: string; // 分享标题
link: string; // 分享链接
imgUrl: string; // 分享图标
// 用户确认分享后执行的回调函数
success(): void;
}
/**
* 获取“分享到朋友圈”及“分享到QQ空间”按钮点击状态及自定义分享内容接口
*/
function updateTimelineShareData(params: IupdateTimelineShareData): void;
/*=============================基础接口================================*/
/*=============================图像接口================================*/
interface IchooseImage extends BaseParams {
/** 最多可以选择的图片张数默认9 */
count?: number;
/** original 原图compressed 压缩图,默认二者都有 */
sizeType?: ImageSizeType[];
/** album 从相册选图camera 使用相机,默认二者都有 */
sourceType?: ImageSourceType[];
/** 成功则返回图片的本地文件路径列表 tempFilePaths */
success(res: {
sourceType: string; // weixin album camera
localIds: string[];
errMsg: string;
}): void;
cancel(): void;
}
/**
* 从本地相册选择图片或使用相机拍照。
*/
function chooseImage(params: IchooseImage): void;
interface IpreviewImage extends BaseParams {
current: string; // 当前显示图片的http链接
urls: string[]; // 需要预览的图片http链接列表
}
/**
* 预览图片接口
*/
function previewImage(params: IpreviewImage): void;
interface IuploadResource extends BaseParams {
localId: string; // 需要上传的图片的本地ID由chooseImage接口获得
isShowProgressTips: number; // 默认为1显示进度提示
// 返回图片的服务器端ID
success(res: { serverId: string }): void;
}
/**
* 上传图片接口
*/
function uploadImage(params: IuploadResource): void;
interface IdownloadResource extends BaseParams {
serverId: string; // 需要下载的图片的服务器端ID由uploadImage接口获得
isShowProgressTips: number; // 默认为1显示进度提示
// 返回图片下载后的本地ID
success(res: Resouce): void;
}
/**
* 下载图片接口
*/
function downloadImage(params: IdownloadResource): void;
interface IgetLocalImgData extends BaseParams {
localId: string; // 图片的localID
// localData是图片的base64数据可以用img标签显示
success(res: { localData: string }): void;
}
/**
* 获取本地图片接口
*/
function getLocalImgData(params: IgetLocalImgData): void;
/*=============================图像接口================================*/
/*=============================音频接口================================*/
/**
* 开始录音接口
*/
function startRecord(): void;
interface IstopRecord extends BaseParams {
success(res: Resouce): void;
}
/**
* 停止录音接口
*/
function stopRecord(params: IstopRecord): void;
interface IonVoiceRecordEnd extends BaseParams {
// 录音时间超过一分钟没有停止的时候会执行 complete 回调
complete(res: Resouce): void;
}
/**
* 监听录音自动停止接口
*/
function onVoiceRecordEnd(params: IonVoiceRecordEnd): void;
interface IplaypausestopVoice extends BaseParams {
localId: string; // 需要播放的音频的本地ID由stopRecord接口获得
}
/**
* 播放语音接口
*/
function playVoice(params: IplaypausestopVoice): void;
/**
* 暂停播放接口
*/
function pauseVoice(params: IplaypausestopVoice): void;
/**
* 停止播放接口
*/
function stopVoice(params: IplaypausestopVoice): void;
interface IonVoicePlayEnd extends BaseParams {
success(res: Resouce): void;
}
/**
* 监听语音播放完毕接口
*/
function onVoicePlayEnd(params: IonVoicePlayEnd): void;
/**
* 上传语音接口
* 备注上传语音有效期3天可用微信多媒体接口下载语音到自己的服务器
* ,此处获得的 serverId 即 media_id参考文档
* ../12 / 58bfcfabbd501c7cd77c19bd9cfa8354.html
* 目前多媒体文件下载接口的频率限制为10000次/ 天,
* 如需要调高频率请邮件weixin - open@qq.com,
* 邮件主题为【申请多媒体接口调用量】,请对你的项目进行简单描述,
* 附上产品体验链接,并对用户量和使用量进行说明。
*/
function uploadVoice(params: IuploadResource): void;
/**
* 下载语音接口
*/
function downloadVoice(params: IdownloadResource): void;
/*=============================音频接口================================*/
/*=============================智能接口================================*/
interface ItranslateVoice extends BaseParams {
localId: string; // 需要识别的音频的本地Id由录音相关接口获得
isShowProgressTips: number; // 默认为1显示进度提示
success(res: { translateResult: string }): void;
}
/**
* 识别音频并返回识别结果接口
*/
function translateVoice(params: ItranslateVoice): void;
/*=============================智能接口================================*/
/*=============================设备信息================================*/
type networkType = "2g" | "3g" | "4g" | "wifi";
interface IgetNetworkType extends BaseParams {
success(res: { networkType: networkType }): void;
}
/**
* 获取网络状态接口
*/
function getNetworkType(params: IgetNetworkType): void;
/*=============================设备信息================================*/
/*=============================地理位置================================*/
interface IopenLocation extends BaseParams {
latitude: number; // 纬度浮点数范围为90 ~ -90
longitude: number; // 经度浮点数范围为180 ~ -180。
name: string; // 位置名
address: string; // 地址详情说明
scale: number; // 地图缩放级别,整形值,范围从1~28。默认为最大
infoUrl: string; // 在查看位置界面底部显示的超链接,可点击跳转
}
/**
* 使用微信内置地图查看位置接口
*/
function openLocation(params: IopenLocation): void;
interface IgetLocation extends BaseParams {
type: "wgs84" | "gcj02"; // 默认为wgs84的gps坐标如果要返回直接给openLocation用的火星坐标可传入'gcj02'
success(res: {
latitude: number; // 纬度浮点数范围为90 ~ -90
longitude: number; // 经度浮点数范围为180 ~ -180。
speed: number; // 速度,以米/每秒计
accuracy: number; // 位置精度
}): void;
}
/**
* 获取地理位置接口
*/
function getLocation(params: IgetLocation): void;
/*=============================地理位置================================*/
/*=============================摇一摇周边================================*/
interface IstartSearchBeacons extends BaseParams {
ticket: string; // 摇周边的业务ticket, 系统自动添加在摇出来的页面链接后面
// 开启查找完成后的回调函数
complete(argv: any): void;
}
/**
* 开启查找周边ibeacon设备接口
* 备注:如需接入摇一摇周边功能,请参考:申请开通摇一摇周边
*/
function startSearchBeacons(params: IstartSearchBeacons): void;
interface IstopSearchBeacons extends BaseParams {
// 关闭查找完成后的回调函数
complete(res: any): void;
}
/**
* 关闭查找周边ibeacon设备接口
*/
function stopSearchBeacons(params: IstopSearchBeacons): void;
interface IonSearchBeacons extends BaseParams {
// 回调函数,可以数组形式取得该商家注册的在周边的相关设备列表
complete(argv: any): void;
}
/**
* 监听周边ibeacon设备接口
*/
function onSearchBeacons(params: IonSearchBeacons): void;
/*=============================摇一摇周边================================*/
/*=============================界面操作================================*/
/**
* 隐藏右上角菜单接口
*/
function hideOptionMenu(): void;
/**
* 显示右上角菜单接口
*/
function showOptionMenu(): void;
/**
* 关闭当前网页窗口接口
*/
function closeWindow(): void;
interface IhideMenuItems extends BaseParams {
menuList: Array<menuProtected | menuShare>; // 要隐藏的菜单项只能隐藏“传播类”和“保护类”按钮所有menu项见附录3
}
/**
* 批量隐藏功能按钮接口
*/
function hideMenuItems(params: IhideMenuItems): void;
interface IshowMenuItems extends BaseParams {
menuList: menuList; // 要显示的菜单项所有menu项见附录3
}
/**
* 批量显示功能按钮接口
*/
function showMenuItems(params: IshowMenuItems): void;
/**
* 隐藏所有非基础按钮接口
* “基本类”按钮详见附录3
*/
function hideAllNonBaseMenuItem(): void;
/**
* 显示所有功能按钮接口
*/
function showAllNonBaseMenuItem(): void;
/*=============================界面操作================================*/
/*=============================微信扫一扫================================*/
type scanType = "qrCode" | "barCode";
interface IscanQRCode extends BaseParams {
needResult: 0 | 1; // 默认为0扫描结果由微信处理1则直接返回扫描结果
scanType: scanType[]; // 可以指定扫二维码还是一维码,默认二者都有
// 当needResult 为 1 时,扫码返回的结果
success(res: { resultStr: string }): void;
}
/**
* 调起微信扫一扫接口
*/
function scanQRCode(params: IscanQRCode): void;
/*=============================微信扫一扫================================*/
/*=============================微信小店================================*/
interface IopenProductSpecificView extends BaseParams {
productId: string; // 商品id
viewType: "0" | "1" | "2"; // 0.默认值普通商品详情页1.扫一扫商品详情页2.小店商品详情页
}
/**
* 跳转微信商品页接口
*/
function openProductSpecificView(params: IopenProductSpecificView): void;
/*=============================微信卡券================================*/
interface IchooseCard extends BaseParams {
shopId: string; // 门店Id
cardType: string; // 卡券类型
cardId: string; // 卡券Id
timestamp: number; // 卡券签名时间戳
nonceStr: string; // 卡券签名随机串
signType: string; // 签名方式,默认'SHA1'
cardSign: string; // 卡券签名
success(res: { cardList: string[] }): void;
}
/**
* 拉取适用卡券列表并获取用户选择信息
*/
function chooseCard(params: IchooseCard): void;
interface IaddCard extends BaseParams {
cardList: Array<{
cardId: string;
cardExt: string;
}>; // 需要添加的卡券列表
success(res: { cardList: string[] }): void;
}
/**
* 批量添加卡券接口
*/
function addCard(): void;
interface IopenCard extends BaseParams {
cardList: Array<{
cardId: string;
code: string;
}>; // 需要打开的卡券列表
}
/**
* 查看微信卡包中的卡券接口
*/
function openCard(params: IopenCard): void;
interface IconsumeAndShareCard extends BaseParams {
cardId: string;
code: string;
}
/**
* 核销后再次赠送卡券接口
*/
function consumeAndShareCard(params: IconsumeAndShareCard): void;
/*=============================微信卡券================================*/
/*=============================微信支付================================*/
interface IchooseWXPay extends BaseParams {
timestamp: number; // 支付签名时间戳注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
nonceStr: string; // 支付签名随机串,不长于 32 位
package: string; // 统一支付接口返回的prepay_id参数值提交格式如prepay_id=***
signType: string; // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
paySign: string; // 支付签名
// 支付成功后的回调函数
success(res: any): void;
}
/**
* 发起一个微信支付请求
*/
function chooseWXPay(params: IchooseWXPay): void;
/*=============================微信支付================================*/
/*=============================微信小程序==============================*/
interface miniProgramMethodsParams extends BaseParams {
url: string;
}
interface miniProgramMethods {
navigateTo(params: miniProgramMethodsParams): void;
navigateBack(params: miniProgramMethodsParams): void;
switchTab(params: miniProgramMethodsParams): void;
reLaunch(params: miniProgramMethodsParams): void;
redirectTo(params: miniProgramMethodsParams): void;
postMessage(params: { data: any }): void;
getEnv(fn: (res: any) => void): void;
}
const miniProgram: miniProgramMethods;
/*=============================微信小程序==============================*/
}
declare function wx(): void;
/*=============================微信内全局变量==============================*/
declare global {
interface Window {
WeixinJSBridge: any;
__wxjs_environment: any;
}
const WeixinJSBridge: any;
}
export default wx;

View File

@@ -0,0 +1,891 @@
!(function (e, n) {
module.exports = n(e);
})(typeof window === "object" && window, function (r, e) {
if (!r) {
console.warn("can't use weixin-js-sdk in server side");
return;
}
var a, c, n, i, t, o, s, d, l, u, p, f, m, g, h, S, y, I, v, _, w, T;
if (!r.jWeixin)
return (
(a = {
config: "preVerifyJSAPI",
onMenuShareTimeline: "menu:share:timeline",
onMenuShareAppMessage: "menu:share:appmessage",
onMenuShareQQ: "menu:share:qq",
onMenuShareWeibo: "menu:share:weiboApp",
onMenuShareQZone: "menu:share:QZone",
previewImage: "imagePreview",
getLocation: "geoLocation",
openProductSpecificView: "openProductViewWithPid",
addCard: "batchAddCard",
openCard: "batchViewCard",
chooseWXPay: "getBrandWCPayRequest",
openEnterpriseRedPacket: "getRecevieBizHongBaoRequest",
startSearchBeacons: "startMonitoringBeacons",
stopSearchBeacons: "stopMonitoringBeacons",
onSearchBeacons: "onBeaconsInRange",
consumeAndShareCard: "consumedShareCard",
openAddress: "editAddress",
}),
(c = (function () {
var e,
n = {};
for (e in a) n[a[e]] = e;
return n;
})()),
(n = r.document),
(i = n.title),
(t = navigator.userAgent.toLowerCase()),
(f = navigator.platform.toLowerCase()),
(o = !(!f.match("mac") && !f.match("win"))),
(s = -1 != t.indexOf("wxdebugger")),
(d = -1 != t.indexOf("micromessenger")),
(l = -1 != t.indexOf("android")),
(u = -1 != t.indexOf("iphone") || -1 != t.indexOf("ipad")),
(p = (f =
t.match(/micromessenger\/(\d+\.\d+\.\d+)/) ||
t.match(/micromessenger\/(\d+\.\d+)/))
? f[1]
: ""),
(m = {
initStartTime: L(),
initEndTime: 0,
preVerifyStartTime: 0,
preVerifyEndTime: 0,
}),
(g = {
version: 1,
appId: "",
initTime: 0,
preVerifyTime: 0,
networkType: "",
isPreVerifyOk: 1,
systemType: u ? 1 : l ? 2 : -1,
clientVersion: p,
url: encodeURIComponent(location.href),
}),
(h = {}),
(S = { _completes: [] }),
(y = { state: 0, data: {} }),
O(function () {
m.initEndTime = L();
}),
(I = !1),
(v = []),
(_ = {
config: function (e) {
C("config", (h = e));
var o = !1 !== h.check;
O(function () {
if (o)
k(
a.config,
{
verifyJsApiList: A(h.jsApiList),
verifyOpenTagList: A(h.openTagList),
},
((S._complete = function (e) {
(m.preVerifyEndTime = L()), (y.state = 1), (y.data = e);
}),
(S.success = function (e) {
g.isPreVerifyOk = 0;
}),
(S.fail = function (e) {
S._fail ? S._fail(e) : (y.state = -1);
}),
(t = S._completes).push(function () {
B();
}),
(S.complete = function (e) {
for (var n = 0, i = t.length; n < i; ++n) t[n]();
S._completes = [];
}),
S)
),
(m.preVerifyStartTime = L());
else {
y.state = 1;
for (var e = S._completes, n = 0, i = e.length; n < i; ++n)
e[n]();
S._completes = [];
}
var t;
}),
_.invoke ||
((_.invoke = function (e, n, i) {
r.WeixinJSBridge && WeixinJSBridge.invoke(e, P(n), i);
}),
(_.on = function (e, n) {
r.WeixinJSBridge && WeixinJSBridge.on(e, n);
}));
},
ready: function (e) {
(0 != y.state || (S._completes.push(e), !d && h.debug)) && e();
},
error: function (e) {
p < "6.0.2" || (-1 == y.state ? e(y.data) : (S._fail = e));
},
checkJsApi: function (e) {
k(
"checkJsApi",
{ jsApiList: A(e.jsApiList) },
((e._complete = function (e) {
l && (i = e.checkResult) && (e.checkResult = JSON.parse(i));
var n,
i = e,
t = i.checkResult;
for (n in t) {
var o = c[n];
o && ((t[o] = t[n]), delete t[n]);
}
}),
e)
);
},
onMenuShareTimeline: function (e) {
M(
a.onMenuShareTimeline,
{
complete: function () {
k(
"shareTimeline",
{
title: e.title || i,
desc: e.title || i,
img_url: e.imgUrl || "",
link: e.link || location.href,
type: e.type || "link",
data_url: e.dataUrl || "",
},
e
);
},
},
e
);
},
onMenuShareAppMessage: function (n) {
M(
a.onMenuShareAppMessage,
{
complete: function (e) {
"favorite" === e.scene
? k("sendAppMessage", {
title: n.title || i,
desc: n.desc || "",
link: n.link || location.href,
img_url: n.imgUrl || "",
type: n.type || "link",
data_url: n.dataUrl || "",
})
: k(
"sendAppMessage",
{
title: n.title || i,
desc: n.desc || "",
link: n.link || location.href,
img_url: n.imgUrl || "",
type: n.type || "link",
data_url: n.dataUrl || "",
},
n
);
},
},
n
);
},
onMenuShareQQ: function (e) {
M(
a.onMenuShareQQ,
{
complete: function () {
k(
"shareQQ",
{
title: e.title || i,
desc: e.desc || "",
img_url: e.imgUrl || "",
link: e.link || location.href,
},
e
);
},
},
e
);
},
onMenuShareWeibo: function (e) {
M(
a.onMenuShareWeibo,
{
complete: function () {
k(
"shareWeiboApp",
{
title: e.title || i,
desc: e.desc || "",
img_url: e.imgUrl || "",
link: e.link || location.href,
},
e
);
},
},
e
);
},
onMenuShareQZone: function (e) {
M(
a.onMenuShareQZone,
{
complete: function () {
k(
"shareQZone",
{
title: e.title || i,
desc: e.desc || "",
img_url: e.imgUrl || "",
link: e.link || location.href,
},
e
);
},
},
e
);
},
updateTimelineShareData: function (e) {
k(
"updateTimelineShareData",
{ title: e.title, link: e.link, imgUrl: e.imgUrl },
e
);
},
updateAppMessageShareData: function (e) {
k(
"updateAppMessageShareData",
{ title: e.title, desc: e.desc, link: e.link, imgUrl: e.imgUrl },
e
);
},
startRecord: function (e) {
k("startRecord", {}, e);
},
stopRecord: function (e) {
k("stopRecord", {}, e);
},
onVoiceRecordEnd: function (e) {
M("onVoiceRecordEnd", e);
},
playVoice: function (e) {
k("playVoice", { localId: e.localId }, e);
},
pauseVoice: function (e) {
k("pauseVoice", { localId: e.localId }, e);
},
stopVoice: function (e) {
k("stopVoice", { localId: e.localId }, e);
},
onVoicePlayEnd: function (e) {
M("onVoicePlayEnd", e);
},
uploadVoice: function (e) {
k(
"uploadVoice",
{
localId: e.localId,
isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
},
e
);
},
downloadVoice: function (e) {
k(
"downloadVoice",
{
serverId: e.serverId,
isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
},
e
);
},
translateVoice: function (e) {
k(
"translateVoice",
{
localId: e.localId,
isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
},
e
);
},
chooseImage: function (e) {
k(
"chooseImage",
{
scene: "1|2",
count: e.count || 9,
sizeType: e.sizeType || ["original", "compressed"],
sourceType: e.sourceType || ["album", "camera"],
},
((e._complete = function (e) {
if (l) {
var n = e.localIds;
try {
n && (e.localIds = JSON.parse(n));
} catch (e) {}
}
}),
e)
);
},
getLocation: function (e) {
(e = e || {}),
k(
a.getLocation,
{ type: e.type || "wgs84" },
((e._complete = function (e) {
delete e.type;
}),
e)
);
},
previewImage: function (e) {
k(a.previewImage, { current: e.current, urls: e.urls }, e);
},
uploadImage: function (e) {
k(
"uploadImage",
{
localId: e.localId,
isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
},
e
);
},
downloadImage: function (e) {
k(
"downloadImage",
{
serverId: e.serverId,
isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
},
e
);
},
getLocalImgData: function (e) {
!1 === I
? ((I = !0),
k(
"getLocalImgData",
{ localId: e.localId },
((e._complete = function (e) {
var n;
(I = !1),
0 < v.length && ((n = v.shift()), wx.getLocalImgData(n));
}),
e)
))
: v.push(e);
},
getNetworkType: function (e) {
k(
"getNetworkType",
{},
((e._complete = function (e) {
var n = e,
e = n.errMsg,
i = ((n.errMsg = "getNetworkType:ok"), n.subtype);
if ((delete n.subtype, i)) n.networkType = i;
else {
var i = e.indexOf(":"),
t = e.substring(i + 1);
switch (t) {
case "wifi":
case "edge":
case "wwan":
n.networkType = t;
break;
default:
n.errMsg = "getNetworkType:fail";
}
}
}),
e)
);
},
openLocation: function (e) {
k(
"openLocation",
{
latitude: e.latitude,
longitude: e.longitude,
name: e.name || "",
address: e.address || "",
scale: e.scale || 28,
infoUrl: e.infoUrl || "",
},
e
);
},
hideOptionMenu: function (e) {
k("hideOptionMenu", {}, e);
},
showOptionMenu: function (e) {
k("showOptionMenu", {}, e);
},
closeWindow: function (e) {
k("closeWindow", {}, (e = e || {}));
},
hideMenuItems: function (e) {
k("hideMenuItems", { menuList: e.menuList }, e);
},
showMenuItems: function (e) {
k("showMenuItems", { menuList: e.menuList }, e);
},
hideAllNonBaseMenuItem: function (e) {
k("hideAllNonBaseMenuItem", {}, e);
},
showAllNonBaseMenuItem: function (e) {
k("showAllNonBaseMenuItem", {}, e);
},
scanQRCode: function (e) {
k(
"scanQRCode",
{
needResult: (e = e || {}).needResult || 0,
scanType: e.scanType || ["qrCode", "barCode"],
},
((e._complete = function (e) {
var n;
u &&
(n = e.resultStr) &&
((n = JSON.parse(n)),
(e.resultStr = n && n.scan_code && n.scan_code.scan_result));
}),
e)
);
},
openAddress: function (e) {
k(
a.openAddress,
{},
((e._complete = function (e) {
((e = e).postalCode = e.addressPostalCode),
delete e.addressPostalCode,
(e.provinceName = e.proviceFirstStageName),
delete e.proviceFirstStageName,
(e.cityName = e.addressCitySecondStageName),
delete e.addressCitySecondStageName,
(e.countryName = e.addressCountiesThirdStageName),
delete e.addressCountiesThirdStageName,
(e.detailInfo = e.addressDetailInfo),
delete e.addressDetailInfo;
}),
e)
);
},
openProductSpecificView: function (e) {
k(
a.openProductSpecificView,
{
pid: e.productId,
view_type: e.viewType || 0,
ext_info: e.extInfo,
},
e
);
},
addCard: function (e) {
for (var n = e.cardList, i = [], t = 0, o = n.length; t < o; ++t) {
var r = n[t],
r = { card_id: r.cardId, card_ext: r.cardExt };
i.push(r);
}
k(
a.addCard,
{ card_list: i },
((e._complete = function (e) {
if ((n = e.card_list)) {
for (var n, i = 0, t = (n = JSON.parse(n)).length; i < t; ++i) {
var o = n[i];
(o.cardId = o.card_id),
(o.cardExt = o.card_ext),
(o.isSuccess = !!o.is_succ),
delete o.card_id,
delete o.card_ext,
delete o.is_succ;
}
(e.cardList = n), delete e.card_list;
}
}),
e)
);
},
chooseCard: function (e) {
k(
"chooseCard",
{
app_id: h.appId,
location_id: e.shopId || "",
sign_type: e.signType || "SHA1",
card_id: e.cardId || "",
card_type: e.cardType || "",
card_sign: e.cardSign,
time_stamp: e.timestamp + "",
nonce_str: e.nonceStr,
},
((e._complete = function (e) {
(e.cardList = e.choose_card_info), delete e.choose_card_info;
}),
e)
);
},
openCard: function (e) {
for (var n = e.cardList, i = [], t = 0, o = n.length; t < o; ++t) {
var r = n[t],
r = { card_id: r.cardId, code: r.code };
i.push(r);
}
k(a.openCard, { card_list: i }, e);
},
consumeAndShareCard: function (e) {
k(
a.consumeAndShareCard,
{ consumedCardId: e.cardId, consumedCode: e.code },
e
);
},
chooseWXPay: function (e) {
k(a.chooseWXPay, x(e), e), B({ jsApiName: "chooseWXPay" });
},
openEnterpriseRedPacket: function (e) {
k(a.openEnterpriseRedPacket, x(e), e);
},
startSearchBeacons: function (e) {
k(a.startSearchBeacons, { ticket: e.ticket }, e);
},
stopSearchBeacons: function (e) {
k(a.stopSearchBeacons, {}, e);
},
onSearchBeacons: function (e) {
M(a.onSearchBeacons, e);
},
openEnterpriseChat: function (e) {
k(
"openEnterpriseChat",
{ useridlist: e.userIds, chatname: e.groupName },
e
);
},
launchMiniProgram: function (e) {
k(
"launchMiniProgram",
{
targetAppId: e.targetAppId,
path: (function (e) {
var n;
if ("string" == typeof e && 0 < e.length)
return (
(n = e.split("?")[0]),
(n += ".html"),
void 0 !== (e = e.split("?")[1]) ? n + "?" + e : n
);
})(e.path),
envVersion: e.envVersion,
},
e
);
},
openBusinessView: function (e) {
k(
"openBusinessView",
{
businessType: e.businessType,
queryString: e.queryString || "",
envVersion: e.envVersion,
},
((e._complete = function (n) {
if (l) {
var e = n.extraData;
if (e)
try {
n.extraData = JSON.parse(e);
} catch (e) {
n.extraData = {};
}
}
}),
e)
);
},
miniProgram: {
navigateBack: function (e) {
(e = e || {}),
O(function () {
k(
"invokeMiniProgramAPI",
{ name: "navigateBack", arg: { delta: e.delta || 1 } },
e
);
});
},
navigateTo: function (e) {
O(function () {
k(
"invokeMiniProgramAPI",
{ name: "navigateTo", arg: { url: e.url } },
e
);
});
},
redirectTo: function (e) {
O(function () {
k(
"invokeMiniProgramAPI",
{ name: "redirectTo", arg: { url: e.url } },
e
);
});
},
switchTab: function (e) {
O(function () {
k(
"invokeMiniProgramAPI",
{ name: "switchTab", arg: { url: e.url } },
e
);
});
},
reLaunch: function (e) {
O(function () {
k(
"invokeMiniProgramAPI",
{ name: "reLaunch", arg: { url: e.url } },
e
);
});
},
postMessage: function (e) {
O(function () {
k(
"invokeMiniProgramAPI",
{ name: "postMessage", arg: e.data || {} },
e
);
});
},
getEnv: function (e) {
O(function () {
e({ miniprogram: "miniprogram" === r.__wxjs_environment });
});
},
},
}),
(w = 1),
(T = {}),
n.addEventListener(
"error",
function (e) {
var n, i, t;
l ||
((t = (n = e.target).tagName),
(i = n.src),
"IMG" != t && "VIDEO" != t && "AUDIO" != t && "SOURCE" != t) ||
(-1 != i.indexOf("wxlocalresource://") &&
(e.preventDefault(),
e.stopPropagation(),
(t = n["wx-id"]) || ((t = w++), (n["wx-id"] = t)),
T[t] ||
((T[t] = !0),
wx.ready(function () {
wx.getLocalImgData({
localId: i,
success: function (e) {
n.src = e.localData;
},
});
}))));
},
!0
),
n.addEventListener(
"load",
function (e) {
var n;
l ||
((n = (e = e.target).tagName),
e.src,
"IMG" != n && "VIDEO" != n && "AUDIO" != n && "SOURCE" != n) ||
((n = e["wx-id"]) && (T[n] = !1));
},
!0
),
e && (r.wx = r.jWeixin = _),
_
);
else return r.jWeixin;
function k(n, e, i) {
r.WeixinJSBridge
? WeixinJSBridge.invoke(n, P(e), function (e) {
V(n, e, i);
})
: C(n, i);
}
function M(n, i, t) {
r.WeixinJSBridge
? WeixinJSBridge.on(n, function (e) {
t && t.trigger && t.trigger(e), V(n, e, i);
})
: C(n, t || i);
}
function P(e) {
return (
((e = e || {}).appId = h.appId),
(e.verifyAppId = h.appId),
(e.verifySignType = "sha1"),
(e.verifyTimestamp = h.timestamp + ""),
(e.verifyNonceStr = h.nonceStr),
(e.verifySignature = h.signature),
e
);
}
function x(e) {
return {
timeStamp: e.timestamp + "",
nonceStr: e.nonceStr,
package: e.package,
paySign: e.paySign,
signType: e.signType || "SHA1",
};
}
function V(e, n, i) {
("openEnterpriseChat" != e && "openBusinessView" !== e) ||
(n.errCode = n.err_code),
delete n.err_code,
delete n.err_desc,
delete n.err_detail;
var t = n.errMsg,
e =
(t ||
((t = n.err_msg),
delete n.err_msg,
(t = (function (e, n) {
var i = c[e];
i && (e = i);
i = "ok";
{
var t;
n &&
((t = n.indexOf(":")),
("access denied" !=
(i = (i = (i =
-1 !=
(i =
-1 !=
(i =
"failed" ==
(i = "confirm" == (i = n.substring(t + 1)) ? "ok" : i)
? "fail"
: i).indexOf("failed_")
? i.substring(7)
: i).indexOf("fail_")
? i.substring(5)
: i).replace(/_/g, " ")).toLowerCase()) &&
"no permission to execute" != i) ||
(i = "permission denied"),
"" ==
(i =
"config" == e && "function not exist" == i ? "ok" : i)) &&
(i = "fail");
}
return (n = e + ":" + i);
})(e, t)),
(n.errMsg = t)),
(i = i || {})._complete && (i._complete(n), delete i._complete),
(t = n.errMsg || ""),
h.debug && !i.isInnerInvoke && alert(JSON.stringify(n)),
t.indexOf(":"));
switch (t.substring(e + 1)) {
case "ok":
i.success && i.success(n);
break;
case "cancel":
i.cancel && i.cancel(n);
break;
default:
i.fail && i.fail(n);
}
i.complete && i.complete(n);
}
function A(e) {
if (e) {
for (var n = 0, i = e.length; n < i; ++n) {
var t = e[n],
t = a[t];
t && (e[n] = t);
}
return e;
}
}
function C(e, n) {
var i;
!h.debug ||
(n && n.isInnerInvoke) ||
((i = c[e]) && (e = i),
n && n._complete && delete n._complete,
console.log('"' + e + '",', n || ""));
}
function B(n) {
var i;
o ||
s ||
h.debug ||
p < "6.0.2" ||
g.systemType < 0 ||
((i = new Image()),
(g.appId = h.appId),
(g.initTime = m.initEndTime - m.initStartTime),
(g.preVerifyTime = m.preVerifyEndTime - m.preVerifyStartTime),
_.getNetworkType({
isInnerInvoke: !0,
success: function (e) {
g.networkType = e.networkType;
e =
"https://open.weixin.qq.com/sdk/report?v=" +
g.version +
"&o=" +
g.isPreVerifyOk +
"&s=" +
g.systemType +
"&c=" +
g.clientVersion +
"&a=" +
g.appId +
"&n=" +
g.networkType +
"&i=" +
g.initTime +
"&p=" +
g.preVerifyTime +
"&u=" +
g.url +
"&jsapi_name=" +
(n ? n.jsApiName : "");
i.src = e;
},
}));
}
function L() {
return new Date().getTime();
}
function O(e) {
d &&
(r.WeixinJSBridge
? e()
: n.addEventListener &&
n.addEventListener("WeixinJSBridgeReady", e, !1));
}
});

View File

@@ -0,0 +1,15 @@
{
"name": "weixin-js-sdk",
"version": "1.6.5",
"license": "MIT",
"main": "index.js",
"description": "微信官方 js-sdk npm 安装版,支持 typescript",
"repository": {
"type": "git",
"url": "https://github.com/yanxi123-com/weixin-js-sdk"
},
"homepage": "https://yanxi123.com/",
"__npminstall_done": true,
"_from": "weixin-js-sdk@1.6.5",
"_resolved": "https://registry.npmmirror.com/weixin-js-sdk/-/weixin-js-sdk-1.6.5.tgz"
}

21
node_modules/weixin-js-sdk/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Yanxi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

36
node_modules/weixin-js-sdk/README.md generated vendored Normal file
View File

@@ -0,0 +1,36 @@
微信官方 js-sdk
----
说明: 仅将官方 js-sdk 发布到 npm支持 CommonJS便于 browserify, webpack 等直接使用,支持 TypeScript。
官方 JS 源码: https://res.wx.qq.com/open/js/jweixin-1.6.0.js
官方使用说明: https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html
安装:
```shell
npm install weixin-js-sdk
```
使用:
```javascript
// commonjs
var wx = require('weixin-js-sdk');
// es module
import wx from 'weixin-js-sdk'
```
### Old versions
* [1.0.0](https://github.com/yanxi123-com/weixin-js-sdk/tree/1.0.0)
* [1.2.0](https://github.com/yanxi123-com/weixin-js-sdk/tree/1.2.0)
### 个人主页
* [https://yanxi123.com/](https://yanxi123.com/)
### 感谢
TypeScript 定义文件来自 [wx-jssdk-ts](https://github.com/zhaoky/wx-jssdk-ts/blob/master/index.d.ts)

601
node_modules/weixin-js-sdk/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,601 @@
// Type definitions for weixin jssdk 1.6.0
// Project: https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace wx {
type ImageSizeType = "original" | "compressed";
type ImageSourceType = "album" | "camera";
type VideoSourceType = "album" | "camera";
type ApiMethod =
| "onMenuShareTimeline"
| "onMenuShareAppMessage"
| "onMenuShareQQ"
| "onMenuShareWeibo"
| "onMenuShareQZone"
| "updateAppMessageShareData"
| "updateTimelineShareData"
| "startRecord"
| "stopRecord"
| "onVoiceRecordEnd"
| "playVoice"
| "pauseVoice"
| "stopVoice"
| "onVoicePlayEnd"
| "uploadVoice"
| "downloadVoice"
| "chooseImage"
| "previewImage"
| "uploadImage"
| "downloadImage"
| "translateVoice"
| "getNetworkType"
| "openLocation"
| "getLocation"
| "hideOptionMenu"
| "showOptionMenu"
| "hideMenuItems"
| "showMenuItems"
| "hideAllNonBaseMenuItem"
| "showAllNonBaseMenuItem"
| "closeWindow"
| "scanQRCode"
| "chooseWXPay"
| "openProductSpecificView"
| "addCard"
| "chooseCard"
| "openCard";
// 所有JS接口列表
type jsApiList = ApiMethod[];
// 开放标签列表
// https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_Open_Tag.html
type openTag = "wx-open-launch-weapp" | "wx-open-launch-app" | "wx-open-subscribe" | "wx-open-audio"
type openTagList = openTag[];
// 所有菜单项列表
// 基本类
type menuBase =
| "menuItem:exposeArticle" // 举报
| "menuItem:setFont" // 调整字体
| "menuItem:dayMode" // 日间模式
| "menuItem:nightMode" // 夜间模式
| "menuItem:refresh" // 刷新
| "menuItem:profile" // 查看公众号(已添加)
| "menuItem:addContact"; // 查看公众号(未添加)
// 传播类
type menuShare =
| "menuItem:share:appMessage" // 发送给朋友
| "menuItem:share:timeline" // 分享到朋友圈
| "menuItem:share:qq" // 分享到QQ
| "menuItem:share:weiboApp" // 分享到Weibo
| "menuItem:favorite" // 收藏
| "menuItem:share:facebook" // 分享到FB
| "menuItem:share:QZone"; // 分享到 QQ 空间
// 保护类
type menuProtected =
| "menuItem:editTag" // 编辑标签
| "menuItem:delete" // 删除
| "menuItem:copyUrl" // 复制链接
| "menuItem:originPage" // 原网页
| "menuItem:readMode" // 阅读模式
| "menuItem:openWithQQBrowser" // 在QQ浏览器中打开
| "menuItem:openWithSafari" // 在Safari中打开
| "menuItem:share:email" // 邮件
| "menuItem:share:brand"; // 一些特殊公众号
type menuList = Array<menuBase | menuProtected | menuShare>;
function config(conf: {
debug?: boolean; // 开启调试模式,调用的所有api的返回值会在客户端alert出来若要查看传入的参数可以在pc端打开参数信息会通过log打出仅在pc端时才会打印。
appId: string; // 必填,公众号的唯一标识
timestamp: number; // 必填,生成签名的时间戳
nonceStr: string; // 必填,生成签名的随机串
signature: string; // 必填签名见附录1
jsApiList?: jsApiList; // 必填需要使用的JS接口列表所有JS接口列表见附录2
openTagList?: openTagList;
}): void;
interface Resouce {
localId: string;
}
interface BaseParams {
success?(...args: any[]): void;
/** 接口调用失败的回调函数 */
fail?(...args: any[]): void;
/** 接口取消调用的回调函数 */
cancel?(...args: any[]): void;
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
complete?(...args: any[]): void;
}
function ready(fn: () => void): void;
function error(fn: (err: { errMsg: string }) => void): void;
interface IcheckJsApi extends BaseParams {
jsApiList: jsApiList; // 需要检测的JS接口列表所有JS接口列表见附录2,
// 以键值对的形式返回可用的api值true不可用为false
// 如:{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
success(res: {
checkResult: { [api: string]: boolean };
errMsg: string;
}): void;
}
/**
* 判断当前客户端版本是否支持指定JS接口
* 备注checkJsApi接口是客户端6.0.2新引入的一个预留接口第一期开放的接口均可不使用checkJsApi来检测。
*/
function checkJsApi(params: IcheckJsApi): void;
interface IonMenuShareTimeline extends BaseParams {
title: string; // 分享标题
link: string; // 分享链接
imgUrl: string; // 分享图标
// 用户确认分享后执行的回调函数
success(): void;
// 用户取消分享后执行的回调函数
cancel(): void;
}
/*=============================基础接口================================*/
/**
* 获取“分享到朋友圈”按钮点击状态及自定义分享内容接口
*/
function onMenuShareTimeline(params: IonMenuShareTimeline): void;
interface IonMenuShareAppMessage extends BaseParams {
title: string; // 分享标题
desc: string; // 分享描述
link: string; // 分享链接
imgUrl: string; // 分享图标
type?: "music" | "video或link" | "link"; // 分享类型,music、video或link不填默认为link
dataUrl?: string; // 如果type是music或video则要提供数据链接默认为空
// 用户确认分享后执行的回调函数
success(): void;
// 用户取消分享后执行的回调函数
cancel(): void;
}
/**
* 获取“分享给朋友”按钮点击状态及自定义分享内容接口
*/
function onMenuShareAppMessage(params: IonMenuShareAppMessage): void;
interface IonMenuShareQQ extends BaseParams {
title: string; // 分享标题
desc: string; // 分享描述
link: string; // 分享链接
imgUrl: string; // 分享图标
// 用户确认分享后执行的回调函数
success(): void;
// 用户取消分享后执行的回调函数
cancel(): void;
}
/**
* 获取“分享到QQ”按钮点击状态及自定义分享内容接口
*/
function onMenuShareQQ(params: IonMenuShareQQ): void;
interface IonMenuShareWeibo extends BaseParams {
title: string; // 分享标题
desc: string; // 分享描述
link: string; // 分享链接
imgUrl: string; // 分享图标
// 用户确认分享后执行的回调函数
success(): void;
// 用户取消分享后执行的回调函数
cancel(): void;
}
/**
* 获取“分享到腾讯微博”按钮点击状态及自定义分享内容接口
*/
function onMenuShareWeibo(params: IonMenuShareWeibo): void;
interface IonMenuShareQZone extends BaseParams {
title: string; // 分享标题
desc: string; // 分享描述
link: string; // 分享链接
imgUrl: string; // 分享图标
// 用户确认分享后执行的回调函数
success(): void;
// 用户取消分享后执行的回调函数
cancel(): void;
}
/**
* 获取“分享到QQ空间”按钮点击状态及自定义分享内容接口
*/
function onMenuShareQZone(params: IonMenuShareQZone): void;
interface IupdateAppMessageShareData extends BaseParams {
title: string; // 分享标题
desc: string; // 分享描述
link: string; // 分享链接
imgUrl: string; // 分享图标
// 用户确认分享后执行的回调函数
success(): void;
}
/**
* 获取“分享给朋友”及“分享到QQ”按钮点击状态及自定义分享内容接口
*/
function updateAppMessageShareData(params: IupdateAppMessageShareData): void;
interface IupdateTimelineShareData extends BaseParams {
title: string; // 分享标题
link: string; // 分享链接
imgUrl: string; // 分享图标
// 用户确认分享后执行的回调函数
success(): void;
}
/**
* 获取“分享到朋友圈”及“分享到QQ空间”按钮点击状态及自定义分享内容接口
*/
function updateTimelineShareData(params: IupdateTimelineShareData): void;
/*=============================基础接口================================*/
/*=============================图像接口================================*/
interface IchooseImage extends BaseParams {
/** 最多可以选择的图片张数默认9 */
count?: number;
/** original 原图compressed 压缩图,默认二者都有 */
sizeType?: ImageSizeType[];
/** album 从相册选图camera 使用相机,默认二者都有 */
sourceType?: ImageSourceType[];
/** 成功则返回图片的本地文件路径列表 tempFilePaths */
success(res: {
sourceType: string; // weixin album camera
localIds: string[];
errMsg: string;
}): void;
cancel(): void;
}
/**
* 从本地相册选择图片或使用相机拍照。
*/
function chooseImage(params: IchooseImage): void;
interface IpreviewImage extends BaseParams {
current: string; // 当前显示图片的http链接
urls: string[]; // 需要预览的图片http链接列表
}
/**
* 预览图片接口
*/
function previewImage(params: IpreviewImage): void;
interface IuploadResource extends BaseParams {
localId: string; // 需要上传的图片的本地ID由chooseImage接口获得
isShowProgressTips: number; // 默认为1显示进度提示
// 返回图片的服务器端ID
success(res: { serverId: string }): void;
}
/**
* 上传图片接口
*/
function uploadImage(params: IuploadResource): void;
interface IdownloadResource extends BaseParams {
serverId: string; // 需要下载的图片的服务器端ID由uploadImage接口获得
isShowProgressTips: number; // 默认为1显示进度提示
// 返回图片下载后的本地ID
success(res: Resouce): void;
}
/**
* 下载图片接口
*/
function downloadImage(params: IdownloadResource): void;
interface IgetLocalImgData extends BaseParams {
localId: string; // 图片的localID
// localData是图片的base64数据可以用img标签显示
success(res: { localData: string }): void;
}
/**
* 获取本地图片接口
*/
function getLocalImgData(params: IgetLocalImgData): void;
/*=============================图像接口================================*/
/*=============================音频接口================================*/
/**
* 开始录音接口
*/
function startRecord(): void;
interface IstopRecord extends BaseParams {
success(res: Resouce): void;
}
/**
* 停止录音接口
*/
function stopRecord(params: IstopRecord): void;
interface IonVoiceRecordEnd extends BaseParams {
// 录音时间超过一分钟没有停止的时候会执行 complete 回调
complete(res: Resouce): void;
}
/**
* 监听录音自动停止接口
*/
function onVoiceRecordEnd(params: IonVoiceRecordEnd): void;
interface IplaypausestopVoice extends BaseParams {
localId: string; // 需要播放的音频的本地ID由stopRecord接口获得
}
/**
* 播放语音接口
*/
function playVoice(params: IplaypausestopVoice): void;
/**
* 暂停播放接口
*/
function pauseVoice(params: IplaypausestopVoice): void;
/**
* 停止播放接口
*/
function stopVoice(params: IplaypausestopVoice): void;
interface IonVoicePlayEnd extends BaseParams {
success(res: Resouce): void;
}
/**
* 监听语音播放完毕接口
*/
function onVoicePlayEnd(params: IonVoicePlayEnd): void;
/**
* 上传语音接口
* 备注上传语音有效期3天可用微信多媒体接口下载语音到自己的服务器
* ,此处获得的 serverId 即 media_id参考文档
* ../12 / 58bfcfabbd501c7cd77c19bd9cfa8354.html
* 目前多媒体文件下载接口的频率限制为10000次/ 天,
* 如需要调高频率请邮件weixin - open@qq.com,
* 邮件主题为【申请多媒体接口调用量】,请对你的项目进行简单描述,
* 附上产品体验链接,并对用户量和使用量进行说明。
*/
function uploadVoice(params: IuploadResource): void;
/**
* 下载语音接口
*/
function downloadVoice(params: IdownloadResource): void;
/*=============================音频接口================================*/
/*=============================智能接口================================*/
interface ItranslateVoice extends BaseParams {
localId: string; // 需要识别的音频的本地Id由录音相关接口获得
isShowProgressTips: number; // 默认为1显示进度提示
success(res: { translateResult: string }): void;
}
/**
* 识别音频并返回识别结果接口
*/
function translateVoice(params: ItranslateVoice): void;
/*=============================智能接口================================*/
/*=============================设备信息================================*/
type networkType = "2g" | "3g" | "4g" | "wifi";
interface IgetNetworkType extends BaseParams {
success(res: { networkType: networkType }): void;
}
/**
* 获取网络状态接口
*/
function getNetworkType(params: IgetNetworkType): void;
/*=============================设备信息================================*/
/*=============================地理位置================================*/
interface IopenLocation extends BaseParams {
latitude: number; // 纬度浮点数范围为90 ~ -90
longitude: number; // 经度浮点数范围为180 ~ -180。
name: string; // 位置名
address: string; // 地址详情说明
scale: number; // 地图缩放级别,整形值,范围从1~28。默认为最大
infoUrl: string; // 在查看位置界面底部显示的超链接,可点击跳转
}
/**
* 使用微信内置地图查看位置接口
*/
function openLocation(params: IopenLocation): void;
interface IgetLocation extends BaseParams {
type: "wgs84" | "gcj02"; // 默认为wgs84的gps坐标如果要返回直接给openLocation用的火星坐标可传入'gcj02'
success(res: {
latitude: number; // 纬度浮点数范围为90 ~ -90
longitude: number; // 经度浮点数范围为180 ~ -180。
speed: number; // 速度,以米/每秒计
accuracy: number; // 位置精度
}): void;
}
/**
* 获取地理位置接口
*/
function getLocation(params: IgetLocation): void;
/*=============================地理位置================================*/
/*=============================摇一摇周边================================*/
interface IstartSearchBeacons extends BaseParams {
ticket: string; // 摇周边的业务ticket, 系统自动添加在摇出来的页面链接后面
// 开启查找完成后的回调函数
complete(argv: any): void;
}
/**
* 开启查找周边ibeacon设备接口
* 备注:如需接入摇一摇周边功能,请参考:申请开通摇一摇周边
*/
function startSearchBeacons(params: IstartSearchBeacons): void;
interface IstopSearchBeacons extends BaseParams {
// 关闭查找完成后的回调函数
complete(res: any): void;
}
/**
* 关闭查找周边ibeacon设备接口
*/
function stopSearchBeacons(params: IstopSearchBeacons): void;
interface IonSearchBeacons extends BaseParams {
// 回调函数,可以数组形式取得该商家注册的在周边的相关设备列表
complete(argv: any): void;
}
/**
* 监听周边ibeacon设备接口
*/
function onSearchBeacons(params: IonSearchBeacons): void;
/*=============================摇一摇周边================================*/
/*=============================界面操作================================*/
/**
* 隐藏右上角菜单接口
*/
function hideOptionMenu(): void;
/**
* 显示右上角菜单接口
*/
function showOptionMenu(): void;
/**
* 关闭当前网页窗口接口
*/
function closeWindow(): void;
interface IhideMenuItems extends BaseParams {
menuList: Array<menuProtected | menuShare>; // 要隐藏的菜单项只能隐藏“传播类”和“保护类”按钮所有menu项见附录3
}
/**
* 批量隐藏功能按钮接口
*/
function hideMenuItems(params: IhideMenuItems): void;
interface IshowMenuItems extends BaseParams {
menuList: menuList; // 要显示的菜单项所有menu项见附录3
}
/**
* 批量显示功能按钮接口
*/
function showMenuItems(params: IshowMenuItems): void;
/**
* 隐藏所有非基础按钮接口
* “基本类”按钮详见附录3
*/
function hideAllNonBaseMenuItem(): void;
/**
* 显示所有功能按钮接口
*/
function showAllNonBaseMenuItem(): void;
/*=============================界面操作================================*/
/*=============================微信扫一扫================================*/
type scanType = "qrCode" | "barCode";
interface IscanQRCode extends BaseParams {
needResult: 0 | 1; // 默认为0扫描结果由微信处理1则直接返回扫描结果
scanType: scanType[]; // 可以指定扫二维码还是一维码,默认二者都有
// 当needResult 为 1 时,扫码返回的结果
success(res: { resultStr: string }): void;
}
/**
* 调起微信扫一扫接口
*/
function scanQRCode(params: IscanQRCode): void;
/*=============================微信扫一扫================================*/
/*=============================微信小店================================*/
interface IopenProductSpecificView extends BaseParams {
productId: string; // 商品id
viewType: "0" | "1" | "2"; // 0.默认值普通商品详情页1.扫一扫商品详情页2.小店商品详情页
}
/**
* 跳转微信商品页接口
*/
function openProductSpecificView(params: IopenProductSpecificView): void;
/*=============================微信卡券================================*/
interface IchooseCard extends BaseParams {
shopId: string; // 门店Id
cardType: string; // 卡券类型
cardId: string; // 卡券Id
timestamp: number; // 卡券签名时间戳
nonceStr: string; // 卡券签名随机串
signType: string; // 签名方式,默认'SHA1'
cardSign: string; // 卡券签名
success(res: { cardList: string[] }): void;
}
/**
* 拉取适用卡券列表并获取用户选择信息
*/
function chooseCard(params: IchooseCard): void;
interface IaddCard extends BaseParams {
cardList: Array<{
cardId: string;
cardExt: string;
}>; // 需要添加的卡券列表
success(res: { cardList: string[] }): void;
}
/**
* 批量添加卡券接口
*/
function addCard(): void;
interface IopenCard extends BaseParams {
cardList: Array<{
cardId: string;
code: string;
}>; // 需要打开的卡券列表
}
/**
* 查看微信卡包中的卡券接口
*/
function openCard(params: IopenCard): void;
interface IconsumeAndShareCard extends BaseParams {
cardId: string;
code: string;
}
/**
* 核销后再次赠送卡券接口
*/
function consumeAndShareCard(params: IconsumeAndShareCard): void;
/*=============================微信卡券================================*/
/*=============================微信支付================================*/
interface IchooseWXPay extends BaseParams {
timestamp: number; // 支付签名时间戳注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
nonceStr: string; // 支付签名随机串,不长于 32 位
package: string; // 统一支付接口返回的prepay_id参数值提交格式如prepay_id=***
signType: string; // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
paySign: string; // 支付签名
// 支付成功后的回调函数
success(res: any): void;
}
/**
* 发起一个微信支付请求
*/
function chooseWXPay(params: IchooseWXPay): void;
/*=============================微信支付================================*/
/*=============================微信小程序==============================*/
interface miniProgramMethodsParams extends BaseParams {
url: string;
}
interface miniProgramMethods {
navigateTo(params: miniProgramMethodsParams): void;
navigateBack(params: miniProgramMethodsParams): void;
switchTab(params: miniProgramMethodsParams): void;
reLaunch(params: miniProgramMethodsParams): void;
redirectTo(params: miniProgramMethodsParams): void;
postMessage(params: { data: any }): void;
getEnv(fn: (res: any) => void): void;
}
const miniProgram: miniProgramMethods;
/*=============================微信小程序==============================*/
}
declare function wx(): void;
/*=============================微信内全局变量==============================*/
declare global {
interface Window {
WeixinJSBridge: any;
__wxjs_environment: any;
}
const WeixinJSBridge: any;
}
export default wx;

891
node_modules/weixin-js-sdk/index.js generated vendored Normal file
View File

@@ -0,0 +1,891 @@
!(function (e, n) {
module.exports = n(e);
})(typeof window === "object" && window, function (r, e) {
if (!r) {
console.warn("can't use weixin-js-sdk in server side");
return;
}
var a, c, n, i, t, o, s, d, l, u, p, f, m, g, h, S, y, I, v, _, w, T;
if (!r.jWeixin)
return (
(a = {
config: "preVerifyJSAPI",
onMenuShareTimeline: "menu:share:timeline",
onMenuShareAppMessage: "menu:share:appmessage",
onMenuShareQQ: "menu:share:qq",
onMenuShareWeibo: "menu:share:weiboApp",
onMenuShareQZone: "menu:share:QZone",
previewImage: "imagePreview",
getLocation: "geoLocation",
openProductSpecificView: "openProductViewWithPid",
addCard: "batchAddCard",
openCard: "batchViewCard",
chooseWXPay: "getBrandWCPayRequest",
openEnterpriseRedPacket: "getRecevieBizHongBaoRequest",
startSearchBeacons: "startMonitoringBeacons",
stopSearchBeacons: "stopMonitoringBeacons",
onSearchBeacons: "onBeaconsInRange",
consumeAndShareCard: "consumedShareCard",
openAddress: "editAddress",
}),
(c = (function () {
var e,
n = {};
for (e in a) n[a[e]] = e;
return n;
})()),
(n = r.document),
(i = n.title),
(t = navigator.userAgent.toLowerCase()),
(f = navigator.platform.toLowerCase()),
(o = !(!f.match("mac") && !f.match("win"))),
(s = -1 != t.indexOf("wxdebugger")),
(d = -1 != t.indexOf("micromessenger")),
(l = -1 != t.indexOf("android")),
(u = -1 != t.indexOf("iphone") || -1 != t.indexOf("ipad")),
(p = (f =
t.match(/micromessenger\/(\d+\.\d+\.\d+)/) ||
t.match(/micromessenger\/(\d+\.\d+)/))
? f[1]
: ""),
(m = {
initStartTime: L(),
initEndTime: 0,
preVerifyStartTime: 0,
preVerifyEndTime: 0,
}),
(g = {
version: 1,
appId: "",
initTime: 0,
preVerifyTime: 0,
networkType: "",
isPreVerifyOk: 1,
systemType: u ? 1 : l ? 2 : -1,
clientVersion: p,
url: encodeURIComponent(location.href),
}),
(h = {}),
(S = { _completes: [] }),
(y = { state: 0, data: {} }),
O(function () {
m.initEndTime = L();
}),
(I = !1),
(v = []),
(_ = {
config: function (e) {
C("config", (h = e));
var o = !1 !== h.check;
O(function () {
if (o)
k(
a.config,
{
verifyJsApiList: A(h.jsApiList),
verifyOpenTagList: A(h.openTagList),
},
((S._complete = function (e) {
(m.preVerifyEndTime = L()), (y.state = 1), (y.data = e);
}),
(S.success = function (e) {
g.isPreVerifyOk = 0;
}),
(S.fail = function (e) {
S._fail ? S._fail(e) : (y.state = -1);
}),
(t = S._completes).push(function () {
B();
}),
(S.complete = function (e) {
for (var n = 0, i = t.length; n < i; ++n) t[n]();
S._completes = [];
}),
S)
),
(m.preVerifyStartTime = L());
else {
y.state = 1;
for (var e = S._completes, n = 0, i = e.length; n < i; ++n)
e[n]();
S._completes = [];
}
var t;
}),
_.invoke ||
((_.invoke = function (e, n, i) {
r.WeixinJSBridge && WeixinJSBridge.invoke(e, P(n), i);
}),
(_.on = function (e, n) {
r.WeixinJSBridge && WeixinJSBridge.on(e, n);
}));
},
ready: function (e) {
(0 != y.state || (S._completes.push(e), !d && h.debug)) && e();
},
error: function (e) {
p < "6.0.2" || (-1 == y.state ? e(y.data) : (S._fail = e));
},
checkJsApi: function (e) {
k(
"checkJsApi",
{ jsApiList: A(e.jsApiList) },
((e._complete = function (e) {
l && (i = e.checkResult) && (e.checkResult = JSON.parse(i));
var n,
i = e,
t = i.checkResult;
for (n in t) {
var o = c[n];
o && ((t[o] = t[n]), delete t[n]);
}
}),
e)
);
},
onMenuShareTimeline: function (e) {
M(
a.onMenuShareTimeline,
{
complete: function () {
k(
"shareTimeline",
{
title: e.title || i,
desc: e.title || i,
img_url: e.imgUrl || "",
link: e.link || location.href,
type: e.type || "link",
data_url: e.dataUrl || "",
},
e
);
},
},
e
);
},
onMenuShareAppMessage: function (n) {
M(
a.onMenuShareAppMessage,
{
complete: function (e) {
"favorite" === e.scene
? k("sendAppMessage", {
title: n.title || i,
desc: n.desc || "",
link: n.link || location.href,
img_url: n.imgUrl || "",
type: n.type || "link",
data_url: n.dataUrl || "",
})
: k(
"sendAppMessage",
{
title: n.title || i,
desc: n.desc || "",
link: n.link || location.href,
img_url: n.imgUrl || "",
type: n.type || "link",
data_url: n.dataUrl || "",
},
n
);
},
},
n
);
},
onMenuShareQQ: function (e) {
M(
a.onMenuShareQQ,
{
complete: function () {
k(
"shareQQ",
{
title: e.title || i,
desc: e.desc || "",
img_url: e.imgUrl || "",
link: e.link || location.href,
},
e
);
},
},
e
);
},
onMenuShareWeibo: function (e) {
M(
a.onMenuShareWeibo,
{
complete: function () {
k(
"shareWeiboApp",
{
title: e.title || i,
desc: e.desc || "",
img_url: e.imgUrl || "",
link: e.link || location.href,
},
e
);
},
},
e
);
},
onMenuShareQZone: function (e) {
M(
a.onMenuShareQZone,
{
complete: function () {
k(
"shareQZone",
{
title: e.title || i,
desc: e.desc || "",
img_url: e.imgUrl || "",
link: e.link || location.href,
},
e
);
},
},
e
);
},
updateTimelineShareData: function (e) {
k(
"updateTimelineShareData",
{ title: e.title, link: e.link, imgUrl: e.imgUrl },
e
);
},
updateAppMessageShareData: function (e) {
k(
"updateAppMessageShareData",
{ title: e.title, desc: e.desc, link: e.link, imgUrl: e.imgUrl },
e
);
},
startRecord: function (e) {
k("startRecord", {}, e);
},
stopRecord: function (e) {
k("stopRecord", {}, e);
},
onVoiceRecordEnd: function (e) {
M("onVoiceRecordEnd", e);
},
playVoice: function (e) {
k("playVoice", { localId: e.localId }, e);
},
pauseVoice: function (e) {
k("pauseVoice", { localId: e.localId }, e);
},
stopVoice: function (e) {
k("stopVoice", { localId: e.localId }, e);
},
onVoicePlayEnd: function (e) {
M("onVoicePlayEnd", e);
},
uploadVoice: function (e) {
k(
"uploadVoice",
{
localId: e.localId,
isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
},
e
);
},
downloadVoice: function (e) {
k(
"downloadVoice",
{
serverId: e.serverId,
isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
},
e
);
},
translateVoice: function (e) {
k(
"translateVoice",
{
localId: e.localId,
isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
},
e
);
},
chooseImage: function (e) {
k(
"chooseImage",
{
scene: "1|2",
count: e.count || 9,
sizeType: e.sizeType || ["original", "compressed"],
sourceType: e.sourceType || ["album", "camera"],
},
((e._complete = function (e) {
if (l) {
var n = e.localIds;
try {
n && (e.localIds = JSON.parse(n));
} catch (e) {}
}
}),
e)
);
},
getLocation: function (e) {
(e = e || {}),
k(
a.getLocation,
{ type: e.type || "wgs84" },
((e._complete = function (e) {
delete e.type;
}),
e)
);
},
previewImage: function (e) {
k(a.previewImage, { current: e.current, urls: e.urls }, e);
},
uploadImage: function (e) {
k(
"uploadImage",
{
localId: e.localId,
isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
},
e
);
},
downloadImage: function (e) {
k(
"downloadImage",
{
serverId: e.serverId,
isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1,
},
e
);
},
getLocalImgData: function (e) {
!1 === I
? ((I = !0),
k(
"getLocalImgData",
{ localId: e.localId },
((e._complete = function (e) {
var n;
(I = !1),
0 < v.length && ((n = v.shift()), wx.getLocalImgData(n));
}),
e)
))
: v.push(e);
},
getNetworkType: function (e) {
k(
"getNetworkType",
{},
((e._complete = function (e) {
var n = e,
e = n.errMsg,
i = ((n.errMsg = "getNetworkType:ok"), n.subtype);
if ((delete n.subtype, i)) n.networkType = i;
else {
var i = e.indexOf(":"),
t = e.substring(i + 1);
switch (t) {
case "wifi":
case "edge":
case "wwan":
n.networkType = t;
break;
default:
n.errMsg = "getNetworkType:fail";
}
}
}),
e)
);
},
openLocation: function (e) {
k(
"openLocation",
{
latitude: e.latitude,
longitude: e.longitude,
name: e.name || "",
address: e.address || "",
scale: e.scale || 28,
infoUrl: e.infoUrl || "",
},
e
);
},
hideOptionMenu: function (e) {
k("hideOptionMenu", {}, e);
},
showOptionMenu: function (e) {
k("showOptionMenu", {}, e);
},
closeWindow: function (e) {
k("closeWindow", {}, (e = e || {}));
},
hideMenuItems: function (e) {
k("hideMenuItems", { menuList: e.menuList }, e);
},
showMenuItems: function (e) {
k("showMenuItems", { menuList: e.menuList }, e);
},
hideAllNonBaseMenuItem: function (e) {
k("hideAllNonBaseMenuItem", {}, e);
},
showAllNonBaseMenuItem: function (e) {
k("showAllNonBaseMenuItem", {}, e);
},
scanQRCode: function (e) {
k(
"scanQRCode",
{
needResult: (e = e || {}).needResult || 0,
scanType: e.scanType || ["qrCode", "barCode"],
},
((e._complete = function (e) {
var n;
u &&
(n = e.resultStr) &&
((n = JSON.parse(n)),
(e.resultStr = n && n.scan_code && n.scan_code.scan_result));
}),
e)
);
},
openAddress: function (e) {
k(
a.openAddress,
{},
((e._complete = function (e) {
((e = e).postalCode = e.addressPostalCode),
delete e.addressPostalCode,
(e.provinceName = e.proviceFirstStageName),
delete e.proviceFirstStageName,
(e.cityName = e.addressCitySecondStageName),
delete e.addressCitySecondStageName,
(e.countryName = e.addressCountiesThirdStageName),
delete e.addressCountiesThirdStageName,
(e.detailInfo = e.addressDetailInfo),
delete e.addressDetailInfo;
}),
e)
);
},
openProductSpecificView: function (e) {
k(
a.openProductSpecificView,
{
pid: e.productId,
view_type: e.viewType || 0,
ext_info: e.extInfo,
},
e
);
},
addCard: function (e) {
for (var n = e.cardList, i = [], t = 0, o = n.length; t < o; ++t) {
var r = n[t],
r = { card_id: r.cardId, card_ext: r.cardExt };
i.push(r);
}
k(
a.addCard,
{ card_list: i },
((e._complete = function (e) {
if ((n = e.card_list)) {
for (var n, i = 0, t = (n = JSON.parse(n)).length; i < t; ++i) {
var o = n[i];
(o.cardId = o.card_id),
(o.cardExt = o.card_ext),
(o.isSuccess = !!o.is_succ),
delete o.card_id,
delete o.card_ext,
delete o.is_succ;
}
(e.cardList = n), delete e.card_list;
}
}),
e)
);
},
chooseCard: function (e) {
k(
"chooseCard",
{
app_id: h.appId,
location_id: e.shopId || "",
sign_type: e.signType || "SHA1",
card_id: e.cardId || "",
card_type: e.cardType || "",
card_sign: e.cardSign,
time_stamp: e.timestamp + "",
nonce_str: e.nonceStr,
},
((e._complete = function (e) {
(e.cardList = e.choose_card_info), delete e.choose_card_info;
}),
e)
);
},
openCard: function (e) {
for (var n = e.cardList, i = [], t = 0, o = n.length; t < o; ++t) {
var r = n[t],
r = { card_id: r.cardId, code: r.code };
i.push(r);
}
k(a.openCard, { card_list: i }, e);
},
consumeAndShareCard: function (e) {
k(
a.consumeAndShareCard,
{ consumedCardId: e.cardId, consumedCode: e.code },
e
);
},
chooseWXPay: function (e) {
k(a.chooseWXPay, x(e), e), B({ jsApiName: "chooseWXPay" });
},
openEnterpriseRedPacket: function (e) {
k(a.openEnterpriseRedPacket, x(e), e);
},
startSearchBeacons: function (e) {
k(a.startSearchBeacons, { ticket: e.ticket }, e);
},
stopSearchBeacons: function (e) {
k(a.stopSearchBeacons, {}, e);
},
onSearchBeacons: function (e) {
M(a.onSearchBeacons, e);
},
openEnterpriseChat: function (e) {
k(
"openEnterpriseChat",
{ useridlist: e.userIds, chatname: e.groupName },
e
);
},
launchMiniProgram: function (e) {
k(
"launchMiniProgram",
{
targetAppId: e.targetAppId,
path: (function (e) {
var n;
if ("string" == typeof e && 0 < e.length)
return (
(n = e.split("?")[0]),
(n += ".html"),
void 0 !== (e = e.split("?")[1]) ? n + "?" + e : n
);
})(e.path),
envVersion: e.envVersion,
},
e
);
},
openBusinessView: function (e) {
k(
"openBusinessView",
{
businessType: e.businessType,
queryString: e.queryString || "",
envVersion: e.envVersion,
},
((e._complete = function (n) {
if (l) {
var e = n.extraData;
if (e)
try {
n.extraData = JSON.parse(e);
} catch (e) {
n.extraData = {};
}
}
}),
e)
);
},
miniProgram: {
navigateBack: function (e) {
(e = e || {}),
O(function () {
k(
"invokeMiniProgramAPI",
{ name: "navigateBack", arg: { delta: e.delta || 1 } },
e
);
});
},
navigateTo: function (e) {
O(function () {
k(
"invokeMiniProgramAPI",
{ name: "navigateTo", arg: { url: e.url } },
e
);
});
},
redirectTo: function (e) {
O(function () {
k(
"invokeMiniProgramAPI",
{ name: "redirectTo", arg: { url: e.url } },
e
);
});
},
switchTab: function (e) {
O(function () {
k(
"invokeMiniProgramAPI",
{ name: "switchTab", arg: { url: e.url } },
e
);
});
},
reLaunch: function (e) {
O(function () {
k(
"invokeMiniProgramAPI",
{ name: "reLaunch", arg: { url: e.url } },
e
);
});
},
postMessage: function (e) {
O(function () {
k(
"invokeMiniProgramAPI",
{ name: "postMessage", arg: e.data || {} },
e
);
});
},
getEnv: function (e) {
O(function () {
e({ miniprogram: "miniprogram" === r.__wxjs_environment });
});
},
},
}),
(w = 1),
(T = {}),
n.addEventListener(
"error",
function (e) {
var n, i, t;
l ||
((t = (n = e.target).tagName),
(i = n.src),
"IMG" != t && "VIDEO" != t && "AUDIO" != t && "SOURCE" != t) ||
(-1 != i.indexOf("wxlocalresource://") &&
(e.preventDefault(),
e.stopPropagation(),
(t = n["wx-id"]) || ((t = w++), (n["wx-id"] = t)),
T[t] ||
((T[t] = !0),
wx.ready(function () {
wx.getLocalImgData({
localId: i,
success: function (e) {
n.src = e.localData;
},
});
}))));
},
!0
),
n.addEventListener(
"load",
function (e) {
var n;
l ||
((n = (e = e.target).tagName),
e.src,
"IMG" != n && "VIDEO" != n && "AUDIO" != n && "SOURCE" != n) ||
((n = e["wx-id"]) && (T[n] = !1));
},
!0
),
e && (r.wx = r.jWeixin = _),
_
);
else return r.jWeixin;
function k(n, e, i) {
r.WeixinJSBridge
? WeixinJSBridge.invoke(n, P(e), function (e) {
V(n, e, i);
})
: C(n, i);
}
function M(n, i, t) {
r.WeixinJSBridge
? WeixinJSBridge.on(n, function (e) {
t && t.trigger && t.trigger(e), V(n, e, i);
})
: C(n, t || i);
}
function P(e) {
return (
((e = e || {}).appId = h.appId),
(e.verifyAppId = h.appId),
(e.verifySignType = "sha1"),
(e.verifyTimestamp = h.timestamp + ""),
(e.verifyNonceStr = h.nonceStr),
(e.verifySignature = h.signature),
e
);
}
function x(e) {
return {
timeStamp: e.timestamp + "",
nonceStr: e.nonceStr,
package: e.package,
paySign: e.paySign,
signType: e.signType || "SHA1",
};
}
function V(e, n, i) {
("openEnterpriseChat" != e && "openBusinessView" !== e) ||
(n.errCode = n.err_code),
delete n.err_code,
delete n.err_desc,
delete n.err_detail;
var t = n.errMsg,
e =
(t ||
((t = n.err_msg),
delete n.err_msg,
(t = (function (e, n) {
var i = c[e];
i && (e = i);
i = "ok";
{
var t;
n &&
((t = n.indexOf(":")),
("access denied" !=
(i = (i = (i =
-1 !=
(i =
-1 !=
(i =
"failed" ==
(i = "confirm" == (i = n.substring(t + 1)) ? "ok" : i)
? "fail"
: i).indexOf("failed_")
? i.substring(7)
: i).indexOf("fail_")
? i.substring(5)
: i).replace(/_/g, " ")).toLowerCase()) &&
"no permission to execute" != i) ||
(i = "permission denied"),
"" ==
(i =
"config" == e && "function not exist" == i ? "ok" : i)) &&
(i = "fail");
}
return (n = e + ":" + i);
})(e, t)),
(n.errMsg = t)),
(i = i || {})._complete && (i._complete(n), delete i._complete),
(t = n.errMsg || ""),
h.debug && !i.isInnerInvoke && alert(JSON.stringify(n)),
t.indexOf(":"));
switch (t.substring(e + 1)) {
case "ok":
i.success && i.success(n);
break;
case "cancel":
i.cancel && i.cancel(n);
break;
default:
i.fail && i.fail(n);
}
i.complete && i.complete(n);
}
function A(e) {
if (e) {
for (var n = 0, i = e.length; n < i; ++n) {
var t = e[n],
t = a[t];
t && (e[n] = t);
}
return e;
}
}
function C(e, n) {
var i;
!h.debug ||
(n && n.isInnerInvoke) ||
((i = c[e]) && (e = i),
n && n._complete && delete n._complete,
console.log('"' + e + '",', n || ""));
}
function B(n) {
var i;
o ||
s ||
h.debug ||
p < "6.0.2" ||
g.systemType < 0 ||
((i = new Image()),
(g.appId = h.appId),
(g.initTime = m.initEndTime - m.initStartTime),
(g.preVerifyTime = m.preVerifyEndTime - m.preVerifyStartTime),
_.getNetworkType({
isInnerInvoke: !0,
success: function (e) {
g.networkType = e.networkType;
e =
"https://open.weixin.qq.com/sdk/report?v=" +
g.version +
"&o=" +
g.isPreVerifyOk +
"&s=" +
g.systemType +
"&c=" +
g.clientVersion +
"&a=" +
g.appId +
"&n=" +
g.networkType +
"&i=" +
g.initTime +
"&p=" +
g.preVerifyTime +
"&u=" +
g.url +
"&jsapi_name=" +
(n ? n.jsApiName : "");
i.src = e;
},
}));
}
function L() {
return new Date().getTime();
}
function O(e) {
d &&
(r.WeixinJSBridge
? e()
: n.addEventListener &&
n.addEventListener("WeixinJSBridgeReady", e, !1));
}
});

15
node_modules/weixin-js-sdk/package.json generated vendored Normal file
View File

@@ -0,0 +1,15 @@
{
"name": "weixin-js-sdk",
"version": "1.6.5",
"license": "MIT",
"main": "index.js",
"description": "微信官方 js-sdk npm 安装版,支持 typescript",
"repository": {
"type": "git",
"url": "https://github.com/yanxi123-com/weixin-js-sdk"
},
"homepage": "https://yanxi123.com/",
"__npminstall_done": true,
"_from": "weixin-js-sdk@1.6.5",
"_resolved": "https://registry.npmmirror.com/weixin-js-sdk/-/weixin-js-sdk-1.6.5.tgz"
}

5
package.json Normal file
View File

@@ -0,0 +1,5 @@
{
"dependencies": {
"weixin-js-sdk": "^1.6.5"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,336 @@
/**
* 头部背景
*/
.goods-top-bg {
height: calc(320rpx + var(--status-bar-height) + 5px);
/* #ifdef H5 */
height: 286rpx;
/* #endif */
background-color: #f5f5f5;
}
.goods-top-search-bg {
background-color: #f5f5f5;
}
/**
* 导航搜索、内容区域
*/
.nav-search {
padding-right: 250rpx;
/* #ifdef MP-ALIPAY */
padding-right: 255rpx;
padding-left: 80rpx;
/* #endif */
/* #ifdef H5 || MP-TOUTIAO || APP */
padding-right: 20rpx;
/* #endif */
/* #ifdef H5 */
padding-top: 20rpx !important;
/* #endif */
padding-bottom: 20rpx;
height: 64rpx;
z-index: 5;
display: flex;
}
.nav-more-top {
/* #ifdef H5 || APP */
top: 135rpx !important;
/* #endif */
}
/**
* 左侧导航
*/
.left-nav {
width: 200rpx;
background-color: #f5f5f5;
height: 100%;
}
.left-nav .item {
height: 80rpx;
line-height: 80rpx;
padding: 0 10rpx;
background: #f5f5f5;
}
.left-nav .nav-active {
background: #fff;
font-weight: 500;
}
/**
* 右侧内容
*/
.right-container {
width: calc(100% - 200rpx);
height: 100%;
top: 0;
right: 0;
background: #f5f5f5;
}
.content-item {
width: calc(100% / 3);
}
.content-item .content {
padding: 28rpx;
}
.content-item .text {
font-weight: 600;
}
.content-item .icon {
width: 92rpx;
height: 92rpx;
}
.content-item.two-img .icon {
width: 104rpx;
height: 104rpx;
}
.content-item.two-img .content {
padding: 26rpx 0;
}
.model-one .content-item:nth-child(3n) {
border-right: 0;
}
.model-one .content .desc {
min-height: 52rpx;
line-height: 26rpx;
}
.model-one .content {
height: 240rpx;
}
.one-content image {
height: 120rpx;
}
.text-random-1,
.text-random-2,
.text-random-3,
.text-random-4,
.text-random-5,
.text-random-6,
.text-random-7,
.text-random-8,
.text-random-9 {
position: relative;
}
.text-random-1::before,
.text-random-2::before,
.text-random-3::before,
.text-random-4::before,
.text-random-5::before,
.text-random-6::before,
.text-random-7::before,
.text-random-8::before,
.text-random-9::before {
content: '';
width: 126rpx;
height: 12rpx;
border-radius: 6rpx;
position: absolute;
bottom: 0;
left: 0;
opacity: 0.6;
}
.text-random-1::before {
background: linear-gradient(90deg, #F2C3A5 0%, rgba(255, 255, 255, 0) 100%);
}
.text-random-2::before {
background: linear-gradient(90deg, #FF9BBB 0%, rgba(255, 255, 255, 0) 100%);
}
.text-random-3::before {
background: linear-gradient(90deg, #EAC5A9 0%, rgba(255, 255, 255, 0) 100%);
}
.text-random-4::before {
background: linear-gradient(90deg, #F7BEBE 0%, rgba(255, 255, 255, 0) 100%);
}
.text-random-5::before {
background: linear-gradient(90deg, #F2DC86 0%, rgba(255, 255, 255, 0) 100%);
}
.text-random-6::before {
background: linear-gradient(90deg, #98B7E8 0%, rgba(255, 255, 255, 0) 100%);
}
.text-random-7::before {
background: linear-gradient(90deg, #CD92F3 0%, rgba(255, 255, 255, 0) 100%);
}
.text-random-8::before {
background: linear-gradient(90deg, #5EEA7C 0%, rgba(255, 255, 255, 0) 100%);
}
.text-random-9::before {
background: linear-gradient(90deg, #E67A7A 0%, rgba(255, 255, 255, 0) 100%);
}
/**
* 商品列表模式
*/
.category-content {
height: 100vh;
/* #ifdef MP-WEIXIN || MP-BAIDU || MP-QQ || MP-KUAISHOU || MP-ALIPAY || APP */
height: calc(100vh - 134rpx - var(--window-bottom));
/* #endif */
/* #ifdef H5 */
height: calc(100vh - 104rpx - var(--window-bottom));
/* #endif */
}
.category-content.goods-model {
padding-top: 182rpx;
}
.top-nav {
height: 182rpx;
top: 0;
left: 0;
z-index: 4;
}
.top-nav-scroll {
width: calc(100% - 70rpx);
}
.top-nav .icon-content {
width: 92rpx;
height: 92rpx;
padding: 1px;
}
.top-nav-scroll .item:first-of-type {
padding-left: 16rpx;
}
.top-nav .item {
padding: 20rpx 4rpx;
}
.nav-list-more {
width: 100%;
max-height: 550rpx;
overflow-y: auto;
}
.nav-list-more image {
width: 92rpx;
height: 92rpx;
border-radius: 50%;
margin-bottom: 10rpx;
}
.nav-list-more .item {
width: 20%;
padding: 20rpx 0;
}
.goods-right-content {
width: calc(100% - 200rpx);
height: calc(100% - 182rpx);
top: 182rpx;
right: 0;
}
.right-content-actual .item {
padding-bottom: 20rpx;
}
.right-content-actual .item:not(:last-of-type) {
border-bottom: 1px solid #eee;
}
.right-content-actual .item .plugins-label-img {
border-top-left-radius: 10rpx;
}
.goods-right-content.category-one-subset-content {
width: 100%;
}
.goods-list-top-nav {
position: sticky;
top: 0;
right: 0;
z-index: 3;
}
.nav-sort-content .sort-item {
height: 80rpx;
line-height: 80rpx;
width: 20%;
}
.nav-sort-content .sort-item .sort-icon {
width: 26rpx;
height: 26rpx !important;
}
.goods-list .goods-img {
width: 160rpx;
height: 160rpx !important;
}
.goods-list .goods-base {
width: calc(100% - 200rpx);
padding-right: 20rpx;
}
.goods-list .goods-base-content {
min-height: 100rpx;
}
.goods-list .goods-base .simple-desc {
line-height: 30rpx;
min-height: 30rpx;
max-height: 58rpx;
}
.goods-list .goods-base .sales-price {
width: calc(100% - 140rpx);
}
.goods-list .goods-base .buy-number {
min-width: 32rpx;
}
/**
* 底部导航
*/
.botton-nav {
width: calc(100% - 60rpx);
left: auto;
bottom: 20rpx;
z-index: 2;
margin-left: 20rpx;
box-shadow: 0rpx 4rpx 8rpx 0px rgba(0, 0, 0, 0.16);
line-height: 84rpx;
height: 84rpx;
}
.botton-nav .btn {
height: 70rpx;
line-height: 70rpx;
}
.botton-nav .cart .badge-icon {
top: -20rpx;
right: -2rpx;
}
/**
* 购物车
*/
.cart-mask {
left: 0;
top: 0;
background: rgb(0, 0, 0, 0.6);
z-index: 5;
}
.cart-content {
left: auto;
bottom: 150rpx;
width: calc(100% - 40rpx);
z-index: 6;
max-width: calc(800px - 40rpx);
margin-left: 20rpx;
}
.cart-content .cart-list {
max-height: 60vh;
}
.cart-content .cart-list .goods-img {
width: 132rpx;
height: 132rpx !important;
}
.cart-content .cart-list .goods-base {
padding-right: 0;
padding-left: 24rpx;
}
.cart-content .cart-list .goods-base-content {
min-height: 60rpx;
}
/**
* 无数据
*/
.no-data {
z-index: 101;
}
/*
* 隐藏滚动条
*/
scroll-view ::-webkit-scrollbar {
display: none;
width: 0;
height: 0;
color: transparent;
}

File diff suppressed because it is too large Load Diff

665
pages/index/index1.vue Normal file
View File

@@ -0,0 +1,665 @@
<template>
<view :class="theme_view">
<view :class="(plugins_mourning_data_is_app ? ' grayscale' : '') + (is_single_page == 1 ? ' single-page-top' : '')">
<!-- diy模式 -->
<block v-if="data_mode == 3">
<block v-if="(data_list || null) != null && (data_list.config || null) != null">
<componentDiy :propValue="data_list.config" :propDataId="data_list.id" :propKey="random_value" @onLocationBack="user_back_choice_location">
<!-- 底部内容 -->
<template slot="diy-bottom-content">
<!-- 结尾 -->
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
<!-- 版权信息 -->
<component-copyright></component-copyright>
</template>
<!-- 底部公共 -->
<template slot="diy-bottom-common">
<component-common ref="common" :propIsGrayscale="plugins_mourning_data_is_app"></component-common>
</template>
</componentDiy>
</block>
<block v-else>
<component-no-data propStatus="0" propPage="home"></component-no-data>
</block>
</block>
<!-- 自动和手动模式 -->
<block v-else>
<!-- 顶部内容如果没有轮播和导航则使用矮的浮动导航背景样式则使用高的背景样式 -->
<view v-if="load_status == 1" class="home-top-nav-content pr" :style="(banner_list.length > 0 || navigation.length > 0 ? top_content_bg_color : top_content_search_bg_color) + top_content_style">
<!-- 顶部背景图片 -->
<view class="pa top-0 left-0 right-0">
<image class="bg-img wh-auto" mode="widthFix" :src="static_url + 'nav-top.png'"></image>
</view>
<!-- 搜索 -->
<view v-if="common_app_is_header_nav_fixed == 1" :class="'search-fixed-seat ' + (common_app_is_enable_search == 1 ? 'nav-enable-search' : '')"></view>
<view :class="'pr ' + (common_app_is_header_nav_fixed == 1 ? 'search-content-fixed' : '')" :style="common_app_is_header_nav_fixed == 1 ? top_content_search_bg_color : ''">
<view :class="'search-content-fixed-content ' + (common_app_is_enable_search == 1 ? 'nav-enable-search' : '')" :style="(common_app_is_header_nav_fixed == 1 ? top_content_style : '') + (common_app_is_header_nav_fixed == 1 ? top_content_search_content_style : '')">
<view class="home-top-nav margin-bottom-sm pr padding-right-main">
<!-- 定位 -->
<view v-if="is_home_location_choice == 1" class="home-top-nav-location dis-inline-block va-m single-text cr-white pr bs-bb padding-left-main padding-right-lg">
<component-choice-location @onBack="user_back_choice_location"></component-choice-location>
</view>
<block v-else>
<!-- logo/标题 -->
<view class="home-top-nav-logo dis-inline-block va-m padding-left-main">
<block v-if="is_home_logo_use_text == 0 && (application_logo || null) != null">
<image :src="application_logo" mode="heightFix" class="home-top-nav-logo-image"></image>
</block>
<block v-else>
<view v-if="(application_title || null) != null" class="home-top-nav-logo-title cr-white single-text">{{ application_title }}</view>
</block>
</view>
</block>
<!-- #ifdef H5 || APP -->
<!-- 右上角icon列表 -->
<view v-if="(right_icon_list || null) != null && right_icon_list.length > 0" class="nav-top-right-icon fr">
<block v-for="(item, index) in right_icon_list">
<view class="item dis-inline-block cp pr" :data-value="item.url || ''" @tap="url_event">
<iconfont :name="item.icon" size="38rpx" color="#fff"></iconfont>
<view v-if="(item.badge || null) != null" class="badge-icon pa">
<component-badge :propNumber="item.badge"></component-badge>
</view>
</view>
</block>
</view>
<!-- #endif -->
</view>
<view v-if="common_app_is_enable_search == 1" class="search-content-input padding-horizontal-main">
<!-- 是否开启搜索框前面icon扫一扫 -->
<block v-if="is_home_search_scan == 1">
<component-search :propIsBtn="true" propSize="sm" :propPlaceholder="$t('customview.customview.726k7y')" propPlaceholderClass="cr-grey-c" propIconColor="#999" propBgColor="#fff"
<!-- #ifndef H5 -->
@onicon="search_icon_event" propIcon="icon-scan" :propIsIconOnEvent="true"
<!-- #endif -->
></component-search>
</block>
<block v-else>
<component-search :propIsBtn="true" propSize="sm" :propPlaceholder="$t('customview.customview.726k7y')" propPlaceholderClass="cr-grey-c" propIconColor="#999" propBgColor="#fff"></component-search>
</block>
</view>
</view>
</view>
<!-- 轮播 -->
<view class="banner-content padding-horizontal-main margin-top-xs" v-if="banner_list.length > 0">
<component-banner :propData="banner_list" @changeBanner="change_banner"></component-banner>
</view>
<!-- 导航 -->
<view v-if="navigation.length > 0" class="spacing-mt" :class="load_status == 1 && (common_shop_notice || null) != null ? '' : ' spacing-mb'">
<view class="padding-horizontal-main">
<view class="bg-white border-radius-main">
<component-icon-nav :propData="{ ...{ data: navigation }, ...{ random: random_value } }"></component-icon-nav>
</view>
</view>
</view>
</view>
<!-- 内容 -->
<view class="content padding-horizontal-main pr">
<!-- 商城公告 -->
<view v-if="load_status == 1 && (common_shop_notice || null) != null" class="notice">
<uni-notice-bar show-icon scrollable :text="common_shop_notice" background-color="transparent" color="#666" />
</view>
<!-- 推荐文章 -->
<view v-if="article_list.length > 0" class="article-list padding-main border-radius-main oh bg-white spacing-mb">
<view mode="aspectFit" class="new-icon va-m fl cp pr divider-r" data-value="/pages/article-category/article-category" @tap="url_event">
<text>{{ $t('index.index.t8bll8') }}</text
><text class="cr-red">{{ $t('index.index.t8bll9') }}</text>
</view>
<view class="right-content fr va-m">
<swiper :vertical="true" :autoplay="true" :circular="true" display-multiple-items="1" interval="3000">
<block v-for="(item, index) in article_list" :key="index">
<swiper-item class="single-text">
<text class="cr-base text-size-sm cp" :data-value="item.category_url" @tap="url_event">[{{ item.article_category_name }}]</text>
<text class="cr-base text-size-sm margin-left-xs cp" :style="(item.title_color || null) != null ? 'color:' + item.title_color + ' !important;' : ''" :data-value="item.url" @tap="url_event">{{ item.title }}</text>
</swiper-item>
</block>
</swiper>
</view>
</view>
<!-- 按照插件顺序渲染插件数据 -->
<block v-if="plugins_sort_list.length > 0">
<block v-for="(pv, pi) in plugins_sort_list" :key="pi">
<!-- 首页中间广告 - 插件 -->
<view v-if="pv.plugins == 'homemiddleadv' && (plugins_homemiddleadv_data || null) != null && plugins_homemiddleadv_data.length > 0" class="plugins-homemiddleadv oh spacing-mb">
<view v-for="(item, index) in plugins_homemiddleadv_data" :key="index" class="item border-radius-main oh cp" :data-value="item.url || ''" @tap="url_event">
<image class="dis-block wh-auto border-radius-main" :src="item.images" mode="widthFix"> </image>
</view>
</view>
<!-- 限时秒杀 - 插件 -->
<view v-if="pv.plugins == 'seckill' && (plugins_seckill_data || null) != null && (plugins_seckill_data.data || null) != null && (plugins_seckill_data.data.goods || null) != null && plugins_seckill_data.data.goods.length > 0" class="plugins-seckill-data border-radius-main spacing-mb bg-white" :style="'background-image: url(' + seckill_static_url + 'seckill-bg.png);'">
<view class="flex-row jc-sb align-c padding-top-main padding-horizontal-main">
<view class="flex-1">
<image class="dis-inline-block va-m icon" :src="plugins_seckill_data.data.home_title_icon" mode="widthFix"></image>
<view class="dis-inline-block va-m margin-left-sm">
<component-countdown :propHour="plugins_seckill_data.data.time.hours" :propMinute="plugins_seckill_data.data.time.minutes" :propSecond="plugins_seckill_data.data.time.seconds"></component-countdown>
</view>
</view>
<text data-value="/pages/plugins/seckill/index/index" @tap="url_event" class="arrow-right padding-right cr-grey text-size-xs cp">{{ $t('common.more') }}</text>
</view>
<component-goods-list :propData="{ style_type: 2, goods_list: plugins_seckill_data.data.goods }" :propLabel="plugins_label_data" :propCurrencySymbol="currency_symbol" :propIsCartParaCurve="true" propSource="index" :propOpenCart="false"></component-goods-list>
</view>
<!-- 活动配置-楼层顶部 - 插件 -->
<view v-if="pv.plugins == 'activity' && (plugins_activity_data || null) != null">
<component-activity-list :propConfig="plugins_activity_data.base" :propData="plugins_activity_data.data" propLocation="0" :propLabel="plugins_label_data" :propCurrencySymbol="currency_symbol" :propIsCartParaCurve="true" propSource="index"></component-activity-list>
</view>
<!-- 门店 - 插件 -->
<view v-if="pv.plugins == 'realstore' && (plugins_realstore_data || null) != null">
<view v-if="(plugins_realstore_data.base.home_data_list_title || null) != null" class="spacing-nav-title flex-row align-c jc-sb text-size-xs">
<text class="text-wrapper title-left-border single-text flex-1 flex-width padding-right-main">{{ plugins_realstore_data.base.home_data_list_title }}</text>
<text data-value="/pages/plugins/realstore/search/search" @tap="url_event" class="arrow-right padding-right cr-grey cp">{{ $t('common.more') }}</text>
</view>
<component-realstore-list :propData="{ ...{ data: plugins_realstore_data.data }, ...{ random: random_value } }"></component-realstore-list>
</view>
<!-- 多商户 - 插件 -->
<view v-if="pv.plugins == 'shop' && (plugins_shop_data || null) != null">
<view v-if="(plugins_shop_data.base.home_data_list_title || null) != null" class="spacing-nav-title flex-row align-c jc-sb text-size-xs">
<text class="text-wrapper title-left-border single-text flex-1 flex-width padding-right-main">{{ plugins_shop_data.base.home_data_list_title }}</text>
<text data-value="/pages/plugins/shop/index/index" @tap="url_event" class="arrow-right padding-right cr-grey cp">{{ $t('common.more') }}</text>
</view>
<component-shop-list :propConfig="plugins_shop_data.base" :propData="{ ...{ data: plugins_shop_data.data }, ...{ random: random_value } }"></component-shop-list>
</view>
<!-- 组合搭配 - 插件 -->
<view v-if="pv.plugins == 'binding' && (plugins_binding_data || null) != null">
<view v-if="(plugins_binding_data.base.home_data_list_title || null) != null" class="spacing-nav-title flex-row align-c jc-sb text-size-xs">
<text class="text-wrapper title-left-border single-text flex-1 flex-width padding-right-main">{{ plugins_binding_data.base.home_data_list_title }}</text>
<text data-value="/pages/plugins/binding/index/index" @tap="url_event" class="arrow-right padding-right cr-grey cp">{{ $t('common.more') }}</text>
</view>
<component-binding-list :propConfig="plugins_binding_data.base" :propData="{ ...{ data: plugins_binding_data.data }, ...{ random: random_value } }" :propCurrencySymbol="currency_symbol"></component-binding-list>
</view>
<!-- 博客-楼层顶部 - 插件 -->
<view v-if="pv.plugins == 'blog' && (plugins_blog_data || null) != null">
<component-blog-list :propConfig="plugins_blog_data.base" :propData="plugins_blog_data.data" propLocation="0"></component-blog-list>
</view>
<!-- 魔方 - 插件 -->
<view v-if="pv.plugins == 'magic' && (plugins_magic_data || null) != null">
<component-magic-list :propData="{ ...plugins_magic_data, ...{ random: random_value } }" :propCurrencySymbol="currency_symbol" :propLabel="plugins_label_data"></component-magic-list>
</view>
</block>
</block>
<!-- 楼层数据 -->
<block v-if="(data_list || null) != null && data_list.length > 0">
<!-- 数据模式0,1自动+手动2拖拽 -->
<block v-if="data_mode == 2">
<!-- 引入拖拽数据模块 -->
<component-layout :propData="data_list"></component-layout>
</block>
<block v-else>
<!-- 自动+手动 -->
<view v-for="(floor, index) in data_list" :key="index" class="floor">
<view class="spacing-nav-title flex-row align-c jc-sb text-size-xs">
<view class="title-left">
<text class="text-wrapper title-left-border" :style="'color:' + (floor.bg_color || '#333') + ';'">{{ floor.name }}</text>
<text v-if="(floor.describe || null) != null" class="vice-name margin-left-lg cr-grey">{{ floor.describe }}</text>
</view>
<text :data-value="'/pages/goods-search/goods-search?category_id=' + floor.id" @tap="url_event" class="arrow-right padding-right cr-grey cp">{{ $t('common.more') }}</text>
</view>
<view class="floor-list wh-auto oh pr">
<block v-if="(floor.goods || null) != null && floor.goods.length > 0">
<component-goods-list :propData="{ style_type: 1, goods_list: floor.goods }" :propLabel="plugins_label_data" :propCurrencySymbol="currency_symbol" :propIsCartParaCurve="true" propSource="index"></component-goods-list>
</block>
</view>
</view>
</block>
</block>
<!-- 按照插件顺序渲染插件数据 -->
<block v-if="plugins_sort_list.length > 0">
<block v-for="(pv, pi) in plugins_sort_list" :key="pi">
<!-- 活动配置-楼层底部 - 插件 -->
<view v-if="pv.plugins == 'activity' && (plugins_activity_data || null) != null">
<component-activity-list :propConfig="plugins_activity_data.base" :propData="plugins_activity_data.data" propLocation="1" :propLabel="plugins_label_data" :propCurrencySymbol="currency_symbol" propSource="index" :propOpenCart="false"></component-activity-list>
</view>
<!-- 博客-楼层底部 - 插件 -->
<view v-if="pv.plugins == 'blog' && (plugins_blog_data || null) != null">
<component-blog-list :propConfig="plugins_blog_data.base" :propData="plugins_blog_data.data" propLocation="1"></component-blog-list>
</view>
<!--- 底部购买记录 - 插件 -->
<view v-if="pv.plugins == 'salerecords' && (plugins_salerecords_data || null) != null && (plugins_salerecords_data.data || null) != null && plugins_salerecords_data.data.length > 0" class="plugins-salerecords bg-white border-radius-main padding-main spacing-mb">
<view class="spacing-nav-title flex-row align-c jc-sb text-size-xs">
<view class="title-left">
<text class="text-wrapper">{{ plugins_salerecords_data.base.home_bottom_title || $t('index.index.s5r784') }}</text>
<text v-if="(plugins_salerecords_data.base || null) != null && (plugins_salerecords_data.base.home_bottom_desc || null) != null" class="vice-name margin-left-sm cr-grey-9">{{ plugins_salerecords_data.base.home_bottom_desc }}</text>
</view>
</view>
<view class="oh">
<swiper :vertical="true" :autoplay="true" :circular="true" :display-multiple-items="plugins_salerecords_data.data.length < 6 ? plugins_salerecords_data.data.length : 6" interval="3000" :style="plugins_salerecords_data.data.length < 6 ? 'height:' + plugins_salerecords_data.data.length * 84.33 + 'rpx;' : ''">
<block v-for="(item, index) in plugins_salerecords_data.data" :key="index">
<swiper-item>
<view class="item oh padding-vertical-main">
<view class="item-content single-text fl">
<image mode="widthFix" :src="item.user.avatar" class="va-m br"> </image>
<text class="margin-left-sm">{{ item.user.user_name_view }}</text>
<text v-if="(item.user.province || null) != null"><text class="padding-left-xs padding-right-xs">-</text>{{ item.user.province }}</text>
</view>
<view class="item-content fl">
<view :data-value="item.goods_url" @tap="url_event" class="cp single-text">
<image mode="widthFix" :src="item.images" class="va-m br"> </image>
<text class="margin-left-sm single-text">{{ item.title }}</text>
</view>
</view>
<view class="item-content single-text fr tr cr-grey padding-top-xs">
{{ item.add_time }}
</view>
</view>
</swiper-item>
</block>
</swiper>
</view>
</view>
</block>
</block>
</view>
</block>
<!-- 提示信息 -->
<block v-if="load_status == 0">
<component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg" propPage="home" :propIsHeader="true"></component-no-data>
</block>
</view>
<!-- 页面已加载模式 -->
<block v-if="load_status == 1 && data_mode != 3">
<!-- 结尾 -->
<component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
<!-- 版权信息 -->
<component-copyright></component-copyright>
<!-- 在线客服 -->
<component-online-service :propIsNav="true" :propIsBar="true" :propIsGrayscale="plugins_mourning_data_is_app"></component-online-service>
<!-- 快捷导航 -->
<component-quick-nav :propIsNav="true" :propIsBar="true" :propIsGrayscale="plugins_mourning_data_is_app"></component-quick-nav>
<!-- 公共 -->
<component-common ref="common" :propIsGrayscale="plugins_mourning_data_is_app"></component-common>
</block>
</view>
</template>
<script>
const app = getApp();
import componentCommon from '@/components/common/common';
import componentSearch from '@/components/search/search';
import componentQuickNav from '@/components/quick-nav/quick-nav';
import componentIconNav from '@/components/icon-nav/icon-nav';
import componentBanner from '@/components/slider/slider';
import componentCountdown from '@/components/countdown/countdown';
import componentLayout from '@/components/layout/layout';
import componentBadge from '@/components/badge/badge';
import componentNoData from '@/components/no-data/no-data';
import componentBottomLine from '@/components/bottom-line/bottom-line';
import componentCopyright from '@/components/copyright/copyright';
import componentOnlineService from '@/components/online-service/online-service';
import componentActivityList from '@/components/activity-list/activity-list';
import componentBlogList from '@/components/blog-list/blog-list';
import componentRealstoreList from '@/components/realstore-list/realstore-list';
import componentShopList from '@/components/shop-list/shop-list';
import componentGoodsList from '@/components/goods-list/goods-list';
import componentBindingList from '@/components/binding-list/binding-list';
import componentMagicList from '@/components/magic-list/magic-list';
import componentDiy from '@/components/diy/diy';
import componentChoiceLocation from '@/components/choice-location/choice-location';
// 状态栏高度
var bar_height = parseInt(app.globalData.get_system_info('statusBarHeight', 0, true));
// #ifdef MP-TOUTIAO
bar_height = 0;
// #endif
export default {
data() {
return {
theme_view: '',
theme_color: '',
common_static_url: '',
seckill_static_url: '',
static_url: '',
data_list_loding_status: 1,
data_list_loding_msg: '',
data_bottom_line_status: false,
load_status: 0,
currency_symbol: app.globalData.currency_symbol(),
is_home_search_scan: app.globalData.data.is_home_search_scan,
data_list: [],
banner_list: [],
navigation: [],
article_list: [],
cart_total: 0,
message_total: 0,
right_icon_list: [],
// 首页数据模式
data_mode: 0,
// 增加随机数,避免无法监听数据列表内部数据更新
random_value: 0,
// 基础配置
common_shop_notice: null,
common_app_is_enable_search: 0,
common_app_is_header_nav_fixed: 0,
common_app_is_online_service: 0,
// 顶部导航、名称、logo、定位
application_title: app.globalData.data.application_title,
application_logo: app.globalData.data.application_logo,
is_home_logo_use_text: app.globalData.data.is_home_logo_use_text,
is_home_location_choice: app.globalData.data.is_home_location_choice,
// 顶部+搜索样式配置
top_content_bg_color: '',
top_content_search_bg_color: '',
top_content_search_content_style: '',
// #ifdef MP
top_content_style: 'padding-top:' + (bar_height + 10) + 'px;',
// #endif
// #ifdef H5 || MP-TOUTIAO
top_content_style: 'padding-top:' + (bar_height + 14) + 'px;',
// #endif
// #ifdef APP
top_content_style: 'padding-top:' + bar_height + 'px;',
// #endif
// 是否单页预览
is_single_page: app.globalData.is_current_single_page() || 0,
// 轮播滚动时,背景色替换
slider_bg: null,
// 插件顺序列表
plugins_sort_list: [],
// 限时秒杀插件
plugins_seckill_data: null,
// 购买记录插件
plugins_salerecords_data: null,
// 活动配置插件
plugins_activity_data: null,
// 标签插件
plugins_label_data: null,
// 首页中间广告插件
plugins_homemiddleadv_data: null,
// 哀悼灰度插件
plugins_mourning_data_is_app: app.globalData.is_app_mourning(),
// 标签插件
plugins_blog_data: null,
// 门店插件
plugins_realstore_data: null,
// 多商户插件
plugins_shop_data: null,
// 组合搭配插件
plugins_binding_data: null,
// 魔方插件
plugins_magic_data: null,
};
},
components: {
componentCommon,
componentSearch,
componentQuickNav,
componentIconNav,
componentBanner,
componentCountdown,
componentLayout,
componentBadge,
componentNoData,
componentBottomLine,
componentCopyright,
componentOnlineService,
componentActivityList,
componentBlogList,
componentRealstoreList,
componentShopList,
componentGoodsList,
componentBindingList,
componentMagicList,
componentDiy,
componentChoiceLocation,
},
onLoad(params) {
// 调用公共事件方法
app.globalData.page_event_onload_handle(params);
},
onShow() {
// 调用公共事件方法
app.globalData.page_event_onshow_handle();
// 数据加载
this.init();
// 初始化配置
this.init_config();
// 公共onshow事件
if ((this.$refs.common || null) != null) {
this.$refs.common.on_show({object: this, method: 'init'});
}
// 设置顶部导航的默认颜色
this.set_navigation_bar_color();
},
// 下拉刷新
onPullDownRefresh() {
if (this.data_list_loding_status === 1) {
uni.stopPullDownRefresh();
} else {
this.init();
}
},
methods: {
// 初始化配置
init_config(status) {
if ((status || false) == true) {
this.setData({
currency_symbol: app.globalData.get_config('currency_symbol'),
common_shop_notice: app.globalData.get_config('config.common_shop_notice'),
common_app_is_enable_search: app.globalData.get_config('config.common_app_is_enable_search'),
common_app_is_header_nav_fixed: app.globalData.get_config('config.common_app_is_header_nav_fixed'),
common_app_is_online_service: app.globalData.get_config('config.common_app_is_online_service'),
application_title: app.globalData.get_application_title(),
application_logo: app.globalData.get_application_logo(),
});
} else {
app.globalData.is_config(this, 'init_config');
}
},
// 获取数据
init(params = {}) {
// 还没有数据则读取缓存
var cache_key = app.globalData.data.cache_index_data_key;
if (this.load_status == 0) {
// 本地缓存数据
var upd_data = uni.getStorageSync(cache_key) || null;
if (upd_data != null) {
// 先使用缓存数据展示
this.setData(upd_data);
// 初始化返回公共处理
this.init_result_common_handle();
// 已有本地缓存则直接取远程有效数据(默认首次取的是远程缓存数据)
params['is_cache'] = 0;
// 设置顶部导航的默认颜色
this.set_navigation_bar_color();
}
} else {
// 已有本地缓存则直接取远程有效数据(默认首次取的是远程缓存数据)
params['is_cache'] = 0;
}
// 网络检查
if ((params || null) == null || (params.loading || 0) == 0) {
app.globalData.network_type_handle(this, 'init', params);
return false;
}
// 没有缓存数据则开启加载层
if (upd_data == null) {
this.setData({
data_list_loding_status: 1,
});
}
// 请求远程数据
uni.request({
url: app.globalData.get_request_url('index', 'index'),
method: 'POST',
data: params,
dataType: 'json',
success: (res) => {
uni.stopPullDownRefresh();
// 数据处理
var data = res.data.data;
if (res.data.code == 0) {
var data_list = data.data_list || null;
var upd_data = {
random_value: Math.random(),
data_bottom_line_status: true,
banner_list: data.banner_list || [],
navigation: data.navigation || [],
article_list: data.article_list || [],
data_mode: data.data_mode || 0,
data_list: data_list,
cart_total: data.cart_total.buy_number || 0,
message_total: parseInt(data.message_total || 0),
right_icon_list: data.right_icon_list || [],
data_list_loding_status: data_list == null || data_list.length == 0 ? 0 : 3,
plugins_sort_list: data.plugins_sort_list || [],
plugins_seckill_data: data.plugins_seckill_data || null,
plugins_salerecords_data: (data.plugins_salerecords_data || null) == null || data.plugins_salerecords_data.length <= 0 ? null : data.plugins_salerecords_data,
plugins_activity_data: (data.plugins_activity_data || null) == null || data.plugins_activity_data.length <= 0 ? null : data.plugins_activity_data,
plugins_label_data: (data.plugins_label_data || null) == null || (data.plugins_label_data.base || null) == null || (data.plugins_label_data.data || null) == null || data.plugins_label_data.data.length <= 0 ? null : data.plugins_label_data,
plugins_homemiddleadv_data: (data.plugins_homemiddleadv_data || null) == null || data.plugins_homemiddleadv_data.length <= 0 ? null : data.plugins_homemiddleadv_data,
plugins_mourning_data_is_app: parseInt(data.plugins_mourning_data || 0) == 1,
plugins_blog_data: data.plugins_blog_data || null,
plugins_realstore_data: data.plugins_realstore_data || null,
plugins_shop_data: data.plugins_shop_data || null,
plugins_binding_data: data.plugins_binding_data || null,
plugins_magic_data: data.plugins_magic_data || null,
};
// 如果开启了哀悼灰色则不固定导航
if (upd_data.plugins_mourning_data_is_app == 1) {
upd_data['common_app_is_header_nav_fixed'] = 0;
}
this.setData(upd_data);
// 存储缓存
uni.setStorageSync(cache_key, upd_data);
// 设置顶部导航的默认颜色
this.set_navigation_bar_color();
// 是否需要重新加载数据
if (parseInt(data.is_result_data_cache || 0) == 1) {
this.init({ is_cache: 0 });
} else {
// 购物车导航角标
app.globalData.set_tab_bar_badge('cart', this.cart_total);
}
} else {
this.setData({
data_list_loding_status: 0,
data_list_loding_msg: res.data.msg,
data_bottom_line_status: true,
});
}
// 初始化返回公共处理
this.init_result_common_handle();
},
fail: () => {
// 轮播数据处理
if (this.load_status == 0 || (this.top_content_search_bg_color || null) == null) {
this.change_banner(app.globalData.get_theme_color());
}
uni.stopPullDownRefresh();
this.setData({
data_list_loding_status: 2,
data_list_loding_msg: this.$t('common.internet_error_tips'),
data_bottom_line_status: true,
load_status: 1,
});
},
});
},
// 设置顶部导航的默认颜色
set_navigation_bar_color() {
if(this.data_mode == 3) {
app.globalData.set_navigation_bar_color(parseInt(app.globalData.get_key_data(this.data_list, 'config.header.com_data.style.function_buttons_type', 0)) == 1);
}
},
// 初始化返回公共处理
init_result_common_handle() {
var theme_view = app.globalData.get_theme_value_view();
var theme_color = app.globalData.get_theme_color();
var common_static_url = app.globalData.get_static_url('common');
var seckill_static_url = app.globalData.get_static_url('seckill', true) + 'app/';
var static_url = app.globalData.get_static_url('home');
// 轮播数据处理
if (this.load_status == 0 || (this.top_content_search_bg_color || null) == null) {
var color = this.banner_list && this.banner_list.length > 0 && (this.banner_list[0]['bg_color'] || null) != null ? this.banner_list[0]['bg_color'] : theme_color;
this.change_banner(color);
}
// 公共数据
this.setData({
top_content_search_content_style: 'background-image: url("' + static_url + 'nav-top.png");',
theme_view: theme_view,
theme_color: theme_color,
common_static_url: common_static_url,
seckill_static_url: seckill_static_url,
static_url: static_url,
load_status: 1,
});
// 分享菜单处理、延时执行,确保基础数据已加载完成
setTimeout(function () {
app.globalData.page_share_handle();
}, 3000);
},
// 选择用户地理位置回调
user_back_choice_location(e) {
// 重新刷新数据
this.init();
},
// url事件
url_event(e) {
app.globalData.url_event(e);
},
// 轮播改变、背景色处理
change_banner(color) {
if ((color || null) == null) {
color = this.theme_color;
}
this.setData({
top_content_bg_color: 'background: linear-gradient(180deg, ' + color + ' 0%, #f5f5f5 80%);',
top_content_search_bg_color: 'background: linear-gradient(180deg, ' + color + ' 0%, #f5f5f5 300%);',
});
},
// 搜索icon扫码事件
search_icon_event(e) {
app.globalData.scan_handle();
}
},
};
</script>
<style>
@import './index.css';
</style>

View File

@@ -255,7 +255,8 @@
var user = app.globalData.get_user_info(this, 'init');
if (user != false) {
this.setData({
pay_url: app.globalData.get_request_url('pay', 'order'),
// pay_url: app.globalData.get_request_url('pay', 'order'),
pay_url: app.globalData.get_request_url('getpayment', 'xo'),
qrcode_url: app.globalData.get_request_url('paycheck', 'order'),
});

View File

@@ -1,9 +1,9 @@
module.exports = {
// webpack配置
configureWebpack: {
// 关闭 webpack 的性能提示
performance: {
hints: false
}
}
// webpack配置
configureWebpack: {
// 关闭 webpack 的性能提示
performance: {
hints: false
}
}
}