修改统计、删除不不必要代码、修改项目库详情bug

This commit is contained in:
DESKTOP-RQ919RC\Pc 2025-03-27 19:03:54 +08:00
parent 4c79609069
commit 7545415f94
22 changed files with 104 additions and 98 deletions

67
app.js
View File

@ -6,34 +6,39 @@ var miucms = require('./utils/miucms.js');
var initial_url = 'https://api.gter.net/xiaoapp_offer.init.json';
var __ = require('./utils/miucms.js');
import util from './utils/util'
import './utils/xstat';
// 保存原始的Page构造器
const originPage = Page;
// // 保存原始的Page构造器
// const originPage = Page;
// // 重写Page构造器
// Page = function (pageConfig) {
// // 添加全局的onShow逻辑
// const originOnLoad = pageConfig.onLoad;
// pageConfig.onLoad = function () {
// util.statistics({})
// if (originOnLoad) originOnLoad.apply(this, arguments);
// };
// 重写Page构造器
Page = function (pageConfig) {
// 添加全局的onShow逻辑
const originOnLoad = pageConfig.onLoad;
pageConfig.onLoad = function () {
util.statistics({})
if (originOnLoad) originOnLoad.apply(this, arguments);
};
// const originOnShare = pageConfig.onShareAppMessage;
// if (originOnShare) {
// pageConfig.onShareAppMessage = function (e) {
// util.statistics({
// name: "share"
// })
// return originOnShare.apply(this, [e]);
// };
// }
const originOnShare = pageConfig.onShareAppMessage;
if (originOnShare) {
pageConfig.onShareAppMessage = function (e) {
util.statistics({
name: "share"
})
return originOnShare.apply(this, [e]);
};
}
// 调用原始的Page函数
return originPage(pageConfig);
};
// // 调用原始的Page函数
// return originPage(pageConfig);
// };
App({
xstatConfig: {
appKey: wx.getAccountInfoSync().miniProgram.appId, // 自动获取 小程序appid
debug: true, //是否打开调试模式
LOG_URL: 'https://stat.gter.net/send', // 上报地址
},
randomString(n) {
let str = 'abcdefghijklmnopqrstuvwxyz9876543210';
let tmp = '',
@ -46,14 +51,14 @@ App({
},
onLaunch: function (options) {
util.statistics({
data: {
scene: options.scene
},
path: options.path,
query: options.query,
name: "onLaunch"
})
// util.statistics({
// data: {
// scene: options.scene
// },
// path: options.path,
// query: options.query,
// name: "onLaunch"
// })
const accountInfo = wx.getAccountInfoSync();
const envVersion = accountInfo.miniProgram.envVersion;

View File

@ -81,7 +81,8 @@
&.selectable {
border: 1rpx solid rgba(215, 215, 215, 1);
background-color: #fff;
color: #000000;
color: #333333;
font-weight: 400;
}
}
}

View File

@ -67,7 +67,8 @@
.file .file-list .file-item .name .tag.selectable {
border: 1rpx solid #d7d7d7;
background-color: #fff;
color: #000000;
color: #333333;
font-weight: 400;
}
.file .file-list .file-item .hint {
font-size: 24rpx;

View File

@ -186,7 +186,8 @@ Component({
})
}
util.bindingUser(data.user)
// util.bindingUser(data.user)
wx.xstat && wx.xstat.setUserid(data.user.uid); // 登录后手动设置用户id , 如果有
}).finally(() => {
this.isloginState = false
})

View File

@ -117,9 +117,9 @@ Component({
this.setData({
groupState: true,
})
util.statistics({
name: "side-group"
})
// util.statistics({
// name: "side-group"
// })
return
}
@ -129,9 +129,9 @@ Component({
path: "/pages/victoryList/victoryList"
})
util.statistics({
name: "side-offer"
})
// util.statistics({
// name: "side-offer"
// })
return
}
@ -141,9 +141,9 @@ Component({
path: "/pages/index/index"
})
util.statistics({
name: "side-gx"
})
// util.statistics({
// name: "side-gx"
// })
return
}

View File

@ -36,9 +36,9 @@ Component({
},
skip() {
util.statistics({
name: this.data.popup.statEvent
})
// util.statistics({
// name: this.data.popup.statEvent
// })
if (this.data.popup.applet?.appid) {
wx.navigateToMiniProgram({
appId: this.data.popup.applet.appid,

View File

@ -463,9 +463,6 @@ Page({
},
onShareTimeline() {
util.statistics({
name: "share-timeline"
})
return {
title: "【寄托港校项目库】- 世界排行榜",
}

View File

@ -163,9 +163,9 @@ Page({
element['entrance_requirements'] = element.admission_requirements[0]['basic_requirements']
element['tuition_fee_text'] = common.formatNumberWithSpaces(element.admissions?.[0]?.tuition_fee ? element.admissions[0].tuition_fee + '' : '')
element['tuition_fee_text'] = common.formatNumberWithSpaces(element.admissions[0].tuition_fee || '')
element['admission_deposit_text'] = common.formatNumberWithSpaces(element.admissions?.[0]?.admission_deposit ? element.admissions[0].admission_deposit + '' : '')
element['admission_deposit_text'] = common.formatNumberWithSpaces(element.admissions[0].admission_deposit || '')
element['period'] = element.details.full_time_normal_year ? (element.details.full_time_normal_year + '年') : '_'
@ -563,9 +563,6 @@ Page({
}
},
onShareTimeline() {
util.statistics({
name: "share-timeline"
})
return {
title: this.getShareTitle(),
}

View File

@ -174,7 +174,7 @@ Page({
const data = res.data
let admissionofficerin = data.admissionofficerin || []
console.log("data", data);
// console.log("data", data);
// data.info.tags = {}
// data.info.rankings = []
// data.scholarships = []
@ -399,12 +399,12 @@ Page({
admissions.forEach(element => {
fields.forEach(field => {
const textKey = `${field}_text`;
element[textKey] = common.formatNumberWithSpaces(element[field] ? element[field] + '' : '');
element[textKey] = common.formatNumberWithSpaces(element[field] || '');
});
element['season'] = this.getIntakeSeason(element.intake_month, element.intake_year)
element['interviewRounds'] = this.calculateInterviewRound(element.application_end || {})
console.log("element", element);
// console.log("element", element);
})
this.setData({
@ -766,7 +766,8 @@ Page({
getOfferData() {
if (this.data.offerPage == 0) return
util.wxget(`https://api.gter.net/v1/program/offerList?limit=10&projectid=${ this.data.info.id }&page=${ this.data.offerPage }`).then(res => {
const limit = this.data.offerPage == 1 ? 5 : 10
util.wxget(`https://api.gter.net/v1/program/offerList?limit=${ limit }&projectid=${ this.data.info.id }&page=${ this.data.offerPage }`).then(res => {
const data = res.data
const list = data.list || []
let side = this.data.side
@ -842,9 +843,6 @@ Page({
}
},
onShareTimeline() {
util.statistics({
name: "share-timeline"
})
return {
title: `${ this.data.info.schoolalias || this.data.info.schoolname || '' }】 - ${this.data.info.name_zh}`,
}
@ -916,7 +914,7 @@ Page({
list = (list).map(element => ({
...element,
semesterState: (year < element.semester.year) || (year === element.semester.year && month < element.semester.month),
tuition_fee_text: common.formatNumberWithSpaces(element.tuition_fee ? element.tuition_fee + '' : '')
tuition_fee_text: common.formatNumberWithSpaces(element.tuition_fee || '')
}));
let side = this.data.side

View File

@ -657,6 +657,7 @@ navigator {
.text {
font-size: 24rpx;
color: #555555;
margin-top: 5rpx;
// margin-right: 20rpx;
}
@ -999,7 +1000,7 @@ navigator {
}
.demand {
padding: 25.5rpx 22.5rpx 75rpx;
padding: 25.5rpx 22.5rpx 40rpx;
// height: 800rpx;
// overflow: hidden;

View File

@ -157,6 +157,10 @@
<view wx:if="{{ side.basic }}" class="side-item" data-type="basic">
<view class="side-head flexcenter side-head-no-bottom">基本信息</view>
<block wx:if="{{ urls.length != 0 && answerType == 0 }}">
<image class="quick-answer" src="https://app.gter.net/image/miniApp/offer/quick-answer.png" mode="widthFix" bind:tap="cutQuickAnswer"></image>
<view class="borderTop"></view>
</block>
<view class="" style="margin-bottom: 30rpx;">
<view class="semester-box flexacenter ">
<view class="text gray semester">{{ newest || '' }}</view>
@ -294,7 +298,7 @@
<template is="item-header" data="{{ text: '最低入学要求' }}"></template>
<view class="demand block {{ demandState != 0 ? 'arrowShow' : '' }} {{ demandState == 2 ? 'demandShow' : '' }}">
<view class="text">{{ admission_requirementsObj.basic_requirements }}</view>
<view class="demand-content">
<view class="demand-content" wx:if="{{ admission_requirementsObj.language_requirements.length != 0 }}">
<template is="demand" wx:for="{{ admission_requirementsObj.language_requirements }}" wx:key="index" data="{{ item }}"></template>
</view>
<view class="demand-bottom flexcenter {{ demandState == 2 ? 'demandShow' : '' }}" bind:tap="cutDemandState" wx:if="{{ demandState != 0 }}">
@ -311,8 +315,8 @@
<view class="tuition block flexcenter">
<view class="left flexcenter flex1">
<view class="unit">{{ admissionsObj.tuition_currency || 'HK$' }}</view>
<view class="text">总学费</view>
<view class="number">{{ admissionsObj.tuition_fee_text || '待确认' }}</view>
<view class="text">总学费</view>
</view>
<view class="tuition-details" wx:if="{{ admissionsObj.tuition_fee_per_credit_text || admissionsObj.application_fee_text || admissionsObj.admission_deposit_text }}">
<view class="tuition-item flexacenter" wx:if="{{ admissionsObj.tuition_fee_per_credit_text }}">
@ -345,7 +349,7 @@
<view class="text">{{ item.description }}</view>
<view class="radius flexacenter">
<view class="key">适用范围</view>
<view class="value">{{ item.is_local_eligible ? '本地生适用' : '' }}{{ item.is_nonlocal_eligible ? '非本地生适用' : '' }}</view>
<view class="value">{{ item.is_local_eligible ? '本地生适用' : '' }}{{ item.is_nonlocal_eligible ? '非本地生适用' : '' }}</view>
</view>
</view>
</block>
@ -550,8 +554,8 @@
{{ item.view || 0 }}
</view>
<view class="item-bottom-item flexcenter">
<image class="item-bottom-icon" mode="widthFix" style="width: 20rpx;" src="https://app.gter.net/image/miniApp/offer/expression-icon.png"></image>
{{ item.ripostes || 0 }}
<image class="item-bottom-icon" mode="widthFix" style="width: 20rpx;" src="https://app.gter.net/image/miniApp/offer/like-icon.png"></image>
{{ item.likenum || 0 }}
</view>
<view class="item-bottom-item flexcenter">
<image class="item-bottom-icon" mode="widthFix" src="/img/discuss-icon.png"></image>
@ -585,7 +589,7 @@
</view>
<view wx:if="{{admissionsObj.leaflet_url || info.website_en || admissionsObj.application_url || admissionsObj.catalog_url }}" class="side-item" data-type="links">
<view class="side-head flexcenter">相关链接</view>
<!-- <view class="side-head flexcenter">相关链接</view> -->
<view class="pdf block" wx:if="{{ admissionsObj.leaflet_url }}">
<image class="icon" src="https://app.gter.net/image/miniApp/offer/pdf-icon.svg" mode="widthFix"></image>

View File

@ -545,6 +545,7 @@ navigator {
.details-box .tuition .text {
font-size: 24rpx;
color: #555555;
margin-top: 5rpx;
}
.details-box .tuition .tuition-details {
width: 300rpx;
@ -827,7 +828,7 @@ navigator {
color: #333333;
}
.details-box .demand {
padding: 25.5rpx 22.5rpx 75rpx;
padding: 25.5rpx 22.5rpx 40rpx;
position: relative;
transition: all 0.3s;
}

View File

@ -503,9 +503,9 @@ Page({
this.indexSidebar.setData({
groupState: true,
})
util.statistics({
name: "side-group"
})
// util.statistics({
// name: "side-group"
// })
},
indexSidebar: null,
@ -787,9 +787,6 @@ Page({
},
onShareTimeline() {
util.statistics({
name: "share-timeline"
})
return {
title: "聚焦港校项目,助你迈向国际名校之路!",
}

View File

@ -70,7 +70,7 @@ Page({
}
if (['subject', 'school'].includes(options.type)) {
const isSubject = options.type === 'subject';
const targetKey = isSubject ? 'maj' : 'com';
const targetKey = isSubject ? 'majDefault' : 'comDefault';
const source = this.data[targetKey] || (isSubject ? {} : this.data.com);
let updates = {
jg: this.decodeKey(isSubject ? options.system : options.mechanism) || '',
@ -380,9 +380,6 @@ Page({
}
},
onShareTimeline() {
util.statistics({
name: "share-timeline"
})
return {
title: "【寄托港校项目库】- 榜单",
}
@ -396,6 +393,8 @@ Page({
this.setData({
[classify == "school" ? 'com' : 'maj']: detail,
screenState: false,
comDefault:{},
majDefault:{},
})
if (classify == "school") this.getSynthesizeData()

View File

@ -643,10 +643,6 @@ Page({
}
},
onShareTimeline() {
util.statistics({
name: "share-timeline"
})
return {
title: "【寄托港校项目库】- " + this.data.info.name,
}

View File

@ -263,7 +263,7 @@ Page({
})
query.exec((res) => {
const data = res[0]
console.log("data", data);
// console.log("data", data);
this.setData({
bezier: {
x: data.left + data.width / 2 - this.rpx15,
@ -507,9 +507,6 @@ Page({
},
onShareTimeline() {
util.statistics({
name: "share-timeline"
})
return {
title: "【寄托港校项目库】 - 学科",
path: `/pages/projectSubjectList/projectSubjectList?id=${ this.data.id }&sid=${ this.data.sid }`,

View File

@ -223,14 +223,14 @@ Page({
if (this.data.loading || page == 0 || !kw) return
this.data.loading = true
// 代表是第一次搜索需要统计
if (page == 1) {
util.statistics({
name: "search",
data: {
kw
}
})
}
// if (page == 1) {
// util.statistics({
// name: "search",
// data: {
// kw
// }
// })
// }
wx.showLoading()
let url = "/miniprogramApi/offer/search/lists"

View File

@ -8,6 +8,13 @@
"condition": {
"miniprogram": {
"list": [
{
"name": "pages/projectDetails/projectDetails",
"pathName": "pages/projectDetails/projectDetails",
"query": "uniqid=G5C00CznrKHP",
"launchMode": "default",
"scene": null
},
{
"name": "pages/projectDetails/projectDetails",
"pathName": "pages/projectDetails/projectDetails",

View File

@ -68,7 +68,8 @@ function xgBasicData(that, app, isindex = false) {
}
function formatNumberWithSpaces(number) {
if (typeof number != 'string') number = ''
// if (typeof number != 'string') number = ''
if (Number(number) != number) return
return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}

View File

@ -109,7 +109,8 @@ function sendData(code) {
success: function (res) {
var data = typeof res.data == 'string' ? JSON.parse(res.data) : res.data;
util.bindingUser(data.user)
// util.bindingUser(data.user)
wx.xstat && wx.xstat.setUserid(data.user.uid); // 登录后手动设置用户id , 如果有
// 将配置与用户session存于本地
// if (!data.session) {

View File

@ -583,6 +583,7 @@ function statistics(obj) {
// 判断是否登录 如果登录需要发送 绑定微信信息埋点
function bindingUser(user = {}) {
return
if (user.uid <= 0) return;
setTimeout(() => {
statistics({

1
utils/xstat.js Normal file

File diff suppressed because one or more lines are too long