Browse Source

修改不兼容多平台的语法

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

1180
pages/activity/DargainDetails/index.vue

File diff suppressed because it is too large Load Diff

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) {

132
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)
title: '两次密码不一致', return uni.showToast({
icon: "none", title: '两次密码不一致',
duration: 2000 icon: 'none',
}); 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