Commit 24bcbfa7 authored by wykolor's avatar wykolor

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

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