主要针对之前缓存微信Token的云函数进行测试
1. pages/index/index.vue中增加测试按钮及云函数调用
<template>
<view class="content">
<image class="logo" src="/static/logo.png"></image>
<view class="text-area">
<text class="title">{
{title}}</text>
<button @click="testWxSign">测试签名</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Hello'
}
},
onLoad() {
},
methods: {
testWxSign() {
var uri = encodeURIComponent(window.location.href.split('#')[0]); //获取当前url然后传递给后台获取授权和签名信息
//var uri = window.location.href.split('#')[0];
uniCloud.callFunction({
name: 'wx-signature',
data: {
params: {
url: uri
}
}
})
.then(res => {
// 返回需要