Merge branch 'master' of http://192.168.1.26:3000/dianliang/dl_uniapp
This commit is contained in:
commit
5f79a9d0dc
5
App.vue
5
App.vue
@ -14,10 +14,7 @@
|
||||
initApp() {
|
||||
// 初始化应用配置
|
||||
this.initConfig()
|
||||
// 检查用户登录状态
|
||||
//#ifdef H5
|
||||
this.checkLogin()
|
||||
//#endif
|
||||
|
||||
},
|
||||
initConfig() {
|
||||
this.globalData.config = config
|
||||
|
@ -55,6 +55,14 @@ export function toApply(data) {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
//消耗权益值
|
||||
export function dealMemberRights(params) {
|
||||
return request({
|
||||
url: '/member/card/dealMemberRights',
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
//------------------名片-----------------------
|
||||
@ -160,4 +168,12 @@ export function saveOrder(data) {
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
//积分列表
|
||||
export function pointList(params) {
|
||||
return request({
|
||||
url: '/member/points/list',
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
}
|
@ -11,6 +11,16 @@ export function getNoticeList(params) {
|
||||
}
|
||||
|
||||
|
||||
// 查询浏览足迹
|
||||
export function getHisList(params) {
|
||||
return request({
|
||||
url: '/busi/notice/appFootprintList',
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 订阅查询通告列表
|
||||
export function getSubscribeList(params) {
|
||||
return request({
|
||||
@ -150,4 +160,4 @@ export function queryListByUserId(params) {
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
}
|
@ -170,6 +170,10 @@
|
||||
import {
|
||||
getNoticeList
|
||||
} from '@/api/business/notice.js'
|
||||
import {dealMemberRights} from '@/api/business/member.js'
|
||||
import {getJSONData} from '@/utils/auth.js';
|
||||
import {getUserType} from '@/utils/common.js'
|
||||
import constant from '@/utils/constant';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@ -280,7 +284,7 @@
|
||||
/**
|
||||
* 选择平台
|
||||
*/
|
||||
choosePlat(index) {
|
||||
async choosePlat(index) {
|
||||
if (index == 2) {
|
||||
//鉴权
|
||||
if (!this.checkIfHasRights(rightsCode.subscribeSelect)) {
|
||||
@ -327,7 +331,7 @@
|
||||
* @param {Object} index
|
||||
* @param {Object} item
|
||||
*/
|
||||
itemClick(index, item) {
|
||||
async itemClick(index, item) {
|
||||
if ('全部' == item) {
|
||||
//全部
|
||||
this.queryParams.sortBy = ""
|
||||
@ -355,7 +359,7 @@
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
goSeach() {
|
||||
async goSeach() {
|
||||
//鉴权
|
||||
if (!this.checkIfHasRights(rightsCode.searchNotice)) {
|
||||
return
|
||||
@ -366,9 +370,10 @@
|
||||
* 鉴权通用方法
|
||||
* @param {Object} rigthsCode
|
||||
*/
|
||||
checkIfHasRights(rigthsCode) {
|
||||
if (!hasRights(rigthsCode)) {
|
||||
toast("请开通会员")
|
||||
async checkIfHasRights(rigthsCode) {
|
||||
let res = await hasRights(rigthsCode)
|
||||
if (!res) {
|
||||
toast('请开通会员')
|
||||
return false
|
||||
}
|
||||
return true
|
||||
@ -439,8 +444,32 @@
|
||||
* @param {Object} item
|
||||
*/
|
||||
goDetail(item) {
|
||||
this.$tab.navigateTo(`/pages/notice/detail?id=${item.id}`)
|
||||
}
|
||||
let userInfo = getJSONData(constant.userInfo)
|
||||
let userType = getUserType()
|
||||
let param = {
|
||||
userId: userInfo.userId,
|
||||
userType: userType,
|
||||
noticeId: item.id,
|
||||
rightsCode: 'unlock_notice',
|
||||
deplete:1
|
||||
}
|
||||
dealMemberRights(param).then(res=>{
|
||||
if (res.code == 200) {
|
||||
this.$tab.navigateTo(`/pages/notice/detail?id=${item.id}`)
|
||||
}
|
||||
}).catch((e) => {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
duration: 2000,
|
||||
title: e
|
||||
});
|
||||
})
|
||||
},
|
||||
|
||||
/**扣除解锁通告权益*/
|
||||
dealMemberRights(){
|
||||
dealMemberRights()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -709,4 +738,4 @@
|
||||
margin: 10rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
@ -34,6 +34,11 @@
|
||||
import {
|
||||
setStrData
|
||||
} from '@/utils/auth.js'
|
||||
import {
|
||||
toast,
|
||||
hasRights
|
||||
} from '@/utils/common.js'
|
||||
import rightsCode from '@/utils/rightsCode'
|
||||
export default {
|
||||
components: {
|
||||
tabBarVue,
|
||||
@ -46,7 +51,7 @@
|
||||
data() {
|
||||
return {
|
||||
//当前用户类型
|
||||
nowUserType: null,
|
||||
nowUserType: 'bz',
|
||||
menus: ['全部', '最新', '高奖励', '急招', '品牌置换'],
|
||||
menuIndex: 0,
|
||||
dataList: ['1', '2', '2', '2'],
|
||||
@ -73,7 +78,10 @@
|
||||
onShow() {
|
||||
this.refreshUserType()
|
||||
},
|
||||
onLoad: function() {
|
||||
onLoad(param) {
|
||||
if (param.menuCode) {
|
||||
this.menuCode = param.menuCode
|
||||
}
|
||||
this.selectSiteConfig("platform_tel")
|
||||
},
|
||||
methods: {
|
||||
@ -82,6 +90,7 @@
|
||||
*/
|
||||
refreshUserType() {
|
||||
this.nowUserType = getUserType()
|
||||
console.log(this.nowUserType, 90);
|
||||
},
|
||||
updateParams(newVal) {
|
||||
this.nowUserType = newVal;
|
||||
@ -99,9 +108,26 @@
|
||||
if ("fabu" == code) {
|
||||
this.$tab.navigateTo('/pages/notice/public-notice')
|
||||
} else {
|
||||
if (code == 'dingyue') {
|
||||
if (!this.checkIfHasRights(rightsCode.subscribeSelect)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
this.menuCode = code
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 鉴权通用方法
|
||||
* @param {Object} rigthsCode
|
||||
*/
|
||||
async checkIfHasRights(rigthsCode) {
|
||||
let res = await hasRights(rigthsCode)
|
||||
if (!res) {
|
||||
toast('请开通会员')
|
||||
return false
|
||||
}
|
||||
return true
|
||||
},
|
||||
/**
|
||||
* 上滑加载数据
|
||||
*/
|
||||
|
@ -26,6 +26,12 @@
|
||||
toast,
|
||||
hasRights
|
||||
} from '@/utils/common.js'
|
||||
import {
|
||||
getCatgByCode
|
||||
} from '@/api/system/config.js'
|
||||
import {
|
||||
getHisList
|
||||
} from '@/api/business/notice.js'
|
||||
export default {
|
||||
components: {
|
||||
navigationBarVue,
|
||||
@ -33,7 +39,7 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dataList: ['', '', '', '', '', '', ''],
|
||||
dataList: [],
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10
|
||||
@ -44,8 +50,67 @@
|
||||
//当前用户权益可以看几条浏览记录
|
||||
maxHisNum: 20,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initData("dl_platform", "platformList")
|
||||
this.initData("dl_blogger_type", "bloggerTypeList")
|
||||
this.selectDataList()
|
||||
},
|
||||
onLoad: function() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 初始化数据
|
||||
* @param {Object} code
|
||||
* @param {Object} dataObj
|
||||
*/
|
||||
initData(code, dataObj) {
|
||||
let that = this
|
||||
getCatgByCode({
|
||||
code: code
|
||||
}).then(res => {
|
||||
if (res.code == 200) {
|
||||
this[dataObj] = res.data
|
||||
}
|
||||
}).catch((e) => {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
duration: 2000,
|
||||
title: e
|
||||
});
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 查询数据
|
||||
*/
|
||||
selectDataList() {
|
||||
getHisList(this.queryParams).then(res => {
|
||||
this.isTriggered = false
|
||||
if (res.code == 200) {
|
||||
if (this.queryParams.pageNum == 1) {
|
||||
this.dataList = res.data.records
|
||||
} else {
|
||||
this.dataList = this.dataList.concat(res.data.records)
|
||||
}
|
||||
this.total = res.data.total
|
||||
}
|
||||
}).catch((e) => {
|
||||
this.isTriggered = false
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
duration: 2000,
|
||||
title: e
|
||||
});
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 查看通告详情
|
||||
* @param {Object} item
|
||||
*/
|
||||
goDetail(item) {
|
||||
this.$tab.navigateTo(`/pages/notice/detail?id=${item.id}`)
|
||||
},
|
||||
/**
|
||||
* 上滑加载数据
|
||||
*/
|
||||
@ -57,6 +122,7 @@
|
||||
}
|
||||
//页码+1,调用获取数据的方法获取第二页数据
|
||||
this.queryParams.pageNum++
|
||||
this.selectDataList()
|
||||
},
|
||||
/**
|
||||
* 下拉刷新数据
|
||||
@ -65,6 +131,8 @@
|
||||
this.isTriggered = true
|
||||
this.queryParams.pageNum = 1
|
||||
this.total = 0
|
||||
|
||||
this.selectDataList()
|
||||
},
|
||||
/**
|
||||
* 查看通告详情
|
||||
|
@ -69,8 +69,21 @@
|
||||
|
||||
<script>
|
||||
import navigationBarVue from '@/components/navigation/navigationBar.vue';
|
||||
import {baseCardList, rightList} from '@/api/business/base.js'
|
||||
import {saveOrder} from '@/api/business/member.js'
|
||||
import {
|
||||
baseCardList,
|
||||
rightList
|
||||
} from '@/api/business/base.js'
|
||||
import {
|
||||
saveOrder
|
||||
} from '@/api/business/member.js'
|
||||
import {
|
||||
getToken
|
||||
} from '@/utils/auth'
|
||||
import {
|
||||
getCodeUrl,
|
||||
getWebAccessTokenAndOpenid,
|
||||
gzhLogin
|
||||
} from '@/api/wxApi'
|
||||
export default {
|
||||
components: {
|
||||
navigationBarVue
|
||||
@ -83,8 +96,8 @@
|
||||
chooseCardIndex: 0,
|
||||
//当前选中的会员卡付款下标
|
||||
choosePriceIndex: 0,
|
||||
//用户类型
|
||||
userType:'02',
|
||||
//用户类型
|
||||
userType: '02',
|
||||
// 会员卡数组
|
||||
memberCardList: [{
|
||||
id: "1",
|
||||
@ -133,10 +146,10 @@
|
||||
cardName: '非会员'
|
||||
}, {
|
||||
id: '2',
|
||||
cardName: '箐英'
|
||||
cardName: '箐英'
|
||||
}, {
|
||||
id: '3',
|
||||
cardName: '钻石'
|
||||
cardName: '钻石'
|
||||
}],
|
||||
rightsList: [{
|
||||
name: "每日解锁通告上限",
|
||||
@ -160,44 +173,95 @@
|
||||
}
|
||||
},
|
||||
|
||||
onLoad(options){
|
||||
this.initData(options.userType);
|
||||
},
|
||||
methods: {
|
||||
/**初始化*/
|
||||
initData(userType){
|
||||
this.userType = userType
|
||||
this.getCardList(userType);
|
||||
this.getRightsList(userType);
|
||||
},
|
||||
onLoad(options) {
|
||||
|
||||
/**获取会员卡列表*/
|
||||
getCardList(userType){
|
||||
baseCardList({userType:userType}).then(res => {
|
||||
this.memberCardList = res.data
|
||||
}).catch((e) => {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
duration: 2000,
|
||||
title: e
|
||||
});
|
||||
})
|
||||
},
|
||||
/**权益列表*/
|
||||
getRightsList(userType){
|
||||
rightList({userType:userType}).then(res => {
|
||||
this.cardList = res.data.cardList
|
||||
this.rightsList = res.data.rightsList
|
||||
console.log(this.cardList,'cardList')
|
||||
console.log(this.rightsList,'rightsList')
|
||||
}).catch((e) => {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
duration: 2000,
|
||||
title: e
|
||||
});
|
||||
})
|
||||
},
|
||||
this.initData(options.userType);
|
||||
|
||||
//获取url中的search
|
||||
let search = location.search.slice(1);
|
||||
|
||||
let arr = search.split("&");
|
||||
let result = {};
|
||||
arr.forEach(function(item) {
|
||||
let itemArr = item.split('=');
|
||||
result[itemArr[0]] = itemArr[1];
|
||||
})
|
||||
|
||||
if (result.code) {
|
||||
getWebAccessTokenAndOpenid(result.code).then(res => {
|
||||
|
||||
gzhLogin(res)
|
||||
})
|
||||
} else {
|
||||
this.toLogin(options.userType)
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
methods: {
|
||||
toLogin(userType) {
|
||||
/*#ifdef APP-PLUS*/
|
||||
// App端特有的逻辑
|
||||
console.log('Running on App-Plus');
|
||||
/*#endif*/
|
||||
|
||||
/*#ifdef H5*/
|
||||
// 在浏览器端(H5)执行的逻辑
|
||||
if (!getToken()) {
|
||||
//未登录状态
|
||||
getCodeUrl(userType).then(res => {
|
||||
window.location.href = res.codeUrl;
|
||||
})
|
||||
}
|
||||
/*#endif*/
|
||||
|
||||
/*#ifdef MP-WEIXIN*/
|
||||
// 微信小程序端执行的逻辑
|
||||
console.log('Running on WeChat Mini Program');
|
||||
/*#endif*/
|
||||
|
||||
},
|
||||
/**初始化*/
|
||||
initData(userType) {
|
||||
if (getToken()) {
|
||||
this.userType = userType
|
||||
this.getCardList(userType);
|
||||
this.getRightsList(userType);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**获取会员卡列表*/
|
||||
getCardList(userType) {
|
||||
baseCardList({
|
||||
userType: userType
|
||||
}).then(res => {
|
||||
this.memberCardList = res.data
|
||||
}).catch((e) => {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
duration: 2000,
|
||||
title: e
|
||||
});
|
||||
})
|
||||
},
|
||||
/**权益列表*/
|
||||
getRightsList(userType) {
|
||||
rightList({
|
||||
userType: userType
|
||||
}).then(res => {
|
||||
this.cardList = res.data.cardList
|
||||
this.rightsList = res.data.rightsList
|
||||
console.log(this.cardList, 'cardList')
|
||||
console.log(this.rightsList, 'rightsList')
|
||||
}).catch((e) => {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
duration: 2000,
|
||||
title: e
|
||||
});
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 菜单点击
|
||||
* @param {Object} index
|
||||
@ -220,41 +284,41 @@
|
||||
handleUserAgrement(site) {
|
||||
this.$tab.navigateTo(`/pages/common/richview/index?title=${site.title}&code=${site.code}`)
|
||||
},
|
||||
/**生成订单*/
|
||||
toOrder(){
|
||||
let data = {
|
||||
userType:this.userType,
|
||||
orderType:'01',
|
||||
goodsId:this.memberCardList[this.chooseCardIndex].id,
|
||||
goodsNum:1,
|
||||
goodsPrice:this.memberCardList[this.chooseCardIndex].priceList[this.choosePriceIndex].price,
|
||||
}
|
||||
if (this.memberCardList[this.chooseCardIndex].priceList[this.choosePriceIndex].title === '年付会员') {
|
||||
data.goodsCycle = '03'
|
||||
}
|
||||
if (this.memberCardList[this.chooseCardIndex].priceList[this.choosePriceIndex].title === '季付会员') {
|
||||
data.goodsCycle = '02'
|
||||
}
|
||||
if (this.memberCardList[this.chooseCardIndex].priceList[this.choosePriceIndex].title === '月付会员') {
|
||||
data.goodsCycle = '01'
|
||||
}
|
||||
saveOrder(data).then(res => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
duration: 2000,
|
||||
title: '保存成功'
|
||||
});
|
||||
uni.navigateBack()
|
||||
}
|
||||
}).catch((e) => {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
duration: 2000,
|
||||
title: e
|
||||
});
|
||||
})
|
||||
},
|
||||
/**生成订单*/
|
||||
toOrder() {
|
||||
let data = {
|
||||
userType: this.userType,
|
||||
orderType: '01',
|
||||
goodsId: this.memberCardList[this.chooseCardIndex].id,
|
||||
goodsNum: 1,
|
||||
goodsPrice: this.memberCardList[this.chooseCardIndex].priceList[this.choosePriceIndex].price,
|
||||
}
|
||||
if (this.memberCardList[this.chooseCardIndex].priceList[this.choosePriceIndex].title === '年付会员') {
|
||||
data.goodsCycle = '03'
|
||||
}
|
||||
if (this.memberCardList[this.chooseCardIndex].priceList[this.choosePriceIndex].title === '季付会员') {
|
||||
data.goodsCycle = '02'
|
||||
}
|
||||
if (this.memberCardList[this.chooseCardIndex].priceList[this.choosePriceIndex].title === '月付会员') {
|
||||
data.goodsCycle = '01'
|
||||
}
|
||||
saveOrder(data).then(res => {
|
||||
if (res.code == 200) {
|
||||
uni.showToast({
|
||||
icon: 'success',
|
||||
duration: 2000,
|
||||
title: '保存成功'
|
||||
});
|
||||
uni.navigateBack()
|
||||
}
|
||||
}).catch((e) => {
|
||||
uni.showToast({
|
||||
icon: 'error',
|
||||
duration: 2000,
|
||||
title: e
|
||||
});
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -181,6 +181,12 @@
|
||||
import {
|
||||
queryDetail
|
||||
} from '@/api/business/member.js'
|
||||
import {
|
||||
getToken
|
||||
} from '@/utils/auth'
|
||||
import {
|
||||
getCodeUrl
|
||||
} from '@/api/wxApi'
|
||||
export default {
|
||||
props: {
|
||||
nowUserType: {
|
||||
@ -188,11 +194,6 @@
|
||||
default: null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 'nowUserType': function(newVal, oldVal) {
|
||||
// this.$emit('update:params', newVal);
|
||||
// }
|
||||
},
|
||||
components: {
|
||||
tabBarVue,
|
||||
},
|
||||
@ -215,7 +216,9 @@
|
||||
}
|
||||
},
|
||||
onShow() {},
|
||||
onLoad() {},
|
||||
onLoad() {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
if (null != getJSONData(constant.userInfo)) {
|
||||
this.userInfo = getJSONData(constant.userInfo)
|
||||
@ -294,7 +297,8 @@
|
||||
* 去积分列表
|
||||
*/
|
||||
goPoints() {
|
||||
this.$tab.navigateTo('/pages/mine/points/points')
|
||||
this.$tab.navigateTo('/pages/mine/points/points?userId=' + this.userInfo.userId + '&pointsBalance=' + this
|
||||
.userInfo.pointsBalance)
|
||||
},
|
||||
/**
|
||||
* 跳转编辑页
|
||||
|
@ -9,7 +9,7 @@
|
||||
<image src="@/static/mine/points.png" mode="aspectFit">
|
||||
</image>可用积分
|
||||
</view>
|
||||
<view class="left-dom-bottom">{{formatNumberWithCommas(56320)}}</view>
|
||||
<view class="left-dom-bottom">{{pointsBalance}}</view>
|
||||
</view>
|
||||
<view class="right-dom" @click="outData()">提现</view>
|
||||
</view>
|
||||
@ -64,9 +64,9 @@
|
||||
|
||||
<script>
|
||||
import navigationBarVue from '@/components/navigation/navigationBar.vue';
|
||||
import {
|
||||
formatNumberWithCommas
|
||||
} from '@/utils/common.js'
|
||||
import {formatNumberWithCommas} from '@/utils/common.js'
|
||||
import {pointList} from '@/api/business/member.js'
|
||||
import {toast} from '@/utils/common.js'
|
||||
export default {
|
||||
components: {
|
||||
navigationBarVue,
|
||||
@ -95,13 +95,24 @@
|
||||
}],
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10
|
||||
pageSize: 10,
|
||||
userId:null
|
||||
},
|
||||
total: 0,
|
||||
//下来刷新状态
|
||||
isTriggered: false,
|
||||
userId:null,
|
||||
pointsBalance:0
|
||||
}
|
||||
},
|
||||
|
||||
onLoad(option){
|
||||
this.userId = option.userId
|
||||
this.queryParams.userId = option.userId
|
||||
this.pointsBalance = option.pointsBalance
|
||||
this.initData()
|
||||
},
|
||||
|
||||
methods: {
|
||||
/**
|
||||
* 格式化数字
|
||||
@ -110,6 +121,21 @@
|
||||
formatNumberWithCommas(number) {
|
||||
return formatNumberWithCommas(number)
|
||||
},
|
||||
|
||||
/**初始化数据*/
|
||||
initData(){
|
||||
pointList(this.queryParams).then(res=>{
|
||||
if (res.code == 200){
|
||||
if (this.queryParams.pageNum == 1) {
|
||||
this.dataList = res.data.records
|
||||
} else {
|
||||
this.dataList = this.dataList.concat(res.data.records)
|
||||
}
|
||||
this.total = res.data.total
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 提现
|
||||
*/
|
||||
|
@ -57,9 +57,12 @@ export function hasRights(code) {
|
||||
if (userRights.hasOwnProperty(code)) {
|
||||
rtnData = userRights[code]
|
||||
}
|
||||
console.log(rtnData, 51);
|
||||
resolve(rtnData)
|
||||
|
||||
})
|
||||
}).catch(e => {
|
||||
reject(e)
|
||||
})
|
||||
|
||||
}
|
||||
@ -76,7 +79,7 @@ export function changeUserType(value) {
|
||||
* @param {Object} value 身份值
|
||||
*/
|
||||
export function getUserType() {
|
||||
return getStrData(constant.userTypeKey)
|
||||
return getStrData(constant.userTypeKey) || '02'
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user