Commit 43a49ec5 authored by wykolor's avatar wykolor

feat: bind weixin

parent be7d6ee8
......@@ -4,11 +4,9 @@ import router from "./router";
import store from "./store";
import "./assets/style/normalize.css";
import "amfe-flexible";
import nativeBridge from './util/nativeBridge'
import VConsole from "vconsole";
new VConsole();
createApp(App)
.use(store)
.use(router)
.use(nativeBridge)
.mount("#app");
......@@ -21,7 +21,7 @@ export function formatBonusTipTxt(errCode: string): string {
tip = '提现金额至少为:1.00元。当前奖励金账户余额不足,多多转介绍吧!';
break;
default:
tip = '绑定微信后,才可进行提现!'
tip = ''
}
return tip;
}
\ No newline at end of file
......@@ -19,7 +19,6 @@ const isAndroid = () => {
};
window.$geek_excuteJS = function (args) {
console.log(args);
try {
const params = JSON.parse(args);
eventBus.emit<NativeInvokeFuncParams>(GEEK_NATVIE_NAME, params);
......@@ -55,8 +54,6 @@ function useNativeBridge(
listener?: ListenerType
): [typeof sendNativeMessage, typeof eventBus] {
const _listener = function (this: ComponentInternalInstance | null, arg?: NativeInvokeFuncParams) {
console.log(arg, 1111111);
if (!arg) return;
const { method, data } = arg;
if (typeof eventTypeOrEventMap === "string") {
......
......@@ -83,9 +83,10 @@
import { BonusListResponse } from "@/model/bonus";
import { FlowType, BizType } from "@/model/bonus/constant";
import { NavBar, Tab, Tabs, Cell, Empty, List, PullRefresh } from "vant";
import { computed, defineComponent, reactive, toRefs } from "vue";
import { computed, defineComponent, onMounted, reactive, toRefs } from "vue";
import { bonusModel } from "@/server/api";
import { useStore } from "vuex";
import { useNativeBridge } from "@/util/use-native-bridge";
interface BonusList {
addList: BonusListResponse[];
......@@ -117,6 +118,7 @@ const BonusDetail = defineComponent({
addList: [],
reduceList: []
});
const [sendNativeMessage] = useNativeBridge("test", arg => console.log(arg));
const onLoad = () => {
if (state.refreshing) {
if (state.active === FlowType.ADD) {
......@@ -167,6 +169,12 @@ const BonusDetail = defineComponent({
onLoad();
}
};
onMounted(() => {
sendNativeMessage({
type: "title",
data: "奖励金明细"
});
});
return {
...toRefs(state),
...toRefs(bonusList),
......
......@@ -188,9 +188,6 @@ const Bonus = defineComponent({
store.commit("bonus/saveStudentId", studentId);
store.commit("bonus/saveToken", token);
store.commit("bonus/saveUserId", userId);
const [sendNativeMessage] = useNativeBridge("bindWeChatChange", function(arg) {
Toast('成功啦')
});
const state = reactive<BonusState>({
loading: false,
finished: false,
......@@ -201,6 +198,9 @@ const Bonus = defineComponent({
BonusAccountStatus,
withdrawList: []
});
const [sendNativeMessage] = useNativeBridge("bindWeChatChange", function() {
state.showBindWx = false;
});
// 获取奖励金信息
bonusModel.getBonusAccount(bonusStoreState.value.studentId).then(res => {
const { data } = res;
......@@ -232,8 +232,7 @@ const Bonus = defineComponent({
const withdraw = () => {
if (!state.bonusAccount?.errCode) {
// 都正常的状态
// router.push("withdraw");
state.showBindWx = true;
router.push("withdraw");
} else if (state.bonusAccount?.errCode === ErrCode.NOT_BIND) {
state.showBindWx = true;
} else {
......
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