Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
sugars committed Sep 6, 2017
1 parent 1441fb4 commit 7eae0ce
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 48 deletions.
30 changes: 5 additions & 25 deletions build/dev-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,16 @@ var app = express()
// http请求模块
const superagent = require('superagent')


// 模拟后台假数据
let appData = require('../mockdata.json')
let self = appData.self
let friend = appData.friend
// let appData = require('../mockdata.json')
// let self = appData.self
// let friend = appData.friend

let apiRoutes = express.Router()

apiRoutes.get('/self', (req, res) => {
res.json({data: self})
})

apiRoutes.get('/friends', (req, res) => {
res.json({data: friend})
})

// 测试salesforce接口
apiRoutes.get('/getBusinessCard', (req, res) => {
let response = res;
let url = 'https://ap4.salesforce.com/services/data/v37.0/query?q=' + encodeURIComponent('SELECT Id, Name, Mobile__c, Company__c FROM Business_Card__c');
let sessionId = '00D6F000001v8ld!ARwAQBpBeIuwsA0MMEpg6dvGOkCioTOoJsJVDAbpHi_U7g5OEu3vNd2qf0EkuWSy6xmQGYJSxw2epX89HDZ10AZRyjtGguqI';
superagent.get(url)
.set('Authorization', 'Bearer ' + sessionId)
.end((err, res) => {
if (err) {
console.log(err)
}
response.json({
data: res.text
})
})
res.json({data: 'data'})
})

app.use('/api', apiRoutes)
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<script src="static/js/Base.js"></script>
<script src="static/js/dynamictk.js"></script>
<script src="static/js/DynamicApi.js"></script>
<script src="static/js/OSSHelp.js"></script>
</head>
<body>
<div id="app"></div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/business/businessdata.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@
...mapGetters(['getBSTitle'])
},
created() {
// this.$store.state.isAjax = true
// this.$store.dispatch('getBusinessDataByCRM', this.$route.query)
this.$store.state.isAjax = true
this.$store.dispatch('getBusinessDataByCRM', this.$route.query)
},
methods: {
backDetails() {
Expand Down
3 changes: 2 additions & 1 deletion src/components/common/businesscard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
:disableRipple="true"
class="list-item"
@click.stop="showDetails(item.new_cardid)">
<mu-avatar :src="''" slot="leftAvatar"/>
<!--<mu-avatar :src="'./static/images/sugars.jpeg'" slot="leftAvatar"/>-->
<img v-lazy="'./static/images/sugars.jpeg'" alt="" slot="leftAvatar" style="width:100%;">
<span slot="describe">
<span style="color: rgba(0, 0, 0, .87)">{{item.new_comp}}</span>
</span>
Expand Down
2 changes: 1 addition & 1 deletion src/components/details/details.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="gridlist">
<mu-grid-list class="gridlist-demo">
<mu-grid-tile titlePosition="bottom" actionPosition="right" :rows="2" :cols="2">
<img :src="'./static/images/sugars.jpeg'"/>
<img v-lazy="'./static/images/sugars.jpeg'"/>
<!--<img :src="scanResult.new_title"/>-->
<span slot="title">当前分组</span>
<span slot="subTitle"><b>{{getCardDetailGroupName}}</b></span>
Expand Down
9 changes: 9 additions & 0 deletions src/components/details/result.vue
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,15 @@
}
},
created() {
let sr = JSON.parse(localStorage.getItem('scanResult'))
this.currSelGroup = this.$store.state.currGroup === "全部" ? '未分组' : this.$store.state.currGroup
this.currSelGroupId = this.$store.state.currGroupId
if (sr) {
this.$store.dispatch('getGroupList')
this.$store.commit('getCardScanResult', {results: sr})
}
},
watch: {
details(oldVal, newVal) {
Expand Down Expand Up @@ -222,6 +229,7 @@
this.$store.commit('showToast', {msg: '请将信息补充完整'})
}
console.log('currSelGroupId', this.currSelGroupId)
console.log('result', this.scanResult)
},
cancelSave() {
Expand All @@ -242,6 +250,7 @@
},
selectGroup(item) {
this.currSelGroup = item.new_name
this.currSelGroupId = item.new_groupid
this.$store.state.scanResult._new_group_value = item.new_groupid
this.groupDialog = false
},
Expand Down
10 changes: 5 additions & 5 deletions src/components/discover/discover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<mu-icon slot="after" value="keyboard_arrow_right"/>
</mu-list-item>
<mu-divider inset/>
<mu-list-item title="我的收藏">
<mu-icon slot="left" value="star"/>
<mu-icon slot="after" value="keyboard_arrow_right"/>
</mu-list-item>
<mu-divider inset/>
<!--<mu-list-item title="我的收藏">-->
<!--<mu-icon slot="left" value="star"/>-->
<!--<mu-icon slot="after" value="keyboard_arrow_right"/>-->
<!--</mu-list-item>-->
<!--<mu-divider inset/>-->
<mu-list-item title="个人资料">
<mu-icon slot="left" value="assignment_ind"/>
<mu-icon slot="after" value="keyboard_arrow_right"/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/group/group.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div v-for="(item,index) in groupList">
<mu-divider/>

<mu-list-item :title="item" class="list-item">
<mu-list-item :title="item.new_name" class="list-item">

</mu-list-item>

Expand Down
15 changes: 6 additions & 9 deletions src/components/home/scan.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
// 创建一个reader
let reader = new FileReader();
// 将图片2将转成 base64 格式
reader.readAsDataURL(file);
// reader.readAsDataURL(file);
// 读取成功后的回调
reader.onload = function () {
// let result = this.result;
Expand All @@ -57,17 +57,14 @@
//判断图片是否小于500K,是就直接上传,反之压缩图片
if (this.result.length <= (500 * 1024)) {
//console.log('data1', this.result);
// self.scanCard(file)
self.$store.dispatch('getScanResult', {file: file, that: this})
// self.$store.dispatch('getScanResult', {file: file, that: this})
} else {
// img.onload = function () {
// let data = self.compress(img, Orientation);
//console.log('data2', data);
// self.scanCard(file)
// }
self.$store.dispatch('getScanResult', {file: file, that: this})
// self.$store.dispatch('getScanResult', {file: file, that: this})
}
}
self.$store.dispatch('getScanResult', {file: file, that: this})
}
},
compress(img, Orientation) {
Expand Down
7 changes: 3 additions & 4 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import VueLazyload from 'vue-lazyload'

Vue.use(VueLazyload, {
preLoad: 1.3,
error: 'static/images/lazy.jpg',
loading: 'static/images/lazy.jpg',
attempt: 1,
error: './static/images/lazy.jpg',
loading: './static/images/lazy.jpg',
attempt: 2,
listenEvents: ['scroll']
})

Expand Down Expand Up @@ -65,7 +65,6 @@ new Vue({
components: {App},
// 组件创建前,请求用户数据
beforeCreate() {

}
})

1 change: 1 addition & 0 deletions src/vuex/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const mutations = {
},
// 获取名片识别结果
getCardScanResult: (state, {results}) => {
localStorage.setItem('scanResult', JSON.stringify(results))
state.scanResult = results;
state.isAjax = false
},
Expand Down

0 comments on commit 7eae0ce

Please sign in to comment.