Browse Source

修改不兼容多平台的语法

zyh
Gao xiaosong 4 years ago
parent
commit
29459e76ca
  1. 330
      pages/activity/DargainDetails/index.vue
  2. 8
      pages/activity/GoodsGroup/index.vue
  3. 122
      pages/user/ChangePassword/index.vue
  4. 2
      pages/user/User/index.vue

330
pages/activity/DargainDetails/index.vue

@ -9,7 +9,7 @@
<!-- 帮助砍价帮砍成功--> <!-- 帮助砍价帮砍成功-->
<view class="pictxt acea-row row-center-wrapper "> <view class="pictxt acea-row row-center-wrapper ">
<div class="bargain-header"> <div class="bargain-header">
<view class="pictrue"><image :src="bargainUserInfo.avatar" /></view> <view class="pictrue"><image :src="bargainUserInfo.avatar"/></view>
<view class="text"> <view class="text">
{{ bargainUserInfo.nickname }} {{ bargainUserInfo.nickname }}
<text>邀请您帮忙砍价</text> <text>邀请您帮忙砍价</text>
@ -19,15 +19,7 @@
</view> </view>
<view class="wrapper bargain-box time on"> <view class="wrapper bargain-box time on">
<div class="pictxt "> <div class="pictxt ">
<count-down <count-down :isDay="true" :tipText="'倒计时 '" :dayText="' 天 '" :hourText="' 时 '" :minuteText="' 分 '" :secondText="' 秒'" :datatime="goodsDetail.stopTime"></count-down>
:isDay="true"
:tipText="'倒计时 '"
:dayText="' 天 '"
:hourText="' 时 '"
:minuteText="' 分 '"
:secondText="' 秒'"
:datatime="goodsDetail.stopTime"
></count-down>
</div> </div>
</view> </view>
<view class="wrapper bargain-box bargain-product"> <view class="wrapper bargain-box bargain-product">
@ -100,14 +92,14 @@
</view> </view>
<view class="bargainGang bargain-box"> <view class="bargainGang bargain-box">
<view class="title font-color-red acea-row row-center-wrapper"> <view class="title font-color-red acea-row row-center-wrapper">
<view class="pictrue"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`" /></view> <view class="pictrue"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`"/></view>
<view class="titleCon">砍价帮</view> <view class="titleCon">砍价帮</view>
<view class="pictrue on"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`" /></view> <view class="pictrue on"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`"/></view>
</view> </view>
<view class="list"> <view class="list">
<view class="item acea-row row-between-wrapper" v-for="(item, bargainHelpListIndex) in bargainHelpList" :key="bargainHelpListIndex"> <view class="item acea-row row-between-wrapper" v-for="(item, bargainHelpListIndex) in bargainHelpList" :key="bargainHelpListIndex">
<view class="pictxt acea-row row-between-wrapper"> <view class="pictxt acea-row row-between-wrapper">
<view class="pictrue"><image :src="item.avatar" /></view> <view class="pictrue"><image :src="item.avatar"/></view>
<view class="text"> <view class="text">
<view class="name line1" v-text="item.nickname"></view> <view class="name line1" v-text="item.nickname"></view>
<view class="line1" v-text="item.add_time"></view> <view class="line1" v-text="item.add_time"></view>
@ -124,18 +116,18 @@
</view> </view>
<view class="goodsDetails bargain-box"> <view class="goodsDetails bargain-box">
<view class="title font-color-red acea-row row-center-wrapper"> <view class="title font-color-red acea-row row-center-wrapper">
<view class="pictrue"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`" /></view> <view class="pictrue"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`"/></view>
<view class="titleCon">商品详情</view> <view class="titleCon">商品详情</view>
<view class="pictrue on"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`" /></view> <view class="pictrue on"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`"/></view>
</view> </view>
<view class="conter" v-html="goodsDetail.description"></view> <view class="conter" v-html="goodsDetail.description"></view>
<view class="lock"></view> <view class="lock"></view>
</view> </view>
<view class="goodsDetails bargain-box"> <view class="goodsDetails bargain-box">
<view class="title font-color-red acea-row row-center-wrapper"> <view class="title font-color-red acea-row row-center-wrapper">
<view class="pictrue"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`" /></view> <view class="pictrue"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`"/></view>
<view class="titleCon">活动规则</view> <view class="titleCon">活动规则</view>
<view class="pictrue on"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`" /></view> <view class="pictrue on"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`"/></view>
</view> </view>
<view class="conter" v-html="goodsDetail.rule"></view> <view class="conter" v-html="goodsDetail.rule"></view>
</view> </view>
@ -156,28 +148,19 @@
</view> </view>
</template> </template>
<script> <script>
import CountDown from '@/components/CountDown'; import CountDown from '@/components/CountDown'
import { import { getBargainDetail, getBargainShare, getBargainStart, getBargainHelp, getBargainHelpPrice, getBargainHelpList, getBargainHelpCount, getBargainStartUser } from '@/api/activity'
getBargainDetail, import { postCartAdd } from '@/api/store'
getBargainShare, import { mapGetters } from 'vuex'
getBargainStart, import {} from '@/libs/wechat'
getBargainHelp, import { isWeixin, parseQuery, handleQrCode } from '@/utils/index'
getBargainHelpPrice,
getBargainHelpList,
getBargainHelpCount,
getBargainStartUser
} from '@/api/activity';
import { postCartAdd } from '@/api/store';
import { mapGetters } from 'vuex';
import {} from '@/libs/wechat';
import { isWeixin, parseQuery, handleQrCode } from '@/utils/index';
const NAME = 'DargainDetails'; const NAME = 'DargainDetails'
export default { export default {
name: 'DargainDetails', name: 'DargainDetails',
components: { components: {
CountDown CountDown,
}, },
props: {}, props: {},
data: function() { data: function() {
@ -203,41 +186,41 @@ export default {
inviteFriends: false, // inviteFriends: false, //
helpFriendsBargain: false, // helpFriendsBargain: false, //
bargainSuccess: false, // bargainSuccess: false, //
mainBargainSuccess: false // mainBargainSuccess: false, //
}; }
}, },
computed: mapGetters(['userInfo', 'isLogin']), computed: mapGetters(['userInfo', 'isLogin']),
mounted: function() { mounted: function() {
this.mountedStart(); this.mountedStart()
}, },
methods: { methods: {
// //
mountedStart: function() { mountedStart: function() {
var that = this; var that = this
let url = handleQrCode(); let url = handleQrCode()
// bargainId id // bargainId id
// bargainUid // bargainUid
if (url) { if (url) {
// //
that.bargainId = url.bargainId; that.bargainId = url.bargainId
that.bargainUid = url.partake; that.bargainUid = url.partake
} else { } else {
// //
that.bargainId = that.$yroute.query.id; that.bargainId = that.$yroute.query.id
that.bargainUid = that.$yroute.query.partake; that.bargainUid = that.$yroute.query.partake
} }
if (this.bargainUid == 0 || !this.bargainUid) { if (this.bargainUid == 0 || !this.bargainUid) {
// urluiduid // urluiduid
that.bargainUid = that.userInfo.uid; that.bargainUid = that.userInfo.uid
} }
console.log(this); console.log(this)
// //
that.getBargainDetail(); that.getBargainDetail()
// //
that.getBargainShare(0); that.getBargainShare(0)
if (that.bargainUid !== that.userInfo.uid) { if (that.bargainUid !== that.userInfo.uid) {
that.getBargainStartUser(); that.getBargainStartUser()
} }
}, },
// //
@ -245,255 +228,258 @@ export default {
// //
if (this.bargainUid === this.userInfo.uid) { if (this.bargainUid === this.userInfo.uid) {
// //
this.getBargainStart(); this.getBargainStart()
} else { } else {
// //
this.getBargainStartUser(); this.getBargainStartUser()
} }
this.getBargainHelpCount(); this.getBargainHelpCount()
}, },
// //
openAlone: function() { openAlone: function() {
this.$yrouter.push({ this.$yrouter.push({
path: '/pages/shop/GoodsCon/index', path: '/pages/shop/GoodsCon/index',
query: { query: {
id: this.goodsDetail.productId id: this.goodsDetail.productId,
} },
}); })
}, },
// //
goPay: function() { goPay: function() {
var data = {}; var data = {}
var that = this; var that = this
data.productId = that.goodsDetail.productId; data.productId = that.goodsDetail.productId
data.cartNum = that.goodsDetail.num; data.cartNum = that.goodsDetail.num
data.uniqueId = ''; data.uniqueId = ''
data.bargainId = that.bargainId; data.bargainId = that.bargainId
data.new = 1; data.new = 1
postCartAdd(data) postCartAdd(data)
.then(res => { .then(res => {
that.$yrouter.push({ that.$yrouter.push({
path: '/pages/order/OrderSubmission/index', path: '/pages/order/OrderSubmission/index',
query: { query: {
id: res.data.cartId id: res.data.cartId,
} },
}); })
}) })
.catch(err => { .catch(err => {
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message, title: err.msg || err.response.data.msg || err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000,
}); })
}); })
}, },
// //
goPoster: function() { goPoster: function() {
var that = this; var that = this
that.getBargainShare(that.bargainId); that.getBargainShare(that.bargainId)
this.$yrouter.push({ this.$yrouter.push({
path: '/pages/activity/Poster/index', path: '/pages/activity/Poster/index',
query: { query: {
id: that.bargainId, id: that.bargainId,
type: 2 type: 2,
} },
}); })
}, },
// //
goList: function() { goList: function() {
this.$yrouter.push({ this.$yrouter.push({
path: '/pages/activity/GoodsBargain/index' path: '/pages/activity/GoodsBargain/index',
}); })
}, },
// //
//bargainId 0 //bargainId 0
//bargainId //bargainId
getBargainShare: function(bargainId) { getBargainShare: function(bargainId) {
var that = this; var that = this
getBargainShare({ getBargainShare({
bargainId: bargainId bargainId: bargainId,
}).then(res => { }).then(res => {
that.bargainShare = res.data; that.bargainShare = res.data
}); })
}, },
// //
getBargainDetail: function() { getBargainDetail: function() {
var that = this; var that = this
uni.showLoading({ uni.showLoading({
title: '加载中', title: '加载中',
mask: true mask: true,
}); })
getBargainDetail(that.bargainId) getBargainDetail(that.bargainId)
.then(res => { .then(res => {
uni.hideLoading(); uni.hideLoading()
that.goodsDetail = res.data.bargain; that.goodsDetail = res.data.bargain
that.goodsDetail.description = that.goodsDetail.description.replace(/\<img/gi, '<img style="max-width:100%;height:auto;"'); that.goodsDetail.description = that.goodsDetail.description.replace(/\<img/gi, '<img style="max-width:100%;height:auto;"')
that.goodsDetail.rule = that.goodsDetail.rule.replace(/\<img/gi, '<img style="max-width:100%;height:auto;"'); that.goodsDetail.rule = that.goodsDetail.rule.replace(/\<img/gi, '<img style="max-width:100%;height:auto;"')
that.goodsDetail.stopTime = that.goodsDetail.stopTime / 1000; that.goodsDetail.stopTime = that.goodsDetail.stopTime / 1000
that.getBargainHelpCount(); that.getBargainHelpCount()
}) })
.catch(res => { .catch(res => {
uni.hideLoading(); uni.hideLoading()
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000,
}); })
}); })
}, },
// - // -
getBargainStart: function() { getBargainStart: function() {
var that = this; var that = this
getBargainStart({ getBargainStart({
bargainId: that.bargainId bargainId: that.bargainId,
}) })
.then(() => { .then(() => {
that.bargainUid = that.userInfo.uid; that.bargainUid = that.userInfo.uid
that.getBargainHelp(); that.getBargainHelp()
that.getBargainHelpCount(); that.getBargainHelpCount()
}) })
.catch(res => { .catch(res => {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000,
}); })
}); })
}, },
// //
getBargainHelp: function() { getBargainHelp: function() {
var that = this; var that = this
if (this.bargainHelpCount.price === 0 && that.bargainUid !== that.userInfo.uid) { if (this.bargainHelpCount.price === 0 && that.bargainUid !== that.userInfo.uid) {
return uni.showToast({ return uni.showToast({
title: '好友已经砍价成功', title: '好友已经砍价成功',
icon: 'success', icon: 'success',
duration: 2000 duration: 2000,
}); })
} }
var data = { var data = {
bargainId: that.bargainId, bargainId: that.bargainId,
bargainUserUid: that.bargainUid bargainUserUid: that.bargainUid,
}; }
getBargainHelp(data) getBargainHelp(data)
.then(res => { .then(res => {
that.activeMsg = res.data.status; that.activeMsg = res.data.status
if (res.data.status === 'SUCCESSFUL' && that.bargainUid !== that.userInfo.uid) { if (res.data.status === 'SUCCESSFUL' && that.bargainUid !== that.userInfo.uid) {
uni.showToast({ uni.showToast({
title: '您已经砍过了', title: '您已经砍过了',
icon: 'none', icon: 'none',
duration: 2000 duration: 2000,
}); })
return; return
} }
that.helpListStatus = false; that.helpListStatus = false
that.page = 1; that.page = 1
that.bargainHelpList = []; that.bargainHelpList = []
that.getBargainHelpPrice(); that.getBargainHelpPrice()
}) })
.catch(res => { .catch(res => {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000,
}); })
}); })
}, },
// //
getBargainHelpPrice: function() { getBargainHelpPrice: function() {
var that = this; var that = this
getBargainHelpPrice({ getBargainHelpPrice({
bargainId: that.bargainId, bargainId: that.bargainId,
bargainUserUid: that.bargainUid bargainUserUid: that.bargainUid,
}) })
.then(res => { .then(res => {
that.bargainHelpPrice = res.data.price; that.bargainHelpPrice = res.data.price
that.getBargainHelpCount(); that.getBargainHelpCount()
that.getBargainHelpList(); that.getBargainHelpList()
switch (that.activeMsg) { switch (that.activeMsg) {
case 'SUCCESSFUL': case 'SUCCESSFUL':
break; break
case 'SUCCESS': case 'SUCCESS':
that.active = true; that.active = true
break; break
} }
}) })
.catch(res => { .catch(res => {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000,
}); })
}); })
}, },
// //
getBargainHelpList: function() { getBargainHelpList: function() {
var that = this; var that = this
if (that.helpListStatus === true) return; if (that.helpListStatus === true) return
getBargainHelpList({ getBargainHelpList({
bargainId: that.bargainId, bargainId: that.bargainId,
bargainUserUid: that.bargainUid, bargainUserUid: that.bargainUid,
page: that.page, page: that.page,
limit: that.limit limit: that.limit,
}) })
.then(res => { .then(res => {
that.helpListStatus = res.data.length < that.limit; that.helpListStatus = res.data.length < that.limit
that.page++; if (that.page == 1) {
that.bargainHelpList = []
}
that.page++
if (res.data) { if (res.data) {
that.bargainHelpList.push.apply(that.bargainHelpList, res.data); that.bargainHelpList.push.apply(that.bargainHelpList, res.data)
} }
}) })
.catch(err => { .catch(err => {
if (!err.msg) { if (!err.msg) {
return; return
} }
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message, title: err.msg || err.response.data.msg || err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000,
}); })
}); })
}, },
// //
getBargainHelpCount: function() { getBargainHelpCount: function() {
getBargainHelpCount({ getBargainHelpCount({
bargainId: this.bargainId, bargainId: this.bargainId,
bargainUserUid: this.bargainUid bargainUserUid: this.bargainUid,
}) })
.then(res => { .then(res => {
// ** 使 = - // ** 使 = -
let remainingPrice = (this.goodsDetail.price - res.data.alreadyPrice).toFixed(2); let remainingPrice = (this.goodsDetail.price - res.data.alreadyPrice).toFixed(2)
this.bargainHelpCount = { this.bargainHelpCount = {
...res.data, ...res.data,
remainingPrice remainingPrice,
}; }
this.handleButtonStatus(); this.handleButtonStatus()
}) })
.catch(err => { .catch(err => {
if (!err.msg) { if (!err.msg) {
return; return
} }
uni.showToast({ uni.showToast({
title: err.msg || err.response.data.msg || err.response.data.message, title: err.msg || err.response.data.msg || err.response.data.message,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000,
}); })
}); })
}, },
// //
handleButtonStatus() { handleButtonStatus() {
// //
// 1. ==> && // 1. ==> &&
if (this.bargainUid === this.userInfo.uid && this.bargainHelpCount.status == 0) { if (this.bargainUid === this.userInfo.uid && this.bargainHelpCount.status == 0) {
this.participate = true; this.participate = true
} else { } else {
this.participate = false; this.participate = false
} }
// 2. ==> && && >0 // 2. ==> && && >0
if (this.bargainUid === this.userInfo.uid && this.bargainHelpCount.status == 1 && this.bargainHelpCount.price > 0) { if (this.bargainUid === this.userInfo.uid && this.bargainHelpCount.status == 1 && this.bargainHelpCount.price > 0) {
this.inviteFriends = true; this.inviteFriends = true
} else { } else {
this.inviteFriends = false; this.inviteFriends = false
} }
// 3. ==> && && >0 && // 3. ==> && && >0 &&
@ -503,23 +489,23 @@ export default {
// this.bargainHelpCount.userBargainStatus && // this.bargainHelpCount.userBargainStatus &&
this.bargainHelpCount.price > 0 this.bargainHelpCount.price > 0
) { ) {
this.helpFriendsBargain = true; this.helpFriendsBargain = true
} else { } else {
this.helpFriendsBargain = false; this.helpFriendsBargain = false
} }
// 4. ==> && && <=0 // 4. ==> && && <=0
if (this.bargainUid === this.userInfo.uid && this.bargainHelpCount.status == 1 && this.bargainHelpCount.price <= 0) { if (this.bargainUid === this.userInfo.uid && this.bargainHelpCount.status == 1 && this.bargainHelpCount.price <= 0) {
this.pay = true; this.pay = true
} else { } else {
this.pay = false; this.pay = false
} }
// 5. ==> && // 5. ==> &&
if (this.bargainUid != this.userInfo.uid) { if (this.bargainUid != this.userInfo.uid) {
this.bargain = true; this.bargain = true
} else { } else {
this.bargain = false; this.bargain = false
} }
// //
@ -530,26 +516,26 @@ export default {
// //
// //
getBargainStartUser: function() { getBargainStartUser: function() {
var that = this; var that = this
getBargainStartUser({ getBargainStartUser({
bargainId: that.bargainId, bargainId: that.bargainId,
bargainUserUid: that.bargainUid bargainUserUid: that.bargainUid,
}) })
.then(res => { .then(res => {
that.bargainUserInfo = res.data; that.bargainUserInfo = res.data
that.getBargainHelpList(); that.getBargainHelpList()
}) })
.catch(res => { .catch(res => {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: 'none', icon: 'none',
duration: 2000 duration: 2000,
}); })
}); })
}, },
// //
close: function() { close: function() {
this.active = false; this.active = false
}, },
// //
onShareAppMessage: function() { onShareAppMessage: function() {
@ -559,24 +545,24 @@ export default {
path: 'pages/activity/DargainDetails/index?id=' + this.storeInfo.id + '&spread=' + uni.getStorageSync('uid'), path: 'pages/activity/DargainDetails/index?id=' + this.storeInfo.id + '&spread=' + uni.getStorageSync('uid'),
success(res) { success(res) {
uni.showToast({ uni.showToast({
title: '分享成功' title: '分享成功',
}); })
}, },
fail(res) { fail(res) {
uni.showToast({ uni.showToast({
title: '分享失败', title: '分享失败',
icon: 'none' icon: 'none',
}); })
} },
};
} }
}, },
},
onShareAppMessage() { onShareAppMessage() {
return { return {
path: `/pages/activity/DargainDetails/index/?id=${this.$yroute.query.id}&partake=${this.userInfo.uid}` path: `/pages/activity/DargainDetails/index/?id=${this.$yroute.query.id}&partake=${this.userInfo.uid}`,
};
} }
}; },
}
</script> </script>
<style lang="less"> <style lang="less">

8
pages/activity/GoodsGroup/index.vue

@ -2,7 +2,7 @@
<view class="page_box"> <view class="page_box">
<view class="content_box"> <view class="content_box">
<scroll-view class="scroll-box" scroll-y enable-back-to-top scroll-with-animation @scrolltolower="loadMore"> <scroll-view class="scroll-box" scroll-y enable-back-to-top scroll-with-animation @scrolltolower="loadMore">
<view class="group-wrap" :style="`background: url('${$VUE_APP_RESOURCES_URL}/images/index-bg.png') no-repeat;`"> <view class="group-wrap" :style="{ background: background }">
<view class="group-head x-bc"> <view class="group-head x-bc">
<text class="group-head__title">爆款拼团</text> <text class="group-head__title">爆款拼团</text>
<text class="group-head__notice">省钱省心限时拼</text> <text class="group-head__notice">省钱省心限时拼</text>
@ -63,7 +63,11 @@ export default {
this.getGrouponList() this.getGrouponList()
}, },
onPullDownRefresh() {}, onPullDownRefresh() {},
computed: {}, computed: {
background() {
return `url('${this.$VUE_APP_RESOURCES_URL}/images/index-bg.png') no-repeat`
},
},
methods: { methods: {
// //
jump(path, parmas) { jump(path, parmas) {

122
pages/user/ChangePassword/index.vue

@ -13,12 +13,7 @@
</view> </view>
<view class="item acea-row row-between-wrapper"> <view class="item acea-row row-between-wrapper">
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" /> <input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
<button <button class="code font-color-red" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="code">{{ text }}</button>
class="code font-color-red"
:disabled="disabled"
:class="disabled === true ? 'on' : ''"
@click="code"
>{{ text }}</button>
</view> </view>
</view> </view>
<view class="confirmBnt bg-color-red" @click="confirm">确认修改</view> <view class="confirmBnt bg-color-red" @click="confirm">确认修改</view>
@ -26,124 +21,115 @@
</template> </template>
<style scoped lang="less"> <style scoped lang="less">
.ChangePassword .phone input { .ChangePassword .phone input {
width: 2*100rpx; width: 2 * 100rpx;
text-align: center; text-align: center;
} }
</style> </style>
<script> <script>
// import { mapGetters } from "vuex"; // import { mapGetters } from "vuex";
import sendVerifyCode from "@/mixins/SendVerifyCode"; import sendVerifyCode from '@/mixins/SendVerifyCode'
import attrs, { required, alpha_num, chs_phone } from "@/utils/validate"; import attrs, { required, alpha_num, chs_phone } from '@/utils/validate'
import { validatorDefaultCatch } from "@/utils/dialog"; import { validatorDefaultCatch } from '@/utils/dialog'
import { registerReset, registerVerify, getUserInfo } from "@/api/user"; import { registerReset, registerVerify, getUserInfo } from '@/api/user'
export default { export default {
name: "ChangePassword", name: 'ChangePassword',
components: {}, components: {},
props: {}, props: {},
data: function() { data: function() {
return { return {
password: "", password: '',
password2: "", password2: '',
captcha: "", captcha: '',
phone: "", // phone: '', //
yphone: "" // yphone: '', //
}; }
}, },
mixins: [sendVerifyCode], mixins: [sendVerifyCode],
// computed: mapGetters(["userInfo"]), // computed: mapGetters(["userInfo"]),
mounted: function() { mounted: function() {
this.getUserInfo(); this.getUserInfo()
}, },
methods: { methods: {
getUserInfo: function() { getUserInfo: function() {
let that = this; let that = this
getUserInfo().then(res => { getUserInfo().then(res => {
that.yphone = res.data.phone; that.yphone = res.data.phone
let reg = /^(\d{3})\d*(\d{4})$/; let reg = /^(\d{3})\d*(\d{4})$/
that.phone = that.yphone.replace(reg, "$1****$2"); that.phone = that.yphone.replace(reg, '$1****$2')
}); })
}, },
async confirm() { async confirm() {
let that = this; let that = this
const { password, password2, captcha } = that; const { password, password2, captcha } = that
try { try {
await that await that
.$validator({ .$validator({
password: [ password: [required(required.message('密码')), attrs.range([6, 16], attrs.range.message('密码')), alpha_num(alpha_num.message('密码'))],
required(required.message("密码")), captcha: [required(required.message('验证码')), alpha_num(alpha_num.message('验证码'))],
attrs.range([6, 16], attrs.range.message("密码")),
alpha_num(alpha_num.message("密码"))
],
captcha: [
required(required.message("验证码")),
alpha_num(alpha_num.message("验证码"))
]
}) })
.validate({ password, captcha }); .validate({ password, captcha })
} catch (e) { } catch (e) {
return validatorDefaultCatch(e); return validatorDefaultCatch(e)
} }
if (password !== password2) return uni.showToast({ if (password !== password2)
return uni.showToast({
title: '两次密码不一致', title: '两次密码不一致',
icon: "none", icon: 'none',
duration: 2000 duration: 2000,
}); })
registerReset({ registerReset({
account: that.yphone, account: that.yphone,
captcha: that.captcha, captcha: that.captcha,
password: that.password password: that.password,
}) })
.then(res => { .then(res => {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: "none", icon: 'none',
duration: 2000 duration: 2000,
}); })
// that.$yrouter.push({ path: "/pages/user/Login/index" }); // that.$yrouter.push({ path: "/pages/user/Login/index" });
}) })
.catch(res => { .catch(res => {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: "none", icon: 'none',
duration: 2000 duration: 2000,
}); })
}); })
}, },
async code() { async code() {
let that = this; let that = this
const { yphone } = that; const { yphone } = that
try { try {
await that await that
.$validator({ .$validator({
yphone: [ yphone: [required(required.message('手机号码')), chs_phone(chs_phone.message())],
required(required.message("手机号码")),
chs_phone(chs_phone.message())
]
}) })
.validate({ yphone }); .validate({ yphone })
} catch (e) { } catch (e) {
return validatorDefaultCatch(e); return validatorDefaultCatch(e)
} }
registerVerify({ phone: yphone }) registerVerify({ phone: yphone })
.then(res => { .then(res => {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: "none", icon: 'none',
duration: 2000 duration: 2000,
}); })
that.sendCode(); that.sendCode()
}) })
.catch(res => { .catch(res => {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: "none", icon: 'none',
duration: 2000 duration: 2000,
}); })
}); })
} },
} },
}; }
</script> </script>

2
pages/user/User/index.vue

@ -128,7 +128,7 @@
</template> </template>
<script> <script>
import { mapState, mapGetters, mapMutations, mapActions } from 'vuex' import { mapState, mapGetters, mapMutations, mapActions } from 'vuex'
import { getUserInfo, getMenuUser, bindingPhone } from '@/api/user' import { getUserInfo, getMenuUser, bindingPhone, wxappBindingPhone } from '@/api/user'
import { isWeixin, VUE_APP_RESOURCES_URL } from '@/utils' import { isWeixin, VUE_APP_RESOURCES_URL } from '@/utils'
import cookie from '@/utils/store/cookie' import cookie from '@/utils/store/cookie'
import SwitchWindow from '@/components/SwitchWindow' import SwitchWindow from '@/components/SwitchWindow'

Loading…
Cancel
Save