Merge pull request '解决体验版弹出登录框' (#65) from dengjie into dev

Reviewed-on: http://git.hchyun.com/feashow/pupil/pulls/65
This commit is contained in:
odjbin
2023-01-28 14:36:24 +00:00
14 changed files with 213 additions and 83 deletions

View File

@@ -77,7 +77,6 @@
methods: { methods: {
//获取历史记录 //获取历史记录
getHistoryOrCollection() { getHistoryOrCollection() {
console.log(uni.getStorageSync('token'));
this.$apiServe.getHistoryOrCollection(this.type).then(res => { this.$apiServe.getHistoryOrCollection(this.type).then(res => {
let data = res.data.data let data = res.data.data
for (const item of data) { for (const item of data) {
@@ -156,6 +155,5 @@
font-weight: 400; font-weight: 400;
color: #FFFFFF; color: #FFFFFF;
line-height: 33px; line-height: 33px;
} }
</style> </style>

View File

@@ -1,6 +1,7 @@
<template> <template>
<view> <view>
<myForm ref="nameAndphone"></myForm> <myForm ref="nameAndphone"></myForm>
<view style="height: 168rpx;"></view>
<u-button type="success" text="确定" color="#0EBB5B" @click="handleSureClick()"></u-button> <u-button type="success" text="确定" color="#0EBB5B" @click="handleSureClick()"></u-button>
<u-modal :show="showM" closeOnClickOverlay="false" confirmText="确定" @confirm="confirm"> <u-modal :show="showM" closeOnClickOverlay="false" confirmText="确定" @confirm="confirm">
<rich-text :nodes="content"></rich-text> <rich-text :nodes="content"></rich-text>
@@ -30,9 +31,7 @@
} }
}, },
onLoad() { onLoad() {
this.getIdeasAndNeeds() if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) {
console.log(uni.getStorageSync('token'))
this.isLoad = false this.isLoad = false
// uni.navigateTo({ // uni.navigateTo({
// url: '../../pages/my/login/login' // url: '../../pages/my/login/login'
@@ -51,7 +50,7 @@
companyName: name, companyName: name,
companyPhone: phone companyPhone: phone
}).then(res => { }).then(res => {
// console.log('绑定公司', res.data); console.log('绑定公司', res.data);
if (res.data.code == 20003) { if (res.data.code == 20003) {
this.showM = true this.showM = true
} else if (res.data.code == 20005) { } else if (res.data.code == 20005) {
@@ -66,8 +65,7 @@
// }) // })
}, },
reOnLoad() { reOnLoad() {
console.log('----------------true') if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) {
this.$toast.warn('登录失败请重试') this.$toast.warn('登录失败请重试')
this.isLoad = false this.isLoad = false
// uni.navigateTo({ // uni.navigateTo({
@@ -78,7 +76,6 @@
this.isLoad = true this.isLoad = true
}, },
failToLoad() { failToLoad() {
console.log('----------------false')
this.$toast.warn('登录失败请重试') this.$toast.warn('登录失败请重试')
} }
@@ -92,7 +89,6 @@
height: 86rpx !important; height: 86rpx !important;
background: #0EBB5B; background: #0EBB5B;
border-radius: 20rpx !important; border-radius: 20rpx !important;
margin-top: 168rpx;
} }
.u-modal__button-group__wrapper--hover { .u-modal__button-group__wrapper--hover {

View File

@@ -1,18 +1,52 @@
<template> <template>
<view> <view>
<productsBtn :type="1"></productsBtn> <productsBtn :type="1" ref="browseHistory"></productsBtn>
<!-- <view style="margin:0 20rpx;">
<u-overlay :show="!isLoad">
<login @success="reOnLoad()" @fail="failToLoad()"></login>
</u-overlay>
</view> -->
</view> </view>
</template> </template>
<script> <script>
import login from 'pages/my/login/login'
export default { export default {
components: {
login
},
data() { data() {
return { return {
type: '' type: '',
isLoad: true,
} }
}, },
onLoad() {
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.isLoad = false
// uni.navigateTo({
// url: '../../pages/my/login/login'
// })
return
}
this.isLoad = true
},
methods: { methods: {
reOnLoad() {
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.$toast.warn('登录失败请重试')
this.isLoad = false
// uni.navigateTo({
// url: '../../pages/my/login/login'
// })
return
}
this.isLoad = true
this.$refs.browseHistory.getHistoryOrCollection()
},
failToLoad() {
this.$toast.warn('登录失败请重试')
}
} }
} }
</script> </script>

View File

@@ -11,14 +11,23 @@
placeholderStyle="color: #CCCCCC;font-size: 24rpx;"></u--input> placeholderStyle="color: #CCCCCC;font-size: 24rpx;"></u--input>
</u-form-item> </u-form-item>
</u--form> </u--form>
<u-button type="success" text="确定" color="#0EBB5B"></u-button> <view style="height: 230rpx;"></view>
<u-button type="success" text="确定" color="#0EBB5B" @click="handleSubmit()"></u-button>
</view>
<view style="margin:0 20rpx;">
<u-overlay :show="!isLoad">
<login @success="reOnLoad()" @fail="failToLoad()"></login>
</u-overlay>
</view> </view>
</view> </view>
</template> </template>
<script> <script>
import login from 'pages/my/login/login'
export default { export default {
components: {
login
},
data() { data() {
return { return {
avatar: 'https://cdn.uviewui.com/uview/album/2.jpg', avatar: 'https://cdn.uviewui.com/uview/album/2.jpg',
@@ -27,8 +36,19 @@
name: '' name: ''
}, },
}, },
isLoad: true,
} }
}, },
onLoad() {
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.isLoad = false
// uni.navigateTo({
// url: '../../pages/my/login/login'
// })
return
}
this.isLoad = true
},
methods: { methods: {
//修改头像 //修改头像
changeAvatar() { changeAvatar() {
@@ -38,13 +58,14 @@
success: (res) => { success: (res) => {
console.log(res.tempFilePaths[0]); //成功则返回图片的本地文件路径列表 tempFilePaths console.log(res.tempFilePaths[0]); //成功则返回图片的本地文件路径列表 tempFilePaths
this.avatar = res.tempFilePaths[0] //更新本地浏览头像图片 this.avatar = res.tempFilePaths[0] //更新本地浏览头像图片
// this.update(res.tempFilePaths[0]) //上传图片 // this.update(res.tempFilePaths[0]) //上传图片
} }
}); });
}, },
update(filePath) { update(filePath) {
const _this = this const _this = this
const token = uni.getStorageSync('token') const token = uni.getStorageSync('loginToken')
const res = uni.uploadFile({ const res = uni.uploadFile({
url: _this.action, //仅为示例,非真实的接口地址 url: _this.action, //仅为示例,非真实的接口地址
filePath: filePath, filePath: filePath,
@@ -61,6 +82,32 @@
} }
}); });
}, },
//提交头像和昵称
handleSubmit() {
this.$apiServe.updateUser({
nickname: this.model.userInfo.name,
avatar: this.avatar
}).then(res => {
console.log('修改头像昵称==', res);
}).finally(_ => {})
},
reOnLoad() {
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.$toast.warn('登录失败请重试')
this.isLoad = false
// uni.navigateTo({
// url: '../../pages/my/login/login'
// })
return
}
this.isLoad = true
},
failToLoad() {
// uni.navigateBack({
// url: '/pages/my/my'
// })
this.$toast.warn('登录失败请重试')
}
} }
} }
</script> </script>
@@ -78,6 +125,5 @@
height: 86rpx !important; height: 86rpx !important;
background: #0EBB5B; background: #0EBB5B;
border-radius: 20rpx !important; border-radius: 20rpx !important;
margin-top: 230rpx;
} }
</style> </style>

View File

@@ -13,16 +13,26 @@
<u-modal :show="showM" closeOnClickOverlay="false" confirmText="确定" @confirm="confirm"> <u-modal :show="showM" closeOnClickOverlay="false" confirmText="确定" @confirm="confirm">
<rich-text :nodes="content"></rich-text> <rich-text :nodes="content"></rich-text>
</u-modal> </u-modal>
<!-- <view style="margin:0 20rpx;">
<u-overlay :show="!isLoad">
<login @success="reOnLoad()" @fail="failToLoad()"></login>
</u-overlay>
</view> -->
</view> </view>
</template> </template>
<script> <script>
import login from 'pages/my/login/login'
export default { export default {
components: {
login
},
data() { data() {
return { return {
name: '', name: '',
phone: '', phone: '',
showM: false, showM: false,
isLoad: true,
//会员中心的用户名旁边不显示edit图标 //会员中心的用户名旁边不显示edit图标
show: false, show: false,
content: `请保持手机畅通<br> content: `请保持手机畅通<br>
@@ -30,6 +40,16 @@
commitment: '承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置' commitment: '承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置承诺声明预留文字位置'
} }
}, },
onLoad() {
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.isLoad = false
// uni.navigateTo({
// url: '../../pages/my/login/login'
// })
return
}
this.isLoad = true
},
methods: { methods: {
// 联系客服模态框 // 联系客服模态框
handleSureClick() { handleSureClick() {
@@ -55,6 +75,20 @@
// uni.switchTab({ // uni.switchTab({
// url: '/pages/my/my' // url: '/pages/my/my'
// }) // })
},
reOnLoad() {
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.$toast.warn('登录失败请重试')
this.isLoad = false
// uni.navigateTo({
// url: '../../pages/my/login/login'
// })
return
}
this.isLoad = true
},
failToLoad() {
this.$toast.warn('登录失败请重试')
} }
} }
} }

View File

@@ -1,16 +1,51 @@
<template> <template>
<view> <view>
<productsBtn :type="2"></productsBtn> <productsBtn :type="2"></productsBtn>
<!-- <view style="margin:0 20rpx;">
<u-overlay :show="!isLoad">
<login @success="reOnLoad()" @fail="failToLoad()"></login>
</u-overlay>
</view> -->
</view> </view>
</template> </template>
<script> <script>
import login from 'pages/my/login/login'
export default { export default {
components: {
login
},
data() { data() {
return { return {
type: '' type: '',
isLoad: true,
} }
}, },
methods: {} onLoad() {
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.isLoad = false
// uni.navigateTo({
// url: '../../pages/my/login/login'
// })
return
}
this.isLoad = true
},
methods: {
reOnLoad() {
if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.$toast.warn('登录失败请重试')
this.isLoad = false
// uni.navigateTo({
// url: '../../pages/my/login/login'
// })
return
}
this.isLoad = true
},
failToLoad() {
this.$toast.warn('登录失败请重试')
}
}
} }
</script> </script>

View File

@@ -88,10 +88,8 @@
} }
}, },
onLoad() { onLoad() {
console.log(uni.getStorageSync('token'));
this.getIdeasAndNeeds() this.getIdeasAndNeeds()
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) { if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
console.log(uni.getStorageSync('token'))
this.isLoad = false this.isLoad = false
// uni.navigateTo({ // uni.navigateTo({
// url: '../../pages/my/login/login' // url: '../../pages/my/login/login'
@@ -103,9 +101,8 @@
methods: { methods: {
//获取创意发布 //获取创意发布
getIdeasAndNeeds() { getIdeasAndNeeds() {
console.log('this.type', this.type);
this.$apiServe.getIdeasAndNeeds(this.type).then(res => { this.$apiServe.getIdeasAndNeeds(this.type).then(res => {
console.log('获取创意发布&需求发布', res.data.data); // console.log('获取创意发布&需求发布', res.data.data);
let data = res.data.data let data = res.data.data
for (const item of data) { for (const item of data) {
item.pub_time = dateFormatXwDetail(item.pub_time) item.pub_time = dateFormatXwDetail(item.pub_time)
@@ -127,7 +124,7 @@
//切换需求发布和创意发布 //切换需求发布和创意发布
tabChange(data) { tabChange(data) {
this.tabCurrent = data.index this.tabCurrent = data.index
console.log('data.index', data.index); // console.log('data.index', data.index);
if (data.index == 0) { if (data.index == 0) {
this.type = 1 this.type = 1
} else if (data.index == 1) { } else if (data.index == 1) {
@@ -151,7 +148,7 @@
success: function(res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
that.$apiServe.deleteIdeasAndNeeds(item.id).then(res => { that.$apiServe.deleteIdeasAndNeeds(item.id).then(res => {
console.log('删除发布', res); // console.log('删除发布', res);
if (res.data.code == 1) { if (res.data.code == 1) {
that.$toast.warn('删除成功') that.$toast.warn('删除成功')
} }
@@ -166,8 +163,7 @@
}) })
}, },
reOnLoad() { reOnLoad() {
console.log('----------------true') if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) {
this.$toast.warn('登录失败请重试') this.$toast.warn('登录失败请重试')
this.isLoad = false this.isLoad = false
// uni.navigateTo({ // uni.navigateTo({
@@ -176,9 +172,9 @@
return return
} }
this.isLoad = true this.isLoad = true
this.getIdeasAndNeeds()
}, },
failToLoad() { failToLoad() {
console.log('----------------false')
this.$toast.warn('登录失败请重试') this.$toast.warn('登录失败请重试')
} }
} }

View File

@@ -51,8 +51,7 @@
this.id = option.id this.id = option.id
this.getCertifiedCjDetail() this.getCertifiedCjDetail()
this.imgUrl = uni.getStorageSync('img_url') this.imgUrl = uni.getStorageSync('img_url')
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) { if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
console.log(uni.getStorageSync('token'))
this.isLoad = false this.isLoad = false
// uni.navigateTo({ // uni.navigateTo({
// url: '../../pages/my/login/login' // url: '../../pages/my/login/login'
@@ -65,7 +64,7 @@
//获取认证厂家详情 //获取认证厂家详情
getCertifiedCjDetail() { getCertifiedCjDetail() {
this.$apiServe.getCertifiedCjDetail(this.id).then(res => { this.$apiServe.getCertifiedCjDetail(this.id).then(res => {
console.log('认证厂家详情页', res.data) // console.log('认证厂家详情页', res.data)
if (res.data.data) { if (res.data.data) {
let data = res.data.data let data = res.data.data
data.images = data.images.split(';') data.images = data.images.split(';')
@@ -76,8 +75,7 @@
}).finally(_ => {}) }).finally(_ => {})
}, },
reOnLoad() { reOnLoad() {
console.log('----------------true') if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) {
this.$toast.warn('登录失败请重试') this.$toast.warn('登录失败请重试')
this.isLoad = false this.isLoad = false
// uni.navigateTo({ // uni.navigateTo({
@@ -86,9 +84,9 @@
return return
} }
this.isLoad = true this.isLoad = true
this.getCertifiedCjDetail()
}, },
failToLoad() { failToLoad() {
console.log('----------------false')
this.$toast.warn('登录失败请重试') this.$toast.warn('登录失败请重试')
} }
} }

View File

@@ -41,8 +41,7 @@
onLoad(option) { onLoad(option) {
this.id = option.id this.id = option.id
this.getNewsDetail() this.getNewsDetail()
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) { if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
console.log(uni.getStorageSync('token'))
this.isLoad = false this.isLoad = false
// uni.navigateTo({ // uni.navigateTo({
// url: '../../pages/my/login/login' // url: '../../pages/my/login/login'
@@ -66,8 +65,7 @@
}).finally(_ => {}) }).finally(_ => {})
}, },
reOnLoad() { reOnLoad() {
console.log('----------------true') if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) {
this.$toast.warn('登录失败请重试') this.$toast.warn('登录失败请重试')
this.isLoad = false this.isLoad = false
// uni.navigateTo({ // uni.navigateTo({
@@ -76,9 +74,9 @@
return return
} }
this.isLoad = true this.isLoad = true
this.getNewsDetail()
}, },
failToLoad() { failToLoad() {
console.log('----------------false')
this.$toast.warn('登录失败请重试') this.$toast.warn('登录失败请重试')
} }
} }

View File

@@ -87,8 +87,7 @@
this.id = option.id this.id = option.id
this.getProductDetail() this.getProductDetail()
this.imgUrl = uni.getStorageSync('img_url') this.imgUrl = uni.getStorageSync('img_url')
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) { if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
console.log(uni.getStorageSync('token'))
this.isLoad = false this.isLoad = false
// uni.navigateTo({ // uni.navigateTo({
// url: '../../pages/my/login/login' // url: '../../pages/my/login/login'
@@ -100,9 +99,8 @@
methods: { methods: {
//获取详情信息 //获取详情信息
getProductDetail() { getProductDetail() {
console.log(this.id);
this.$apiServe.getProductDetail(this.id).then(res => { this.$apiServe.getProductDetail(this.id).then(res => {
console.log('产品详情页', res.data) // console.log('产品详情页', res.data)
if (res.data.data.thumb) { if (res.data.data.thumb) {
this.isThumb = true this.isThumb = true
} }
@@ -121,7 +119,7 @@
//收藏按钮 //收藏按钮
starTap() { starTap() {
this.$apiServe.collect(this.id).then(res => { this.$apiServe.collect(this.id).then(res => {
console.log('收藏成功', res.data) // console.log('收藏成功', res.data)
if (res.data.code == 1) { if (res.data.code == 1) {
this.detailList.is_fav = 1 this.detailList.is_fav = 1
this.$toast.warn('收藏成功') this.$toast.warn('收藏成功')
@@ -135,8 +133,7 @@
this.showHeart = !this.showHeart this.showHeart = !this.showHeart
}, },
reOnLoad() { reOnLoad() {
console.log('----------------true') if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) {
this.$toast.warn('登录失败请重试') this.$toast.warn('登录失败请重试')
this.isLoad = false this.isLoad = false
// uni.navigateTo({ // uni.navigateTo({
@@ -145,9 +142,9 @@
return return
} }
this.isLoad = true this.isLoad = true
this.getProductDetail()
}, },
failToLoad() { failToLoad() {
console.log('----------------false')
this.$toast.warn('登录失败请重试') this.$toast.warn('登录失败请重试')
} }
} }
@@ -170,10 +167,8 @@
right: 77rpx; right: 77rpx;
z-index: 99; z-index: 99;
} }
} }
.content { .content {
padding: 20rpx; padding: 20rpx;
background-color: #fff; background-color: #fff;

View File

@@ -155,8 +155,8 @@
}, },
onTabItemTap() { onTabItemTap() {
console.log('----onTabItemTap') console.log('----onTabItemTap')
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) { if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
console.log(uni.getStorageSync('token')) console.log(uni.getStorageSync('loginToken'))
this.isLoad = false this.isLoad = false
// uni.navigateTo({ // uni.navigateTo({
// url: '../../pages/my/login/login' // url: '../../pages/my/login/login'
@@ -164,7 +164,7 @@
return return
} }
this.isLoad = true this.isLoad = true
this.token = uni.getStorageSync('token') this.token = uni.getStorageSync('loginToken')
this.getFormData() this.getFormData()
this.fileList1 = [] this.fileList1 = []
this.needsPublishForm = {} this.needsPublishForm = {}
@@ -238,7 +238,7 @@
getProductValue(data) { getProductValue(data) {
this.showProductPicker = false this.showProductPicker = false
this.showCategoryPicker = false this.showCategoryPicker = false
this.needsPublishForm.product= data.value[0] this.needsPublishForm.product = data.value[0]
// console.log(data) // console.log(data)
// const obj = this.productPickerList.find(item => { // const obj = this.productPickerList.find(item => {
// return item.name === data.value[0] // return item.name === data.value[0]
@@ -368,9 +368,10 @@
return false return false
} }
this.needsPublishForm.type = Number(this.tabCurrent + 1) this.needsPublishForm.type = Number(this.tabCurrent + 1)
this.needsPublishForm.pub_time = this.needsPublishForm.pub_time ? this.needsPublishForm.pub_time : new Date().getTime() this.needsPublishForm.pub_time = this.needsPublishForm.pub_time ? this.needsPublishForm.pub_time :
new Date().getTime()
const temp = [] const temp = []
if(this.fileList1.length > 0) { if (this.fileList1.length > 0) {
this.fileList1.map(item => { this.fileList1.map(item => {
temp.push(item.url) temp.push(item.url)
}) })
@@ -392,12 +393,14 @@
...this.needsPublishForm ...this.needsPublishForm
} }
apiService.submitIdeasAndNeeds(data).then(res => { apiService.submitIdeasAndNeeds(data).then(res => {
this.$toast.success(res.data.msg) this.$toast.warn('发布成功')
console.log('esf=', res);
// this.$toast.success(res.data.msg)
}) })
}, },
reOnLoad() { reOnLoad() {
console.log('----------------true') console.log('----------------true')
if (!uni.getStorageSync('token') || uni.getStorageSync('token').length === 0) { if (!uni.getStorageSync('loginToken') || uni.getStorageSync('loginToken').length === 0) {
this.$toast.warn('登录失败请重试') this.$toast.warn('登录失败请重试')
this.isLoad = false this.isLoad = false
// uni.navigateTo({ // uni.navigateTo({
@@ -405,7 +408,7 @@
// }) // })
return return
} }
this.token = uni.getStorageSync('token') this.token = uni.getStorageSync('loginToken')
this.isLoad = true this.isLoad = true
this.getFormData() this.getFormData()
}, },

View File

@@ -96,18 +96,8 @@
// code: code // code: code
// }).then(res => { // }).then(res => {
// var data = res.data.data // var data = res.data.data
// console.log('登录code换取的信息', data); // // console.log('登录code换取的信息', data);
// // uni.setStorageSync('token', data.token); // uni.setStorageSync('token', data.token);
// // that.$toast.success('登录成功')
// // that.$emit('success')
// //登录完成后使用手机code换取手机号,调用/user/getMobileByMnp接口
// //接口详细链接 https://docs.apipost.cn/preview/468be606f65cae75/3f2f988ddf82dd8e
// // const codeData = {
// // code: e.detail.code
// // }
// // apiService.postMobileByMnp(codeData).then(res => {
// // console.log(res)
// // })
// }) // })
// }, // },
// }) // })

View File

@@ -38,7 +38,7 @@
}).then(res => { }).then(res => {
var data = res.data.data var data = res.data.data
// console.log('登录code换取的信息', data); // console.log('登录code换取的信息', data);
uni.setStorageSync('token', data.token); uni.setStorageSync('loginToken', data.token);
that.$toast.success('登录成功') that.$toast.success('登录成功')
that.$emit('success') that.$emit('success')
//登录完成后使用手机code换取手机号,调用/user/getMobileByMnp接口 //登录完成后使用手机code换取手机号,调用/user/getMobileByMnp接口

View File

@@ -8,7 +8,7 @@ function isOutTime(res) {
}) })
}, 1000) }, 1000)
uni.removeStorageSync('userInfo') uni.removeStorageSync('userInfo')
uni.removeStorageSync('token') uni.removeStorageSync('loginToken')
} else { } else {
// uni.showToast(res.data.message); // uni.showToast(res.data.message);
} }
@@ -18,7 +18,7 @@ const service = {
get(url, data) { get(url, data) {
const header = {} const header = {}
// header['Authorization'] = 'Bearer ' + uni.getStorageSync('token') // header['Authorization'] = 'Bearer ' + uni.getStorageSync('token')
header['token'] = uni.getStorageSync('token') header['token'] = uni.getStorageSync('loginToken')
header['content-type'] = 'application/json' header['content-type'] = 'application/json'
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.request({ uni.request({
@@ -43,7 +43,7 @@ const service = {
}, },
post(url, data, isLogin) { post(url, data, isLogin) {
const header = {} const header = {}
header['token'] = uni.getStorageSync('token') header['token'] = uni.getStorageSync('loginToken')
header['content-type'] = 'application/json' header['content-type'] = 'application/json'
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.request({ uni.request({
@@ -92,7 +92,7 @@ const service = {
}, },
put(url, data, isLogin) { put(url, data, isLogin) {
const header = {} const header = {}
header['token'] = uni.getStorageSync('token') header['token'] = uni.getStorageSync('loginToken')
header['content-type'] = 'application/json' header['content-type'] = 'application/json'
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.request({ uni.request({
@@ -100,10 +100,10 @@ const service = {
url: serverHost + url, url: serverHost + url,
header: header, header: header,
success: res => { success: res => {
if (!res.data.flag) { // if (!res.data.flag) {
isOutTime(res) // isOutTime(res)
reject(res) // reject(res)
} // }
resolve(res) resolve(res)
}, },
data: data, data: data,
@@ -118,7 +118,7 @@ const service = {
}, },
putWithFormData(url, data, isLogin) { putWithFormData(url, data, isLogin) {
const header = {} const header = {}
header['token'] = uni.getStorageSync('token') header['token'] = uni.getStorageSync('loginToken')
header['content-type'] = 'application/x-www-form-urlencoded' header['content-type'] = 'application/x-www-form-urlencoded'
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.request({ uni.request({
@@ -144,7 +144,7 @@ const service = {
}, },
delete(url, data, isLogin) { delete(url, data, isLogin) {
const header = {} const header = {}
header['token'] = uni.getStorageSync('token') header['token'] = uni.getStorageSync('loginToken')
header['content-type'] = 'application/json' header['content-type'] = 'application/json'
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
uni.request({ uni.request({
@@ -205,7 +205,7 @@ const toast = {
} }
} }
const apiService = { const apiService = {
uploadImgUrl: serverHost + `/upload/image/`, uploadImgUrl: serverHost,
imgUrl: serverHost, imgUrl: serverHost,
// login: data => { // login: data => {
// data = Object.assign(data || {}, {}) // data = Object.assign(data || {}, {})
@@ -326,6 +326,13 @@ const apiService = {
resolve(service.get(url)) resolve(service.get(url))
}) })
}, },
//修改个人信息
updateUser(data) {
const url = `/center/userupdate`
return new Promise((resolve, reject) => {
resolve(service.post(url, data))
})
},
// 获取首页分类Tag // 获取首页分类Tag
getTags(data) { getTags(data) {
const url = `/home/tags` const url = `/home/tags`