Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
P
pica-professional-exam
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
Close sidebar
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
com.pica.cloud.education.frontend
pica-professional-exam
提交
31fa7065
提交
31fa7065
编写于
11月 25, 2021
作者:
changdi.hao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化代码逻辑
上级
450146a2
变更
2
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
105 行增加
和
95 行删除
+105
-95
env-config.js
src/utils/env-config.js
+32
-33
coupon-list.vue
src/views/coupon/coupon-list.vue
+73
-62
未找到文件。
src/utils/env-config.js
浏览文件 @
31fa7065
...
@@ -8,12 +8,12 @@ export const envConfig = {
...
@@ -8,12 +8,12 @@ export const envConfig = {
// baseUrl: 'http://10.177.15.180:10202/',
// baseUrl: 'http://10.177.15.180:10202/',
// baseUrl: 'http://192.168.140.14:10201/',
// baseUrl: 'http://192.168.140.14:10201/',
baseUrl
:
'https://test1-sc.yunqueyi.com/'
,
baseUrl
:
"https://dev-sc.yunqueyi.com/"
,
apiUrl
:
'https://dev-api.yunqueyi.com/'
,
apiUrl
:
"https://dev-api.yunqueyi.com/"
,
webPageUrl
:
'https://dev-phome.yunqueyi.com/'
,
webPageUrl
:
"https://dev-phome.yunqueyi.com/"
,
hactiveUrl
:
'https://dev-hactive.yunqueyi.com'
,
hactiveUrl
:
"https://dev-hactive.yunqueyi.com"
,
fileUrl
:
'https://dev-www.yunqueyi.com'
,
fileUrl
:
"https://dev-www.yunqueyi.com"
,
appId
:
'wx2c577552a2d28550'
,
// 用于微信授权登录
appId
:
"wx2c577552a2d28550"
,
// 用于微信授权登录
wxType
:
15
,
// 分享、用户信息对应的appid
wxType
:
15
,
// 分享、用户信息对应的appid
tradeType
:
4
,
tradeType
:
4
,
...
@@ -47,49 +47,48 @@ export const envConfig = {
...
@@ -47,49 +47,48 @@ export const envConfig = {
// appId: 'wx2c577552a2d28550', // 用于微信授权登录
// appId: 'wx2c577552a2d28550', // 用于微信授权登录
// wxType: 15, // 分享、用户信息对应的appid
// wxType: 15, // 分享、用户信息对应的appid
// tradeType: 4,
// tradeType: 4,
},
},
dev
:
{
dev
:
{
baseUrl
:
'https://dev-sc.yunqueyi.com/'
,
baseUrl
:
"https://dev-sc.yunqueyi.com/"
,
apiUrl
:
'https://dev-api.yunqueyi.com/'
,
apiUrl
:
"https://dev-api.yunqueyi.com/"
,
webPageUrl
:
'https://dev-phome.yunqueyi.com/'
,
webPageUrl
:
"https://dev-phome.yunqueyi.com/"
,
hactiveUrl
:
'https://dev-hactive.yunqueyi.com'
,
hactiveUrl
:
"https://dev-hactive.yunqueyi.com"
,
fileUrl
:
'https://dev-www.yunqueyi.com'
,
fileUrl
:
"https://dev-www.yunqueyi.com"
,
appId
:
'wx2c577552a2d28550'
,
// 用于微信授权登录
appId
:
"wx2c577552a2d28550"
,
// 用于微信授权登录
wxType
:
15
,
// 分享、用户信息对应的appid
wxType
:
15
,
// 分享、用户信息对应的appid
tradeType
:
4
,
tradeType
:
4
,
},
},
test
:
{
test
:
{
baseUrl
:
'https://test1-sc.yunqueyi.com/'
,
baseUrl
:
"https://test1-sc.yunqueyi.com/"
,
apiUrl
:
'https://test1-api.yunqueyi.com/'
,
apiUrl
:
"https://test1-api.yunqueyi.com/"
,
webPageUrl
:
'https://test1-phome.yunqueyi.com/'
,
webPageUrl
:
"https://test1-phome.yunqueyi.com/"
,
hactiveUrl
:
'https://test1-hactive.yunqueyi.com'
,
hactiveUrl
:
"https://test1-hactive.yunqueyi.com"
,
fileUrl
:
'https://test1-www.yunqueyi.com'
,
fileUrl
:
"https://test1-www.yunqueyi.com"
,
// appId: 'wxcaad75b7fff5659c', // 用于微信授权登录
// appId: 'wxcaad75b7fff5659c', // 用于微信授权登录
// appId: 'wx2c577552a2d28550', // 用于微信授权登录
// appId: 'wx2c577552a2d28550', // 用于微信授权登录
appId
:
'wx85f38ae09d22b12e'
,
// 用于微信授权登录
appId
:
"wx85f38ae09d22b12e"
,
// 用于微信授权登录
wxType
:
30
,
wxType
:
30
,
tradeType
:
5
,
tradeType
:
5
,
},
},
uat
:
{
uat
:
{
baseUrl
:
'https://uat-sc.yunqueyi.com/'
,
baseUrl
:
"https://uat-sc.yunqueyi.com/"
,
apiUrl
:
'https://uat-api.yunqueyi.com/'
,
apiUrl
:
"https://uat-api.yunqueyi.com/"
,
webPageUrl
:
'https://uat-phome.yunqueyi.com/'
,
webPageUrl
:
"https://uat-phome.yunqueyi.com/"
,
hactiveUrl
:
'https://uat-hactive.yunqueyi.com'
,
hactiveUrl
:
"https://uat-hactive.yunqueyi.com"
,
fileUrl
:
'https://uat-www.yunqueyi.com'
,
fileUrl
:
"https://uat-www.yunqueyi.com"
,
// appId: 'wx342ef0e5afee54a7', // 用于微信授权登录
// appId: 'wx342ef0e5afee54a7', // 用于微信授权登录
appId
:
'wx2c577552a2d28550'
,
// 用于微信授权登录
appId
:
"wx2c577552a2d28550"
,
// 用于微信授权登录
wxType
:
15
,
wxType
:
15
,
tradeType
:
4
,
tradeType
:
4
,
},
},
pro
:
{
pro
:
{
baseUrl
:
'https://sc.yunqueyi.com/'
,
baseUrl
:
"https://sc.yunqueyi.com/"
,
apiUrl
:
'https://api.yunqueyi.com/'
,
apiUrl
:
"https://api.yunqueyi.com/"
,
webPageUrl
:
'https://phome.yunqueyi.com/'
,
webPageUrl
:
"https://phome.yunqueyi.com/"
,
hactiveUrl
:
'https://hactive.yunqueyi.com'
,
hactiveUrl
:
"https://hactive.yunqueyi.com"
,
fileUrl
:
'https://www.yunqueyi.com'
,
fileUrl
:
"https://www.yunqueyi.com"
,
appId
:
'wx2c577552a2d28550'
,
// 用于微信授权登录
appId
:
"wx2c577552a2d28550"
,
// 用于微信授权登录
wxType
:
15
,
wxType
:
15
,
tradeType
:
4
,
tradeType
:
4
,
}
}
,
}
}
;
src/views/coupon/coupon-list.vue
浏览文件 @
31fa7065
...
@@ -11,18 +11,20 @@
...
@@ -11,18 +11,20 @@
borderStyle=
"1px solid #fff"
borderStyle=
"1px solid #fff"
></CommonNavbar>
></CommonNavbar>
<CouponList
<CouponList
v-if=
"dataList.length"
v-if=
"dataList.length
&& done
"
:dataList=
"dataList"
:dataList=
"dataList"
@
revieveOrUse=
"revieveOrUse"
@
revieveOrUse=
"revieveOrUse"
:fromPage=
"fromPage"
:fromPage=
"fromPage"
></CouponList>
></CouponList>
<no-coupon
v-else
></no-coupon>
<no-coupon
v-if=
"done && !(dataList.length && dataList)"
></no-coupon>
<Loading
v-show=
"!done"
/>
</section>
</section>
</
template
>
</
template
>
<
script
>
<
script
>
import
CommonNavbar
from
"@/components/common/common-navbar"
;
import
CommonNavbar
from
"@/components/common/common-navbar"
;
import
CouponList
from
"@/components/coupon/component-list"
;
import
CouponList
from
"@/components/coupon/component-list"
;
import
NoCoupon
from
"@/components/coupon/no-coupon"
;
import
NoCoupon
from
"@/components/coupon/no-coupon"
;
import
Loading
from
"@/components/common/common-loading"
;
import
{
getWebPageUrl
,
getHactiveUrl
}
from
"@/utils"
;
import
{
getWebPageUrl
,
getHactiveUrl
}
from
"@/utils"
;
import
{
mapGetters
,
mapActions
}
from
"vuex"
;
import
{
mapGetters
,
mapActions
}
from
"vuex"
;
import
{
Toast
}
from
"vant"
;
import
{
Toast
}
from
"vant"
;
...
@@ -32,7 +34,8 @@ export default {
...
@@ -32,7 +34,8 @@ export default {
components
:
{
components
:
{
CommonNavbar
,
CommonNavbar
,
CouponList
,
CouponList
,
NoCoupon
NoCoupon
,
Loading
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -46,7 +49,8 @@ export default {
...
@@ -46,7 +49,8 @@ export default {
dataList
:
[],
dataList
:
[],
provinceId
:
""
,
provinceId
:
""
,
fromPage
:
""
,
fromPage
:
""
,
isInMergeDetail
:
false
isInMergeDetail
:
false
,
done
:
false
};
};
},
},
computed
:
{
computed
:
{
...
@@ -87,6 +91,8 @@ export default {
...
@@ -87,6 +91,8 @@ export default {
});
});
}
}
this
.
init
();
window
.
__getUserInfo4CouponList
=
function
(
param
)
{
window
.
__getUserInfo4CouponList
=
function
(
param
)
{
console
.
log
(
"__getUserInfo4CouponList"
,
param
);
console
.
log
(
"__getUserInfo4CouponList"
,
param
);
_this
.
token
=
param
.
userToken
;
_this
.
token
=
param
.
userToken
;
...
@@ -98,32 +104,35 @@ export default {
...
@@ -98,32 +104,35 @@ export default {
_this
.
getUserInfo
();
_this
.
getUserInfo
();
};
};
},
},
mounted
()
{
mounted
()
{
// 如果在浏览器或微信里
if
(
this
.
isWeb
)
{
const
{
token
,
info
}
=
this
.
$store
.
state
.
user
;
this
.
token
=
token
||
this
.
couponToken
||
localStorage
.
getItem
(
"couponToken"
)
||
getCookie
(
"couponToken"
);
if
(
this
.
token
&&
!
info
.
id
)
{
console
.
log
(
"4444 this.token"
,
this
.
token
);
// this.$store.dispatch('setToken', this.token);
this
.
commonCheckToken
(()
=>
{
this
.
$store
.
dispatch
(
"setToken"
,
this
.
token
);
// this.$store.dispatch("getUserInfo");
});
return
;
}
// 从登陆页面过来的
this
.
getAllCoupons
();
}
else
{
this
.
getUserInfo
();
}
},
},
methods
:
{
methods
:
{
...
mapActions
([
"setUserInfo"
]),
init
()
{
// 如果在浏览器或微信里
if
(
this
.
isWeb
)
{
const
{
token
,
info
}
=
this
.
$store
.
state
.
user
;
this
.
token
=
token
||
this
.
couponToken
||
localStorage
.
getItem
(
"couponToken"
)
||
getCookie
(
"couponToken"
);
if
(
this
.
token
&&
!
info
.
id
)
{
console
.
log
(
"4444 this.token"
,
this
.
token
);
// this.$store.dispatch('setToken', this.token);
this
.
commonCheckToken
(()
=>
{
this
.
$store
.
dispatch
(
"setToken"
,
this
.
token
);
// this.$store.dispatch("getUserInfo");
});
return
;
}
// 从登陆页面过来的
this
.
getAllCoupons
();
}
else
{
this
.
getUserInfo
();
}
},
//获取用户信息
//获取用户信息
getUserInfo
()
{
getUserInfo
()
{
rocNative
.
getUserInfo
({
rocNative
.
getUserInfo
({
...
@@ -133,33 +142,34 @@ export default {
...
@@ -133,33 +142,34 @@ export default {
// 获取我的优惠券列表
// 获取我的优惠券列表
getMyCoupons
()
{
getMyCoupons
()
{
this
.
commonCheckToken
(()
=>
{
this
.
GET
(
`trade/coupon/app/myCoupons`
,
{}).
then
(
res
=>
{
this
.
GET
(
`trade/coupon/app/myCoupons`
,
{}).
then
(
res
=>
{
if
(
res
.
code
==
"000000"
)
{
if
(
res
.
code
==
"000000"
)
{
this
.
provinceId
=
res
.
data
.
provinceId
;
this
.
provinceId
=
res
.
data
.
provinceId
;
this
.
done
=
true
;
this
.
dataList
=
this
.
handlerAllCouponList
(
this
.
dataList
=
this
.
handlerAllCouponList
(
res
.
data
.
baseCouponModelList
||
[],
res
.
data
.
baseCouponModelList
||
[],
false
false
);
);
}
}
else
if
(
res
.
code
==
"200000"
||
res
.
code
==
"200006"
)
{
});
rocNative
.
gotoLogin
();
}
});
});
},
},
// 主动领取优惠券
// 主动领取优惠券
// 状态码:1已下架,请领取其他优惠券 2优惠券已失效 3已领取,快去使用优惠券 4优惠券已领完 5成功领取
// 状态码:1已下架,请领取其他优惠券 2优惠券已失效 3已领取,快去使用优惠券 4优惠券已领完 5成功领取
receiveCouponByid
(
couponId
)
{
receiveCouponByid
(
couponId
)
{
this
.
commonCheckToken
(()
=>
{
this
.
POST
(
`trade/coupon/app/receive/
${
couponId
}
`
,
{}).
then
(
this
.
POST
(
`trade/coupon/app/receive/
${
couponId
}
`
,
{}).
then
(
({
code
,
data
})
=>
{
({
code
,
data
})
=>
{
if
(
code
==
"000000"
)
{
if
(
code
==
"000000"
)
{
console
.
log
(
"data.description"
,
data
.
description
);
console
.
log
(
"data.description"
,
data
.
description
);
data
.
description
&&
Toast
(
data
.
description
);
data
.
description
&&
Toast
(
data
.
description
);
this
.
searchCoupons
(
);
this
.
searchCoupons
();
}
else
if
(
res
.
code
==
"200000"
||
res
.
code
==
"200006"
)
{
}
rocNative
.
gotoLogin
();
}
}
);
}
}
);
);
},
},
// 处理(所有)列表数据
// 处理(所有)列表数据
...
@@ -187,23 +197,23 @@ export default {
...
@@ -187,23 +197,23 @@ export default {
// 获取所有优惠券列表
// 获取所有优惠券列表
getAllCoupons
()
{
getAllCoupons
()
{
console
.
log
(
"getAllCoupons"
);
console
.
log
(
"getAllCoupons"
);
this
.
commonCheckToken
(()
=>
{
let
couponId
=
this
.
couponId
;
let
couponId
=
this
.
couponId
;
if
(
couponId
)
{
if
(
couponId
)
{
this
.
POST
(
`trade/coupon/app/receive/
${
couponId
}
`
,
{}).
then
(
this
.
POST
(
`trade/coupon/app/receive/
${
couponId
}
`
,
{}).
then
(
({
code
,
data
})
=>
{
({
code
,
data
})
=>
{
if
(
code
==
"000000"
)
{
if
(
code
==
"000000"
)
{
if
(
data
.
description
)
{
if
(
data
.
description
)
{
this
.
$toast
({
message
:
data
.
description
,
duration
:
5000
});
this
.
$toast
({
message
:
data
.
description
,
duration
:
5000
});
}
}
}
this
.
searchCoupons
();
}
else
if
(
res
.
code
==
"200000"
||
res
.
code
==
"200006"
)
{
rocNative
.
gotoLogin
();
}
}
);
this
.
searchCoupons
();
}
else
{
}
this
.
searchCoupons
();
);
}
}
else
{
});
this
.
searchCoupons
();
}
},
},
// 区分是否是我的优惠券
// 区分是否是我的优惠券
...
@@ -238,6 +248,7 @@ export default {
...
@@ -238,6 +248,7 @@ export default {
this
.
POST
(
`trade/coupon/app/searchCoupons`
,
params
).
then
(
res
=>
{
this
.
POST
(
`trade/coupon/app/searchCoupons`
,
params
).
then
(
res
=>
{
if
(
res
.
code
==
"000000"
)
{
if
(
res
.
code
==
"000000"
)
{
this
.
provinceId
=
res
.
data
.
provinceId
;
this
.
provinceId
=
res
.
data
.
provinceId
;
this
.
done
=
true
;
this
.
dataList
=
this
.
handlerAllCouponList
(
this
.
dataList
=
this
.
handlerAllCouponList
(
res
.
data
.
baseCouponModelList
||
[],
res
.
data
.
baseCouponModelList
||
[],
true
true
...
...
写
预览
Markdown
格式
0%
请重试
or
附加一个文件
附加文件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录