初始化

This commit is contained in:
魏啾
2024-05-23 14:45:18 +08:00
parent c6f49f161e
commit e6d878888c
4 changed files with 53 additions and 18 deletions

View File

@@ -53,4 +53,8 @@ export default {
szzpyissuedby(data) { //开票人列表
return uni.api.post("szzpy/issuedby", data);
},
userttwechat(data) { //开票人列表
return uni.api.post("user/ttwechat", data);
},
}

8
package-lock.json generated
View File

@@ -7,7 +7,8 @@
"dependencies": {
"dayjs": "^1.11.11",
"html2canvas": "^1.4.1",
"uview-ui": "^2.0.36"
"uview-ui": "^2.0.36",
"weixin-js-sdk": "^1.6.5"
}
},
"node_modules/base64-arraybuffer": {
@@ -66,6 +67,11 @@
"engines": {
"HBuilderX": "^3.1.0"
}
},
"node_modules/weixin-js-sdk": {
"version": "1.6.5",
"resolved": "https://registry.npmmirror.com/weixin-js-sdk/-/weixin-js-sdk-1.6.5.tgz",
"integrity": "sha512-Gph1WAWB2YN/lMOFB/ymb+hbU/wYazzJgu6PMMktCy9cSCeW5wA6Zwt0dpahJbJ+RJEwtTv2x9iIu0U4enuVSQ=="
}
}
}

View File

@@ -40,6 +40,7 @@
</view>
</template>
<script>
import wx from 'weixin-js-sdk';
export default {
components: {},
data() {
@@ -97,22 +98,46 @@
},
onShow() {},
methods: {
jumpToMiniProgram() {
plus.share.getServices(function (res) {
var sweixin = null;
for (var i = 0; i < res.length; i++) {
var t = res[i];
if (t.id == 'weixin') {
sweixin = t;
}
}
if (sweixin) {
sweixin.launchMiniProgram({
id:'gh_fa9286427a5b', //这里写你的小程序原始id以gh开头
type: 0, // //小程序版本 0-正式版; 1-测试版; 2-体验版
path: 'pages/index/index' //这里是指定页的路径,如需传参直接字符串拼接(首页可以省略
});
}
async jumpToMiniProgram() {
let res = await this.api.userttwechat()
console.log(res)
// plus.share.getServices(function (res) {
// var sweixin = null;
// for (var i = 0; i < res.length; i++) {
// var t = res[i];
// if (t.id == 'weixin') {
// sweixin = t;
// }
// }
// if (sweixin) {
// sweixin.launchMiniProgram({
// id:'gh_fa9286427a5b', //这里写你的小程序原始id以gh开头
// type: 0, // //小程序版本 0-正式版; 1-测试版; 2-体验版
// path: 'pages/index/index' //这里是指定页的路径,如需传参直接字符串拼接(首页可以省略)
// });
// }
// });
wx.config({
"debug": true,
"beta": false,
"jsApiList": ['wx-open-launch-weapp'],
openTagList: ['wx-open-launch-weapp'], // 跳转小程序时必填
"appId": res.data.wechat_mini.appId,
"nonceStr": res.data.wechat_mini.nonceStr,
"timestamp": res.data.wechat_mini.timestamp,
"url": res.data.wechat_mini.url,
"signature": res.data.wechat_mini.signature,
});
// res.data.wechat_mini
// 在wx.ready内调用
wx.ready(function() {
// 在这里调用 API
uni.navigateTo({
url: '/pages/index/index' // 跳转到的页面路径
});
});
wx.error(function(res) {
console.log('err', res)
});
// // #ifdef H5
// // 在H5环境中调用此函数来跳转到小程序

View File

@@ -3,4 +3,4 @@
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') +
'" />')</script><link rel=stylesheet href=/static/index.2da1efab.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src="/chunk-vendors.js?v=1716373696937"></script><script src="/index.js?v=1716373696937"></script></body></html>
'" />')</script><link rel=stylesheet href=/static/index.2da1efab.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src="/chunk-vendors.js?v=1716445785217"></script><script src="/index.js?v=1716445785217"></script></body></html>