From b223b97ef826487b40031b68354d476c50ca8367 Mon Sep 17 00:00:00 2001 From: aipincaihuiying <981042545@qq.com> Date: Thu, 1 Sep 2022 20:07:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Estore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/index.ts | 4 +- src/stores/modules/CountResultStore.module.ts | 28 ++++++++++++++ src/stores/modules/tsts.module.ts | 37 ------------------- .../DepositInterestTrial/CountResult.vue | 19 ++++++++-- 4 files changed, 46 insertions(+), 42 deletions(-) create mode 100644 src/stores/modules/CountResultStore.module.ts delete mode 100644 src/stores/modules/tsts.module.ts diff --git a/src/stores/index.ts b/src/stores/index.ts index 4def054..6ea6709 100644 --- a/src/stores/index.ts +++ b/src/stores/index.ts @@ -6,6 +6,8 @@ * @FilePath: \mcep-h5\src\stores\index.ts * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE */ +import CountResultStore from "@/stores/modules/CountResultStore.module"; + export * from "./token.store"; export * from "./user.store"; import dict from "@/services/dict.service"; @@ -16,7 +18,7 @@ Vue.use(Vuex); export default new Vuex.Store({ modules: { - + CountResultStore, } }); diff --git a/src/stores/modules/CountResultStore.module.ts b/src/stores/modules/CountResultStore.module.ts new file mode 100644 index 0000000..9c908e0 --- /dev/null +++ b/src/stores/modules/CountResultStore.module.ts @@ -0,0 +1,28 @@ + +const state = { + resultData:{} +}; +const mutations = { + setResultData: (state: any, resultData: any) => { + state.resultData = resultData + }, + +}; +const actions = { + setResultData({ commit }: any, params: any) { + commit("setApproveParams", params); + }, + +}; +const getters = { + getResultData: (state: any) => { + return state.resultData; + }, + +}; +export default { + state, + mutations, + actions, + getters +}; diff --git a/src/stores/modules/tsts.module.ts b/src/stores/modules/tsts.module.ts deleted file mode 100644 index 3ae7e39..0000000 --- a/src/stores/modules/tsts.module.ts +++ /dev/null @@ -1,37 +0,0 @@ -const state = { - questionAnswerObj: {}, - faceSignInfo: {}, - imageFileObj: [] -}; -const mutations = { - setQuestionAnswerObj: (state: any, questionAnswerObj: any) => { - state.questionAnswerObj = questionAnswerObj - }, - setFaceSignInfo: (state: any, faceSignListInfo: any) =>{ - state.faceSignInfo = faceSignListInfo - }, - setImageFileObj: (state: any, imageFileObj: any) =>{ - state.imageFileObj = imageFileObj - }, - addImageFileObj: (state: any, imageFileObj: any) =>{ - state.imageFileObj.push(imageFileObj); - } -}; -const actions = {}; -const getters = { - getQuestionAnswerObj: (state: any) => { - return state.questionAnswerObj; - }, - getFaceSignInfo: (state: any) => { - return state.faceSignInfo; - }, - getImageFileObj: (state: any) => { - return state.imageFileObj; - } -}; -export default { - state, - mutations, - actions, - getters -}; diff --git a/src/views/DepositInterestTrial/CountResult.vue b/src/views/DepositInterestTrial/CountResult.vue index 2f66299..a715f05 100644 --- a/src/views/DepositInterestTrial/CountResult.vue +++ b/src/views/DepositInterestTrial/CountResult.vue @@ -70,6 +70,7 @@ Vue.use(VueRouter); name: "CountResult", }) export default class CountResult extends Vue{ + resultData:any={}; flag=true; resultPlus:any=""; result:any=""; @@ -98,23 +99,33 @@ export default class CountResult extends Vue{ //router.beforeEach((to,from,next) => {}); //beforeRouteLeave(to:any,from,next){} created() { - this.result = window.localStorage.getItem("result"); + /*this.result = window.localStorage.getItem("result"); this.loanAmt= window.localStorage.getItem("loanAmt"); this.resultPlus=window.localStorage.getItem("resultPlus"); this.loanRate=window.localStorage.getItem("loanRate"); this.loanTime=window.localStorage.getItem("loanTime"); - this.repayType=window.localStorage.getItem("repayType"); + this.repayType=window.localStorage.getItem("repayType");*/ + let getStoreData = this.$store.getters["CountResultStore/getResultData"]; + console.log("获取到getStoreData的数据"); + console.log(getStoreData); } returnCount() { this.$router.back(); } toSeeRepayPlan() { - window.localStorage.setItem("result",this.result); + /* window.localStorage.setItem("result",this.result); window.localStorage.setItem("loanAmt",this.loanAmt); window.localStorage.setItem("resultPlus",this.resultPlus); window.localStorage.setItem("loanRate",this.loanRate); window.localStorage.setItem("loanTime",this.loanTime); - window.localStorage.setItem("repayType",this.repayType); + window.localStorage.setItem("repayType",this.repayType);*/ + this.resultData.result = this.result; + this.resultData.loanAmt = this.loanAmt; + this.resultData.resultPlus = this.resultPlus; + this.resultData.loanRate = this.loanRate; + this.resultData.loanTime = this.loanTime; + this.resultData.repayType = this.repayType; + this.$store.commit("CountResultStore/setResultData",this.resultData); this.$router.push({ name: "RepayPlan", }); -- 2.22.0