Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
merge code
  • Loading branch information
chenxukf103 committed Dec 11, 2018
2 parents 420cd56 + 37a3aff commit 612cb51
Show file tree
Hide file tree
Showing 25 changed files with 397 additions and 193 deletions.
18 changes: 11 additions & 7 deletions src/collections/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ class Account {
* @param password (密码)
* @param mnemonicCode (助记词)-对称加密
* @param mnemonicCodeLanguage (助记词)-语言版本
* @param state (状态)-N-正常,D-删除
*/
constructor (address, identityId, type, name, password, mnemonicCode, secret, mnemonicCodeLanguage) {
constructor (address, identityId, type, name, password, mnemonicCode, secret, mnemonicCodeLanguage, state) {
this.address = address;
this.identityId = identityId;
this.type = type;
Expand All @@ -21,6 +22,7 @@ class Account {
this.mnemonicCode = mnemonicCode;
this.secret = secret;
this.mnemonicCodeLanguage = mnemonicCodeLanguage;
this.state = state;
}

/**
Expand All @@ -32,6 +34,7 @@ class Account {
* @param name
* @param password
* @param mnemonicCodeLanguage
* @param state
* @returns {*}
*/
static insertAccount (
Expand All @@ -43,10 +46,11 @@ class Account {
name = '',
password = '',
mnemonicCode = '',
state = 'N',
mnemonicCodeLanguage = 'english'
} = {}
) {
let account = new Account(address, identityId, type, name, password, mnemonicCode, secret, mnemonicCodeLanguage);
let account = new Account(address, identityId, type, name, password, mnemonicCode, secret, mnemonicCodeLanguage, state);
instance.insert(account);
return this;
}
Expand All @@ -57,7 +61,7 @@ class Account {
* @returns {*} 返回一个数组,多个
*/
static findByIdentityId (identityId) {
let resultRet = instance.find({identityId: identityId});
let resultRet = instance.find({identityId: identityId, state: 'N'});
return resultRet;
}

Expand Down Expand Up @@ -97,22 +101,22 @@ class Account {
* @returns {Object|*}
*/
static findByType(type) {
return instance.find({type: type});
return instance.find({type: type, state: 'N'});
}

/**
*查询全部
*/
static findAll () {
return instance.data;
return instance.find({state: 'N'});
}


/**
*查询全部,按类型排序
*/
static findAllSoryByType () {
let resultRet = instance.chain().find()
let resultRet = instance.chain().find({state: 'N'})
.simplesort('type', true).data();
return resultRet;
}
Expand All @@ -123,7 +127,7 @@ class Account {
* @returns {*}
*/
static genAccountName(type) {
let results = instance.find({type: type});
let results = instance.find({type: type, state: 'N'});
let accountNames = results.map(item => {
return item.name;
});
Expand Down
5 changes: 5 additions & 0 deletions src/core/utils/QRCodeScanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ export default{
'describeLineSpacing': '8', //(行间距)
'describeColor': '#ffffff', //(文字颜色)

//choose photo button
'choosePhotoEnable': 'true', //(支持相册选取, 默认false)
'choosePhotoBtnTitle': vueInstance.$t('scan.album'), //(选取按钮文字)
'choosePhotoBtnColor': "#4e8dec", //(选取按钮颜色)

//scan border
'borderColor': '#4e8dec', //(扫描框颜色)
'borderScale': '0.6', //(边框大小,0.1 ~ 1)
Expand Down
15 changes: 10 additions & 5 deletions src/core/utils/initScript.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
// import Vue from 'vue';
import Vue from 'vue';
export default {
done () {
// console.info('初始化');
// console.info('删除的ethereum历史数据....');
// Vue.collecitons.history.removeHistory({acctType: 'ethereum'});
// console.info('删除的ethereum历史数据.... end');
/*console.info('初始化');
console.info('删除的ethereum历史数据....');
Vue.collecitons.history.removeHistory({acctType: 'ethereum'});
console.info('删除的ethereum历史数据.... end');*/
Vue.collecitons.account.findAndUpdateAcct({}, (account) => {
if (!account.state) {
return account.state = 'N';
}
});
}
};
8 changes: 5 additions & 3 deletions src/i18n/lang/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"addAsset": "Add Assets",
"scanFailTip": "Non wallet address, please re scan.",
"scanDeviceError": "Nonsupport device.",
"scanTitle": "scan",
"scanTitle": "Scan",
"scanTip": "Please scan the QR code.",
"accountActivatedTitle": "Account not activated",
"stellarAccountActivatedMsg": "All Accounts need to hold one XLM balance in Steller network to ensure authenticity of account.",
Expand Down Expand Up @@ -296,7 +296,8 @@
"confirmPwdPlaceholder": "Please enter repeat password",
"oldPwdErrorTip": "Old Password Incorrect",
"deleteWallet": "Delete Wallet",
"acctNotexist": "Wallet does not exist"
"acctNotexist": "Wallet does not exist",
"delAcctTip": "After deleting the account, you can add it again"
},
"history": {
"contractSuccess": "Call contract Succeeded",
Expand Down Expand Up @@ -325,7 +326,8 @@
"failure": "Fail",
"shareWeiXinFail": "No WeChat client installed",
"shareQQFail": "No QQ client installed",
"inputIllegal": "Input Illegal"
"inputIllegal": "Input Illegal",
"album": "Album"
},
"gesture": {
"gestureTitle": "Please set gesture password",
Expand Down
6 changes: 4 additions & 2 deletions src/i18n/lang/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,8 @@
"confirmPwdPlaceholder": "確認用のパスワードを入力してください",
"oldPwdErrorTip": "元のパスワードが誤って入力された",
"deleteWallet": "ウォレットを削除",
"acctNotexist": "ウォレットは存在しません"
"acctNotexist": "ウォレットは存在しません",
"delAcctTip": "アカウントを削除した後、再度追加することができます"
},
"history": {
"contractSuccess": "コントラクト呼び出しに成功",
Expand Down Expand Up @@ -326,7 +327,8 @@
"failure": "共有障害",
"shareWeiXinFail": "WeChatクライアントがインストールされていません",
"shareQQFail": "QQクライアントがインストールされていない",
"inputIllegal": "不正な入力"
"inputIllegal": "不正な入力",
"album": "アルバム"
},
"gesture": {
"gestureTitle": "グラフィックパスワードを設定してください",
Expand Down
6 changes: 4 additions & 2 deletions src/i18n/lang/ko-KO.json
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@
"confirmPwdPlaceholder": "확인 비밀번호를 입력하십시오.",
"oldPwdErrorTip": "원래 암호가 잘못 입력되었습니다.",
"deleteWallet": "지갑 삭제",
"acctNotexist": "지갑이 존재하지 않습니다."
"acctNotexist": "지갑이 존재하지 않습니다.",
"delAcctTip": "계정을 삭제 한 후 다시 추가 할 수 있습니다."
},
"history": {
"contractSuccess": "계약을 전용하는데 성공하였습니다.",
Expand Down Expand Up @@ -325,7 +326,8 @@
"failure": "공유 하지 못했습니다.",
"shareWeiXinFail": "Wechat가 설치 되지 않았습니다.",
"shareQQFail": "QQ가 설치 되어 있지 않습니다.",
"inputIllegal": "잘못 된 입력"
"inputIllegal": "잘못 된 입력",
"album": "앨범"
},
"gesture": {
"gestureTitle": "그래픽 암호 설정",
Expand Down
10 changes: 6 additions & 4 deletions src/i18n/lang/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@
"xrpMarketTitle": "瑞波行情",
"xrpMarketSubTitle": "瑞波市场行情",
"xrpMarketDesc": "由StellarChat社区改进布署。数据从瑞波实时网络和RippleCharts API获取",
"u919Title": "U919溯源",
"u919SubTitle": "U919溯源",
"u919Title": "U919朔源",
"u919SubTitle": "U919朔源",
"u919Desc": "由ultiledger.io提供"
},
"setting": {
Expand Down Expand Up @@ -296,7 +296,8 @@
"confirmPwdPlaceholder": "请输入确认密码",
"oldPwdErrorTip": "原密码输入不正确",
"deleteWallet": "删除钱包",
"acctNotexist": "该钱包不存在"
"acctNotexist": "该钱包不存在",
"delAcctTip": "删除该账户后,您可以重新添加"
},
"history": {
"contractSuccess": "调用合约成功",
Expand Down Expand Up @@ -325,7 +326,8 @@
"failure": "分享失败",
"shareWeiXinFail": "未安装微信客户端",
"shareQQFail": "未安装QQ客户端",
"inputIllegal": "输入非法"
"inputIllegal": "输入非法",
"album": "相册"
},
"gesture": {
"gestureTitle": "请设置您的图形密码",
Expand Down
4 changes: 2 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ const initApp = () => {
} else {
this.$i18n.locale = setting.language; /* 设置已经设置的语言*/
vantI18n(setting.language); /* 设置已经设置的语言*/
let currentAcct = this.$collecitons.account.findByAddress(setting.defaultAddress);
/* let currentAcct = this.$collecitons.account.findByAddress(setting.defaultAddress);
if (currentAcct && currentAcct.identityId) {
let identity = this.$collecitons.identity.findById(currentAcct.identityId);
if (identity && !identity.backFlag) {
return this.$router.push({name: 'back-mnemonicCode', params: {showVpop: true}});
}
}
} */
}
}
});
Expand Down
73 changes: 50 additions & 23 deletions src/pages/acct/acct-detail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
:address="account.address"></pl-wallet-addr>
</div>
</pl-block>
<div class="single-btn margin-bottom margin-top" v-if="source == sourceType.IMPORT">
<div class="single-btn margin-bottom margin-top" v-if="delFlag!=='0'">
<van-button size="large" round type="primary" @click="toCheckPassword('3')" v-text="$t('acct.deleteWallet')"></van-button>
</div>
</pl-content-block>
Expand Down Expand Up @@ -95,23 +95,31 @@
account: {},
acctName: '',
showAcctNameDialog: false,
source: '',
sourceType: SourceType,
checkType: '' /*校验类型,主要用于是对那个功能点进行密码输入*/
};
},
computed: {
currentAccount () {
return this.$store.state.account;
},
delFlag () {
let identity = this.$collecitons.identity.findById(this.account.identityId);
if (identity && identity.source === SourceType.CREATED) {
let accounts = this.$collecitons.account.findByIdentityId(identity.id);
// 不能删除
if (accounts && accounts.length === 1) {
return '0';
}
return '1';
}
return '2';
}
},
methods: {
show (item) {
this.account = item;
this.acctName = item.name;
let identity = this.$collecitons.identity.findById(item.identityId);
this.source = identity.source;
this.showPop = true;
},
close () {
Expand All @@ -137,33 +145,52 @@
this.checkType = checkType;
this.$refs.pwdDialog.show();
},
delWallet () {
removeDataAndUpdateActions (option, identityId) {
const toast = this.$toast.loading({
duration: 0,
forbidClick: true,
loadingType: 'circular'
});
if (this.delFlag === '1') {
this.$collecitons.account.findAndUpdateAcct(option, (account) => {
return account.state = 'D';
});
} else {
this.$collecitons.account.findAndRemoveAcct(option);
}
this.$collecitons.history.removeHistory(option);
this.$collecitons.asset.removAssetByAddressAndName(option);
let map = {};
map[this.account.address] = '';
this.$store.dispatch('setPasswordMap', map);
let allAccount = this.$collecitons.account.findAll();
if (allAccount && allAccount.length > 0) {
let account = {...allAccount[0], setBalance: false};
this.$store.dispatch('setAccount' , account);
this.$emit('afterDelAcct');
} else {
this.$collecitons.identity.deleteIdentityById(identityId);
}
setTimeout(() => {
toast.clear();
this.close();
}, 1000);
},
delWallet () {
if (this.account) {
let identityId = this.currentAccount.identityId;
let option = {address: this.account.address};
this.$collecitons.account.findAndRemoveAcct(option);
this.$collecitons.history.removeHistory(option);
this.$collecitons.asset.removAssetByAddressAndName(option);
let map = {};
map[this.account.address] = '';
this.$store.dispatch('setPasswordMap', map);
let allAccount = this.$collecitons.account.findAll();
if (allAccount && allAccount.length > 0) {
let account = {...allAccount[0], setBalance: false};
this.$store.dispatch('setAccount' , account);
this.$emit('afterDelAcct');
if (this.delFlag === '1') { // 逻辑删除操作
this.$dialog.confirm({
title: this.$t('common.tip'),
message: this.$t('acct.delAcctTip')
}).then(() => {
this.removeDataAndUpdateActions(option, identityId);
});
} else {
this.$collecitons.identity.deleteIdentityById(identityId);
this.removeDataAndUpdateActions(option, identityId);
}
setTimeout(() => {
toast.clear();
this.close();
}, 1000);
} else {
this.$toast(this.$t('acct.acctNotexist'));
}
Expand All @@ -173,7 +200,7 @@
if (this.checkType === '1') {
this.$refs.exportSecret.show(password);
} else if (this.checkType === '2') {
this.$refs.backupsMemorizing.show(cryptor.decryptAES(this.currentAccount.mnemonicCode, password), password);
this.$refs.backupsMemorizing.show(cryptor.decryptAES(this.currentAccount.mnemonicCode, password), password, 'backups');
} else if (this.checkType === '3') { // 删除钱包
this.delWallet();
}
Expand Down
6 changes: 5 additions & 1 deletion src/pages/assets/popup/view-accounts-pop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
@close="close"></view-account-item>
</van-popup>
<account-type-select ref="accountTypeSelect" @done="updateCurrentAcct"></account-type-select>
<wallet-type-select ref="walletTypeSelect" @done="updateImportAcct"></wallet-type-select>
<wallet-type-select ref="walletTypeSelect" @done="updateImportAcct" @refreshAll="refreshAccts"></wallet-type-select>
<acct-detail ref="acctDetail" @afterDelAcct='afterDelAcct'></acct-detail>
</div>
</template>
Expand Down Expand Up @@ -69,6 +69,10 @@
afterDelAcct () {
this.$emit('afterDelAcct');
},
refreshAccts () {
this.updateCurrentAcct();
this.updateImportAcct();
},
updateCurrentAcct () {
let createIdentity = this.$collecitons.identity.findBySource(SourceType.CREATED);
if (createIdentity && createIdentity.length > 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/history/tx-detail-bitcoin.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div>
<div style="overflow-x: hidden;">
<pl-block class="van-hairline--bottom">
<div class="text-center padding">
<van-icon name="checked" class="text-primary" style="font-size: 40px;vertical-align: middle;"/>
Expand Down
Loading

0 comments on commit 612cb51

Please sign in to comment.