Authored by bevishuang

Merge branch 'develop' of http://git.yoho.cn/fe/xianyu-ufo-app-web into develop

<template>
<LayoutApp :title="title" :show-back="true">
<div class="pane-body">
<FormItem>
<CInput
label="收货人"
place-holder="请写姓名"
v-model="model.consignee"
:textValue="model.consignee"
type="text"
></CInput>
</FormItem>
<FormItem>
<CInput label="手机号" place-holder="请填写手机号" v-model="model.mobile" :textValue="model.mobile"></CInput>
</FormItem>
<template>
<Scroll ref="scroll" :options="scrollOpts">
<div class="pane-body">
<FormItem>
<div class="wrapper-area">
<label class="input-label">所在区域</label>
<div class="wrapper-arrow" @click="chooseArea">
<template v-if="model.area">
<label class="text-label">{{ model.area }}</label>
</template>
<template v-else>
<label class="choose-area">请选择</label>
</template>
<div class="arrow"></div>
<CInput
label="收货人"
place-holder="请写姓名"
v-model="model.consignee"
:textValue="model.consignee"
type="text"
></CInput>
</FormItem>
<FormItem>
<CInput
label="手机号"
place-holder="请填写手机号"
v-model="model.mobile"
:textValue="model.mobile"
></CInput>
</FormItem>
<template>
<FormItem>
<div class="wrapper-area">
<label class="input-label">所在区域</label>
<div class="wrapper-arrow" @click="chooseArea">
<template v-if="model.area">
<label class="text-label">{{ model.area }}</label>
</template>
<template v-else>
<label class="choose-area">请选择</label>
</template>
<div class="arrow"></div>
</div>
</div>
</div>
</FormItem>
</template>
<FormItem>
<CInput
label="详细地址"
place-holder="请输入详细地址"
v-model="model.address"
:textValue="model.address"
></CInput>
</FormItem>
</template>
<FormItem>
<CInput
label="详细地址"
place-holder="请输入详细地址"
v-model="model.address"
:textValue="model.address"
></CInput>
</FormItem>
<!-- 订单修改地址隐藏 -->
<div v-if="!orderCode" class="wrapper-tag">
<p class="tag-text">设置标签:</p>
<RadioGroup class="wrapper-radio">
<div v-for="(tag, index) in addressTags" :key="index">
<Radio
class="tag-radio"
:label="{ text: `${tag.name}`, value: `${tag.code}` }"
v-model="model.tag_code"
checked="tag.code === model.tag_code"
></Radio>
</div>
</RadioGroup>
</div>
<!-- 订单修改地址隐藏 -->
<div v-if="!orderCode" class="wrapper-del">
<Radio
class="radio"
:label="{ text: '设为默认地址', value: true }"
style="flex: 0 1 100%;"
checked="model.is_default"
v-model="model.is_default"
></Radio>
<div v-if="isUpdate" class="del-address" @click="delAddress">删除地址</div>
<!-- 订单修改地址隐藏 -->
<div v-if="!orderCode" class="wrapper-tag">
<p class="tag-text">设置标签:</p>
<RadioGroup class="wrapper-radio">
<div v-for="(tag, index) in addressTags" :key="index">
<Radio
class="tag-radio"
:label="{ text: `${tag.name}`, value: `${tag.code}` }"
v-model="model.tag_code"
checked="tag.code === model.tag_code"
></Radio>
</div>
</RadioGroup>
</div>
<!-- 订单修改地址隐藏 -->
<div v-if="!orderCode" class="wrapper-del">
<Radio
class="radio"
:label="{ text: '设为默认地址', value: true }"
style="flex: 0 1 100%;"
checked="model.is_default"
v-model="model.is_default"
></Radio>
<div v-if="isUpdate" class="del-address" @click="delAddress">删除地址</div>
</div>
</div>
<div :class="submitClass" @touchend="onSubmit">确 认</div>
</div>
</Scroll>
<AddressAct
class="address-act"
ref="addressAct"
v-show="isShowProvince"
@popHidden="popHidden"
... ... @@ -84,6 +90,7 @@ import FormItem from "./components/form-item";
import Radio from "./components/radio";
import AddressAct from "./components/address-act";
import RadioGroup from "./components/radio-group";
import { Scroll } from "cube-ui";
import { createNamespacedHelpers } from "vuex";
const { mapState, mapMutations, mapActions } = createNamespacedHelpers(
... ... @@ -98,10 +105,14 @@ export default {
FormItem,
Radio,
AddressAct,
RadioGroup
RadioGroup,
Scroll
},
data() {
return {
scrollOpts: {
bounce: false
},
isShowProvince: false,
isUpdate: false,
updateMobileNum: "",
... ... @@ -332,9 +343,27 @@ export default {
</script>
<style lang="scss" scoped>
/deep/ {
.cube-scroll-content {
min-height: 100%;
}
.cube-scroll-list-wrapper {
overflow: auto;
}
.cube-loading-spinners {
margin: auto;
}
}
.address-act {
z-index: 99;
}
.pane-body {
height: 100%;
overflow-y: hidden;
overflow-y: auto;
padding-top: 12px;
padding-left: 40px;
padding-right: 40px;
... ...
... ... @@ -154,8 +154,8 @@ export default {
refreshProductList(index) {
let str = get(get(this.navList, `[${index}].url`, '').split('?'), '[1]', '');
this.params = Object.assign({}, queryString.parse(str), this.listBaseParams);
this.fetchList(this.params);
this.searchParams = Object.assign({}, queryString.parse(str), this.listBaseParams);
this.fetchList(this.searchParams);
},
async onPullingUp() {
... ... @@ -178,7 +178,7 @@ export default {
return;
}
if (typeof params === 'object' && Object.keys(params)) {
searchParams = Object.assign({...searchParams}, params);
searchParams ={...params};
this.searchParams = searchParams;
}
... ... @@ -214,8 +214,10 @@ export default {
},
onPullingDown() {
this.params.isReset = true;
this.fetchList(this.params);
let params = this.searchParams;
params.isReset = true;
this.fetchList(params);
},
},
components: {
... ...
... ... @@ -26,8 +26,10 @@ export default {
},
methods: {
jump(item) {
const { type, description } = item;
console.log(item);
let { type, description } = item;
this.$router.push({name:'newsDetail',query: {type,description}})
this.$emit('clearStore',1);
}
}
};
... ...
... ... @@ -2,7 +2,7 @@ export default [
{
name: 'news',
path: '/xianyu/news',
component: () => import(/* webpackChunkName: "news" */ './news')
component: () => import(/* webpackChunkName: "news" */ './news'),
},
{
name: 'newsDetail',
... ...
... ... @@ -7,7 +7,9 @@
@pulling-up="onPullingUp"
:data="newsList.list">
<div class="news-content">
<Tab v-if="newsList.tabList.length > 0" :list="newsList.tabList"></Tab>
<Tab
v-if="newsList.tabList.length > 0" :list="newsList.tabList"
@clearStore="clearStoreData"></Tab>
<List v-if="newsList.list.length > 0" :list="newsList && newsList.list || []"></List>
<UfoNoItem v-else :tip="`暂无数据`"></UfoNoItem>
</div>
... ... @@ -30,9 +32,6 @@ export default {
data() {
return {
options: {
// bounce: {
// top: false
// },
pullUpLoad: true
},
msg: '消息',
... ... @@ -62,6 +61,10 @@ export default {
};
await this.fetchNewsList(params);
this.$refs.scroll.forceUpdate();
},
clearStoreData(index) {
console.log(index);
}
},
watch:{
... ...
... ... @@ -28,9 +28,6 @@ export default {
data() {
return {
options: {
// bounce: {
// top: false
// },
pullUpLoad: true
},
title: '',
... ... @@ -41,6 +38,7 @@ export default {
...mapState(['newsList','newsDeatilList']),
},
activated() {
console.log('111');
let params = {
type: this.type,
isPage: true
... ... @@ -51,9 +49,6 @@ export default {
this.title = this.$route.query.description;
this.type = this.$route.query.type;
},
activated() {
},
methods: {
...mapActions(['fetchNewsList']),
async onPullingUp() {
... ...
... ... @@ -61,7 +61,7 @@ export default {
const regexp = /#\*(.*?)\*#/;
return confirmDesc.split(regexp);
} else {
return [confirmDesc];
return confirmDesc ? [confirmDesc] : [];
}
}
}
... ...
... ... @@ -58,6 +58,7 @@ export default {
display: block;
background-size: contain;
margin-right: 40px;
background-image: url("~statics/image/order/addr-icon@3x.png");
}
.back-address-icon {
... ...
... ... @@ -100,7 +100,7 @@ export default {
this.$createOrderPayType({
orderCode,
price: parseFloat(bidDepositInfo.depositAmount),
desc: '保证金',
desc: '支付定金',
extra: JSON.stringify({
forward: {
name: 'OrderList',
... ...
... ... @@ -103,7 +103,7 @@ export default {
this.$createOrderPayType({
orderCode,
price: parseFloat(bidDepositInfo.depositAmount),
desc: '保证金',
desc: '支付定金',
extra: JSON.stringify({
forward: {
name: 'OrderList',
... ...
... ... @@ -5,6 +5,7 @@ const uuid = require('uuid');
const passport = require('passport');
const TaobaoStrategy = require('./passport-taobao');
const authcode = require('../../utils/authcode');
const redis = require('../../utils/redis');
const aes = require('./aes');
const log = global.yoho.logger;
... ... @@ -15,6 +16,7 @@ const loginPage = '//m.yohobuy.com/signin.html';
const homePage = `${config.siteUrl}/xianyu/channel`;
const URL_BIND_KEY = 'bind_code';
const MAX_MSG_SEND_TIMES = 20;
// taobao 登录
passport.use('taobao', new TaobaoStrategy({
... ... @@ -43,7 +45,7 @@ class passportModel extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
signinByOpenID({ nickname, openId, sourceType, businessLine}) {
signinByOpenID({ nickname, openId, sourceType, sourceTypeSecond, businessLine}) {
let param = {
nickname: nickname || '',
openId: openId,
... ... @@ -55,6 +57,10 @@ class passportModel extends global.yoho.BaseModel {
param.business_line = businessLine;
}
if (sourceTypeSecond) {
param.source_type_second = sourceTypeSecond;
}
return this.get({ data: param });
}
syncUserSession({uid, sessionKey, req, res}) {
... ... @@ -119,25 +125,33 @@ class passportModel extends global.yoho.BaseModel {
log.info(`[sync profile error] uid: ${uid} | err: ${JSON.stringify(e)}`);
});
}
sendTaobaoBindCode(mobile) {
return this.post({
data: {
method: 'app.bind.sendCodeByTB',
source_type: 'taobao',
mobile
}
});
sendTaobaoBindCode(mobile, sourceTypeSecond) {
let data = {
method: 'app.bind.sendCodeByTB',
source_type: 'taobao',
mobile
};
if (sourceTypeSecond) {
data.source_type_second = sourceTypeSecond;
}
return this.post({ data });
}
bindTaobaoAccountByCode({ mobile, code, openId }) {
return this.post({
data: {
method: 'app.bind.bindTBByCode',
source_type: 'taobao',
mobile,
code,
open_id: openId
}
});
bindTaobaoAccountByCode({ mobile, code, openId, sourceTypeSecond }) {
let data = {
method: 'app.bind.bindTBByCode',
source_type: 'taobao',
mobile,
code,
open_id: openId
};
if (sourceTypeSecond) {
data.source_type_second = sourceTypeSecond;
}
return this.post({ data });
}
};
... ... @@ -161,7 +175,8 @@ const login = {
return model.signinByOpenID({
openId: user.open_uid,
sourceType: 'taobao'
sourceType: 'taobao',
sourceTypeSecond: req.yoho.isAliApp ? 'xianyu' : ''
}).then(result => {
let redirectUrl = loginPage;
... ... @@ -213,12 +228,27 @@ const bind = {
return bindInfo;
},
sendSms(req, res, next) {
async sendSms(req, res, next) {
let { mobile, bindCode } = req.body || {};
let info = bind.getBindThirdInfo(bindCode);
if (info.type === 'taobao') {
req.ctx(passportModel).sendTaobaoBindCode(mobile).then(res.json).catch(next);
const timeKey = `${config.app}:bindsms:taobao:${info.openId}`;
let sendTimes = await redis.getAsync(timeKey);
sendTimes = (sendTimes || 0) + 1;
if (sendTimes > MAX_MSG_SEND_TIMES) {
log.info(`[SMS delivery times exceeded] type: taobao | openId: ${info.openId} | mobile: ${mobile} | ua: ${req.get('user-agent')}`);
return res.json({
code: 403,
message: '操作频繁,请稍后重试'
});
}
redis.setex(timeKey, 60 * 60 * 2, sendTimes);
req.ctx(passportModel).sendTaobaoBindCode(mobile, req.yoho.isAliApp ? 'xianyu' : '').then(res.json).catch(next);
} else {
res.json({
code: 200,
... ... @@ -236,7 +266,8 @@ const bind = {
model.bindTaobaoAccountByCode({
mobile,
code,
openId: info.openId
openId: info.openId,
sourceTypeSecond: req.yoho.isAliApp ? 'xianyu' : ''
}).then(result => {
if (_.get(result, 'data.is_bind') === 'Y') {
model.syncUserSession({
... ...
{
"name": "xianyu-ufo-app-web",
"version": "0.0.2-beta-15",
"version": "0.0.2-beta-17",
"private": true,
"description": "Xianyu Project With Express",
"repository": {
... ...