update
This commit is contained in:
parent
f3a17650cd
commit
c48289bb60
@ -807,6 +807,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"root": "pages/testPage",
|
||||||
|
"pages": [{
|
||||||
|
"path": "index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "测试页面"
|
||||||
|
}
|
||||||
|
}]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"globalStyle": {
|
"globalStyle": {
|
||||||
|
|||||||
@ -6208,6 +6208,7 @@ export default {
|
|||||||
},
|
},
|
||||||
goToRobot() {
|
goToRobot() {
|
||||||
this.$util.toNextRoute("navigateTo", `/pages/robot/index`);
|
this.$util.toNextRoute("navigateTo", `/pages/robot/index`);
|
||||||
|
// this.$util.toNextRoute("navigateTo", `/pages/testPage/index`);
|
||||||
},
|
},
|
||||||
handleShowTrafficDetail() {
|
handleShowTrafficDetail() {
|
||||||
this.showMonthDetail = !this.showMonthDetail;
|
this.showMonthDetail = !this.showMonthDetail;
|
||||||
|
|||||||
@ -53,7 +53,8 @@ const noDecimal = (s) =>{
|
|||||||
fuhao = '-'
|
fuhao = '-'
|
||||||
}
|
}
|
||||||
s = parseFloat((s + "").replace(/[^\d\.-]/g, "")) + ""
|
s = parseFloat((s + "").replace(/[^\d\.-]/g, "")) + ""
|
||||||
let l = s.split(".")[0].split("").reverse(), r = s.split(".")[1];
|
let l = s.split(".")[0].split("").reverse(),
|
||||||
|
r = s.split(".")[1];
|
||||||
let t = ''
|
let t = ''
|
||||||
for (let i = 0; i < l.length; i++) {
|
for (let i = 0; i < l.length; i++) {
|
||||||
t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");
|
t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");
|
||||||
@ -111,7 +112,11 @@ const getMoneyNoDecimal = (money)=>{
|
|||||||
|
|
||||||
|
|
||||||
const handleRedText = (value) => {
|
const handleRedText = (value) => {
|
||||||
return <text>{{value}}</text>
|
return <text > {
|
||||||
|
{
|
||||||
|
value
|
||||||
|
}
|
||||||
|
} < /text>
|
||||||
}
|
}
|
||||||
|
|
||||||
//事件转换函数,主要用作格式化x轴为时间轴,根据需求自行修改
|
//事件转换函数,主要用作格式化x轴为时间轴,根据需求自行修改
|
||||||
@ -129,10 +134,18 @@ const formatDateTime = (timeStamp, returnType)=>{
|
|||||||
var second = date.getSeconds();
|
var second = date.getSeconds();
|
||||||
minute = minute < 10 ? ('0' + minute) : minute;
|
minute = minute < 10 ? ('0' + minute) : minute;
|
||||||
second = second < 10 ? ('0' + second) : second;
|
second = second < 10 ? ('0' + second) : second;
|
||||||
if(returnType == 'full'){return y + '-' + m + '-' + d + ' '+ h +':' + minute + ':' + second;}
|
if (returnType == 'full') {
|
||||||
if(returnType == 'y-m-d'){return y + '-' + m + '-' + d;}
|
return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
|
||||||
if(returnType == 'h:m'){return h +':' + minute;}
|
}
|
||||||
if(returnType == 'h:m:s'){return h +':' + minute +':' + second;}
|
if (returnType == 'y-m-d') {
|
||||||
|
return y + '-' + m + '-' + d;
|
||||||
|
}
|
||||||
|
if (returnType == 'h:m') {
|
||||||
|
return h + ':' + minute;
|
||||||
|
}
|
||||||
|
if (returnType == 'h:m:s') {
|
||||||
|
return h + ':' + minute + ':' + second;
|
||||||
|
}
|
||||||
return [y, m, d, h, minute, second];
|
return [y, m, d, h, minute, second];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,11 +162,21 @@ const cfu = {
|
|||||||
"option": {},
|
"option": {},
|
||||||
//下面是自定义format配置,因除H5端外的其他端无法通过props传递函数,只能通过此属性对应下标的方式来替换
|
//下面是自定义format配置,因除H5端外的其他端无法通过props传递函数,只能通过此属性对应下标的方式来替换
|
||||||
"formatter": {
|
"formatter": {
|
||||||
"yAxisDemo1":function(val, index, opts){return val+'元'},
|
"yAxisDemo1": function (val, index, opts) {
|
||||||
"yAxisDemo2":function(val, index, opts){return val.toFixed(2)},
|
return val + '元'
|
||||||
"xAxisDemo1":function(val, index, opts){return val+'年';},
|
},
|
||||||
"xAxisDemo2":function(val, index, opts){return formatDateTime(val,'h:m')},
|
"yAxisDemo2": function (val, index, opts) {
|
||||||
"seriesDemo1":function(val, index, series, opts){return val+'元'},
|
return val.toFixed(2)
|
||||||
|
},
|
||||||
|
"xAxisDemo1": function (val, index, opts) {
|
||||||
|
return val + '年';
|
||||||
|
},
|
||||||
|
"xAxisDemo2": function (val, index, opts) {
|
||||||
|
return formatDateTime(val, 'h:m')
|
||||||
|
},
|
||||||
|
"seriesDemo1": function (val, index, series, opts) {
|
||||||
|
return val + '元'
|
||||||
|
},
|
||||||
"tooltipDemo1": function (item, category, index, opts) {
|
"tooltipDemo1": function (item, category, index, opts) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
return '随便用' + item.data + '年'
|
return '随便用' + item.data + '年'
|
||||||
@ -321,47 +344,61 @@ const cfu = {
|
|||||||
|
|
||||||
},
|
},
|
||||||
"entryCarNumber": function (item, category, index, opts) {
|
"entryCarNumber": function (item, category, index, opts) {
|
||||||
console.log('item',item)
|
console.log('item', item);
|
||||||
console.log('category',category)
|
console.log('category', category);
|
||||||
console.log('index',index)
|
console.log('index', index);
|
||||||
console.log('opts',opts)
|
console.log('opts', opts);
|
||||||
|
// 从opts里面 拿到这一行的详细数据
|
||||||
|
let detail = opts.series.filter(subItem => subItem.name === item.name)[0]
|
||||||
|
let add = ''
|
||||||
|
if (detail.linearIndex > 0) {
|
||||||
|
// 上一年
|
||||||
|
let lastYearObj = opts.series[detail.linearIndex - 1]
|
||||||
|
console.log('lastYearObj', lastYearObj);
|
||||||
|
// 当前年
|
||||||
|
let currentYearObj = opts.series[detail.linearIndex]
|
||||||
|
add = (((currentYearObj.real[index] - lastYearObj.real[index]) / lastYearObj.real[index]) * 100).toFixed(2) + '%'
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${detail.realDateList[index]}: ${detail.data[index].toFixed(2)}万元${add?detail.data[index]>0?','+add:'':''}`
|
||||||
|
|
||||||
// return item.name
|
// return item.name
|
||||||
let data = opts.series.filter(subItem=> subItem.name === item.name)[0].real[index]
|
// let data = opts.series.filter(subItem=> subItem.name === item.name)[0].real[index]
|
||||||
let day = opts.series.filter(subItem=> subItem.name === item.name)[0].howDayNumber
|
// let day = opts.series.filter(subItem=> subItem.name === item.name)[0].howDayNumber
|
||||||
|
|
||||||
let festivalType = opts.series[0].selectFestival
|
// let festivalType = opts.series[0].selectFestival
|
||||||
console.log('festivalType',festivalType)
|
// console.log('festivalType',festivalType)
|
||||||
console.log('data',data)
|
// console.log('data',data)
|
||||||
console.log('day',day)
|
// console.log('day',day)
|
||||||
let curData = opts.series.filter(subItem=> subItem.name === '24年')[0].real[index]
|
// let curData = opts.series.filter(subItem=> subItem.name === '24年')[0].real[index]
|
||||||
let compareData = opts.series.filter(subItem=> subItem.name === '23年')[0].real[index]
|
// let compareData = opts.series.filter(subItem=> subItem.name === '23年')[0].real[index]
|
||||||
// 显示具体的日期
|
// // 显示具体的日期
|
||||||
let realDate = opts.series.filter(subItem=> subItem.name === '23年')[0].realDateList[index]
|
// let realDate = opts.series.filter(subItem=> subItem.name === '23年')[0].realDateList[index]
|
||||||
// 显示具体的日期
|
// // 显示具体的日期
|
||||||
let curDate = opts.series.filter(subItem=> subItem.name === '24年')[0].realDateList[index]
|
// let curDate = opts.series.filter(subItem=> subItem.name === '24年')[0].realDateList[index]
|
||||||
|
|
||||||
let add = Number(((curData/compareData)-1)*100).toFixed(2)
|
// let add = Number(((curData/compareData)-1)*100).toFixed(2)
|
||||||
if(item.name==='24年'){
|
// if(item.name==='24年'){
|
||||||
if(data){
|
// if(data){
|
||||||
return `${curDate}:${data?getMoney(data / 10000,2):''}万元${add>0?',+':add<0?',':''}${add?add+'%':''}${
|
// return `${curDate}:${data?getMoney(data / 10000,2):''}万元${add>0?',+':add<0?',':''}${add?add+'%':''}${
|
||||||
festivalType===1 && index===1?'(清明节)':
|
// festivalType===1 && index===1?'(清明节)':
|
||||||
festivalType===2 && index===2?'(劳动节)':
|
// festivalType===2 && index===2?'(劳动节)':
|
||||||
festivalType===3 && index===3?'(端午节)':
|
// festivalType===3 && index===3?'(端午节)':
|
||||||
festivalType===5 && index===3?'(中秋节)':
|
// festivalType===5 && index===3?'(中秋节)':
|
||||||
festivalType===6 && index===1?'(国庆节)':
|
// festivalType===6 && index===1?'(国庆节)':
|
||||||
''}`
|
// ''}`
|
||||||
}else{
|
// }else{
|
||||||
return `${curDate}:`
|
// return `${curDate}:`
|
||||||
}
|
// }
|
||||||
}else{
|
// }else{
|
||||||
return `${realDate}:${data?getMoney(data / 10000,2):''}万元${
|
// return `${realDate}:${data?getMoney(data / 10000,2):''}万元${
|
||||||
festivalType===1 && index===1?'(清明节)':
|
// festivalType===1 && index===1?'(清明节)':
|
||||||
festivalType===2 && index===3?'(劳动节)':
|
// festivalType===2 && index===3?'(劳动节)':
|
||||||
festivalType===3 && index===1?'(端午节)':
|
// festivalType===3 && index===1?'(端午节)':
|
||||||
festivalType===5 && index===1?'(中秋节)':
|
// festivalType===5 && index===1?'(中秋节)':
|
||||||
festivalType===6 && index===3?'(国庆节)':
|
// festivalType===6 && index===3?'(国庆节)':
|
||||||
''}`
|
// ''}`
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
// if (item.name==='24年'){
|
// if (item.name==='24年'){
|
||||||
@ -574,8 +611,7 @@ const cfu = {
|
|||||||
"gridType": "dash",
|
"gridType": "dash",
|
||||||
"dashLength": 2,
|
"dashLength": 2,
|
||||||
},
|
},
|
||||||
"legend": {
|
"legend": {},
|
||||||
},
|
|
||||||
"extra": {
|
"extra": {
|
||||||
"line": {
|
"line": {
|
||||||
"type": "curve",
|
"type": "curve",
|
||||||
@ -735,8 +771,7 @@ const cfu = {
|
|||||||
"gridType": "dash",
|
"gridType": "dash",
|
||||||
"dashLength": 2,
|
"dashLength": 2,
|
||||||
},
|
},
|
||||||
"legend": {
|
"legend": {},
|
||||||
},
|
|
||||||
"extra": {
|
"extra": {
|
||||||
"line": {
|
"line": {
|
||||||
"type": "straight",
|
"type": "straight",
|
||||||
@ -756,15 +791,12 @@ const cfu = {
|
|||||||
"yAxis": {
|
"yAxis": {
|
||||||
"gridType": "dash",
|
"gridType": "dash",
|
||||||
"dashLength": 2,
|
"dashLength": 2,
|
||||||
"data":[
|
"data": [{
|
||||||
{
|
|
||||||
"min": 0,
|
"min": 0,
|
||||||
"max": 80
|
"max": 80
|
||||||
}
|
}]
|
||||||
]
|
|
||||||
},
|
|
||||||
"legend": {
|
|
||||||
},
|
},
|
||||||
|
"legend": {},
|
||||||
"extra": {
|
"extra": {
|
||||||
"line": {
|
"line": {
|
||||||
"type": "curve",
|
"type": "curve",
|
||||||
@ -784,15 +816,12 @@ const cfu = {
|
|||||||
"yAxis": {
|
"yAxis": {
|
||||||
"gridType": "dash",
|
"gridType": "dash",
|
||||||
"dashLength": 2,
|
"dashLength": 2,
|
||||||
"data":[
|
"data": [{
|
||||||
{
|
|
||||||
"min": 0,
|
"min": 0,
|
||||||
"max": 80
|
"max": 80
|
||||||
}
|
}]
|
||||||
]
|
|
||||||
},
|
|
||||||
"legend": {
|
|
||||||
},
|
},
|
||||||
|
"legend": {},
|
||||||
"extra": {
|
"extra": {
|
||||||
"area": {
|
"area": {
|
||||||
"type": "curve",
|
"type": "curve",
|
||||||
@ -812,10 +841,11 @@ const cfu = {
|
|||||||
"disableGrid": true,
|
"disableGrid": true,
|
||||||
},
|
},
|
||||||
"yAxis": {
|
"yAxis": {
|
||||||
"data":[{"min":0}]
|
"data": [{
|
||||||
},
|
"min": 0
|
||||||
"legend": {
|
}]
|
||||||
},
|
},
|
||||||
|
"legend": {},
|
||||||
"extra": {
|
"extra": {
|
||||||
"column": {
|
"column": {
|
||||||
"type": "group",
|
"type": "group",
|
||||||
@ -833,10 +863,11 @@ const cfu = {
|
|||||||
"disableGrid": true,
|
"disableGrid": true,
|
||||||
},
|
},
|
||||||
"yAxis": {
|
"yAxis": {
|
||||||
"data":[{"min":0}]
|
"data": [{
|
||||||
},
|
"min": 0
|
||||||
"legend": {
|
}]
|
||||||
},
|
},
|
||||||
|
"legend": {},
|
||||||
"extra": {
|
"extra": {
|
||||||
"mount": {
|
"mount": {
|
||||||
"type": "mount",
|
"type": "mount",
|
||||||
@ -854,10 +885,8 @@ const cfu = {
|
|||||||
"min": 0,
|
"min": 0,
|
||||||
"axisLine": false
|
"axisLine": false
|
||||||
},
|
},
|
||||||
"yAxis": {
|
"yAxis": {},
|
||||||
},
|
"legend": {},
|
||||||
"legend": {
|
|
||||||
},
|
|
||||||
"extra": {
|
"extra": {
|
||||||
"bar": {
|
"bar": {
|
||||||
"type": "group",
|
"type": "group",
|
||||||
@ -880,8 +909,7 @@ const cfu = {
|
|||||||
"gridType": "dash",
|
"gridType": "dash",
|
||||||
"dashLength": 2,
|
"dashLength": 2,
|
||||||
},
|
},
|
||||||
"legend": {
|
"legend": {},
|
||||||
},
|
|
||||||
"extra": {
|
"extra": {
|
||||||
"area": {
|
"area": {
|
||||||
"type": "straight",
|
"type": "straight",
|
||||||
@ -973,10 +1001,8 @@ const cfu = {
|
|||||||
"scrollColor": "#A6A6A6",
|
"scrollColor": "#A6A6A6",
|
||||||
"scrollBackgroundColor": "#EFEBEF"
|
"scrollBackgroundColor": "#EFEBEF"
|
||||||
},
|
},
|
||||||
"yAxis": {
|
"yAxis": {},
|
||||||
},
|
"legend": {},
|
||||||
"legend": {
|
|
||||||
},
|
|
||||||
"extra": {
|
"extra": {
|
||||||
"candle": {
|
"candle": {
|
||||||
"color": {
|
"color": {
|
||||||
@ -995,8 +1021,7 @@ const cfu = {
|
|||||||
"markLine": {
|
"markLine": {
|
||||||
"type": "dash",
|
"type": "dash",
|
||||||
"dashLength": 5,
|
"dashLength": 5,
|
||||||
"data": [
|
"data": [{
|
||||||
{
|
|
||||||
"value": 2150,
|
"value": 2150,
|
||||||
"lineColor": "#f04864",
|
"lineColor": "#f04864",
|
||||||
"showLabel": true
|
"showLabel": true
|
||||||
@ -1028,8 +1053,7 @@ const cfu = {
|
|||||||
"showTitle": true,
|
"showTitle": true,
|
||||||
"data": []
|
"data": []
|
||||||
},
|
},
|
||||||
"legend": {
|
"legend": {},
|
||||||
},
|
|
||||||
"extra": {
|
"extra": {
|
||||||
"mix": {
|
"mix": {
|
||||||
"column": {
|
"column": {
|
||||||
@ -1054,11 +1078,9 @@ const cfu = {
|
|||||||
"disableGrid": false,
|
"disableGrid": false,
|
||||||
"gridType": "dash",
|
"gridType": "dash",
|
||||||
},
|
},
|
||||||
"legend": {
|
"legend": {},
|
||||||
},
|
|
||||||
"extra": {
|
"extra": {
|
||||||
"scatter": {
|
"scatter": {},
|
||||||
},
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"bubble": {
|
"bubble": {
|
||||||
@ -1081,8 +1103,7 @@ const cfu = {
|
|||||||
"max": 150
|
"max": 150
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
"legend": {
|
"legend": {},
|
||||||
},
|
|
||||||
"extra": {
|
"extra": {
|
||||||
"bubble": {
|
"bubble": {
|
||||||
"border": 2,
|
"border": 2,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
225
pages/testPage/index.vue
Normal file
225
pages/testPage/index.vue
Normal file
@ -0,0 +1,225 @@
|
|||||||
|
<template>
|
||||||
|
<div class="main">
|
||||||
|
<template v-if="webViewSrc">
|
||||||
|
<web-view
|
||||||
|
id="myWebView"
|
||||||
|
ref="myWebView"
|
||||||
|
:src="webViewSrc"
|
||||||
|
@message="onMessage"
|
||||||
|
></web-view>
|
||||||
|
</template>
|
||||||
|
<!-- @load="onMinLoad" -->
|
||||||
|
|
||||||
|
<!-- <span @click="handleGetPoint">获取位置信息</span> -->
|
||||||
|
</div>
|
||||||
|
<!-- src="https://saas.eshangtech.com/goaliPay/index.html" -->
|
||||||
|
|
||||||
|
<!-- src="https://ahyd.eshangtech.com/goaliPay/index.html" -->
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { mapGetters } from "vuex";
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
message: "",
|
||||||
|
webViewSrc: ``,
|
||||||
|
nowObj: {},
|
||||||
|
loginType: "",
|
||||||
|
};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters({
|
||||||
|
user: "user",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
async onLoad() {
|
||||||
|
this.webViewSrc = `https://eshangtech.com/goaliPay/testwx.html`;
|
||||||
|
return;
|
||||||
|
|
||||||
|
let type = uni.getStorageSync("loginType");
|
||||||
|
console.log("loginType", type);
|
||||||
|
this.loginType = type;
|
||||||
|
let obj = {
|
||||||
|
loginType: type,
|
||||||
|
phone: this.user.MEMBERSHIP_MOBILEPHONE,
|
||||||
|
};
|
||||||
|
this.nowObj = obj;
|
||||||
|
const jsonString = JSON.stringify(obj);
|
||||||
|
const encodedData = encodeURIComponent(jsonString);
|
||||||
|
console.log("encodedData", encodedData);
|
||||||
|
if (type === "min") {
|
||||||
|
// const code = await this.login();
|
||||||
|
// console.log("dasldhasodhbasoudh", code);
|
||||||
|
// const codeString = JSON.stringify(code);
|
||||||
|
// const encodedCode = encodeURIComponent(codeString);
|
||||||
|
// console.log("encodedCode", encodedCode);
|
||||||
|
this.webViewSrc = `https://eshangtech.com/goaliPay/testwx.html`;
|
||||||
|
// https://ahyd.eshangtech.com/goaliPay/index.html
|
||||||
|
// https://saas.eshangtech.com/goaliPay/index.html
|
||||||
|
} else {
|
||||||
|
this.webViewSrc = `https://saas.eshangtech.com/goaliPay/index.html#${encodedData}`;
|
||||||
|
}
|
||||||
|
console.log("this.webViewSrc", this.webViewSrc);
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async onMinLoad() {
|
||||||
|
// console.log("111", 11);
|
||||||
|
// const code = await this.login();
|
||||||
|
// console.log("dasldhasodhbasoudh", code);
|
||||||
|
// const codeString = JSON.stringify(code);
|
||||||
|
// const encodedCode = encodeURIComponent(codeString);
|
||||||
|
// console.log("encodedCode", encodedCode);
|
||||||
|
// this.webViewSrc = `https://eshangtech.com/goaliPay/testwx.html#${encodedCode}`;
|
||||||
|
// this.webViewSrc = `https://eshangtech.com/goaliPay/testwx.html`;
|
||||||
|
// console.log("this.webViewSrc", this.webViewSrc);
|
||||||
|
},
|
||||||
|
handleGetPoint() {
|
||||||
|
$wanmeiyizhan.handleGetPosition().then((res) => {});
|
||||||
|
},
|
||||||
|
onMessage(event) {
|
||||||
|
let _this = this;
|
||||||
|
console.log("收到 H5 的消息:", event.detail.data[0]);
|
||||||
|
if (event.detail.data[0].action === "scanCode") {
|
||||||
|
uni.scanCode({
|
||||||
|
success: function (res) {
|
||||||
|
console.log("res", res);
|
||||||
|
_this.sendMessageToH5({ type: "scanCode", res: res });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else if (event.detail.data[0].action === "position") {
|
||||||
|
// let req = {
|
||||||
|
// membershipId: _this.user.MEMBERSHIP_ID,
|
||||||
|
// };
|
||||||
|
|
||||||
|
// _this.$api.$get("/Html5/GetMemberLocation", req).then((res) => {
|
||||||
|
// console.log("resdasda", res);
|
||||||
|
// });
|
||||||
|
|
||||||
|
plus.geolocation.getCurrentPosition(async function (position) {
|
||||||
|
console.log("当前位置:", position);
|
||||||
|
let res = position.coords;
|
||||||
|
let seatInfo = {
|
||||||
|
latitude: res.latitude,
|
||||||
|
longitude: res.longitude,
|
||||||
|
};
|
||||||
|
_this.sendMessageToH5({ type: "position", res: seatInfo });
|
||||||
|
});
|
||||||
|
} else if (event.detail.data[0].action === "openLocation") {
|
||||||
|
let obj = event.detail.data[0].res;
|
||||||
|
console.log("openLocation", obj);
|
||||||
|
uni.openLocation({
|
||||||
|
latitude: obj.latitude * 1,
|
||||||
|
longitude: obj.longitude * 1,
|
||||||
|
scale: 16, // 缩放比例
|
||||||
|
name: obj.name,
|
||||||
|
address: "", // 这个可能会影响地图的定位,所以可以选择不填
|
||||||
|
success(data) {
|
||||||
|
console.log(data);
|
||||||
|
},
|
||||||
|
fail(err) {
|
||||||
|
console.log(err);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} else if (event.detail.data[0].action === "openNewPage") {
|
||||||
|
let obj = event.detail.data[0].res;
|
||||||
|
console.log("openNewPage", obj);
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages/thirdParty/newPage?url=${obj.url}&title=${obj.title}`,
|
||||||
|
});
|
||||||
|
} else if (event.detail.data[0].action === "backPage") {
|
||||||
|
uni.navigateBack({
|
||||||
|
delta: 1,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// event.data 包含 H5 发送过来的消息内容
|
||||||
|
},
|
||||||
|
sendMessageToH5(data) {
|
||||||
|
console.log("收到消息", data);
|
||||||
|
let obj = this.nowObj;
|
||||||
|
obj[data.type] = data.res;
|
||||||
|
this.nowObj = obj;
|
||||||
|
console.log("obj", obj);
|
||||||
|
const jsonString = JSON.stringify(obj);
|
||||||
|
const encodedData = encodeURIComponent(jsonString);
|
||||||
|
console.log("encodedData", encodedData);
|
||||||
|
this.webViewSrc = `https://saas.eshangtech.com/goaliPay/index.html#${encodedData}`;
|
||||||
|
console.log("this.webViewSrc", this.webViewSrc);
|
||||||
|
// const webView = this.$refs.myWebView;
|
||||||
|
// webView.postMessage(data);
|
||||||
|
},
|
||||||
|
async login() {
|
||||||
|
let str = Math.random().toString(36).substr(2, 15);
|
||||||
|
let time = Math.floor(Date.now() / 1000);
|
||||||
|
|
||||||
|
let jsapi_ticket = await this.$api.$get(
|
||||||
|
"/EShangApiMain/WeChat/GetJsapiTicket",
|
||||||
|
{
|
||||||
|
appId: "wx4c497eddcec4a0e7",
|
||||||
|
sourcePlatform: "minprogram",
|
||||||
|
// minprogram
|
||||||
|
// publicprogram
|
||||||
|
}
|
||||||
|
);
|
||||||
|
console.log("jsapi_ticket", jsapi_ticket);
|
||||||
|
const req = {
|
||||||
|
jsapi_ticket: jsapi_ticket.Result_Data,
|
||||||
|
appId: "wx4c497eddcec4a0e7",
|
||||||
|
// wx4c497eddcec4a0e7 min
|
||||||
|
// wxcf4dbe1815d5d872
|
||||||
|
timestamp: time,
|
||||||
|
nonceStr: str,
|
||||||
|
url: `https://eshangtech.com/goaliPay/testwx.html`,
|
||||||
|
jsApiList: ["openLocation", "getLocation", "scanQRCode"],
|
||||||
|
};
|
||||||
|
console.log("req321312", req);
|
||||||
|
const data = await this.$api.$post(
|
||||||
|
"/EShangApiMain/WeChat/GetConfigSignature",
|
||||||
|
req
|
||||||
|
);
|
||||||
|
console.log("datalogin", data);
|
||||||
|
req.result = data.Result_Data;
|
||||||
|
return req;
|
||||||
|
|
||||||
|
// let str = this.generateNonceStr();
|
||||||
|
// let time = new Date().getTime();
|
||||||
|
// fetch(
|
||||||
|
// `https://api.eshangtech.com/EShangApiMain/WeChat/GetJsapiTicket?appId=wx4c497eddcec4a0e7&sourcePlatform=minprogram`
|
||||||
|
// )
|
||||||
|
// .then((response) => response.json())
|
||||||
|
// .then((data) => {
|
||||||
|
// wx.config({
|
||||||
|
// debug: true, // 开启调试模式
|
||||||
|
// appId: "wx4c497eddcec4a0e7", // 微信公众号或小程序的AppID
|
||||||
|
// timestamp: time, // 时间戳
|
||||||
|
// nonceStr: str, // 随机字符串
|
||||||
|
// signature: data.signature, // 签名
|
||||||
|
// jsApiList: ["openLocation", "scanQRCode", "getLocation"], // 需要调用的API列表
|
||||||
|
// });
|
||||||
|
|
||||||
|
// wx.ready(function () {});
|
||||||
|
// });
|
||||||
|
},
|
||||||
|
generateNonceStr(length = 16) {
|
||||||
|
let nonceStr = "";
|
||||||
|
const characters =
|
||||||
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
|
// 使用当前时间戳作为随机种子
|
||||||
|
const timestamp = Date.now();
|
||||||
|
// 拼接时间戳和随机数
|
||||||
|
for (let i = 0; i < length; i++) {
|
||||||
|
nonceStr += characters.charAt(
|
||||||
|
Math.floor(Math.random() * characters.length)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return nonceStr + timestamp.toString(36).slice(-4); // 添加时间戳的后4位,增加唯一性
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style scoped lang="less">
|
||||||
|
.main {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Loading…
x
Reference in New Issue
Block a user