Commit 24bcbfa7 authored by wykolor's avatar wykolor

feat: 奖励金明细view字段填充

parent 81db3e94
......@@ -5,7 +5,7 @@
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
"lint": "vue-cli-service lint --fix"
},
"dependencies": {
"amfe-flexible": "^2.2.1",
......
......@@ -2,10 +2,10 @@ import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import './assets/style/normalize.css';
import 'vant/lib/index.css';
import 'amfe-flexible';
createApp(App)
import "./assets/style/normalize.css";
import "vant/lib/index.css";
import "amfe-flexible";
createApp(App)
.use(store)
.use(router)
.mount("#app");
\ No newline at end of file
.mount("#app");
/*
* @Author: wykolor
* @Date: 2021-03-23 10:36:45
* @Last Modified by: wykolor
* @Last Modified time: 2021-03-23 10:36:45
* @Author: wykolor
* @Date: 2021-03-23 10:36:45
* @Last Modified by: wykolor
* @Last Modified time: 2021-03-24 16:16:30
*/
// 流水类型
export enum FlowType {
ADD = 'ADD', // 收入
REDUCE = 'REDUCE' // 支出
ADD = "ADD", // 收入
REDUCE = "REDUCE" // 支出
}
// 业务类型
export enum BizType {
WITHDRAW = 'WITHDRAW', // 提现
ORDER = 'ORDER', // 订单支付
ORDER_RETURN = 'ORDER_RETURN', // 订单返还
INTRODUCE = 'INTRODUCE', // 转介绍
WITHDRAW_RETURN = 'WITHDRAW_RETURN', // 提现返还
WITHDRAW = "WITHDRAW", // 提现
ORDER = "ORDER", // 订单支付
ORDER_RETURN = "ORDER_RETURN", // 订单返还
INTRODUCE = "INTRODUCE", // 转介绍
WITHDRAW_RETURN = "WITHDRAW_RETURN" // 提现返还
}
// 奖励金账户状态
export enum BonusAccountStatus {
ACTIVE = 'ACTIVE', // 正常
FREEZE = 'FREEZE', // 冻结
}
\ No newline at end of file
ACTIVE = "ACTIVE", // 正常
FREEZE = "FREEZE" // 冻结
}
/*
* @Author: wykolor
* @Date: 2021-03-23 11:44:35
* @Author: wykolor
* @Date: 2021-03-23 11:44:35
* @Last Modified by: wykolor
* @Last Modified time: 2021-03-23 17:00:17
* @Last Modified time: 2021-03-24 16:20:07
*/
export interface PageParams {
pageSize?: number
pageNum?: number
pageSize: number;
pageNum: number;
}
export interface baseResponse<T = object> {
code: number;
msg: string;
data: T
export interface BaseResponse<T = object> {
code?: number;
msg?: string;
data: T;
}
export interface Paging<T = object> {
total: number;
pageNum: number;
pageSize: number;
hasNextPage: boolean;
list: Array<T>
total: number;
pageNum: number;
pageSize: number;
hasNextPage: boolean;
list: Array<T>;
}
export interface BonusListResponse {
creationTime: string;
flowType: string;
amountChange: number;
bizType: string;
bizTypeName: string;
relationNo: string;
withdrawApplyTime: string;
withdrawPayTime: string;
className: string;
schoolAreaName: string;
creationTime: string;
flowType: string;
amountChange: number;
bizType: string;
bizTypeName: string;
relationNo: string;
withdrawApplyTime: string;
withdrawPayTime: string;
className: string;
schoolAreaName: string;
}
export interface BonusListParams extends PageParams{
studentId: number;
flowType: string;
export interface BonusListParams extends PageParams {
studentId: number;
flowType: string;
}
export interface BonusAccountResponse {
status: string;
balance: number;
sumAdd: number;
sumWithdraw: number;
withdrawing: number;
status: string;
balance: number;
sumAdd: number;
sumWithdraw: number;
withdrawing: number;
}
export interface WithdrawListParams extends PageParams {
studentId: number;
export interface WithdrawListParams extends PageParams {
studentId: number;
}
export interface WithdrawListResponse {
accountName: string ;
withdrawApplyTime: string;
withdrawAmount: number;
withdrawPayTime: string ;
status: string;
expectedPayTime: string ;
failTime: string;
reason: string;
accountName: string;
withdrawApplyTime: string;
withdrawAmount: number;
withdrawPayTime: string;
status: string;
expectedPayTime: string;
failTime: string;
reason: string;
}
export interface CheckCaptchaParams {
userId: string;
ticket: string;
randStr: string;
userId: string;
ticket: string;
randStr: string;
}
export interface WithdrawParams {
withdrawAmount: number;
userId: number;
studentId: number;
smsVerifyCode: string;
}
\ No newline at end of file
withdrawAmount: number;
userId: number;
studentId: number;
smsVerifyCode: string;
}
import { BonusAccountResponse, BonusListParams, BonusListResponse, CheckCaptchaParams, Paging, WithdrawListParams, WithdrawListResponse, WithdrawParams } from '@/model/bonus';
import { get, post } from '../../request';
const bonusUrl = '/v1/marketingAccount/';
const withdrawUrl = '/v1/withdraw/'
import {
BonusAccountResponse,
BonusListParams,
BonusListResponse,
CheckCaptchaParams,
Paging,
WithdrawListParams,
WithdrawListResponse,
WithdrawParams
} from "@/model/bonus";
import { get, post } from "../../request";
// 奖励金收支列表
export const getBonusList = (params: BonusListParams) => {
return post<Paging<BonusListResponse>>(`${bonusUrl}bonus/flow/list`, params )
}
return post<Paging<BonusListResponse>>(
`/mock/api-jksxb-app/v1/marketingAccount/bonus/flow/list`,
params
);
};
// 奖励金账户信息
export const getBonusAccount = (studentId: string) => {
return get<BonusAccountResponse>(`${bonusUrl}bonus/count`, { studentId })
}
return get<BonusAccountResponse>(`v1/marketingAccount/bonus/count`, { studentId });
};
// 提现记录列表
export const getWithdrawList = (params: WithdrawListParams) => {
return post<Paging<WithdrawListResponse>>(`${withdrawUrl}query`, params)
}
return post<Paging<WithdrawListResponse>>(`/v1/withdraw/query`, params);
};
// 检验图形验证码
export const checkCaptcha = (params: CheckCaptchaParams) => {
return get<string>(`${withdrawUrl}checkCaptcha`, params);
}
return get<string>(`/v1/withdraw/checkCaptcha`, params);
};
// 提现
export const withdraw = (params: WithdrawParams) => {
return post<string>('', params);
}
\ No newline at end of file
return post<string>("/v1/withdraw", params);
};
import * as bonusModel from "./bonus/index";
export {
bonusModel
}
\ No newline at end of file
export { bonusModel };
let baseURL: string = "";
if (process.env.NODE_ENV === 'development') {
let baseURL = "";
if (process.env.NODE_ENV === "development") {
baseURL = "/api";
} else {
// baseURL = "";
}
export default baseURL;
\ No newline at end of file
export default baseURL;
import axios, { AxiosRequestConfig } from 'axios'
import baseUrl from "./env";
import {Toast} from 'vant'
import axios, { AxiosRequestConfig } from "axios";
const instance = axios.create({
// headers: {
// 'content-type': 'application/json;charset=UTF-8',
// 'token': 'one'
// },
baseURL: baseUrl,
timeout: 10000,
withCredentials: true
})
function startLoading() {
Toast.loading({
message: '加载中...',
forbidClick: true,
duration: 0
// headers: {
// 'content-type': 'application/json;charset=UTF-8',
// 'token': 'one'
// },
baseURL: "",
timeout: 10000,
withCredentials: true
});
}
function endLoading() {
Toast.clear();
}
// function startLoading() {
// Toast.loading({
// message: "加载中...",
// forbidClick: true,
// duration: 0
// });
// }
// function endLoading() {
// Toast.clear();
// }
// 声明一个对象用于存储请求个数
let needLoadingRequestCount:number = 0;
// let needLoadingRequestCount = 0;
function showFullScreenLoading() {
if (needLoadingRequestCount === 0) {
startLoading();
}
needLoadingRequestCount++;
}
// function showFullScreenLoading() {
// if (needLoadingRequestCount === 0) {
// startLoading();
// }
// needLoadingRequestCount++;
// }
function tryHideFullScreenLoading() {
if (needLoadingRequestCount <= 0) return;
needLoadingRequestCount--;
if (needLoadingRequestCount === 0) {
endLoading();
}
}
// function tryHideFullScreenLoading() {
// if (needLoadingRequestCount <= 0) return;
// needLoadingRequestCount--;
// if (needLoadingRequestCount === 0) {
// endLoading();
// }
// }
// 拦截器 在请求之前拦截
instance.interceptors.request.use(
(config: AxiosRequestConfig) => {
showFullScreenLoading();
return config;
},
error => {
......@@ -54,25 +50,15 @@ instance.interceptors.request.use(
}
);
// 响应拦截器
instance.interceptors.response.use(
response => {
console.log('响应', response);
// 隐藏加载样式
tryHideFullScreenLoading();
return response.data;
},
error => {
const { status, data } = error.response;
if (status === 401) {
// Message.error(data.msg);
}
tryHideFullScreenLoading();
return Promise.reject(error.message);
}
);
export default instance;
import axios from "./http"
import { baseResponse } from '../model/bonus/index'
import axios from "./http";
import { BaseResponse } from "../model/bonus/index";
/**
* 封装的get请求
* @param {*} url 请求路径
* @param {*} params 请求参数
* @returns
*/
export function get<T=any>(url: string, params?: object) {
return axios.get<baseResponse<T>>(url, params)
}
/**
* 封装的post请求
* @param {*} url 请求路径
* @param {*} params 请求参数
* @returns
*/
export function post<T=any>(url: string, params?: object) {
return axios.post<baseResponse<T>>(url, params)
}
\ No newline at end of file
export function get<T>(url: string, params?: object) {
return axios.get<T>(url, params);
}
/**
* 封装的post请求
* @param {*} url 请求路径
* @param {*} params 请求参数
* @returns
*/
export function post<T>(url: string, params?: object) {
return axios.post<T>(url, params);
}
import { createStore } from "vuex";
import bonus from './module/bonus'
import bonus from "./module/bonus";
export default createStore({
state: {
studentName: 'wangyan'
studentName: "wangyan"
},
getters: {
studentFullName: state => state.studentName + 'WANG'
studentFullName: state => state.studentName + "WANG"
},
mutations: {},
actions: {},
......
const bonus = {
namespaced: true,
state: () => ({
studentId: 12,
userId: 'color'
}),
getters: {
studentId: state => state.studentId + 1,
userName: state => state.userId + 'wangyan',
studentFullName: state => state.studentId + state.userId
},
mutations: {
namespaced: true,
state: () => ({
studentId: 12,
userId: "color"
}),
getters: {
studentId: state => state.studentId + 1,
userName: state => state.userId + "wangyan",
studentFullName: state => state.studentId + state.userId
},
mutations: {},
actions: {}
};
},
actions: {
}
}
export default bonus
\ No newline at end of file
export default bonus;
......@@ -13,16 +13,16 @@ export type WildCardEventHandlerList = Array<WildcardHandler>;
export type EventHandlerMap = Map<EventType, EventHandlerList | WildCardEventHandlerList>;
export interface Emitter {
all: EventHandlerMap;
all: EventHandlerMap;
on<T = any>(type: EventType, handler: Handler<T>): void;
on(type: '*', handler: WildcardHandler): void;
on<T = any>(type: EventType, handler: Handler<T>): void;
on(type: "*", handler: WildcardHandler): void;
off<T = any>(type: EventType, handler: Handler<T>): void;
off(type: '*', handler: WildcardHandler): void;
off<T = any>(type: EventType, handler: Handler<T>): void;
off(type: "*", handler: WildcardHandler): void;
emit<T = any>(type: EventType, event?: T): void;
emit(type: '*', event?: any): void;
emit<T = any>(type: EventType, event?: T): void;
emit(type: "*", event?: any): void;
}
/**
......@@ -31,55 +31,58 @@ export interface Emitter {
* @returns {Mitt}
*/
export default function mitt(_all?: EventHandlerMap): Emitter {
const all = _all || new Map();
const all = _all || new Map();
return {
return {
/**
* A Map of event names to registered handler functions.
*/
all,
/**
* A Map of event names to registered handler functions.
*/
all,
/**
* Register an event handler for the given type.
* @param {string|symbol} type Type of event to listen for, or `"*"` for all events
* @param {Function} handler Function to call in response to given event
* @memberOf mitt
*/
on<T = any>(type: EventType, handler: Handler<T>) {
const handlers = all.get(type);
const added = handlers && handlers.push(handler);
if (!added) {
all.set(type, [handler]);
}
},
/**
* Register an event handler for the given type.
* @param {string|symbol} type Type of event to listen for, or `"*"` for all events
* @param {Function} handler Function to call in response to given event
* @memberOf mitt
*/
on<T = any>(type: EventType, handler: Handler<T>) {
const handlers = all.get(type);
const added = handlers && handlers.push(handler);
if (!added) {
all.set(type, [handler]);
}
},
/**
* Remove an event handler for the given type.
* @param {string|symbol} type Type of event to unregister `handler` from, or `"*"`
* @param {Function} handler Handler function to remove
* @memberOf mitt
*/
off<T = any>(type: EventType, handler: Handler<T>) {
const handlers = all.get(type);
if (handlers) {
handlers.splice(handlers.indexOf(handler) >>> 0, 1);
}
},
/**
* Remove an event handler for the given type.
* @param {string|symbol} type Type of event to unregister `handler` from, or `"*"`
* @param {Function} handler Handler function to remove
* @memberOf mitt
*/
off<T = any>(type: EventType, handler: Handler<T>) {
const handlers = all.get(type);
if (handlers) {
handlers.splice(handlers.indexOf(handler) >>> 0, 1);
}
},
/**
* Invoke all handlers for the given type.
* If present, `"*"` handlers are invoked after type-matched handlers.
*
* Note: Manually firing "*" handlers is not supported.
*
* @param {string|symbol} type The event type to invoke
* @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler
* @memberOf mitt
*/
emit<T = any>(type: EventType, evt: T) {
((all.get(type) || []) as EventHandlerList).slice().map((handler) => { handler(evt); });
((all.get('*') || []) as WildCardEventHandlerList).slice().map((handler) => { handler(type, evt); });
}
};
}
\ No newline at end of file
/**
* Invoke all handlers for the given type.
* If present, `"*"` handlers are invoked after type-matched handlers.
*
* Note: Manually firing "*" handlers is not supported.
*
* @param {string|symbol} type The event type to invoke
* @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler
* @memberOf mitt
*/
emit<T = any>(type: EventType, evt: T) {
((all.get(type) || []) as EventHandlerList).slice().map(handler => {
handler(evt);
});
((all.get("*") || []) as WildCardEventHandlerList).slice().map(handler => {
handler(type, evt);
});
}
};
}
import { App } from 'vue'
import mitt from './mitt'
import { App } from "vue";
import mitt from "./mitt";
const isiOS = () => {
const u = navigator.userAgent;
......@@ -9,19 +9,19 @@ const isiOS = () => {
const isAndroid = () => {
const u = navigator.userAgent;
const android = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1;
const android = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1;
return android;
};
const postMessage = (data) => {
const postMessage = data => {
if (isAndroid()) {
window.ReactNativeWebView
&& window.ReactNativeWebView.onMessage
&& window.ReactNativeWebView.onMessage(JSON.stringify(data));
window.ReactNativeWebView &&
window.ReactNativeWebView.onMessage &&
window.ReactNativeWebView.onMessage(JSON.stringify(data));
}
window.ReactNativeWebView
&& window.ReactNativeWebView.postMessage
&& window.ReactNativeWebView.postMessage(JSON.stringify(data));
window.ReactNativeWebView &&
window.ReactNativeWebView.postMessage &&
window.ReactNativeWebView.postMessage(JSON.stringify(data));
};
if (isiOS() || isAndroid()) {
......@@ -37,12 +37,12 @@ if (isiOS() || isAndroid()) {
}
function install(Vue: App) {
const GEEK_NATVIE_NAME = 'GEEK_NATVIE_NAME';
const GEEK_NATVIE_NAME = "GEEK_NATVIE_NAME";
// eslint-disable-next-line camelcase
const event_bus = mitt();
// eslint-disable-next-line func-names
window.$geek_excuteJS = function (args) {
window.$geek_excuteJS = function(args) {
try {
const params = JSON.parse(args);
event_bus.emit(GEEK_NATVIE_NAME, params);
......@@ -60,49 +60,49 @@ function install(Vue: App) {
},
$nativeTitle(title) {
const message = {
type: 'title',
data: title,
type: "title",
data: title
};
postMessage(message);
},
$shareImg(base64Img, timeline = false) {
const message = {
type: timeline ? 'shareTimeline' : 'share',
type: timeline ? "shareTimeline" : "share",
data: {
type: 'img',
img: base64Img,
},
type: "img",
img: base64Img
}
};
postMessage(message);
},
$shareText(txt, timeline = false) {
const message = {
type: timeline ? 'shareTimeline' : 'share',
type: timeline ? "shareTimeline" : "share",
data: {
type: 'text',
description: txt,
},
type: "text",
description: txt
}
};
postMessage(message);
},
$shareNews({ title, url, description }, timeline = false) {
const message = {
type: timeline ? 'shareTimeline' : 'share',
type: timeline ? "shareTimeline" : "share",
data: {
type: 'news',
type: "news",
description,
webpageUrl: url,
title,
},
title
}
};
postMessage(message);
},
$playVieo(url) {
const message = {
type: 'video',
type: "video",
data: {
url,
},
url
}
};
postMessage(message);
},
......@@ -111,15 +111,15 @@ function install(Vue: App) {
},
$exitWebView(data) {
this.$postMessage({
type: 'exitWebview',
type: "exitWebview",
data
})
});
},
$shareReport(params) {
this.$postMessage({
type: 'reportShare',
type: "reportShare",
params
})
});
}
},
created() {
......@@ -127,7 +127,7 @@ function install(Vue: App) {
},
beforeDestroy() {
event_bus.off(GEEK_NATVIE_NAME, this.listenNativeMessage);
},
}
});
}
......
export function countDown(times: number, interval: number, callback: Function) {
let count = 0;
let timeCounter;
function _countDownStart() {
if (timeCounter == null) {
return false;
}
count++;
callback(times - count + 1);
if (count > times) {
clearTimeout(timeCounter);
} else {
timeCounter = setTimeout(_countDownStart, interval);
}
let count = 0;
let timeCounter;
function _countDownStart() {
if (timeCounter == null) {
return false;
}
timeCounter = setTimeout(_countDownStart, interval);
}
\ No newline at end of file
count++;
callback(times - count + 1);
if (count > times) {
clearTimeout(timeCounter);
} else {
timeCounter = setTimeout(_countDownStart, interval);
}
}
timeCounter = setTimeout(_countDownStart, interval);
}
This diff is collapsed.
......@@ -4,19 +4,23 @@ module.exports = {
devServer: {
hot: true,
open: true,
// host: "192.168.44.20",
// port: 8080,
https: false,
//以上的ip和端口是我们本机的;下面为需要跨域的
proxy: {
//配置跨域
"/mock": {
target: "http://192.168.44.114:4100",
ws: true,
changOrigin: true //允许跨域
},
"/api": {
target: "http://localhost:5001/api/", // 这里后台的地址模拟的;应该填写你们真实的后台接口
target: "http://192.168.44.114:4100",
ws: true,
changOrigin: true //允许跨域
},
"/service": {
target: "http://192.168.44.114:4100",
ws: true,
changOrigin: true, //允许跨域
pathRewrite: {
"^/api": "" //请求的时候使用这个api就可以
}
changOrigin: true //允许跨域
}
}
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment