登录方式重构
This commit is contained in:
@@ -403,6 +403,13 @@ export function wxappBindingPhone(data) {
|
|||||||
return request.post('wxapp/binding', data)
|
return request.post('wxapp/binding', data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序上传用户头像
|
||||||
|
*/
|
||||||
|
export function wxappGetUserInfo (data) {
|
||||||
|
return request.post('/wxapp/loginAuth', data)
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* h5切换公众号登陆
|
* h5切换公众号登陆
|
||||||
* */
|
* */
|
||||||
|
|||||||
@@ -85,7 +85,6 @@ export default {
|
|||||||
runTime() {
|
runTime() {
|
||||||
//时间函数
|
//时间函数
|
||||||
let intDiff = this.time - Date.parse(new Date()) / 1000 //获取数据中的时间戳的时间差
|
let intDiff = this.time - Date.parse(new Date()) / 1000 //获取数据中的时间戳的时间差
|
||||||
console.log(intDiff)
|
|
||||||
let day = 0,
|
let day = 0,
|
||||||
hour = 0,
|
hour = 0,
|
||||||
minute = 0,
|
minute = 0,
|
||||||
|
|||||||
+14
-12
@@ -135,7 +135,9 @@
|
|||||||
"mp-weixin" : {
|
"mp-weixin" : {
|
||||||
"appid" : "wx604d2ea4702620d2",
|
"appid" : "wx604d2ea4702620d2",
|
||||||
"setting" : {
|
"setting" : {
|
||||||
"urlCheck" : false
|
"urlCheck" : true,
|
||||||
|
"postcss" : true,
|
||||||
|
"minified" : false
|
||||||
},
|
},
|
||||||
"usingComponents" : true,
|
"usingComponents" : true,
|
||||||
"permission" : {
|
"permission" : {
|
||||||
@@ -165,17 +167,17 @@
|
|||||||
"title" : "yshop",
|
"title" : "yshop",
|
||||||
"devServer" : {
|
"devServer" : {
|
||||||
"disableHostCheck" : true,
|
"disableHostCheck" : true,
|
||||||
"proxy": {
|
"proxy" : {
|
||||||
"/h5api": {
|
"/h5api" : {
|
||||||
// 需要被代理的后台地址
|
// 需要被代理的后台地址
|
||||||
"target": "http://itxzz.top",
|
"target" : "http://itxzz.51vip.biz/",
|
||||||
"changeOrigin": true,
|
"changeOrigin" : true,
|
||||||
"secure": false,
|
"secure" : false,
|
||||||
"pathRewrite": {
|
"pathRewrite" : {
|
||||||
"^/h5api": "/api"
|
"^/h5api" : "/api"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"router" : {
|
"router" : {
|
||||||
"mode" : "history"
|
"mode" : "history"
|
||||||
|
|||||||
@@ -38,8 +38,8 @@
|
|||||||
<text class="num" v-text="bargainHelpCount.remainingPrice"></text>
|
<text class="num" v-text="bargainHelpCount.remainingPrice"></text>
|
||||||
</view>
|
</view>
|
||||||
<view class="acea-row row-middle">
|
<view class="acea-row row-middle">
|
||||||
<view class="successNum" v-text="'原价' + goodsDetail.price"></view>
|
<view class="successNum" v-text="`原价:${goodsDetail.price || 0}`"></view>
|
||||||
<view class="successNum" v-text="'已有' + bargainSumCount + '人砍价成功'"></view>
|
<view class="successNum" v-text="`已有${bargainSumCount || 0}人砍价成功`"></view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -51,9 +51,9 @@
|
|||||||
|
|
||||||
<!-- 砍价进度条下的金额 -->
|
<!-- 砍价进度条下的金额 -->
|
||||||
<view class="balance acea-row row-between-wrapper">
|
<view class="balance acea-row row-between-wrapper">
|
||||||
<view v-text="'已砍' + bargainHelpCount.alreadyPrice + '元'"></view>
|
<view v-text="`已砍${bargainHelpCount.alreadyPrice || 0}元`"></view>
|
||||||
<view v-if="bargainHelpCount.price === 0">砍价成功</view>
|
<view v-if="bargainHelpCount.price === 0">砍价成功</view>
|
||||||
<view v-else v-text="'还剩' + bargainHelpCount.price + '元'"></view>
|
<view v-else v-text="`还剩${bargainHelpCount.price || 0}元`"></view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 砍价成功:-->
|
<!-- 砍价成功:-->
|
||||||
|
|||||||
@@ -213,7 +213,10 @@ export default {
|
|||||||
height: 210rpx;
|
height: 210rpx;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
/* #ifdef H5 */
|
||||||
top: 80rpx;
|
top: 80rpx;
|
||||||
|
/* #endif */
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,7 +225,10 @@ export default {
|
|||||||
height: 120rpx;
|
height: 120rpx;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
/* #ifdef H5 */
|
||||||
top: 80rpx;
|
top: 80rpx;
|
||||||
|
/* #endif */
|
||||||
z-index: 3;
|
z-index: 3;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,11 +7,11 @@
|
|||||||
<view class="tui-price__box">
|
<view class="tui-price__box">
|
||||||
<view class="tui-goods-price">
|
<view class="tui-goods-price">
|
||||||
<view class="tui-size-24">¥</view>
|
<view class="tui-size-24">¥</view>
|
||||||
<view class="tui-price-large">{{ storeCombination.price.split('.')[0] }}</view>
|
<view class="tui-price-large">{{ storeCombination.price.split('.')[0] || 0 }}</view>
|
||||||
<view class="tui-size-24">.{{ storeCombination.price.split('.')[1] }}</view>
|
<view class="tui-size-24">.{{ storeCombination.price.split('.')[1] || 0 }}</view>
|
||||||
<!-- <text>已拼2020件</text> -->
|
<!-- <text>已拼2020件</text> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="tui-price-tag">{{ storeCombination.people }}人团</view>
|
<view class="tui-price-tag">{{ storeCombination.people || 0 }}人团</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -96,15 +96,14 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted: function() {
|
mounted() {
|
||||||
var that = this
|
|
||||||
let url = handleQrCode()
|
let url = handleQrCode()
|
||||||
if (url) {
|
if (url) {
|
||||||
that.pinkId = url.pinkId
|
this.pinkId = url.pinkId
|
||||||
} else {
|
} else {
|
||||||
that.pinkId = that.$yroute.query.id
|
this.pinkId = this.$yroute.query.id
|
||||||
}
|
}
|
||||||
that.getCombinationPink()
|
this.getCombinationPink()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
pay: function() {
|
pay: function() {
|
||||||
|
|||||||
@@ -18,22 +18,21 @@
|
|||||||
name: "Poster",
|
name: "Poster",
|
||||||
components: {},
|
components: {},
|
||||||
props: {},
|
props: {},
|
||||||
data: function () {
|
data () {
|
||||||
return {
|
return {
|
||||||
status: true,
|
status: true,
|
||||||
id: 0,
|
id: 0,
|
||||||
image: ""
|
image: ""
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted: function () {
|
mounted () {
|
||||||
var that = this;
|
var id = this.$yroute.query.id;
|
||||||
var id = that.$yroute.query.id;
|
var type = this.$yroute.query.type;
|
||||||
var type = that.$yroute.query.type;
|
this.id = id;
|
||||||
that.id = id;
|
|
||||||
if (type == 2) {
|
if (type == 2) {
|
||||||
that.getBargainPoster();
|
this.getBargainPoster();
|
||||||
} else {
|
} else {
|
||||||
that.getCombinationPoster();
|
this.getCombinationPoster();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@@ -6,10 +6,12 @@
|
|||||||
<view class="force-login__content y-f">
|
<view class="force-login__content y-f">
|
||||||
<open-data class="user-avatar" type="userAvatarUrl"></open-data>
|
<open-data class="user-avatar" type="userAvatarUrl"></open-data>
|
||||||
<open-data class="user-name" type="userNickName"></open-data>
|
<open-data class="user-name" type="userNickName"></open-data>
|
||||||
<view class="login-notice">为了提供更优质的服务,需要获取您的头像昵称</view>
|
<view class="login-notice">为了提供更优质的服务,请先登录</view>
|
||||||
<button class="cu-btn author-btn" v-if="canIUseGetUserProfile" @tap="getUserInfoProfile">授权并查看</button>
|
<button
|
||||||
<button class="cu-btn author-btn" v-else @getuserinfo="getUserInfo" open-type="getUserInfo">授权并查看</button>
|
class="cu-btn author-btn"
|
||||||
<button class="cu-btn close-btn" @tap="back">暂不授权</button>
|
open-type="getPhoneNumber"
|
||||||
|
@getphonenumber="phoneLogin">微信手机号一键登录</button>
|
||||||
|
<button class="cu-btn close-btn" @tap="back">暂不登录</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
@@ -27,10 +29,11 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapState, mapMutations, mapActions } from 'vuex'
|
import { mapState, mapMutations, mapActions } from 'vuex'
|
||||||
import { wxappAuth, getUser } from '@/api/user'
|
import { wxappAuth, getUser, getUserInfo } from '@/api/user'
|
||||||
|
import { login, authorize, getProvider } from '@/utils'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import cookie from '@/utils/store/cookie'
|
import cookie from '@/utils/store/cookie'
|
||||||
import { login, authorize } from '@/utils'
|
import store from '@/store'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
@@ -43,11 +46,8 @@ export default {
|
|||||||
...mapState(['isAuthorization', '$deviceType', 'token']),
|
...mapState(['isAuthorization', '$deviceType', 'token']),
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
console.log(wx.getUserProfile)
|
|
||||||
if (wx.getUserProfile) {
|
if (wx.getUserProfile) {
|
||||||
console.log(this)
|
|
||||||
this.canIUseGetUserProfile = true
|
this.canIUseGetUserProfile = true
|
||||||
console.log(this.canIUseGetUserProfile)
|
|
||||||
}
|
}
|
||||||
// // 先校验用户是否授权,如果没有授权,显示授权按钮
|
// // 先校验用户是否授权,如果没有授权,显示授权按钮
|
||||||
},
|
},
|
||||||
@@ -74,9 +74,9 @@ export default {
|
|||||||
query: {},
|
query: {},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getUserInfo(data) {
|
getUserInfoBtn(data) {
|
||||||
console.log(data)
|
console.log(data)
|
||||||
console.log('getUserInfo')
|
console.log('getUserInfoBtn')
|
||||||
if (data.detail.errMsg == 'getUserInfo:fail auth deny') {
|
if (data.detail.errMsg == 'getUserInfo:fail auth deny') {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '取消授权',
|
title: '取消授权',
|
||||||
@@ -106,13 +106,14 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 申请获取用户信息
|
||||||
getUserInfoProfile(data) {
|
getUserInfoProfile(data) {
|
||||||
console.log('getUserInfoProfile')
|
console.log('getUserInfoProfile')
|
||||||
wx.getUserProfile({
|
wx.getUserProfile({
|
||||||
lang: 'zh_CN',
|
lang: 'zh_CN',
|
||||||
desc: '需要获取您的信息用来展示',
|
desc: '需要获取您的信息用来展示',
|
||||||
success: res => {
|
success: res => {
|
||||||
console.log(res)
|
console.log('用户信息',res)
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '登录中',
|
title: '登录中',
|
||||||
})
|
})
|
||||||
@@ -134,10 +135,67 @@ export default {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
// 微信用户手机号登录
|
||||||
|
phoneLogin(e) {
|
||||||
|
console.log('用户微信手机号登录')
|
||||||
|
if (e.mp.detail.errMsg == 'getPhoneNumber:ok') {
|
||||||
|
console.log(e.mp.detail)
|
||||||
|
getProvider()
|
||||||
|
.then(provider => {
|
||||||
|
console.log('当前的环境商',provider)
|
||||||
|
if (!provider) {
|
||||||
|
reject()
|
||||||
|
}
|
||||||
|
// uni登录
|
||||||
|
uni.login({
|
||||||
|
provider: provider,
|
||||||
|
success: async function(loginRes) {
|
||||||
|
console.log(loginRes)
|
||||||
|
let code = loginRes.code // 获取开发code
|
||||||
|
cookie.set('wxLoginCode', loginRes.code)
|
||||||
|
wxappAuth({
|
||||||
|
encryptedData: e.mp.detail.encryptedData,
|
||||||
|
iv: e.mp.detail.iv,
|
||||||
|
code: code,
|
||||||
|
spread: cookie.get('spread'),
|
||||||
|
})
|
||||||
|
.then( res => {
|
||||||
|
console.log('登录成功,开始处理登录信息保存,并获取用户详情')
|
||||||
|
uni.hideLoading()
|
||||||
|
store.commit('login', res.data.token, dayjs(res.data.expires_time))
|
||||||
|
store.dispatch('userInfo', true)
|
||||||
|
getUserInfo()
|
||||||
|
.then(user => {
|
||||||
|
console.log('获取用户信息成功')
|
||||||
|
uni.setStorageSync('uid', user.data.uid)
|
||||||
|
store.dispatch('setUserInfo', user.data)
|
||||||
|
this.$yrouter.reLaunch({
|
||||||
|
path: cookie.get('redirect').replace(/\ /g, ''),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.log('获取用户信息失败')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.log(error)
|
||||||
|
console.log('登录接口调用失败')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(err => {})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '已拒绝授权',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (wx.getUserProfile) {
|
if (wx.getUserProfile) {
|
||||||
console.log(this)
|
|
||||||
this.canIUseGetUserProfile = true
|
this.canIUseGetUserProfile = true
|
||||||
console.log(this.canIUseGetUserProfile)
|
console.log(this.canIUseGetUserProfile)
|
||||||
}
|
}
|
||||||
|
|||||||
+55
-32
@@ -19,36 +19,52 @@
|
|||||||
</view>
|
</view>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
</view>
|
</view>
|
||||||
<Banner v-if="item.type == 'banner'" :detail="item.componentContent.bannerData" @getbgcolor="getbgcolor"></Banner>
|
<Banner v-if="item.type == 'banner'"
|
||||||
<uni-notice-bar v-if="item.type == 'noticeBar'" scrollable="true" @click="goRoll(item.componentContent.roll[0])" single="true" :speed="10" showIcon="true" :text="item.componentContent.roll[0].info"></uni-notice-bar>
|
:detail="item.componentContent.bannerData"
|
||||||
<view class="content_box home_content_box" v-if="item.type == 'menu' && item.componentContent.menus">
|
@getbgcolor="getbgcolor"></Banner>
|
||||||
|
<uni-notice-bar
|
||||||
|
v-if="item.type == 'noticeBar'"
|
||||||
|
scrollable="true"
|
||||||
|
@click="goRoll(item.componentContent.roll[0])"
|
||||||
|
single="true" :speed="10"
|
||||||
|
showIcon="true"
|
||||||
|
:text="item.componentContent.roll[0].info"></uni-notice-bar>
|
||||||
|
<view class="content_box home_content_box"
|
||||||
|
v-if="item.type == 'menu' && item.componentContent.menus">
|
||||||
<!-- 菜单 -->
|
<!-- 菜单 -->
|
||||||
<Menu :list="item.componentContent.menus"></Menu>
|
<Menu :list="item.componentContent.menus"></Menu>
|
||||||
</view>
|
</view>
|
||||||
<!-- 滚动新闻 -->
|
<!-- 滚动新闻 -->
|
||||||
<!-- 广告 -->
|
<!-- 广告 -->
|
||||||
<Adv v-if="item.type == 'adv' && item.componentContent.detail" :detail="item.componentContent.detail" />
|
<Adv v-if="item.type == 'adv' && item.componentContent.detail"
|
||||||
|
:detail="item.componentContent.detail" />
|
||||||
<!-- 热门榜单 -->
|
<!-- 热门榜单 -->
|
||||||
<HotCommodity v-if="item.type == 'hotCommodity'" :detail="likeInfo"></HotCommodity>
|
<HotCommodity v-if="item.type == 'hotCommodity'"
|
||||||
|
:detail="likeInfo" />
|
||||||
<!-- 超值拼团 -->
|
<!-- 超值拼团 -->
|
||||||
<Groupon v-if="item.type == 'groupon'" :detail="combinationList" />
|
<Groupon v-if="item.type == 'groupon'" :detail="combinationList" />
|
||||||
<!-- 首发新品->秒杀 -->
|
<!-- 首发新品->秒杀 -->
|
||||||
<FirstNewProduct v-if="item.type == 'firstNewProduct'" :detail="firstList"></FirstNewProduct>
|
<FirstNewProduct v-if="item.type == 'firstNewProduct'"
|
||||||
|
:detail="firstList" />
|
||||||
<!-- 精品推荐 -->
|
<!-- 精品推荐 -->
|
||||||
<ProductsRecommended v-if="item.type == 'productsRecommended'" :detail="bastList"></ProductsRecommended>
|
<ProductsRecommended v-if="item.type == 'productsRecommended'"
|
||||||
|
:detail="bastList" />
|
||||||
<!-- 促销单品 -->
|
<!-- 促销单品 -->
|
||||||
<PromoteProduct v-if="item.type == 'promoteProduct'" :detail="benefit"></PromoteProduct>
|
<PromoteProduct v-if="item.type == 'promoteProduct'"
|
||||||
|
:detail="benefit" />
|
||||||
<!-- 直播 -->
|
<!-- 直播 -->
|
||||||
<!-- #ifdef MP-WEIXIN -->
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
<Live v-if="item.type == 'live'" :detail="live"></Live>
|
<Live v-if="item.type == 'live'" :detail="live" />
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
<!-- 为您推荐 -->
|
<!-- 为您推荐 -->
|
||||||
<PromotionGood v-if="item.type == 'promotionGood'" :benefit="benefit"></PromotionGood>
|
<PromotionGood v-if="item.type == 'promotionGood'" :benefit="benefit" />
|
||||||
<Coupon-window :coupon-list="couponList" v-if="showCoupon" @checked="couponClose" @close="couponClose"> </Coupon-window>
|
<Coupon-window
|
||||||
|
:coupon-list="couponList"
|
||||||
|
v-if="showCoupon"
|
||||||
|
@checked="couponClose" @close="couponClose" />
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="demo" style='height:100rpx'></view> -->
|
<!-- #ifdef H5 -->
|
||||||
<!-- #ifndef APP-PLUS -->
|
<view class="bottomSpace" style='line-height:100rpx'>正在使用H5方式浏览</view>
|
||||||
<view class="bottomSpace" style='line-height:100rpx'>PC</view>
|
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -182,6 +198,7 @@ export default {
|
|||||||
observeParents: true,
|
observeParents: true,
|
||||||
},
|
},
|
||||||
bgImage: '',
|
bgImage: '',
|
||||||
|
// indexTitle: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -198,34 +215,40 @@ export default {
|
|||||||
return style
|
return style
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
onLoad: function() {
|
onLoad() {
|
||||||
this.getLocation()
|
this.getLocation()
|
||||||
let that = this
|
|
||||||
// uni.showLoading({
|
// uni.showLoading({
|
||||||
// title: "加载中",
|
// title: "加载中",
|
||||||
// });
|
// });
|
||||||
getCanvas()
|
getCanvas()
|
||||||
.then(res => {})
|
.then(res => {
|
||||||
|
console.log('223',res)
|
||||||
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
|
if (!error) {
|
||||||
|
return
|
||||||
|
}
|
||||||
this.homeData = JSON.parse(error.data.json)
|
this.homeData = JSON.parse(error.data.json)
|
||||||
console.log(this.homeData)
|
console.log('225',this.homeData)
|
||||||
console.log(222)
|
|
||||||
})
|
})
|
||||||
getHomeData().then(res => {
|
getHomeData().then(res => {
|
||||||
that.logoUrl = res.data.logoUrl
|
this.logoUrl = res.data.logoUrl
|
||||||
res.data.banner.map(item => (item.bgcolor = item.color || ''))
|
res.data.banner.forEach(item => (item.bgcolor = item.color || ''))
|
||||||
that.$set(that, 'info', res.data.info)
|
this.info = res.data.info
|
||||||
that.$set(that, 'firstList', res.data.firstList)
|
console.log('239', res.data.info)
|
||||||
that.$set(that, 'bastList', res.data.bastList)
|
console.log('239',this.info)
|
||||||
that.$set(that, 'likeInfo', res.data.likeInfo)
|
this.$set(this, 'info', res.data.info)
|
||||||
that.$set(that, 'live', res.data.liveList)
|
this.$set(this, 'firstList', res.data.firstList)
|
||||||
that.$set(that, 'lovely', res.data.lovely)
|
this.$set(this, 'bastList', res.data.bastList)
|
||||||
that.$set(that, 'benefit', res.data.benefit)
|
this.$set(this, 'likeInfo', res.data.likeInfo)
|
||||||
that.$set(that, 'couponList', res.data.couponList)
|
this.$set(this, 'live', res.data.liveList)
|
||||||
that.$set(that, 'combinationList', res.data.combinationList)
|
this.$set(this, 'lovely', res.data.lovely)
|
||||||
|
this.$set(this, 'benefit', res.data.benefit)
|
||||||
|
this.$set(this, 'couponList', res.data.couponList)
|
||||||
|
this.$set(this, 'combinationList', res.data.combinationList)
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
that.setOpenShare()
|
this.setOpenShare()
|
||||||
// that.doColorThief()
|
// this.doColorThief()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<view class="header bg-color-red acea-row row-middle" :class="refundOrder ? 'on' : ''">
|
<view class="header bg-color-red acea-row row-middle" :class="refundOrder ? 'on' : ''">
|
||||||
<view class="data" :class="refundOrder ? 'on' : ''">
|
<view class="data" :class="refundOrder ? 'on' : ''">
|
||||||
<view class="state">{{ orderInfo._status._msg }}</view>
|
<view class="state">{{ orderInfo._status._msg }}</view>
|
||||||
<view>{{ orderInfo.createTime }}</view>
|
<view>{{ orderInfo.createTime || '' }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<template v-if="!refundOrder">
|
<template v-if="!refundOrder">
|
||||||
@@ -24,14 +24,18 @@
|
|||||||
: 'icon-yuandianxiao',
|
: 'icon-yuandianxiao',
|
||||||
status.type >= 0 ? 'font-color-red' : ''
|
status.type >= 0 ? 'font-color-red' : ''
|
||||||
]"></view>
|
]"></view>
|
||||||
<view class="line" :class="{ 'bg-color-red': status.type > 0 && status.type != 9 }"></view>
|
<view class="line" :class="{
|
||||||
|
'bg-color-red': status.type > 0 && status.type != 9
|
||||||
|
}"></view>
|
||||||
<view class="iconfont" :class="[
|
<view class="iconfont" :class="[
|
||||||
status.type === 1 ? 'icon-webicon318' : 'icon-yuandianxiao',
|
status.type === 1 ? 'icon-webicon318' : 'icon-yuandianxiao',
|
||||||
status.type >= 1 && status.type != 6 && status.type != 9
|
status.type >= 1 && status.type != 6 && status.type != 9
|
||||||
? 'font-color-red'
|
? 'font-color-red'
|
||||||
: ''
|
: ''
|
||||||
]"></view>
|
]"></view>
|
||||||
<view class="line" :class="{'bg-color-red':status.type > 1 && status.type != 6 && status.type != 9}"
|
<view class="line" :class="{
|
||||||
|
'bg-color-red':status.type > 1 && status.type != 6 && status.type != 9
|
||||||
|
}"
|
||||||
v-if="orderInfo.shippingType === 1"></view>
|
v-if="orderInfo.shippingType === 1"></view>
|
||||||
<view class="iconfont"
|
<view class="iconfont"
|
||||||
:class="[status.type === 2 ? 'icon-webicon318' : 'icon-yuandianxiao',status.type >= 2 && status.type != 6 && status.type != 9? 'font-color-red': '']"
|
:class="[status.type === 2 ? 'icon-webicon318' : 'icon-yuandianxiao',status.type >= 2 && status.type != 6 && status.type != 9? 'font-color-red': '']"
|
||||||
@@ -47,8 +51,7 @@
|
|||||||
: ''
|
: ''
|
||||||
]"></view>
|
]"></view>
|
||||||
<view class="line" :class="{
|
<view class="line" :class="{
|
||||||
'bg-color-red':
|
'bg-color-red': status.type > 3 && status.type != 6 && status.type != 9
|
||||||
status.type > 3 && status.type != 6 && status.type != 9
|
|
||||||
}"></view>
|
}"></view>
|
||||||
<view class="iconfont" :class="[
|
<view class="iconfont" :class="[
|
||||||
status.type == 4 ? 'icon-webicon318' : 'icon-yuandianxiao',
|
status.type == 4 ? 'icon-webicon318' : 'icon-yuandianxiao',
|
||||||
@@ -105,8 +108,9 @@
|
|||||||
<div class="name">
|
<div class="name">
|
||||||
{{ system_store.name}}
|
{{ system_store.name}}
|
||||||
<span class="phone">{{ system_store.phone }}</span>
|
<span class="phone">{{ system_store.phone }}</span>
|
||||||
<span @click="telPhone(system_store.phone)" class="iconfont icon-tonghua font-color-red"
|
<span @click="telPhone(system_store.phone)"
|
||||||
:href="'tel:' + system_store.phone"></span>
|
class="iconfont icon-tonghua font-color-red"
|
||||||
|
:href="'tel:' + system_store.phone"></span>
|
||||||
</div>
|
</div>
|
||||||
<div>{{ system_store.address }}</div>
|
<div>{{ system_store.address }}</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -119,19 +123,19 @@
|
|||||||
<view class="item acea-row row-between">
|
<view class="item acea-row row-between">
|
||||||
<view>订单编号:</view>
|
<view>订单编号:</view>
|
||||||
<view class="conter acea-row row-middle row-right">
|
<view class="conter acea-row row-middle row-right">
|
||||||
{{ orderInfo.orderId }}
|
{{ orderInfo.orderId || '' }}
|
||||||
<!-- #ifndef H5 -->
|
<!-- #ifndef H5 -->
|
||||||
<text class="copy copy-data" @click="copyClipboard(orderInfo.orderId)">复制</text>
|
<text class="copy copy-data" @click="copyClipboard(orderInfo.orderId)">复制</text>
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item acea-row row-between">
|
<view class="item acea-row row-between">
|
||||||
<view>下单时间:</view>
|
<view>下单时间:</view>
|
||||||
<view class="conter">{{ orderInfo.createTime }}</view>
|
<view class="conter">{{ orderInfo.createTime || '' }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item acea-row row-between">
|
<view class="item acea-row row-between">
|
||||||
<view>订单类型:</view>
|
<view>订单类型:</view>
|
||||||
<view class="conter">{{ orderTypeName }}</view>
|
<view class="conter">{{ orderTypeName || '' }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item acea-row row-between">
|
<view class="item acea-row row-between">
|
||||||
<view>支付状态:</view>
|
<view>支付状态:</view>
|
||||||
@@ -139,11 +143,11 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="item acea-row row-between">
|
<view class="item acea-row row-between">
|
||||||
<view>支付方式:</view>
|
<view>支付方式:</view>
|
||||||
<view class="conter">{{ orderInfo._status._payType }}</view>
|
<view class="conter">{{ orderInfo._status._payType || '' }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item acea-row row-between" v-if="orderInfo.mark">
|
<view class="item acea-row row-between" v-if="orderInfo.mark">
|
||||||
<view>买家留言:</view>
|
<view>买家留言:</view>
|
||||||
<view class="conter">{{ orderInfo.mark }}</view>
|
<view class="conter">{{ orderInfo.mark || '' }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -185,42 +189,42 @@
|
|||||||
<view class="wrapper" v-if="refundOrder">
|
<view class="wrapper" v-if="refundOrder">
|
||||||
<view class="item acea-row row-between">
|
<view class="item acea-row row-between">
|
||||||
<view>收货人:</view>
|
<view>收货人:</view>
|
||||||
<view class="conter">{{ orderInfo.realName }}</view>
|
<view class="conter">{{ orderInfo.realName || '' }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item acea-row row-between">
|
<view class="item acea-row row-between">
|
||||||
<view>联系电话:</view>
|
<view>联系电话:</view>
|
||||||
<view class="conter">{{ orderInfo.userPhone }}</view>
|
<view class="conter">{{ orderInfo.userPhone || '' }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item acea-row row-between">
|
<view class="item acea-row row-between">
|
||||||
<view>收货地址:</view>
|
<view>收货地址:</view>
|
||||||
<view class="conter">{{ orderInfo.userAddress }}</view>
|
<view class="conter">{{ orderInfo.userAddress || '' }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="wrapper">
|
<view class="wrapper">
|
||||||
<view class="item acea-row row-between" v-if="!isIntegral">
|
<view class="item acea-row row-between" v-if="!isIntegral">
|
||||||
<view>支付金额:</view>
|
<view>支付金额:</view>
|
||||||
<view class="conter">¥{{ orderInfo.totalPrice }}</view>
|
<view class="conter">¥{{ orderInfo.totalPrice || 0 }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item acea-row row-between" v-if="isIntegral">
|
<view class="item acea-row row-between" v-if="isIntegral">
|
||||||
<view>支付积分:</view>
|
<view>支付积分:</view>
|
||||||
<view class="conter">{{ orderInfo.payIntegral }}积分</view>
|
<view class="conter">{{ orderInfo.payIntegral || 0 }}积分</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item acea-row row-between" v-if="orderInfo.couponPrice > 0">
|
<view class="item acea-row row-between" v-if="orderInfo.couponPrice > 0">
|
||||||
<view>优惠券抵扣:</view>
|
<view>优惠券抵扣:</view>
|
||||||
<view class="conter">-¥{{ orderInfo.couponPrice }}</view>
|
<view class="conter">-¥{{ orderInfo.couponPrice ||0 }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item acea-row row-between" v-if="orderInfo.useIntegral > 0">
|
<view class="item acea-row row-between" v-if="orderInfo.useIntegral > 0">
|
||||||
<view>积分抵扣:</view>
|
<view>积分抵扣:</view>
|
||||||
<view class="conter">-¥{{ orderInfo.deductionPrice }}</view>
|
<view class="conter">-¥{{ orderInfo.deductionPrice || 0 }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item acea-row row-between" v-if="orderInfo.payPostage > 0">
|
<view class="item acea-row row-between" v-if="orderInfo.payPostage > 0">
|
||||||
<view>运费:</view>
|
<view>运费:</view>
|
||||||
<view class="conter">¥{{ orderInfo.payPostage }}</view>
|
<view class="conter">¥{{ orderInfo.payPostage || 0 }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="actualPay acea-row row-right">
|
<view class="actualPay acea-row row-right">
|
||||||
实付款:
|
实付款:
|
||||||
<text class="money font-color-red" v-if="!isIntegral">¥{{ orderInfo.payPrice }}</text>
|
<text class="money font-color-red" v-if="!isIntegral">¥{{ orderInfo.payPrice || 0 }}</text>
|
||||||
<text class="money font-color-red" v-if="isIntegral">{{ orderInfo.payIntegral }}积分</text>
|
<text class="money font-color-red" v-if="isIntegral">{{ orderInfo.payIntegral || 0 }}积分</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view style="height:100rpx;" v-if="!refundOrder && offlineStatus"></view>
|
<view style="height:100rpx;" v-if="!refundOrder && offlineStatus"></view>
|
||||||
@@ -494,7 +498,6 @@
|
|||||||
},
|
},
|
||||||
async toPay(type) {
|
async toPay(type) {
|
||||||
var that = this;
|
var that = this;
|
||||||
console.log(type, "支付方式");
|
|
||||||
await payOrderHandle(this.orderInfo.orderId, type, that.from);
|
await payOrderHandle(this.orderInfo.orderId, type, that.from);
|
||||||
that.getDetail();
|
that.getDetail();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -62,8 +62,12 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<Loading :loaded="loaded" :loading="loading"></Loading>
|
<Loading :loaded="loaded" :loading="loading"></Loading>
|
||||||
<PriceChange :change="change" :orderInfo="orderInfo" v-on:closechange="changeclose($event)" v-on:savePrice="savePrice"
|
<PriceChange
|
||||||
:status="status"></PriceChange>
|
:change="change"
|
||||||
|
:orderInfo="orderInfo"
|
||||||
|
v-on:closechange="changeclose($event)"
|
||||||
|
v-on:savePrice="savePrice"
|
||||||
|
:status="status"></PriceChange>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -72,37 +72,34 @@ export default {
|
|||||||
!this.loading && this.getProductReplyList();
|
!this.loading && this.getProductReplyList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getProductReplyCount: function() {
|
getProductReplyCount () {
|
||||||
let that = this;
|
getReplyConfig(this.product_id).then(res => {
|
||||||
getReplyConfig(that.product_id).then(res => {
|
this.$set(that, "replyData", res.data);
|
||||||
that.$set(that, "replyData", res.data);
|
this.navList[0].num = res.data.sumCount;
|
||||||
that.navList[0].num = res.data.sumCount;
|
this.navList[1].num = res.data.goodCount;
|
||||||
that.navList[1].num = res.data.goodCount;
|
this.navList[2].num = res.data.inCount;
|
||||||
that.navList[2].num = res.data.inCount;
|
this.navList[3].num = res.data.poorCount;
|
||||||
that.navList[3].num = res.data.poorCount;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getProductReplyList: function() {
|
getProductReplyList () {
|
||||||
let that = this;
|
if (this.loading) return; //阻止下次请求(false可以进行请求);
|
||||||
if (that.loading) return; //阻止下次请求(false可以进行请求);
|
if (this.loadend) return; //阻止结束当前请求(false可以进行请求);
|
||||||
if (that.loadend) return; //阻止结束当前请求(false可以进行请求);
|
this.loading = true;
|
||||||
that.loading = true;
|
let q = { page: this.page, limit: this.limit, type: this.currentActive };
|
||||||
let q = { page: that.page, limit: that.limit, type: that.currentActive };
|
getReplyList(this.product_id, q).then(res => {
|
||||||
getReplyList(that.product_id, q).then(res => {
|
this.loading = false;
|
||||||
that.loading = false;
|
|
||||||
//apply();js将一个数组插入另一个数组;
|
//apply();js将一个数组插入另一个数组;
|
||||||
that.reply.push.apply(that.reply, res.data);
|
this.reply.push.apply(this.reply, res.data);
|
||||||
that.loadend = res.data.length < that.limit; //判断所有数据是否加载完成;
|
this.loadend = res.data.length < this.limit; //判断所有数据是否加载完成;
|
||||||
that.page = that.page + 1;
|
this.page = this.page + 1;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
changeType: function(index) {
|
changeType (index) {
|
||||||
let that = this;
|
this.currentActive = index;
|
||||||
that.currentActive = index;
|
this.page = 1;
|
||||||
that.page = 1;
|
this.loadend = false;
|
||||||
that.loadend = false;
|
this.$set(this, "reply", []);
|
||||||
that.$set(that, "reply", []);
|
this.getProductReplyList();
|
||||||
that.getProductReplyList();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ export default {
|
|||||||
nows: false,
|
nows: false,
|
||||||
recommendLoading: false,
|
recommendLoading: false,
|
||||||
target: false,
|
target: false,
|
||||||
isIntegral: false,
|
isIntegral: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@@ -193,10 +193,11 @@ export default {
|
|||||||
this.loading = false
|
this.loading = false
|
||||||
if (this.target) {
|
if (this.target) {
|
||||||
this.productList = res.data
|
this.productList = res.data
|
||||||
|
this.target = false
|
||||||
} else {
|
} else {
|
||||||
this.productList.push.apply(this.productList, res.data)
|
this.productList.push.apply(this.productList, res.data)
|
||||||
}
|
}
|
||||||
this.target = false
|
console.log(this.target)
|
||||||
this.loadend = res.data.length < this.where.limit //判断所有数据是否加载完成;
|
this.loadend = res.data.length < this.where.limit //判断所有数据是否加载完成;
|
||||||
this.where.page = this.where.page + 1
|
this.where.page = this.where.page + 1
|
||||||
})
|
})
|
||||||
@@ -209,60 +210,78 @@ export default {
|
|||||||
this.getProductList()
|
this.getProductList()
|
||||||
},
|
},
|
||||||
//点击事件处理
|
//点击事件处理
|
||||||
set_where: function(index) {
|
set_where(index) {
|
||||||
let that = this
|
this.productList = []
|
||||||
switch (index) {
|
this.$set(this, 'productList', [])
|
||||||
case 0:
|
this.where.page = 1
|
||||||
return that.$yrouter.push({
|
this.target = true
|
||||||
path: '/pages/shop/GoodsClass/index',
|
this.loadend = false
|
||||||
})
|
|
||||||
case 1:
|
switch (index) {
|
||||||
if (that.price === 0) that.price = 1
|
case 0:
|
||||||
else if (that.price === 1) that.price = 2
|
return this.$yrouter.push({
|
||||||
else if (that.price === 2) that.price = 0
|
path: '/pages/shop/GoodsClass/index',
|
||||||
that.stock = 0
|
})
|
||||||
break
|
case 1:
|
||||||
case 2:
|
if (this.price === 0) this.price = 1
|
||||||
if (that.stock === 0) that.stock = 1
|
else if (this.price === 1) this.price = 2
|
||||||
else if (that.stock === 1) that.stock = 2
|
else if (this.price === 2) this.price = 0
|
||||||
else if (that.stock === 2) that.stock = 0
|
this.stock = 0
|
||||||
that.price = 0
|
break
|
||||||
break
|
case 2:
|
||||||
case 3:
|
if (this.stock === 0) this.stock = 1
|
||||||
that.nows = !that.nows
|
else if (this.stock === 1) this.stock = 2
|
||||||
break
|
else if (this.stock === 2) this.stock = 0
|
||||||
default:
|
this.price = 0
|
||||||
break
|
break
|
||||||
}
|
case 3:
|
||||||
this.productList = []
|
this.nows = !this.nows
|
||||||
that.$set(that, 'productList', [])
|
break
|
||||||
that.where.page = 1
|
default:
|
||||||
that.target = true
|
break
|
||||||
that.loadend = false
|
}
|
||||||
that.getProductList()
|
// this.getProductList()
|
||||||
|
this.setWhere()
|
||||||
|
const { s = '', id = 0, title = '' } = this.$yroute.query
|
||||||
|
if (s !== this.where.keyword || id !== this.where.sid) {
|
||||||
|
this.loadend = false
|
||||||
|
this.loading = false
|
||||||
|
this.where.page = 1
|
||||||
|
this.where.sid = id
|
||||||
|
this.title = title && id ? title : ''
|
||||||
|
this.nows = false
|
||||||
|
this.$set(this, 'productList', [])
|
||||||
|
this.price = 0
|
||||||
|
this.stock = 0
|
||||||
|
// this.getProductList();
|
||||||
|
}
|
||||||
|
let q = this.where
|
||||||
|
let getData = this.isIntegral !== 'true' ? getProducts : getProductsIntegral
|
||||||
|
getData(this.where).then(res => {
|
||||||
|
this.loading = false
|
||||||
|
this.productList = res.data
|
||||||
|
})
|
||||||
},
|
},
|
||||||
//设置where条件
|
//设置where条件
|
||||||
setWhere: function() {
|
setWhere() {
|
||||||
let that = this
|
if (this.price === 0) {
|
||||||
if (that.price === 0) {
|
this.where.priceOrder = ''
|
||||||
that.where.priceOrder = ''
|
} else if (this.price === 1) {
|
||||||
} else if (that.price === 1) {
|
this.where.priceOrder = 'asc'
|
||||||
that.where.priceOrder = 'asc'
|
} else if (this.price === 2) {
|
||||||
} else if (that.price === 2) {
|
this.where.priceOrder = 'desc'
|
||||||
that.where.priceOrder = 'desc'
|
|
||||||
}
|
}
|
||||||
if (that.stock === 0) {
|
if (this.stock === 0) {
|
||||||
that.where.salesOrder = ''
|
this.where.salesOrder = ''
|
||||||
} else if (that.stock === 1) {
|
} else if (this.stock === 1) {
|
||||||
that.where.salesOrder = 'asc'
|
this.where.salesOrder = 'asc'
|
||||||
} else if (that.stock === 2) {
|
} else if (this.stock === 2) {
|
||||||
that.where.salesOrder = 'desc'
|
this.where.salesOrder = 'desc'
|
||||||
}
|
}
|
||||||
that.where.news = that.nows ? '1' : '0'
|
this.where.news = this.nows ? '1' : '0'
|
||||||
},
|
},
|
||||||
switchTap: function() {
|
switchTap() {
|
||||||
let that = this
|
this.Switch = !this.Switch
|
||||||
that.Switch = !that.Switch
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
+57
-61
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="register absolute">
|
<view class="register absolute">
|
||||||
<view class="whiteBg" v-if="formItem === 1">
|
<view class="whiteBg" v-if="formItem === 1">
|
||||||
<view class="title acea-row row-between-wrapper">
|
<view class="title acea-row">
|
||||||
<view class="item" :class="current === index ? 'on' : ''" v-for="(item, index) in navList"
|
<view class="item" :class="current === index ? 'on' : ''" v-for="(item, index) in navList"
|
||||||
@click="navTap(index)" :key="index">{{ item }}</view>
|
@click="navTap(index)" :key="index">{{ item }}</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -9,42 +9,32 @@
|
|||||||
<form @submit.prevent="submit">
|
<form @submit.prevent="submit">
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="acea-row row-between-wrapper">
|
<view class="acea-row row-between-wrapper">
|
||||||
<!-- <svg class="icon" aria-hidden="true">
|
<input type="text" placeholder="输入手机号码"
|
||||||
<use xlink:href="#icon-phone_" />
|
v-model="account" required
|
||||||
</svg>-->
|
@input="checkPhone"/>
|
||||||
<input type="text" placeholder="输入手机号码" v-model="account" required />
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item" v-if="account.length === 11">
|
||||||
<view class="acea-row row-between-wrapper">
|
<view class="acea-row row-between-wrapper">
|
||||||
<!-- <svg class="icon" aria-hidden="true">
|
|
||||||
<use xlink:href="#icon-code_" />
|
|
||||||
</svg>-->
|
|
||||||
<input type="password" placeholder="填写登录密码" v-model="password" required />
|
<input type="password" placeholder="填写登录密码" v-model="password" required />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</form>
|
</form>
|
||||||
</view>
|
</view>
|
||||||
<view class="list" :hidden="current !== 1">
|
<!-- <view class="list" :hidden="current !== 1">
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="acea-row row-between-wrapper">
|
<view class="acea-row row-between-wrapper">
|
||||||
<!-- <svg class="icon" aria-hidden="true">
|
|
||||||
<use xlink:href="#icon-phone_" />
|
|
||||||
</svg>-->
|
|
||||||
<input type="text" placeholder="输入手机号码" v-model="account" />
|
<input type="text" placeholder="输入手机号码" v-model="account" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="align-left">
|
<view class="align-left">
|
||||||
<!-- <svg class="icon" aria-hidden="true">
|
|
||||||
<use xlink:href="#icon-code_1" />
|
|
||||||
</svg>-->
|
|
||||||
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
|
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
|
||||||
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''"
|
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''"
|
||||||
@click="code">{{ text }}</button>
|
@click="code">{{ text }}</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view> -->
|
||||||
<view class="logon" @click="loginMobile" :hidden="current !== 1">登录</view>
|
<view class="logon" @click="loginMobile" :hidden="current !== 1">登录</view>
|
||||||
<view class="logon" @click="submit" :hidden="current === 1">登录</view>
|
<view class="logon" @click="submit" :hidden="current === 1">登录</view>
|
||||||
<view class="tip">
|
<view class="tip">
|
||||||
@@ -52,6 +42,7 @@
|
|||||||
<text @click="formItem = 2" class="font-color-red">立即注册</text>
|
<text @click="formItem = 2" class="font-color-red">立即注册</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- 注册 -->
|
||||||
<view class="whiteBg" v-else>
|
<view class="whiteBg" v-else>
|
||||||
<view class="title acea-row row-between-wrapper">
|
<view class="title acea-row row-between-wrapper">
|
||||||
<view class="item on">注册账号</view>
|
<view class="item on">注册账号</view>
|
||||||
@@ -133,7 +124,7 @@
|
|||||||
mixins: [sendVerifyCode],
|
mixins: [sendVerifyCode],
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
navList: ["账号登录"],
|
navList: ["手机号登录"],
|
||||||
current: 0,
|
current: 0,
|
||||||
account: "",
|
account: "",
|
||||||
password: "",
|
password: "",
|
||||||
@@ -144,49 +135,54 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async loginMobile() {
|
checkPhone(e) {
|
||||||
var that = this;
|
if (e.target.value.length === 11) {
|
||||||
const {
|
console.log('手机号')
|
||||||
account,
|
}
|
||||||
captcha
|
},
|
||||||
} = that;
|
async loginMobile() {
|
||||||
try {
|
var that = this;
|
||||||
await that
|
const {
|
||||||
.$validator({
|
account,
|
||||||
account: [
|
captcha
|
||||||
required(required.message("手机号码")),
|
} = that;
|
||||||
chs_phone(chs_phone.message())
|
try {
|
||||||
],
|
await that
|
||||||
captcha: [
|
.$validator({
|
||||||
required(required.message("验证码")),
|
account: [
|
||||||
alpha_num(alpha_num.message("验证码"))
|
required(required.message("手机号码")),
|
||||||
]
|
chs_phone(chs_phone.message())
|
||||||
})
|
],
|
||||||
.validate({
|
captcha: [
|
||||||
account,
|
required(required.message("验证码")),
|
||||||
captcha
|
alpha_num(alpha_num.message("验证码"))
|
||||||
});
|
]
|
||||||
} catch (e) {
|
})
|
||||||
return validatorDefaultCatch(e);
|
.validate({
|
||||||
}
|
account,
|
||||||
loginMobile({
|
captcha
|
||||||
phone: that.account,
|
});
|
||||||
captcha: that.captcha,
|
} catch (e) {
|
||||||
spread: cookie.get("spread")
|
return validatorDefaultCatch(e);
|
||||||
})
|
}
|
||||||
.then(res => {
|
loginMobile({
|
||||||
var data = res.data;
|
phone: that.account,
|
||||||
that.$store.commit("login", data.token, dayjs(data.expires_time));
|
captcha: that.captcha,
|
||||||
handleGetUserInfo();
|
spread: cookie.get("spread")
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.then(res => {
|
||||||
uni.showToast({
|
var data = res.data;
|
||||||
title: err.msg || err.response.data.msg || err.response.data.message,
|
that.$store.commit("login", data.token, dayjs(data.expires_time));
|
||||||
icon: "none",
|
handleGetUserInfo();
|
||||||
duration: 2000
|
})
|
||||||
});
|
.catch(err => {
|
||||||
});
|
uni.showToast({
|
||||||
},
|
title: err.msg || err.response.data.msg || err.response.data.message,
|
||||||
|
icon: "none",
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
async register() {
|
async register() {
|
||||||
var that = this;
|
var that = this;
|
||||||
const {
|
const {
|
||||||
|
|||||||
@@ -0,0 +1,343 @@
|
|||||||
|
<template>
|
||||||
|
<view class="register absolute">
|
||||||
|
<view class="whiteBg" v-if="formItem === 1">
|
||||||
|
<view class="title acea-row">
|
||||||
|
<view class="item" :class="current === index ? 'on' : ''" v-for="(item, index) in navList"
|
||||||
|
@click="navTap(index)" :key="index">{{ item }}</view>
|
||||||
|
</view>
|
||||||
|
<view class="list" :hidden="current !== 0">
|
||||||
|
<form @submit.prevent="submit">
|
||||||
|
<view class="item">
|
||||||
|
<view class="acea-row row-between-wrapper">
|
||||||
|
<!-- <svg class="icon" aria-hidden="true">
|
||||||
|
<use xlink:href="#icon-phone_" />
|
||||||
|
</svg>-->
|
||||||
|
<input type="text" placeholder="输入手机号码" v-model="account" required />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<view class="acea-row row-between-wrapper">
|
||||||
|
<!-- <svg class="icon" aria-hidden="true">
|
||||||
|
<use xlink:href="#icon-code_" />
|
||||||
|
</svg>-->
|
||||||
|
<input type="password" placeholder="填写登录密码" v-model="password" required />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</form>
|
||||||
|
</view>
|
||||||
|
<view class="list" :hidden="current !== 1">
|
||||||
|
<view class="item">
|
||||||
|
<view class="acea-row row-between-wrapper">
|
||||||
|
<!-- <svg class="icon" aria-hidden="true">
|
||||||
|
<use xlink:href="#icon-phone_" />
|
||||||
|
</svg>-->
|
||||||
|
<input type="text" placeholder="输入手机号码" v-model="account" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<view class="align-left">
|
||||||
|
<!-- <svg class="icon" aria-hidden="true">
|
||||||
|
<use xlink:href="#icon-code_1" />
|
||||||
|
</svg>-->
|
||||||
|
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
|
||||||
|
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''"
|
||||||
|
@click="code">{{ text }}</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="logon" @click="loginMobile" :hidden="current !== 1">登录</view>
|
||||||
|
<view class="logon" @click="submit" :hidden="current === 1">登录</view>
|
||||||
|
<view class="tip">
|
||||||
|
没有账号?
|
||||||
|
<text @click="formItem = 2" class="font-color-red">立即注册</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 注册 -->
|
||||||
|
<view class="whiteBg" v-else>
|
||||||
|
<view class="title acea-row row-between-wrapper">
|
||||||
|
<view class="item on">注册账号</view>
|
||||||
|
</view>
|
||||||
|
<view class="list">
|
||||||
|
<view class="item">
|
||||||
|
<view>
|
||||||
|
<!-- <svg class="icon" aria-hidden="true">
|
||||||
|
<use xlink:href="#icon-phone_" />
|
||||||
|
</svg>-->
|
||||||
|
<input name="account" type="text" placeholder="输入手机号码" v-model="account" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<view class="align-left">
|
||||||
|
<!-- <svg class="icon" aria-hidden="true">
|
||||||
|
<use xlink:href="#icon-code_1" />
|
||||||
|
</svg>-->
|
||||||
|
<input name="verifyCode" type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
|
||||||
|
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''"
|
||||||
|
@click="code">{{ text }}</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="item">
|
||||||
|
<view>
|
||||||
|
<!-- <svg class="icon" aria-hidden="true">
|
||||||
|
<use xlink:href="#icon-code_" />
|
||||||
|
</svg>-->
|
||||||
|
<input name="password" type="password" placeholder="填写您的登录密码" v-model="password" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- #ifndef H5 -->
|
||||||
|
<view class="item">
|
||||||
|
<view>
|
||||||
|
<!-- <svg class="icon" aria-hidden="true">
|
||||||
|
<use xlink:href="#icon-phone_" />
|
||||||
|
</svg>-->
|
||||||
|
<input name="inviteCode" type="text" placeholder="输入邀请码" v-model="inviteCode" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- #endif -->
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<view class="logon" @click="register">注册</view>
|
||||||
|
<view class="tip">
|
||||||
|
已有账号?
|
||||||
|
<text @click="formItem = 1" class="font-color-red">立即登录</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import sendVerifyCode from "@/mixins/SendVerifyCode";
|
||||||
|
import {
|
||||||
|
login,
|
||||||
|
loginMobile,
|
||||||
|
registerVerify,
|
||||||
|
register
|
||||||
|
} from "@/api/user";
|
||||||
|
import attrs, {
|
||||||
|
required,
|
||||||
|
alpha_num,
|
||||||
|
chs_phone
|
||||||
|
} from "@/utils/validate";
|
||||||
|
import {
|
||||||
|
validatorDefaultCatch
|
||||||
|
} from "@/utils/dialog";
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import cookie from "@/utils/store/cookie";
|
||||||
|
|
||||||
|
import {
|
||||||
|
handleGetUserInfo
|
||||||
|
} from "@/utils";
|
||||||
|
|
||||||
|
const BACK_URL = "login_back_url";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Login",
|
||||||
|
mixins: [sendVerifyCode],
|
||||||
|
data: function () {
|
||||||
|
return {
|
||||||
|
navList: ["账号登录", "修改密码"],
|
||||||
|
current: 0,
|
||||||
|
account: "",
|
||||||
|
password: "",
|
||||||
|
captcha: "",
|
||||||
|
inviteCode: "",
|
||||||
|
formItem: 1,
|
||||||
|
type: "login"
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async loginMobile() {
|
||||||
|
var that = this;
|
||||||
|
const {
|
||||||
|
account,
|
||||||
|
captcha
|
||||||
|
} = that;
|
||||||
|
try {
|
||||||
|
await that
|
||||||
|
.$validator({
|
||||||
|
account: [
|
||||||
|
required(required.message("手机号码")),
|
||||||
|
chs_phone(chs_phone.message())
|
||||||
|
],
|
||||||
|
captcha: [
|
||||||
|
required(required.message("验证码")),
|
||||||
|
alpha_num(alpha_num.message("验证码"))
|
||||||
|
]
|
||||||
|
})
|
||||||
|
.validate({
|
||||||
|
account,
|
||||||
|
captcha
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
return validatorDefaultCatch(e);
|
||||||
|
}
|
||||||
|
loginMobile({
|
||||||
|
phone: that.account,
|
||||||
|
captcha: that.captcha,
|
||||||
|
spread: cookie.get("spread")
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
var data = res.data;
|
||||||
|
that.$store.commit("login", data.token, dayjs(data.expires_time));
|
||||||
|
handleGetUserInfo();
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
uni.showToast({
|
||||||
|
title: err.msg || err.response.data.msg || err.response.data.message,
|
||||||
|
icon: "none",
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
async register() {
|
||||||
|
var that = this;
|
||||||
|
const {
|
||||||
|
account,
|
||||||
|
captcha,
|
||||||
|
password
|
||||||
|
} = that;
|
||||||
|
try {
|
||||||
|
await that
|
||||||
|
.$validator({
|
||||||
|
account: [
|
||||||
|
required(required.message("手机号码")),
|
||||||
|
chs_phone(chs_phone.message())
|
||||||
|
],
|
||||||
|
captcha: [
|
||||||
|
required(required.message("验证码")),
|
||||||
|
alpha_num(alpha_num.message("验证码"))
|
||||||
|
],
|
||||||
|
password: [
|
||||||
|
required(required.message("密码")),
|
||||||
|
attrs.range([6, 16], attrs.range.message("密码")),
|
||||||
|
alpha_num(alpha_num.message("密码"))
|
||||||
|
]
|
||||||
|
})
|
||||||
|
.validate({
|
||||||
|
account,
|
||||||
|
captcha,
|
||||||
|
password
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
return validatorDefaultCatch(e);
|
||||||
|
}
|
||||||
|
register({
|
||||||
|
account: that.account,
|
||||||
|
captcha: that.captcha,
|
||||||
|
password: that.password,
|
||||||
|
inviteCode: that.inviteCode,
|
||||||
|
spread: cookie.get("spread")
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: "success",
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
that.formItem = 1;
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
uni.showToast({
|
||||||
|
title: err.msg || err.response.data.msg || err.response.data.message,
|
||||||
|
icon: "none",
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
async code() {
|
||||||
|
var that = this;
|
||||||
|
const {
|
||||||
|
account
|
||||||
|
} = that;
|
||||||
|
try {
|
||||||
|
await that
|
||||||
|
.$validator({
|
||||||
|
account: [
|
||||||
|
required(required.message("手机号码")),
|
||||||
|
chs_phone(chs_phone.message())
|
||||||
|
]
|
||||||
|
})
|
||||||
|
.validate({
|
||||||
|
account
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
return validatorDefaultCatch(e);
|
||||||
|
}
|
||||||
|
if (that.formItem == 2) that.type = "register";
|
||||||
|
await registerVerify({
|
||||||
|
phone: that.account,
|
||||||
|
type: that.type
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.msg,
|
||||||
|
icon: "success",
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
that.sendCode();
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
uni.showToast({
|
||||||
|
title: err.msg || err.response.data.msg || err.response.data.message,
|
||||||
|
icon: "none",
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
navTap: function (index) {
|
||||||
|
this.current = index;
|
||||||
|
},
|
||||||
|
async submit() {
|
||||||
|
const {
|
||||||
|
account,
|
||||||
|
password
|
||||||
|
} = this;
|
||||||
|
try {
|
||||||
|
await this.$validator({
|
||||||
|
account: [
|
||||||
|
required(required.message("账号")),
|
||||||
|
attrs.range([5, 16], attrs.range.message("账号")),
|
||||||
|
alpha_num(alpha_num.message("账号"))
|
||||||
|
],
|
||||||
|
password: [
|
||||||
|
required(required.message("密码")),
|
||||||
|
attrs.range([6, 16], attrs.range.message("密码")),
|
||||||
|
alpha_num(alpha_num.message("密码"))
|
||||||
|
]
|
||||||
|
}).validate({
|
||||||
|
account,
|
||||||
|
password
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
return validatorDefaultCatch(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
login({
|
||||||
|
username: account,
|
||||||
|
password,
|
||||||
|
spread: cookie.get("spread")
|
||||||
|
})
|
||||||
|
.then(({
|
||||||
|
data
|
||||||
|
}) => {
|
||||||
|
this.$store.commit("login", data.token, dayjs(data.expires_time));
|
||||||
|
handleGetUserInfo();
|
||||||
|
// let replace=this.$yroute.query.replace
|
||||||
|
// if(replace){
|
||||||
|
|
||||||
|
// }
|
||||||
|
// this.$yrouter.replace({
|
||||||
|
// path: this.$yroute.query.replace || '/pages/home/index'
|
||||||
|
// });
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.log(err);
|
||||||
|
uni.showToast({
|
||||||
|
title: err.msg || err.response.data.msg || err.response.data.message,
|
||||||
|
icon: "none",
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -39,7 +39,8 @@
|
|||||||
<view class="item acea-row row-between-wrapper">
|
<view class="item acea-row row-between-wrapper">
|
||||||
<view>手机号</view>
|
<view>手机号</view>
|
||||||
<view class="input">
|
<view class="input">
|
||||||
<input type="text" v-if="userInfo.phone" v-model="userInfo.phone" />
|
<!-- <input type="text" v-model="userInfo.phone" placeholder="未绑定"/> -->
|
||||||
|
<input type="text" v-if="userInfo.phone" v-model="userInfo.phone" placeholder="未绑定"/>
|
||||||
<input type="text" v-else value="未绑定" disabled class="id" />
|
<input type="text" v-else value="未绑定" disabled class="id" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -156,7 +157,6 @@ export default {
|
|||||||
},
|
},
|
||||||
chooseImage() {
|
chooseImage() {
|
||||||
chooseImage((img) => {
|
chooseImage((img) => {
|
||||||
console.log(img);
|
|
||||||
this.avatar = img;
|
this.avatar = img;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
+126
-54
@@ -1,7 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="user">
|
<view class="user">
|
||||||
<view v-if="$store.getters.token || userInfo.uid">
|
<view v-if="$store.getters.token || userInfo.uid">
|
||||||
<view class="header bg-color-red acea-row row-between-wrapper">
|
<view class="getUserBaseData header bg-color-red acea-row row-between-wrapper" v-if="!userInfo.avatar && !userInfo.nickname">
|
||||||
|
<button class="userDataBtn" v-if="canIUseGetUserProfile" @tap="getUserInfoProfile">授权并查看用户信息</button>
|
||||||
|
<button class="userDataBtn" v-else @getuserinfo="getUserInfo" open-type="getUserInfo">授权并查看用户信息</button>
|
||||||
|
</view>
|
||||||
|
<view class="header bg-color-red acea-row row-between-wrapper" v-else>
|
||||||
<view class="picTxt acea-row row-between-wrapper">
|
<view class="picTxt acea-row row-between-wrapper">
|
||||||
<view class="pictrue">
|
<view class="pictrue">
|
||||||
<image :src="userInfo.avatar" />
|
<image :src="userInfo.avatar" />
|
||||||
@@ -19,15 +23,15 @@
|
|||||||
<text class="iconfont icon-bianji1"></text>
|
<text class="iconfont icon-bianji1"></text>
|
||||||
</view>
|
</view>
|
||||||
<!-- #ifdef MP-WEIXIN -->
|
<!-- #ifdef MP-WEIXIN -->
|
||||||
<button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" class="binding" v-else>
|
<!-- <button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" class="binding" v-else>
|
||||||
<text>绑定手机号</text>
|
<text>绑定手机号</text>
|
||||||
</button>
|
</button> -->
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
|
|
||||||
<!-- #ifndef MP-WEIXIN -->
|
<!-- #ifndef MP-WEIXIN -->
|
||||||
<button class="binding" @click="goBindPhone()" v-else>
|
<!-- <button class="binding" @click="goBindPhone()" v-else>
|
||||||
<text>绑定手机号</text>
|
<text>绑定手机号</text>
|
||||||
</button>
|
</button> -->
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -128,11 +132,11 @@
|
|||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { mapState, mapGetters, mapMutations, mapActions } from 'vuex'
|
import { mapState, mapGetters, mapMutations, mapActions } from 'vuex'
|
||||||
import { getUserInfo, getMenuUser, bindingPhone, wxappBindingPhone } from '@/api/user'
|
import { getUserInfo, getMenuUser, wxappAuth, bindingPhone, wxappBindingPhone, wxappGetUserInfo } from '@/api/user'
|
||||||
import { isWeixin, VUE_APP_RESOURCES_URL } from '@/utils'
|
import { isWeixin, VUE_APP_RESOURCES_URL, parseQuery, getProvider } from '@/utils'
|
||||||
import cookie from '@/utils/store/cookie'
|
|
||||||
import SwitchWindow from '@/components/SwitchWindow'
|
import SwitchWindow from '@/components/SwitchWindow'
|
||||||
import Authorization from '@/pages/authorization/index'
|
import Authorization from '@/pages/authorization/index'
|
||||||
|
import cookie from '@/utils/store/cookie'
|
||||||
|
|
||||||
const NAME = 'User'
|
const NAME = 'User'
|
||||||
|
|
||||||
@@ -145,14 +149,23 @@ export default {
|
|||||||
props: {},
|
props: {},
|
||||||
data: function() {
|
data: function() {
|
||||||
return {
|
return {
|
||||||
MyMenus: [],
|
canIUseGetUserProfile: false,
|
||||||
switchActive: false,
|
MyMenus: [],
|
||||||
isWeixin: false,
|
switchActive: false,
|
||||||
|
isWeixin: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: mapGetters(['userInfo']),
|
computed: mapGetters(['userInfo']),
|
||||||
|
onLoad() {
|
||||||
|
if (wx.getUserProfile) {
|
||||||
|
this.canIUseGetUserProfile = true
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations(['updateAuthorizationPage']),
|
...mapMutations(['updateAuthorizationPage']),
|
||||||
|
toLogin() {
|
||||||
|
this.$yrouter.push('/pages/user/Login/index')
|
||||||
|
},
|
||||||
goReturnList() {
|
goReturnList() {
|
||||||
this.$yrouter.push('/pages/order/ReturnList/index')
|
this.$yrouter.push('/pages/order/ReturnList/index')
|
||||||
},
|
},
|
||||||
@@ -165,9 +178,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
goBindPhone() {
|
goBindPhone() {
|
||||||
this.$yrouter.push({
|
this.$yrouter.push('/pages/user/BindingPhone/index')
|
||||||
path: '/pages/user/BindingPhone/index',
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
goUserCoupon() {
|
goUserCoupon() {
|
||||||
this.$yrouter.push('/pages/user/coupon/UserCoupon/index')
|
this.$yrouter.push('/pages/user/coupon/UserCoupon/index')
|
||||||
@@ -179,45 +190,41 @@ export default {
|
|||||||
this.$yrouter.push('/pages/user/promotion/UserPromotion/index')
|
this.$yrouter.push('/pages/user/promotion/UserPromotion/index')
|
||||||
},
|
},
|
||||||
goUserAccount() {
|
goUserAccount() {
|
||||||
this.$yrouter.push({
|
this.$yrouter.push('/pages/user/UserAccount/index')
|
||||||
path: '/pages/user/UserAccount/index',
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
goPersonalData() {
|
goPersonalData() {
|
||||||
this.$yrouter.push('/pages/user/PersonalData/index')
|
this.$yrouter.push('/pages/user/PersonalData/index')
|
||||||
},
|
},
|
||||||
getPhoneNumber: function(e) {
|
getPhoneNumber (e) {
|
||||||
let thit = this
|
// 判断一下这里是不是小程序 如果是小程序,走获取微信手机号进行绑定
|
||||||
console.log(e)
|
if (e.mp.detail.errMsg == 'getPhoneNumber:ok') {
|
||||||
// 判断一下这里是不是小程序 如果是小程序,走获取微信手机号进行绑定
|
uni.showLoading({
|
||||||
if (e.mp.detail.errMsg == 'getPhoneNumber:ok') {
|
title: '绑定中',
|
||||||
uni.showLoading({
|
})
|
||||||
title: '绑定中',
|
wxappBindingPhone({
|
||||||
})
|
encryptedData: e.mp.detail.encryptedData,
|
||||||
wxappBindingPhone({
|
iv: e.mp.detail.iv,
|
||||||
encryptedData: e.mp.detail.encryptedData,
|
})
|
||||||
iv: e.mp.detail.iv,
|
.then(res => {
|
||||||
})
|
// this.User();
|
||||||
.then(res => {
|
this.$store.dispatch('userInfo', true)
|
||||||
// this.User();
|
uni.hideLoading()
|
||||||
thit.$store.dispatch('userInfo', true)
|
uni.showToast({
|
||||||
uni.hideLoading()
|
title: res.msg,
|
||||||
uni.showToast({
|
icon: 'success',
|
||||||
title: res.msg,
|
duration: 2000,
|
||||||
icon: 'success',
|
})
|
||||||
duration: 2000,
|
})
|
||||||
})
|
.catch(error => {
|
||||||
})
|
uni.hideLoading()
|
||||||
.catch(error => {
|
this.$store.dispatch('userInfo', true)
|
||||||
uni.hideLoading()
|
console.log(error)
|
||||||
thit.$store.dispatch('userInfo', true)
|
uni.showToast({
|
||||||
console.log(error)
|
title: error.msg || error.response.data.msg || error.response.data.message,
|
||||||
uni.showToast({
|
icon: 'none',
|
||||||
title: error.msg || error.response.data.msg || error.response.data.message,
|
duration: 2000,
|
||||||
icon: 'none',
|
})
|
||||||
duration: 2000,
|
})
|
||||||
})
|
|
||||||
})
|
|
||||||
// // 获取当前环境的服务商
|
// // 获取当前环境的服务商
|
||||||
// uni.getProvider({
|
// uni.getProvider({
|
||||||
// service: "oauth",
|
// service: "oauth",
|
||||||
@@ -233,7 +240,7 @@ export default {
|
|||||||
// })
|
// })
|
||||||
// .then(res => {
|
// .then(res => {
|
||||||
// // this.User();
|
// // this.User();
|
||||||
// thit.$store.dispatch("userInfo", true);
|
// this.$store.dispatch("userInfo", true);
|
||||||
// uni.hideLoading();
|
// uni.hideLoading();
|
||||||
// uni.showToast({
|
// uni.showToast({
|
||||||
// title: res.msg,
|
// title: res.msg,
|
||||||
@@ -243,7 +250,7 @@ export default {
|
|||||||
// })
|
// })
|
||||||
// .catch(error => {
|
// .catch(error => {
|
||||||
// uni.hideLoading();
|
// uni.hideLoading();
|
||||||
// thit.$store.dispatch("userInfo", true);
|
// this.$store.dispatch("userInfo", true);
|
||||||
// console.log(error);
|
// console.log(error);
|
||||||
// uni.showToast({
|
// uni.showToast({
|
||||||
// title: error.msg ||
|
// title: error.msg ||
|
||||||
@@ -264,15 +271,67 @@ export default {
|
|||||||
// reject("获取环境服务商失败");
|
// reject("获取环境服务商失败");
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
} else {
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '已拒绝授权',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 2000,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 获取用户授权,读取头像、昵称
|
||||||
|
getUserInfo(data) {
|
||||||
|
if (data.detail.errMsg == 'getUserInfo:fail auth deny') {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '已拒绝授权',
|
title: '取消授权',
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
})
|
})
|
||||||
|
return
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeswitch(data) {
|
// 申请获取用户信息
|
||||||
|
getUserInfoProfile(data) {
|
||||||
|
wx.getUserProfile({
|
||||||
|
lang: 'zh_CN',
|
||||||
|
desc: '需要获取您的信息用来展示',
|
||||||
|
success: res => {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '正在更新信息...',
|
||||||
|
duration: 2000,
|
||||||
|
})
|
||||||
|
getProvider()
|
||||||
|
.then(provider => { // 环境提供商
|
||||||
|
if (!provider) {
|
||||||
|
reject()
|
||||||
|
}
|
||||||
|
// 获取开发code
|
||||||
|
uni.login({
|
||||||
|
provider: provider,
|
||||||
|
success: async loginRes => {
|
||||||
|
wxappGetUserInfo({
|
||||||
|
encryptedData: res.encryptedData,
|
||||||
|
iv: res.iv,
|
||||||
|
code: loginRes.code, // 开发code
|
||||||
|
}).then(res => {
|
||||||
|
console.log(res === 200)
|
||||||
|
if (res.status === 200) {
|
||||||
|
this.userInfo.avatar = res.data.avatar
|
||||||
|
this.userInfo.nickname = res.data.nickname
|
||||||
|
} else {
|
||||||
|
uni.showLoading({
|
||||||
|
title: res.msg,
|
||||||
|
duration: 2000,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
changeswitch(data) {
|
||||||
this.switchActive = data
|
this.switchActive = data
|
||||||
},
|
},
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
@@ -357,6 +416,19 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
|
.getUserBaseData{
|
||||||
|
.userDataBtn{
|
||||||
|
width: 80%;
|
||||||
|
height: 80rpx;
|
||||||
|
background: linear-gradient(to right, #f35447 0%, #ff8e3c 100%);
|
||||||
|
background: -moz-linear-gradient(to right, #f35447 0%, #ff8e3c 100%);
|
||||||
|
border-radius: 40rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-family: PingFang SC;
|
||||||
|
font-weight: 500;
|
||||||
|
color: rgba(255, 255, 255, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
.footer-line-height {
|
.footer-line-height {
|
||||||
height: 1 * 100rpx;
|
height: 1 * 100rpx;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,18 +97,17 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
getUseCoupons: function() {
|
getUseCoupons() {
|
||||||
let that = this
|
if (this.loading) return //阻止下次请求(false可以进行请求);
|
||||||
if (that.loading) return //阻止下次请求(false可以进行请求);
|
if (this.loadend) return //阻止结束当前请求(false可以进行请求);
|
||||||
if (that.loadend) return //阻止结束当前请求(false可以进行请求);
|
this.loading = true
|
||||||
that.loading = true
|
let q = { page: this.page, limit: this.limit }
|
||||||
let q = { page: that.page, limit: that.limit }
|
|
||||||
getCoupon(q).then(res => {
|
getCoupon(q).then(res => {
|
||||||
that.loading = false
|
this.loading = false
|
||||||
//apply();js将一个数组插入另一个数组;
|
//apply();js将一个数组插入另一个数组;
|
||||||
that.couponsList.push.apply(that.couponsList, res.data)
|
this.couponsList.push.apply(this.couponsList, res.data)
|
||||||
that.loadend = res.data.length < that.limit //判断所有数据是否加载完成;
|
this.loadend = res.data.length < this.limit //判断所有数据是否加载完成;
|
||||||
that.page = that.page + 1
|
this.page = this.page + 1
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,9 +7,9 @@
|
|||||||
<image :src="userInfo.avatar" />
|
<image :src="userInfo.avatar" />
|
||||||
</view>
|
</view>
|
||||||
<view class="text">
|
<view class="text">
|
||||||
<view class="line1">{{ userInfo.nickname }}</view>
|
<view class="line1">{{ userInfo.nickname || '' }}</view>
|
||||||
<view class="integral acea-row">
|
<view class="integral acea-row">
|
||||||
<text>积分: {{ userInfo.integral }}</text>
|
<text>积分: {{ userInfo.integral || 0 }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
+6
-8
@@ -2,7 +2,7 @@ import Vue from 'vue'
|
|||||||
|
|
||||||
// import MpvueRouterPatch from 'mpvue-router-patch'
|
// import MpvueRouterPatch from 'mpvue-router-patch'
|
||||||
// Vue.use(MpvueRouterPatch)
|
// Vue.use(MpvueRouterPatch)
|
||||||
import { wxappAuth, getUserInfo } from '@/api/user'
|
import { wxappAuth, getUserInfo, wxappBindingPhone } from '@/api/user'
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import cookie from '@/utils/store/cookie'
|
import cookie from '@/utils/store/cookie'
|
||||||
@@ -164,7 +164,7 @@ export const getProvider = service => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.log(error)
|
console.log('167',error)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@ export const login = loginInfo => {
|
|||||||
auth(code)
|
auth(code)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
let redirect = cookie.get('redirect').replace(/\ /g, '')
|
let redirect = cookie.get('redirect').replace(/\ /g, '')
|
||||||
console.log(redirect)
|
console.log('199',redirect)
|
||||||
if (redirect) {
|
if (redirect) {
|
||||||
redirect = redirect.split('/pages')[1]
|
redirect = redirect.split('/pages')[1]
|
||||||
if (!redirect) {
|
if (!redirect) {
|
||||||
@@ -286,9 +286,8 @@ export const login = loginInfo => {
|
|||||||
reject('获取用户信息失败')
|
reject('获取用户信息失败')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => { // 登录接口调用失败
|
||||||
console.log(error)
|
console.log(error)
|
||||||
console.log('登录接口调用失败')
|
|
||||||
reject('登录接口调用失败')
|
reject('登录接口调用失败')
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@@ -299,18 +298,17 @@ export const login = loginInfo => {
|
|||||||
uni.getUserInfo({
|
uni.getUserInfo({
|
||||||
provider: provider,
|
provider: provider,
|
||||||
success: function(user) {
|
success: function(user) {
|
||||||
console.log(user)
|
|
||||||
console.log('获取用户信息成功')
|
console.log('获取用户信息成功')
|
||||||
console.log('开始调用登录接口')
|
console.log('开始调用登录接口')
|
||||||
wxappAuth({
|
wxappAuth({
|
||||||
|
// phone: user.phone
|
||||||
encryptedData: user.encryptedData,
|
encryptedData: user.encryptedData,
|
||||||
iv: user.iv,
|
iv: user.iv,
|
||||||
code: code,
|
code: code,
|
||||||
spread: cookie.get('spread'),
|
spread: cookie.get('spread'),
|
||||||
})
|
})
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
console.log('登录接口调用成功')
|
console.log('登录成功,开始处理登录信息保存,并获取用户详情')
|
||||||
console.log('开始处理登录信息保存,并获取用户详情')
|
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
store.commit('login', data.token, dayjs(data.expires_time))
|
store.commit('login', data.token, dayjs(data.expires_time))
|
||||||
store.dispatch('userInfo', true)
|
store.dispatch('userInfo', true)
|
||||||
|
|||||||
+14
-3
@@ -20,6 +20,16 @@ import cookie from '@/utils/store/cookie'
|
|||||||
const fly = new Fly()
|
const fly = new Fly()
|
||||||
fly.config.baseURL = VUE_APP_API_URL
|
fly.config.baseURL = VUE_APP_API_URL
|
||||||
|
|
||||||
|
// 小程序请求域名
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
fly.config.baseURL = 'http://itxzz.51vip.biz/api'
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
// app端
|
||||||
|
fly.config.baseURL = 'http://itxzz.51vip.biz/api'
|
||||||
|
// #endif
|
||||||
|
|
||||||
fly.interceptors.response.use(
|
fly.interceptors.response.use(
|
||||||
response => {
|
response => {
|
||||||
// console.log(response)
|
// console.log(response)
|
||||||
@@ -27,9 +37,10 @@ fly.interceptors.response.use(
|
|||||||
return response
|
return response
|
||||||
},
|
},
|
||||||
error => {
|
error => {
|
||||||
|
console.log(error)
|
||||||
if (error.toString() == 'Error: Network Error') {
|
if (error.toString() == 'Error: Network Error') {
|
||||||
console.log('————————')
|
console.log('————————')
|
||||||
console.log('发送请求失败', error)
|
console.log('请求失败', error)
|
||||||
console.log('————————')
|
console.log('————————')
|
||||||
handleLoginFailure()
|
handleLoginFailure()
|
||||||
return Promise.reject({ msg: '未登录', toLogin: true })
|
return Promise.reject({ msg: '未登录', toLogin: true })
|
||||||
@@ -123,9 +134,9 @@ const request = ['post', 'put', 'patch'].reduce((request, method) => {
|
|||||||
return baseRequest(Object.assign({ url, data, method }, defaultOpt, options))
|
return baseRequest(Object.assign({ url, data, method }, defaultOpt, options))
|
||||||
}
|
}
|
||||||
return request
|
return request
|
||||||
}, {})
|
}, {});
|
||||||
|
|
||||||
;['get', 'delete', 'head'].forEach(method => {
|
['get', 'delete', 'head'].forEach(method => {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param url string 接口地址
|
* @param url string 接口地址
|
||||||
|
|||||||
Reference in New Issue
Block a user