This commit is contained in:
cclu 2025-01-09 19:22:41 +08:00
parent f3a17650cd
commit c48289bb60
7 changed files with 3889 additions and 2224 deletions

View File

@ -807,6 +807,15 @@
}
}
]
},
{
"root": "pages/testPage",
"pages": [{
"path": "index",
"style": {
"navigationBarTitleText": "测试页面"
}
}]
}
],
"globalStyle": {

View File

@ -6208,6 +6208,7 @@ export default {
},
goToRobot() {
this.$util.toNextRoute("navigateTo", `/pages/robot/index`);
// this.$util.toNextRoute("navigateTo", `/pages/testPage/index`);
},
handleShowTrafficDetail() {
this.showMonthDetail = !this.showMonthDetail;

View File

@ -53,7 +53,8 @@ const noDecimal = (s) =>{
fuhao = '-'
}
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 = ''
for (let i = 0; i < l.length; i++) {
t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : "");
@ -111,7 +112,11 @@ const getMoneyNoDecimal = (money)=>{
const handleRedText = (value) => {
return <text>{{value}}</text>
return <text > {
{
value
}
} < /text>
}
//事件转换函数主要用作格式化x轴为时间轴根据需求自行修改
@ -129,10 +134,18 @@ const formatDateTime = (timeStamp, returnType)=>{
var second = date.getSeconds();
minute = minute < 10 ? ('0' + minute) : minute;
second = second < 10 ? ('0' + second) : second;
if(returnType == 'full'){return y + '-' + m + '-' + d + ' '+ 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;}
if (returnType == 'full') {
return y + '-' + m + '-' + d + ' ' + 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];
}
@ -149,11 +162,21 @@ const cfu = {
"option": {},
//下面是自定义format配置因除H5端外的其他端无法通过props传递函数只能通过此属性对应下标的方式来替换
"formatter": {
"yAxisDemo1":function(val, index, opts){return val+'元'},
"yAxisDemo2":function(val, index, opts){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+'元'},
"yAxisDemo1": function (val, index, opts) {
return val + '元'
},
"yAxisDemo2": function (val, index, opts) {
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) {
if (index == 0) {
return '随便用' + item.data + '年'
@ -321,47 +344,61 @@ const cfu = {
},
"entryCarNumber": function (item, category, index, opts) {
console.log('item',item)
console.log('category',category)
console.log('index',index)
console.log('opts',opts)
console.log('item', item);
console.log('category', category);
console.log('index', index);
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
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 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 festivalType = opts.series[0].selectFestival
console.log('festivalType',festivalType)
console.log('data',data)
console.log('day',day)
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 realDate = opts.series.filter(subItem=> subItem.name === '23年')[0].realDateList[index]
// 显示具体的日期
let curDate = opts.series.filter(subItem=> subItem.name === '24年')[0].realDateList[index]
// let festivalType = opts.series[0].selectFestival
// console.log('festivalType',festivalType)
// console.log('data',data)
// console.log('day',day)
// 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 realDate = opts.series.filter(subItem=> subItem.name === '23年')[0].realDateList[index]
// // 显示具体的日期
// let curDate = opts.series.filter(subItem=> subItem.name === '24年')[0].realDateList[index]
let add = Number(((curData/compareData)-1)*100).toFixed(2)
if(item.name==='24年'){
if(data){
return `${curDate}${data?getMoney(data / 10000,2):''}万元${add>0?'+':add<0?'':''}${add?add+'%':''}${
festivalType===1 && index===1?'(清明节)':
festivalType===2 && index===2?'(劳动节)':
festivalType===3 && index===3?'(端午节)':
festivalType===5 && index===3?'(中秋节)':
festivalType===6 && index===1?'(国庆节)':
''}`
}else{
return `${curDate}`
}
}else{
return `${realDate}${data?getMoney(data / 10000,2):''}万元${
festivalType===1 && index===1?'(清明节)':
festivalType===2 && index===3?'(劳动节)':
festivalType===3 && index===1?'(端午节)':
festivalType===5 && index===1?'(中秋节)':
festivalType===6 && index===3?'(国庆节)':
''}`
}
// let add = Number(((curData/compareData)-1)*100).toFixed(2)
// if(item.name==='24年'){
// if(data){
// return `${curDate}${data?getMoney(data / 10000,2):''}万元${add>0?'+':add<0?'':''}${add?add+'%':''}${
// festivalType===1 && index===1?'(清明节)':
// festivalType===2 && index===2?'(劳动节)':
// festivalType===3 && index===3?'(端午节)':
// festivalType===5 && index===3?'(中秋节)':
// festivalType===6 && index===1?'(国庆节)':
// ''}`
// }else{
// return `${curDate}`
// }
// }else{
// return `${realDate}${data?getMoney(data / 10000,2):''}万元${
// festivalType===1 && index===1?'(清明节)':
// festivalType===2 && index===3?'(劳动节)':
// festivalType===3 && index===1?'(端午节)':
// festivalType===5 && index===1?'(中秋节)':
// festivalType===6 && index===3?'(国庆节)':
// ''}`
// }
// if (item.name==='24年'){
@ -574,8 +611,7 @@ const cfu = {
"gridType": "dash",
"dashLength": 2,
},
"legend": {
},
"legend": {},
"extra": {
"line": {
"type": "curve",
@ -735,8 +771,7 @@ const cfu = {
"gridType": "dash",
"dashLength": 2,
},
"legend": {
},
"legend": {},
"extra": {
"line": {
"type": "straight",
@ -756,15 +791,12 @@ const cfu = {
"yAxis": {
"gridType": "dash",
"dashLength": 2,
"data":[
{
"data": [{
"min": 0,
"max": 80
}
]
},
"legend": {
}]
},
"legend": {},
"extra": {
"line": {
"type": "curve",
@ -784,15 +816,12 @@ const cfu = {
"yAxis": {
"gridType": "dash",
"dashLength": 2,
"data":[
{
"data": [{
"min": 0,
"max": 80
}
]
},
"legend": {
}]
},
"legend": {},
"extra": {
"area": {
"type": "curve",
@ -812,10 +841,11 @@ const cfu = {
"disableGrid": true,
},
"yAxis": {
"data":[{"min":0}]
},
"legend": {
"data": [{
"min": 0
}]
},
"legend": {},
"extra": {
"column": {
"type": "group",
@ -833,10 +863,11 @@ const cfu = {
"disableGrid": true,
},
"yAxis": {
"data":[{"min":0}]
},
"legend": {
"data": [{
"min": 0
}]
},
"legend": {},
"extra": {
"mount": {
"type": "mount",
@ -854,10 +885,8 @@ const cfu = {
"min": 0,
"axisLine": false
},
"yAxis": {
},
"legend": {
},
"yAxis": {},
"legend": {},
"extra": {
"bar": {
"type": "group",
@ -880,8 +909,7 @@ const cfu = {
"gridType": "dash",
"dashLength": 2,
},
"legend": {
},
"legend": {},
"extra": {
"area": {
"type": "straight",
@ -973,10 +1001,8 @@ const cfu = {
"scrollColor": "#A6A6A6",
"scrollBackgroundColor": "#EFEBEF"
},
"yAxis": {
},
"legend": {
},
"yAxis": {},
"legend": {},
"extra": {
"candle": {
"color": {
@ -995,8 +1021,7 @@ const cfu = {
"markLine": {
"type": "dash",
"dashLength": 5,
"data": [
{
"data": [{
"value": 2150,
"lineColor": "#f04864",
"showLabel": true
@ -1028,8 +1053,7 @@ const cfu = {
"showTitle": true,
"data": []
},
"legend": {
},
"legend": {},
"extra": {
"mix": {
"column": {
@ -1054,11 +1078,9 @@ const cfu = {
"disableGrid": false,
"gridType": "dash",
},
"legend": {
},
"legend": {},
"extra": {
"scatter": {
},
"scatter": {},
}
},
"bubble": {
@ -1081,8 +1103,7 @@ const cfu = {
"max": 150
}]
},
"legend": {
},
"legend": {},
"extra": {
"bubble": {
"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
View 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>