Kaynağa Gözat

Merge branch 'mp' of http://49.234.186.218:9000/root/ieplus-app into mp

abpcoder 1 ay önce
ebeveyn
işleme
81f908f547

+ 0 - 207
README.md

@@ -1,207 +0,0 @@
-# IE-plus 项目
-
-## 项目简介
-这是一个基于 uni-app 的学习应用项目,使用 Vite 作为构建工具。
-
-## 最近修改
-
-### 日历组件全面升级 - 新增多项功能
-**修改时间**: 2024年
-**修改内容**: 为 uni-calendar 组件新增了多项实用功能,提升组件的灵活性和可定制性
-
-#### 新增功能
-
-##### 1. 周日位置控制
-- **参数**: `sundayFirst` (Boolean, 默认: false)
-- **功能**: 控制周日显示在第一列还是最后一列
-- **用法**: 
-  ```vue
-  <uni-calendar :sunday-first="true" />  <!-- 周日在前 -->
-  <uni-calendar :sunday-first="false" /> <!-- 周日在后 -->
-  ```
-
-##### 2. 显示模式控制
-- **参数**: `displayMode` (String, 默认: 'month')
-- **可选值**: 'month' | 'week'
-- **功能**: 控制按月显示还是按周显示
-- **特点**: 按周显示时,其他周的日期会显示但置灰,只有指定周正常显示
-- **方法**: 
-  - `preWeek()`: 切换到上一周
-  - `nextWeek()`: 切换到下一周
-  - `setWeekNumber(weekNumber)`: 设置指定周数
-- **事件**: `change-week`: 周数变化时触发
-- **用法**:
-  ```vue
-  <uni-calendar 
-    ref="calendar"
-    display-mode="week" 
-    :week-number="currentWeek"
-    @change-week="onWeekChange" />
-  
-  <!-- 在父组件中调用切换方法 -->
-  <button @click="$refs.calendar.preWeek()">上一周</button>
-  <button @click="$refs.calendar.nextWeek()">下一周</button>
-  <button @click="$refs.calendar.setWeekNumber(3)">第3周</button>
-  ```
-
-##### 3. 今天高亮控制
-- **参数**: `highlightToday` (Boolean, 默认: true)
-- **功能**: 控制是否高亮今天,影响"回到今日"按钮显示和今天日期样式
-- **用法**:
-  ```vue
-  <uni-calendar :highlight-today="false" />  <!-- 不高亮今天 -->
-  ```
-
-##### 4. 工具栏显示控制
-- **参数**: `showToolbar` (Boolean, 默认: true)
-- **功能**: 控制是否显示顶部的月份切换工具栏
-- **用法**:
-  ```vue
-  <uni-calendar :show-toolbar="false" />  <!-- 隐藏工具栏 -->
-  ```
-
-##### 5. 自定义日期样式插槽
-- **插槽**: `calendar-item`
-- **功能**: 允许外部自定义每个日期项的显示样式
-- **特点**: 可以完全自定义整个日期项,包含更多参数
-- **用法**:
-  ```vue
-  <!-- 自定义整个日期项 -->
-  <uni-calendar>
-    <template #calendar-item="{ weeks, calendar, selected, lunar, highlightToday, weekIndex, weeksIndex }">
-      <view class="enhanced-calendar-item" :class="{ 'not-current-month': !weeks.isCurrentMonth }">
-        <text class="date-number">{{ weeks.date }}</text>
-        <view class="date-indicators">
-          <view v-if="weeks.extraInfo" class="indicator-dot"></view>
-          <view v-if="weeks.isDay" class="today-badge">今</view>
-          <view v-if="!weeks.isCurrentMonth" class="month-badge">非本月</view>
-        </view>
-      </view>
-  </template>
-</uni-calendar>
-```
-
-#### 数据属性说明
-每个日期项(weeks)包含以下属性:
-- `fullDate`: 完整日期字符串 (如: "2024-01-15")
-- `year`: 年份
-- `month`: 月份
-- `date`: 日期数字
-- `isDay`: 是否为今天
-- `disable`: 是否禁用
-- `isCurrentMonth`: **是否为当前月份** (true: 本月, false: 上月/下月)
-- `isWeekModeDisabled`: 按周模式下的置灰标识
-- `beforeMultiple`: 多选开始标识
-- `afterMultiple`: 多选结束标识
-- `multiple`: 多选中间标识
-- `lunar`: 农历信息
-- `extraInfo`: 额外信息(打点数据)
-
-#### 修改文件
-1. `src/uni_modules/uni-calendar/components/uni-calendar/uni-calendar.vue`
-   - 新增5个props参数
-   - 添加计算属性 `filteredWeeks` 处理按周显示
-   - 修改模板支持条件渲染和插槽
-   - 优化星期标题显示逻辑
-
-2. `src/uni_modules/uni-calendar/components/uni-calendar/util.js`
-   - 新增 `sundayFirst` 参数支持
-   - 修改 `_getWeek` 方法支持周日位置控制
-   - 优化日期计算逻辑
-
-3. `src/uni_modules/uni-calendar/components/uni-calendar/uni-calendar-item.vue`
-   - 新增 `highlightToday` 参数支持
-   - 添加插槽支持自定义日期样式
-   - 优化今天高亮显示逻辑
-
-#### 完整参数列表
-```vue
-<uni-calendar
-  :sunday-first="false"           <!-- 周日位置控制 -->
-  display-mode="month"            <!-- 显示模式 -->
-  :week-number="1"                <!-- 按周显示时的周数 -->
-  :highlight-today="true"         <!-- 是否高亮今天 -->
-  :show-toolbar="true"            <!-- 是否显示工具栏 -->
-  :insert="true"                  <!-- 插入模式 -->
-  :lunar="false"                  <!-- 显示农历 -->
-  :range="false"                  <!-- 范围选择 -->
-  :selected="[]"                  <!-- 打点信息 -->
-  :start-date=""                  <!-- 开始日期 -->
-  :end-date=""                    <!-- 结束日期 -->
-  :show-month="true"              <!-- 显示月份背景 -->
-  :clear-date="true"              <!-- 清空日期 -->
-  :readonly="false"               <!-- 只读模式 -->
->
-  <template #calendar-item="{ weeks, calendar, selected, lunar, highlightToday, weekIndex, weeksIndex }">
-    <!-- 自定义整个日期项 -->
-  </template>
-</uni-calendar>
-```
-
-#### 日期范围API
-Calendar 工具类提供两个实用的日期范围获取方法:
-
-##### 1. 获取本月日期范围
-```javascript
-import Calendar from './util.js'
-
-const calendar = new Calendar()
-const monthRange = calendar.getCurrentMonthRange('2024-10-15')
-// 返回: {startDate: '2024-10-01', endDate: '2024-10-31', totalDays: 31, totalWeeks: 5}
-```
-
-##### 2. 获取指定周日期范围
-```javascript
-// 获取当前日期所在的周
-const currentWeek = calendar.getCurrentWeekRange('2024-10-15')
-// 返回: {startDate: '2024-10-13', endDate: '2024-10-19', totalDays: 7, currentWeek: 3, totalWeeks: 5}
-
-// 获取指定周数
-const week2 = calendar.getCurrentWeekRange('2024-10-15', 2)
-// 返回: {startDate: '2024-10-06', endDate: '2024-10-12', totalDays: 7, currentWeek: 2, totalWeeks: 5}
-```
-
-**参数说明:**
-- `date`: 日期字符串,可选,默认为当前日期
-- `weekNumber`: 周数,从1开始,可选,不传时自动计算指定日期所在的周
-
-**返回值说明:**
-- `startDate`: 开始日期
-- `endDate`: 结束日期  
-- `totalDays`: 总天数
-- `totalWeeks`: 总周数(实际包含本月日期的周数)
-- `currentWeek`: 当前周数(仅周范围方法)
-
-#### 技术细节
-- 使用 Vue 3 的 Composition API 和插槽系统
-- 通过计算属性实现按周显示的数据过滤
-- 使用条件渲染控制工具栏和今天高亮显示
-- 支持完全自定义的日期样式渲染
-- 提供完整的周切换API,支持跨月份切换
-- 智能处理边界情况(第一周/最后一周的跨月切换)
-- 提供实用的日期范围获取API,支持外部调用
-
-#### 影响范围
-- 所有使用 uni-calendar 组件的页面都可以使用新功能
-- 向后兼容,现有代码无需修改
-- 新功能为可选参数,默认行为保持不变
-
-## 项目结构
-```
-src/
-├── uni_modules/          # uni-app 模块
-│   └── uni-calendar/     # 日历组件
-├── pagesStudy/           # 学习相关页面
-├── components/           # 公共组件
-└── ...
-```
-
-## 开发说明
-- 使用 Vue 3 + TypeScript
-- 构建工具:Vite
-- UI框架:uni-app
-- 样式:SCSS + Tailwind CSS
-
-## 注意事项
-- 修改日历组件后,请确保所有使用该组件的页面都能正常显示
-- 如果需要在其他项目中复用此修改,请同时复制两个文件的修改内容

+ 0 - 1
builddev.sh

@@ -1 +0,0 @@
-npm run build:custom dev

+ 0 - 1
buildprod.sh

@@ -1 +0,0 @@
-npm run build:custom pro

+ 0 - 1
rundev.sh

@@ -1 +0,0 @@
-npm run dev:custom dev

+ 0 - 1
runprod.sh

@@ -1 +0,0 @@
-npm run dev:custom pro

+ 0 - 2
src/uni_modules/vue3-echarts/changelog.md

@@ -1,2 +0,0 @@
-## 1.0.0(2022-11-05)
-vue3-echarts 支持H5、小程序

+ 0 - 40
src/uni_modules/vue3-echarts/components/vue3-echarts/echarts.js

@@ -1,40 +0,0 @@
-// myEhcarts.js
-// 引入 echarts 核心模块,核心模块提供了 echarts 使用必须要的接口。
-import * as echarts from 'echarts/core'
-
-// 引入图表类型,图表后缀都为 Chart
-import { BarChart, LineChart, PieChart, ScatterChart } from 'echarts/charts'
-
-// 引入提示框,标题,直角坐标系等组件,组件后缀都为 Component
-import {
-  TitleComponent,
-  TooltipComponent,
-  GridComponent,
-  LegendComponent,
-  DatasetComponent,
-  TransformComponent
-} from 'echarts/components'
-// 标签自动布局,全局过渡动画等特性
-import { LabelLayout, UniversalTransition } from 'echarts/features'
-// 引入 Canvas 渲染器,注意引入 CanvasRenderer 或者 SVGRenderer 是必须的一步
-import { CanvasRenderer } from 'echarts/renderers'
-
-// 将以上引入的组件使用use()方法注册
-echarts.use([
-  TitleComponent,
-  TooltipComponent,
-  GridComponent,
-  LegendComponent,
-  DatasetComponent,
-  TransformComponent,
-  LabelLayout,
-  UniversalTransition,
-  BarChart,
-  LineChart,
-  PieChart,
-  ScatterChart,
-  CanvasRenderer
-])
-
-// 导出
-export default echarts

+ 0 - 258
src/uni_modules/vue3-echarts/components/vue3-echarts/vue3-echarts.vue

@@ -1,258 +0,0 @@
-<template>
-	<!-- #ifdef MP-WEIXIN || MP-ALIPAY || MP-BAIDU || MP-TOUTIAO -->
-	<canvas type="2d" class="echarts" :canvas-id="canvasId" :id="canvasId" @touchstart="touchStart" @touchmove="touchMove" @touchend="touchEnd" />
-	<!-- #endif -->
-	<!-- #ifndef MP-WEIXIN || MP-ALIPAY || MP-BAIDU || MP-TOUTIAO -->
-	<canvas class="echarts" :canvas-id="canvasId" :id="canvasId" @touchstart="touchStart" @touchmove="touchMove" @touchend="touchEnd" />
-	<!-- #endif -->
-</template>
-<script setup>
-/**
- * vue3 echarts 兼容uni-app
- * @description vue3 echart兼容uni-app
- * @property {Object} options 图表配置数据
- * @property {String} canvasId 画布id
- * @example <vue3-echarts ref="echarts" :options="options" canvasId="echarts"></vue3-echarts>
- */
-import WxCanvas from './wx-canvas.js';
-// import echarts from "./echarts" //按需引入
-import * as echarts from 'echarts';
-import { ref, watch, nextTick, onMounted, onBeforeUnmount, getCurrentInstance } from 'vue';
-const instance = getCurrentInstance();
-const exposeObj = {}; // 导出组件方法、echart实例
-var chartInstance;
-const props = defineProps({
-	canvasId: {
-		type: String,
-		default: 'echarts'
-	},
-	options: {
-		type: Object,
-		default: () => {
-			return {};
-		}
-	}
-});
-const emits = defineEmits(['click']);
-let ctx = null;
-
-onMounted(() => {
-	echarts.registerPreprocessor(options => {
-		if (options && options.series) {
-			if (options.series.length > 0) {
-				options.series.forEach(series => {
-					series.progressive = 0;
-				});
-			} else if (typeof options.series === 'object') {
-				options.series.progressive = 0;
-			}
-		}
-	});
-});
-
-onBeforeUnmount(() => {
-	chartInstance && chartInstance.dispose();
-});
-
-// #ifdef H5
-//H5绘制图表
-const initChart = options => {
-	ctx = uni.createCanvasContext(props.canvasId, instance);
-	chartInstance = echarts.init(document.getElementById(props.canvasId));
-	chartInstance.clear();
-	chartInstance.setOption(options ? options : props.options);
-	chartInstance.on('click', function(params) {
-		emits('click', params);
-	});
-	exposeObj.chart = chartInstance;
-};
-//H5生成图片
-const canvasToTempFilePath = opt => {
-	const base64 = chartInstance.getDataURL();
-	opt.success && opt.success({ tempFilePath: base64 });
-};
-exposeObj.canvasToTempFilePath = canvasToTempFilePath;
-// #endif
-// #ifndef H5
-//绘制图表
-const initChart = async options => {
-	// #ifdef MP-WEIXIN || MP-ALIPAY || MP-BAIDU || MP-TOUTIAO
-	const canvasAttr = await getCanvasAttr2d();
-	// #endif
-	// #ifndef MP-WEIXIN || MP-ALIPAY || MP-BAIDU || MP-TOUTIAO
-	const canvasAttr = await getCanvasAttr();
-	// #endif
-	const { canvas, canvasWidth, canvasHeight, canvasDpr } = canvasAttr;
-	chartInstance = echarts.init(canvas, null, {
-		width: canvasWidth,
-		height: canvasHeight,
-		devicePixelRatio: canvasDpr // new
-	});
-	canvas.setChart(chartInstance);
-	chartInstance.clear();
-	chartInstance.setOption(options ? options : props.options);
-	chartInstance.on('click', function(params) {
-		emits('click', params);
-	});
-	exposeObj.chart = chartInstance;
-};
-//生成图片
-const canvasToTempFilePath = opt => {
-	// #ifdef MP-WEIXIN || MP-ALIPAY || MP-BAIDU || MP-TOUTIAO
-	var query = uni
-		.createSelectorQuery()
-		// #ifndef MP-ALIPAY
-		.in(instance);
-	// #endif
-	query
-		.select('#' + props.canvasId)
-		.fields({ node: true, size: true })
-		.exec(res => {
-			const canvasNode = res[0].node;
-			opt.canvas = canvasNode;
-			uni.canvasToTempFilePath(opt, instance);
-		});
-	// #endif
-	// #ifndef MP-WEIXIN || MP-ALIPAY || MP-BAIDU || MP-TOUTIAO
-	if (!opt.canvasId) {
-		opt.canvasId = props.canvasId;
-	}
-	ctx.draw(true, () => {
-		uni.canvasToTempFilePath(opt, instance);
-	});
-	// #endif
-};
-exposeObj.canvasToTempFilePath = canvasToTempFilePath;
-// #endif
-
-const getCanvasAttr2d = function() {
-	return new Promise((resolve, reject) => {
-		const query = uni.createSelectorQuery().in(instance);
-		query
-			.select('#' + props.canvasId)
-			.fields({
-				node: true,
-				size: true
-			})
-			.exec(res => {
-				const canvasNode = res[0].node;
-				const canvasDpr = uni.getSystemInfoSync().pixelRatio;
-				const canvasWidth = res[0].width;
-				const canvasHeight = res[0].height;
-				ctx = canvasNode.getContext('2d');
-
-				const canvas = new WxCanvas(ctx, props.canvasId, true, canvasNode);
-				echarts.setCanvasCreator(() => {
-					return canvas;
-				});
-				resolve({
-					canvas,
-					canvasWidth,
-					canvasHeight,
-					canvasDpr
-				});
-			});
-	});
-};
-
-const getCanvasAttr = function() {
-	return new Promise((resolve, reject) => {
-		ctx = uni.createCanvasContext(props.canvasId, instance);
-		var canvas = new WxCanvas(ctx, props.canvasId, false);
-		echarts.setCanvasCreator(() => {
-			return canvas;
-		});
-		const canvasDpr = 1;
-		var query = uni
-			.createSelectorQuery()
-			// #ifndef MP-ALIPAY
-			.in(instance);
-		// #endif
-		query
-			.select('#' + props.canvasId)
-			.boundingClientRect(res => {
-				const canvasWidth = res.width;
-				const canvasHeight = res.height;
-				resolve({
-					canvas,
-					canvasWidth,
-					canvasHeight,
-					canvasDpr
-				});
-			})
-			.exec();
-	});
-};
-const touchStart = e => {
-	if (chartInstance && e.touches.length > 0) {
-		var touch = e.touches[0];
-		var handler = chartInstance.getZr().handler;
-		handler.dispatch('mousedown', {
-			zrX: touch.x,
-			zrY: touch.y
-		});
-		handler.dispatch('mousemove', {
-			zrX: touch.x,
-			zrY: touch.y
-		});
-		handler.processGesture(wrapTouch(e), 'start');
-	}
-};
-const touchMove = e => {
-	if (chartInstance && e.touches.length > 0) {
-		var touch = e.touches[0];
-		var handler = chartInstance.getZr().handler;
-		handler.dispatch('mousemove', {
-			zrX: touch.x,
-			zrY: touch.y
-		});
-		handler.processGesture(wrapTouch(e), 'change');
-	}
-};
-
-const touchEnd = e => {
-	if (chartInstance) {
-		const touch = e.changedTouches ? e.changedTouches[0] : {};
-		var handler = chartInstance.getZr().handler;
-		handler.dispatch('mouseup', {
-			zrX: touch.x,
-			zrY: touch.y
-		});
-		handler.dispatch('click', {
-			zrX: touch.x,
-			zrY: touch.y
-		});
-		handler.processGesture(wrapTouch(e), 'end');
-	}
-};
-const wrapTouch = function(event) {
-	for (let i = 0; i < event.touches.length; ++i) {
-		const touch = event.touches[i];
-		touch.offsetX = touch.x;
-		touch.offsetY = touch.y;
-	}
-	return event;
-};
-
-watch(
-    () => props.options,
-	(newValue, oldValue) => {
-		if (newValue.series) {
-			nextTick(() => {
-				initChart(newValue);
-			});
-		}
-	},
-	{
-		deep: true,
-		immediate: true
-	}
-);
-defineExpose(exposeObj); //导出组件方法、echart实例
-</script>
-<style lang="scss" scoped>
-.echarts {
-	width: 100%;
-	height: 100%;
-}
-</style>

+ 0 - 106
src/uni_modules/vue3-echarts/components/vue3-echarts/wx-canvas.js

@@ -1,106 +0,0 @@
-export default class WxCanvas {
-	constructor(ctx, canvasId, isNew, canvasNode) {
-		this.ctx = ctx;
-		this.canvasId = canvasId;
-		this.chart = null;
-		this.isNew = isNew
-		if (isNew) {
-			this.canvasNode = canvasNode;
-		} else {
-			this._initStyle(ctx);
-		}
-
-		// this._initCanvas(zrender, ctx);
-
-		this._initEvent();
-	}
-	// 新增空函数,修复调用 echarts.init 时报错
-	addEventListener() {}
-
-	getContext(contextType) {
-		if (contextType === '2d') {
-			return this.ctx;
-		}
-	}
-
-	// canvasToTempFilePath(opt) {
-	//   if (!opt.canvasId) {
-	//     opt.canvasId = this.canvasId;
-	//   }
-	//   return wx.canvasToTempFilePath(opt, this);
-	// }
-
-	setChart(chart) {
-		this.chart = chart;
-	}
-
-	attachEvent() {
-		// noop
-	}
-
-	detachEvent() {
-		// noop
-	}
-
-	_initCanvas(zrender, ctx) {
-		zrender.util.getContext = function() {
-			return ctx;
-		};
-
-		zrender.util.$override('measureText', function(text, font) {
-			ctx.font = font || '12px sans-serif';
-			return ctx.measureText(text);
-		});
-	}
-
-	_initStyle(ctx) {
-		ctx.createRadialGradient = () => {
-			return ctx.createCircularGradient(arguments);
-		};
-	}
-
-	_initEvent() {
-		this.event = {};
-		const eventNames = [{
-			wxName: 'touchStart',
-			ecName: 'mousedown'
-		}, {
-			wxName: 'touchMove',
-			ecName: 'mousemove'
-		}, {
-			wxName: 'touchEnd',
-			ecName: 'mouseup'
-		}, {
-			wxName: 'touchEnd',
-			ecName: 'click'
-		}];
-
-		eventNames.forEach(name => {
-			this.event[name.wxName] = e => {
-				const touch = e.touches[0];
-				this.chart.getZr().handler.dispatch(name.ecName, {
-					zrX: name.wxName === 'tap' ? touch.clientX : touch.x,
-					zrY: name.wxName === 'tap' ? touch.clientY : touch.y
-				});
-			};
-		});
-	}
-
-	set width(w) {
-		if (this.canvasNode) this.canvasNode.width = w
-	}
-	set height(h) {
-		if (this.canvasNode) this.canvasNode.height = h
-	}
-
-	get width() {
-		if (this.canvasNode)
-			return this.canvasNode.width
-		return 0
-	}
-	get height() {
-		if (this.canvasNode)
-			return this.canvasNode.height
-		return 0
-	}
-}

+ 0 - 82
src/uni_modules/vue3-echarts/package.json

@@ -1,82 +0,0 @@
-{
-  "id": "vue3-echarts",
-  "displayName": "vue3-echarts",
-  "version": "1.0.0",
-  "description": "vue3-echarts 轻松引入Echarts,遵循Echarts官方写法使用简单,支持H5、PC、小程序、APP。",
-  "keywords": [
-    "vue3",
-    "echarts",
-    "微信小程序"
-],
-  "repository": "",
-"engines": {
-  },
-  "dcloudext": {
-    "type": "component-vue",
-    "sale": {
-      "regular": {
-        "price": "0.00"
-      },
-      "sourcecode": {
-        "price": "0.00"
-      }
-    },
-    "contact": {
-      "qq": ""
-    },
-    "declaration": {
-      "ads": "无",
-      "data": "插件不采集任何数据",
-      "permissions": "无"
-    },
-    "npmurl": ""
-  },
-  "uni_modules": {
-    "dependencies": [],
-    "encrypt": [],
-    "platforms": {
-      "cloud": {
-        "tcb": "y",
-        "aliyun": "y"
-      },
-      "client": {
-        "Vue": {
-          "vue2": "n",
-          "vue3": "y"
-        },
-        "App": {
-          "app-vue": "y",
-          "app-nvue": "y"
-        },
-        "H5-mobile": {
-          "Safari": "y",
-          "Android Browser": "y",
-          "微信浏览器(Android)": "y",
-          "QQ浏览器(Android)": "y"
-        },
-        "H5-pc": {
-          "Chrome": "y",
-          "IE": "u",
-          "Edge": "y",
-          "Firefox": "y",
-          "Safari": "y"
-        },
-        "小程序": {
-          "微信": "y",
-          "阿里": "y",
-          "百度": "y",
-          "字节跳动": "y",
-          "QQ": "y",
-          "钉钉": "u",
-          "快手": "u",
-          "飞书": "u",
-          "京东": "u"
-        },
-        "快应用": {
-          "华为": "u",
-          "联盟": "u"
-        }
-      }
-    }
-  }
-}

+ 0 - 1
src/uni_modules/vue3-echarts/readme.md

@@ -1 +0,0 @@
-# vue3-echarts

+ 0 - 34
src/utils/plus-helper.js

@@ -1,34 +0,0 @@
-import mxConfig from "@/common/mxConfig";
-
-export function openUrl(url) {
-    if (typeof plus == 'undefined') {
-        if (typeof window?.open === 'function') {
-            window.open(url)
-            return true
-        }
-        return false
-    }
-    plus.runtime.openURL(url)
-    return true
-}
-
-export function openAppLink(appKey) {
-    if (typeof plus == 'undefined') return
-    const linkConfig = mxConfig.sysAppLinks[appKey]
-    if (!linkConfig) return
-    const platform = plus.os.name
-    const platformLink = linkConfig[platform]
-    if (!platformLink) return
-    if (platformLink.url) {
-        plus.runtime.openURL(platformLink.url)
-    } else {
-        console.log(platformLink, linkConfig)
-        if (plus.runtime.isApplicationExist(platformLink)) {
-            plus.runtime.launchApplication(platformLink, function(e) {
-                console.log('launchApplication error:', e)
-            })
-        } else {
-            plus.runtime.openURL(linkConfig.failUrl)
-        }
-    }
-}

+ 0 - 24
src/utils/request/index.js

@@ -1,24 +0,0 @@
-// 引入配置
-import config from '@/config'
-// 引入请求拦截
-import {requestInterceptors} from './requestInterceptors.js'
-// 引入响应拦截
-import {responseInterceptors} from './responseInterceptors.js'
-// 初始化请求配置
-export const useRequest = (app) => {
-    uni.$uv.http.setConfig((defaultConfig) => {
-        /* defaultConfig 为默认全局配置 */
-        defaultConfig.baseURL = config.serverBaseUrl /* 根域名 */
-        defaultConfig.custom = {catch: config.responseErrorCatch, root: true}
-        defaultConfig.paramsSerializer = (v) => uni.$uv.queryParams(v, false, 'comma')
-        return defaultConfig
-    })
-    requestInterceptors(app);
-    responseInterceptors(app);
-}
-
-// 兼容旧的mx-app request的写法,防止修改过多的request原文件
-// TODO:待确认是否兼容了所有请求场景,需要结合interceptors
-export default function request(options) {
-    return uni.$uv.http.request(options)
-}

+ 0 - 46
src/utils/request/requestInterceptors.js

@@ -1,46 +0,0 @@
-import env from "@/config"
-import {useUserStore} from "@/hooks/useUserStore";
-import {useEnvStore} from "@/hooks/useEnvStore"
-import {useUserStore as useUserStoreNew} from "@/store/userStore"
-
-/**
- * 请求拦截
- * @param {Object} http
- */
-export const requestInterceptors = (vm) => {
-    uni.$uv.http.interceptors.request.use((config) => { // 可使用async await 做异步操作
-        const {token, isAgreeProtocol} = useUserStore()
-        // 'NoToken' url 自动适配
-        if (config.custom?.autoFitNoToken && (!token.value || config.custom?.withoutToken)) {
-            config.url = config.url + 'NoToken'
-        }
-        // 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{}
-        config.data = config.data || {}
-        config.header = config.header || {}
-        // 补充header信息
-        config.header['X-Requested-With'] = 'XMLHttpRequest';
-        config.header['type'] = env.identifier
-        const userStore = useUserStoreNew();
-        const examType = userStore.getExamType;
-        const location = userStore.getLocation;
-        if (examType) {
-          config.header['examType'] = examType;
-        }
-        if (location) {
-          config.header['location'] = encodeURIComponent(location);
-        }
-        if (isAgreeProtocol.value) {
-            // NOTE: 这里在明确用户同意协议后才访问系统信息,否则有可能提前出现权限询问,导致平台审核被拒!
-            const {systemInfo} = useEnvStore()
-            for (const [key, value] of Object.entries(systemInfo.value)) {
-                config.header[key] = value
-            }
-        }
-        // 可以在此通过vm引用vuex中的变量,具体值在store.state中
-        if (!config.custom?.withoutToken && token.value) {
-            config.header['Authorization'] = `Bearer ${token.value}`
-        }
-        return config
-    }, (config) => // 可使用async await 做异步操作
-        Promise.reject(config))
-}

+ 0 - 101
src/utils/request/responseInterceptors.js

@@ -1,101 +0,0 @@
-import throttle from "@/uni_modules/uv-ui-tools/libs/function/throttle";
-import mxConst from "@/common/mxConst";
-import {fnPlaceholder} from "@/utils/uni-helper";
-import {useUserStore} from "@/hooks/useUserStore";
-
-function isBlobRequest(response) {
-    return response?.config?.responseType?.toLowerCase() === 'arraybuffer'
-}
-
-/**
- * 响应拦截
- * @param {Object} http
- */
-export const responseInterceptors = (vm) => {
-    // blob 预处理,文件流强制转换输出类型
-    uni.$uv.http.interceptors.response.use((response) => {
-        if (isBlobRequest(response)) {
-            response.config.custom = response.config.custom || {}
-            response.config.custom.raw = true
-        }
-        return response
-    })
-
-    // 一般的请求处理结果
-    uni.$uv.http.interceptors.response.use(async (response) => { /* 对响应成功做点什么 可使用async await 做异步操作*/
-        const data = response.data
-        // 自定义参数
-        const custom = response.config?.custom
-        const code = data.code || response.statusCode
-        if (code !== 200) { // 服务端返回的状态码不等于200,则reject()
-            const {clearToken} = useUserStore()
-            const msg = data.msg || data.message || mxConst.serverErrors[data.code] || '服务器错误,请稍后重试'
-            switch (code) {
-                case 401:
-                    // 无提示跳转
-                    clearToken()
-                    throttle(() => uni.$uv.route(mxConst.routes.login))
-                    break
-                case 402:
-                case 405:
-                    // 有提示跳转
-                    throttle(() => {
-                        Promise.all([
-                            new Promise((resolve) => {
-                                uni.showModal({
-                                    content: msg, // 登陆提示或者是 VIP 提示
-                                    showCancel: false,
-                                    success: _ => {
-                                        if (data.code == 402) {
-                                            clearToken()
-                                            uni.$uv.route(mxConst.routes.login)
-                                        }
-                                        else if (data.code == 405) {
-                                            uni.$uv.route(mxConst.routes.activate)
-                                        }
-                                        else {
-                                            throw new Error('Unhandled code for modal action: ' + data.code)
-                                        }
-                                        resolve()
-                                    }
-                                })
-                            })
-                        ])
-                    })
-                    break
-                default:
-                    // 如果没有显式定义custom的toast参数为false的话,默认对报错进行toast弹出提示
-                    if (custom?.toast !== false) {
-                        uni.$uv.toast(msg)
-                    }
-                    break
-            }
-
-            // 如果需要catch返回,则进行reject
-            if (custom?.catch) {
-                // 后续能显式收到错误
-                return Promise.reject(data)
-            } else {
-                // 打断继续执行,但不会显式收到错误
-                return new Promise(fnPlaceholder)
-            }
-        }
-
-        // 成功时,定了几种不同的返回类型
-        if (custom?.raw === true) return response
-        if (custom?.root === true) return data // 默认配置
-        return data.data || {}
-    }, (response) => { /*  对响应错误做点什么 (statusCode !== 200)*/
-        return Promise.reject(response)
-    })
-
-    // blob 文件流返回数据处理
-    uni.$uv.http.interceptors.response.use((response) => {
-        if (isBlobRequest(response)) {
-            if (!(response.data instanceof Blob) && (response.data instanceof ArrayBuffer)) {
-                response.data = new Blob([response.data])
-            }
-        }
-        return response
-    })
-}