Merge pull request 'api' (#39) from zhy into master

Reviewed-on: http://git.luyuan.tk/luyuan/deming/pulls/39
This commit is contained in:
hansu 2020-07-03 09:09:24 +08:00
commit b86e2831c7
9 changed files with 111 additions and 48 deletions

View File

@ -2,5 +2,5 @@
export default {} export default {}
</script> </script>
<style lang="scss"> <style lang="scss">
@import "/static/css/normalize" @import "/static/css/normalize";
</style> </style>

View File

@ -56,16 +56,16 @@ export default {
}); });
}, },
// 使用帮助&售后政策列表 // 使用帮助&售后政策列表
getUseHelpList({page, tid}) { getUseHelpList({ page, tid }) {
return vm.$u.post('Member/UseHelpList', { return vm.$u.post('Member/UseHelpList', {
page: page, page: page,
tid: tid tid: tid,
}); });
}, },
// 使用帮助&售后政策详情 // 使用帮助&售后政策详情
getUseHelpInfo({ launch_id }) { getUseHelpInfo({ launch_id }) {
return vm.$u.post('Member/UseHelpInfo', { return vm.$u.post('Member/UseHelpInfo', {
launch_id: launch_id launch_id: launch_id,
}); });
}, },
// 标签的列表 // 标签的列表
@ -75,11 +75,11 @@ export default {
// 获取地区列表 // 获取地区列表
getAreaList({ pid }) { getAreaList({ pid }) {
return vm.$u.post('Area/areaList', { return vm.$u.post('Area/areaList', {
pid: pid pid: pid,
}); });
}, },
getArea() { getArea() {
return vm.$u.post('Area/getAreaTree') return vm.$u.post('Area/getAreaTree');
}, },
// 用户收货地址列表 // 用户收货地址列表
getAddressList() { getAddressList() {
@ -168,7 +168,7 @@ export default {
getPointslogList() { getPointslogList() {
return vm.$u.post('member/pointslogList'); return vm.$u.post('member/pointslogList');
}, },
// 收藏列表 商品 不传值;店铺 type: 2 // 收藏列表 商品 不传值;店铺 type: 2
getFavoritesList({ type = undefined } = {}) { getFavoritesList({ type = undefined } = {}) {
let params = {}; let params = {};
if(type) Object.assign(params, {type: type}) if(type) Object.assign(params, {type: type})
@ -177,7 +177,7 @@ export default {
// 取消收藏(商品/店铺) // 取消收藏(商品/店铺)
removeFavorite({ id }) { removeFavorite({ id }) {
return vm.$u.post('Member/removeFavorite', { return vm.$u.post('Member/removeFavorite', {
id: id id: id,
}); });
}, },
// 设置-用户信息 // 设置-用户信息
@ -193,6 +193,15 @@ export default {
birthday: birthday, birthday: birthday,
}); });
}, },
// 修改绑定手机号
changeMemberPhone({ old_mobile, old_code, new_mobile, new_code }) {
return vm.$u.post('Member/changeMemberInfo', {
old_mobile: old_mobile,
old_code: old_code,
new_mobile: new_mobile,
new_code: new_code,
});
},
// 设置-关于我们 // 设置-关于我们
aboutUsInfo() { aboutUsInfo() {
return vm.$u.post('Setting/AboutUsInfo'); return vm.$u.post('Setting/AboutUsInfo');

View File

@ -13,7 +13,7 @@
</view> </view>
<view class="info-item"> <view class="info-item">
<view class="title">生日</view> <view class="title">生日</view>
<view class="value">{{ userInfo.member_birthday }}</view> <view class="value">{{ userInfo.member_birthday | dateFormat }}</view>
</view> </view>
<view class="info-item"> <view class="info-item">
<view class="title">手机号</view> <view class="title">手机号</view>
@ -21,7 +21,7 @@
</view> </view>
<view class="info-item"> <view class="info-item">
<view class="title">等级</view> <view class="title">等级</view>
<view class="value">{{ userInfo.member_exppoints }}</view> <view class="value">{{ userInfo.level }}</view>
</view> </view>
<view class="info-item"> <view class="info-item">
<view class="title">积分数</view> <view class="title">积分数</view>
@ -34,6 +34,7 @@
</view> </view>
</template> </template>
<script> <script>
import common from '@/static/js/common.js'
export default { export default {
data() { data() {
return { return {
@ -46,6 +47,11 @@ export default {
onNavigationBarButtonTap() { onNavigationBarButtonTap() {
this.toEditPage(); this.toEditPage();
}, },
filters: {
dateFormat(value) {
return common.timestampToDate({ timestamp: value });
}
},
methods: { methods: {
getUserInfo() { getUserInfo() {
this.$u.api.getMemberInfo().then(res => { this.$u.api.getMemberInfo().then(res => {

View File

@ -9,7 +9,8 @@
<view class="code"> <view class="code">
<view class="title">验证码</view> <view class="title">验证码</view>
<input type="text" v-model="oldCode" placeholder="请输入验证码" /> <input type="text" v-model="oldCode" placeholder="请输入验证码" />
<view class="get-code">获取验证码</view> <u-verification-code :seconds="seconds" @end="end" @start="start" ref="uOldCode" @change="oldCodeChange" unique-key="old" change-text="x秒"></u-verification-code>
<view class="get-code" @click="getCode(0)">{{ btnText[0] }}</view>
</view> </view>
</view> </view>
<view class="new-phone"> <view class="new-phone">
@ -20,8 +21,10 @@
<view class="code"> <view class="code">
<view class="title">验证码</view> <view class="title">验证码</view>
<input type="text" v-model="newCode" placeholder="请输入验证码" /> <input type="text" v-model="newCode" placeholder="请输入验证码" />
<view class="get-code">获取验证码</view> <u-verification-code :seconds="seconds" @end="end" @start="start" ref="uNewCode" @change="newCodeChange" unique-key="new" change-text="x秒"></u-verification-code>
<view class="get-code" @click="getCode(1)">{{ btnText[1] }}</view>
</view> </view>
<u-toast ref="uToast" />
</view> </view>
</view> </view>
<view class="tips">注意修改手机号需要原手机号获取验证码无原手机验证码请联系后台</view> <view class="tips">注意修改手机号需要原手机号获取验证码无原手机验证码请联系后台</view>
@ -35,13 +38,80 @@ export default {
oldNumber: '', oldNumber: '',
oldCode: '', oldCode: '',
newNumber: '', newNumber: '',
newCode: '' newCode: '',
btnText: ['获取验证码', '获取验证码'],
seconds: 60, //
} }
}, },
methods: { methods: {
verifyValue() { verifyValue(type) {
if (this.$u.test.mobile(this.oldNumber)) this.$u.toast('请填写正确的原手机号'); const phone = type == 0 ? this.oldNumber : this.newNumber;
if (this.$u.test.mobile(this.newNumber)) this.$u.toast('请填写正确的新手机号'); return this.$u.test.mobile(phone);
},
// @param Number type 0: 1:
getSmsCode (type) {
if(!this.verifyValue(type)) {
let tips = type == 0 ? '请填写正确的原手机号' : '请填写正确的新手机号';
this.$u.toast(tips);
return false;
}
if(this.seconds > 0) {
this.$u.toast('倒计时结束后再发送');
}
uni.showLoading({
title: '正在获取验证码'
})
this.$u.api.sendSmsCode({
member_mobile: type == 0 ? this.oldNumber: this.newNumber,
smslog_type: 4 // [1:,2:,3:,4:]
}).then(res => {
uni.hideLoading();
if(res.errCode == 0) {
} else {
this.$u.toast(res.message);
}
})
},
oldCodeChange(text) {
this.$set(this.btnText, 0, text);
},
newCodeChange(text) {
this.$set(this.btnText, 1, text);
},
getCode(type) {
const refs = type == 0 ? this.$refs.uOldCode : this.$refs.uNewCode;
if(refs.canGetCode) {
//
uni.showLoading({
title: '正在获取验证码'
})
setTimeout(() => {
uni.hideLoading();
// this.start()
this.$u.toast('验证码已发送');
//
refs.start();
}, 2000);
} else {
this.$u.toast('倒计时结束后再发送');
}
},
changeMemberPhone() {
this.$u.api.changeMemberPhone({
old_mobile: this.oldNumber,
old_code: this.oldCode,
new_mobile: this.newNumber,
new_code: this.newCode,
}).then(res => {
})
},
end() {
this.$u.toast('倒计时结束');
},
start() {
this.$u.toast('倒计时开始');
} }
}, },
}; };
@ -64,15 +134,17 @@ export default {
color: rgba(51,51,51,1); color: rgba(51,51,51,1);
} }
.input { .input {
flex: 1; width: 340rpx;
font-size: 26rpx; font-size: 26rpx;
} }
.get-code { .get-code {
flex: 1;
font-size: 28rpx; font-size: 28rpx;
color: rgba(153,153,153,1); color: rgba(153,153,153,1);
position: relative; position: relative;
padding: 0 25rpx; padding: 0 25rpx;
margin-left: 20rpx; margin-left: 20rpx;
text-align: center;
&::after { &::after {
position: absolute; position: absolute;
content: ""; content: "";

View File

@ -1,19 +0,0 @@
<template>
<div>
<myText ref="telText" tel="11" style="width:750rem;height:100vh" @onTel="onTel" @click="myTextClick"></myText>
</div>
</template>
<script>
export default {
data() {
return {
}
},
onLoad() {
},
methods: {
}
}
</script>

View File

@ -315,12 +315,6 @@
{ {
"root": "pageE", "root": "pageE",
"pages":[ "pages":[
{
"path": "zhibo/index",
"style": {
"navigationStyle": "custom"
}
},
{ {
"path": "tool/MineHistory", "path": "tool/MineHistory",
"style": { "style": {

View File

@ -13,18 +13,18 @@
</view> </view>
<view class="info-right"> <view class="info-right">
<view class="info-phone">{{ userInfo.member_mobile | phoneFormat }}</view> <view class="info-phone">{{ userInfo.member_mobile | phoneFormat }}</view>
<view class="user-rank">等级:{{ userInfo.member_exppoints }}</view> <view class="user-rank">等级:{{ userInfo.level }}</view>
</view> </view>
</view> </view>
<view class="member-service" @click="toOtherPage('/mine/MemberServe')">会员服务</view> <view class="member-service" @click="toOtherPage('/mine/MemberServe')">会员服务</view>
</view> </view>
<view class="bottom"> <view class="bottom">
<view @click="toOtherPage('/mine/GoodsCollection')"> <view @click="toOtherPage('/mine/GoodsCollection')">
<view>99</view> <view>{{ userInfo.member_fav_goods_num }}</view>
<view>商品收藏</view> <view>商品收藏</view>
</view> </view>
<view @click="toOtherPage('/mine/StoreCollection')"> <view @click="toOtherPage('/mine/StoreCollection')">
<view>9</view> <view>{{ userInfo.member_fav_store_num }}</view>
<view>店铺收藏</view> <view>店铺收藏</view>
</view> </view>
<view @click="toOtherPage('/mine/ImageTextCollection')"> <view @click="toOtherPage('/mine/ImageTextCollection')">
@ -36,7 +36,7 @@
<view>积分数</view> <view>积分数</view>
</view> </view>
<view @click="toOtherPage('/mine/MineConcerns')"> <view @click="toOtherPage('/mine/MineConcerns')">
<view>9</view> <view>{{ userInfo.member_snsfrend_num }}</view>
<view>关注</view> <view>关注</view>
</view> </view>
</view> </view>
@ -123,7 +123,7 @@
export default { export default {
data() { data() {
return { return {
userInfo: {} userInfo: {},
}; };
}, },
filters: { filters: {
@ -146,7 +146,6 @@ export default {
}) })
}, },
toOtherPage(url) { toOtherPage(url) {
// console.log(url);
uni.navigateTo({ uni.navigateTo({
url: '/pageE' + url url: '/pageE' + url
}); });

Binary file not shown.

View File

@ -5,6 +5,7 @@ const common = {
* @return { String } 处理好的富文本 * @return { String } 处理好的富文本
*/ */
unescapeHTML(temp){ unescapeHTML(temp){
if(!temp) return '';
temp = "" + temp; temp = "" + temp;
return temp.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&apos;/g, "'"); return temp.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&quot;/g, '"').replace(/&apos;/g, "'");
}, },
@ -16,6 +17,7 @@ const common = {
* @return { String } 格式化日期 * @return { String } 格式化日期
*/ */
timestampToDate({timestamp, spacer = '-', end = 'day'} = {}) { timestampToDate({timestamp, spacer = '-', end = 'day'} = {}) {
if(!timestamp) return '';
const newDate = new Date(parseInt(timestamp) * 1000); const newDate = new Date(parseInt(timestamp) * 1000);
// const year = newDate.getUTCFullYear(); // const year = newDate.getUTCFullYear();
const year = newDate.getFullYear(); const year = newDate.getFullYear();