Browse Source

'开始联调'

hfll
hflllll 1 month ago
parent
commit
dc40bb34a1
24 changed files with 356 additions and 270 deletions
  1. +1
    -1
      App.vue
  2. +8
    -3
      api/index.js
  3. +5
    -0
      api/modules/book.js
  4. +1
    -1
      api/modules/config.js
  5. +0
    -95
      api/modules/exhibit.js
  6. +6
    -3
      api/modules/home.js
  7. +27
    -6
      api/modules/login.js
  8. +32
    -0
      api/modules/member.js
  9. +5
    -0
      api/modules/promotion.js
  10. +32
    -20
      api/request.js
  11. +1
    -1
      config/index.js
  12. +2
    -2
      manifest.json
  13. +8
    -11
      mixins/config.js
  14. +19
    -18
      pages/index/home.vue
  15. +3
    -1
      pages/index/member.vue
  16. +24
    -10
      pages/index/user.vue
  17. +7
    -7
      stores/index.js
  18. +23
    -4
      subPages/home/plan.vue
  19. +36
    -7
      subPages/home/submit.vue
  20. +3
    -3
      subPages/login/login.vue
  21. +29
    -35
      subPages/login/userInfo.vue
  22. +59
    -31
      subPages/member/recharge.vue
  23. +3
    -0
      subPages/user/discount.vue
  24. +22
    -11
      subPages/user/profile.vue

+ 1
- 1
App.vue View File

@ -15,7 +15,7 @@
console.log(uni.getStorageSync('token')); console.log(uni.getStorageSync('token'));
console.log('App Show') console.log('App Show')
// await this.$store.dispatch('initData')
await this.$store.dispatch('initData')
// console.log('') // console.log('')
}, },
onHide: function() { onHide: function() {


+ 8
- 3
api/index.js View File

@ -1,13 +1,18 @@
import user from '@/api/modules/user' import user from '@/api/modules/user'
import config from '@/api/modules/config' import config from '@/api/modules/config'
import exhibit from '@/api/modules/exhibit'
import login from '@/api/modules/login' import login from '@/api/modules/login'
import home from '@/api/modules/home' import home from '@/api/modules/home'
import member from '@/api/modules/member'
import book from '@/api/modules/book'
import promotion from '@/api/modules/promotion'
export { export {
user, user,
config, config,
exhibit,
login, login,
home
home,
member,
book,
promotion
} }

+ 5
- 0
api/modules/book.js View File

@ -0,0 +1,5 @@
import request from "@/api/request";
export default {
}

+ 1
- 1
api/modules/config.js View File

@ -4,7 +4,7 @@ import http from "@/api/http";
export default { export default {
async queryConfigList() { async queryConfigList() {
return http({ return http({
url: '/config/queryConfigList',
url: '/config/list',
method: 'GET' method: 'GET'
}) })
}, },


+ 0
- 95
api/modules/exhibit.js View File

@ -1,95 +0,0 @@
import http from "@/api/http";
export default {
// 查看展品信息列表
async queryShowpieceList(data) {
return http({
url: '/showpiece/queryShowpieceList',
method: 'GET',
data
})
},
// 查看维修记录列表
async queryRepairList(data) {
return http({
url: '/showpiece/queryRepairList',
method: 'GET',
data
})
},
// 查看保养记录
async queryMaintenanceList(data) {
return http({
url: '/showpiece/queryMaintenanceList',
method: 'GET',
data
})
},
// 保养-新增保养记录
async addMaintenance(data) {
return http({
url: '/showpiece/addMaintenance',
method: 'POST',
data,
showLoading: true,
needToken: true
})
},
// 报修- 查看报修单列表
async queryMalfunctionList(data) {
return http({
url: '/showpiece/queryMalfunctionList',
method: 'GET',
data
})
},
// 报修- 新增报修单
async addMalfunction(data) {
return http({
url: '/showpiece/addMalfunction',
method: 'POST',
data,
showLoading: true,
needToken: true
})
},
// 查看保修单详情
async queryMalfunctionById(data) {
return http({
url: '/showpiece/queryMalfunctionById',
method: 'GET',
data
})
},
// 修改保修单
async updateMalfunction(data) {
return http({
url: '/showpiece/updateMalfunction',
method: 'POST',
data,
showLoading: true,
needToken: true
})
},
// 新增维修记录
async addRepair(data) {
return http({
url: '/showpiece/addRepair',
method: 'POST',
data,
showLoading: true,
needToken: true
})
},
}

+ 6
- 3
api/modules/home.js View File

@ -2,11 +2,13 @@ import http from "@/api/http";
export default{ export default{
async getSignup() {
async getSignup(data) {
// 首页底部内容添加报名 // 首页底部内容添加报名
return http({ return http({
url: '/index/linkSignup', url: '/index/linkSignup',
method: 'GET',
method: 'POST',
data,
needToken: true
}) })
}, },
@ -19,10 +21,11 @@ export default{
}, },
// 首页底部内容链接详情 // 首页底部内容链接详情
async getLinkDetails() {
async getLinkDetails(data) {
return http({ return http({
url: '/index/linkDetails', url: '/index/linkDetails',
method: 'GET', method: 'GET',
data
}) })
}, },


+ 27
- 6
api/modules/login.js View File

@ -1,24 +1,45 @@
// import request from "@/api/request"; // import request from "@/api/request";
import http from "@/api/http"; import http from "@/api/http";
export default { export default {
// 程序-绑定手机号码
// 绑定手机号码
async bindPhone(data) { async bindPhone(data) {
return http({ return http({
url: '/login/bindPhone',
method: 'GET',
data
url: '/login/getPhoneNumber',
method: 'POST',
data,
needToken: true
}) })
}, },
// 登录
async login(data) { async login(data) {
return http({ return http({
url: '/login/login',
method: 'GET',
url: '/login/wxLogin',
method: 'POST',
data, data,
// header: { // header: {
// 'Content-Type': 'application/x-www-form-urlencoded' // 'Content-Type': 'application/x-www-form-urlencoded'
// }, // },
showLoading: true showLoading: true
}) })
},
// 获取用户信息
async getUserInfo() {
return http({
url: '/login/getUserInfo',
method: 'GET',
needToken: true
})
},
// 更新用户信息
async updateUserInfo(data) {
return http({
url: '/login/updateUserInfo',
method: 'POST',
data,
needToken: true
})
} }
} }

+ 32
- 0
api/modules/member.js View File

@ -0,0 +1,32 @@
import request from "@/api/request";
export default {
// 开通会员
async openMember(data) {
return request({
url: '/member/open',
method: 'POST',
data,
needToken: true,
showLoading: true
})
},
// 取会员列表
async getMemberList() {
return request({
url: '/member/list',
method: 'GET'
})
},
// 获取优惠卷
async getCouponList(data) {
return request({
url: '/member/coupon',
method: 'GET',
needToken: true,
data
})
}
}

+ 5
- 0
api/modules/promotion.js View File

@ -0,0 +1,5 @@
import request from "@/api/request";
export default {
}

+ 32
- 20
api/request.js View File

@ -1,21 +1,24 @@
import config from "@/config"; import config from "@/config";
export default function request ( {
url = '',
method = 'GET',
data = {},
showLoading = false,
header = {} ,
export default function request({
url = '',
method = 'GET',
data = {},
showLoading = false,
header = {},
needToken = false, // 需要token needToken = false, // 需要token
showToast = true // 默认显示失败的提示 showToast = true // 默认显示失败的提示
} ) {
if (showLoading) uni.showLoading({title: '加载中'})
if(needToken) {
}) {
if (showLoading) uni.showLoading({ title: '加载中' })
if (needToken) {
const token = uni.getStorageSync('token') const token = uni.getStorageSync('token')
if (token) { if (token) {
header['X-Access-Token'] = token header['X-Access-Token'] = token
}else {
} else {
if (showLoading) {
uni.hideLoading()
}
uni.showToast({ uni.showToast({
title: '请先登录', title: '请先登录',
icon: 'none' icon: 'none'
@ -39,18 +42,25 @@ export default function request ( {
// 优先处理业务逻辑响应 // 优先处理业务逻辑响应
if (res.statusCode === 200 && res.data) { if (res.statusCode === 200 && res.data) {
// 业务成功 // 业务成功
if (res.data.code === 200 ) {
if (res.data.code === 200) {
if (showLoading) {
uni.hideLoading()
}
resolve(res.data) resolve(res.data)
return return
} }
// 业务失败但有具体错误信息 // 业务失败但有具体错误信息
const errorMsg = res.data.message || '请求失败' const errorMsg = res.data.message || '请求失败'
if (showToast) { if (showToast) {
if (showLoading) {
uni.hideLoading()
}
uni.showToast({ uni.showToast({
title: errorMsg, title: errorMsg,
icon: 'none'
icon: 'none',
duration: 3000
}) })
} }
reject({ reject({
@ -77,11 +87,14 @@ export default function request ( {
case 404: case 404:
error.message = '资源不存在' error.message = '资源不存在'
break; break;
case 500:
case 500:
error.message = '服务器错误' error.message = '服务器错误'
break; break;
} }
if (showToast) { if (showToast) {
if (showLoading) {
uni.hideLoading()
}
uni.showToast({ uni.showToast({
title: error.message, title: error.message,
icon: 'none' icon: 'none'
@ -93,6 +106,9 @@ export default function request ( {
console.log(`Fail ${method} ${url}`, err); console.log(`Fail ${method} ${url}`, err);
const errorMsg = err.errMsg || '请求失败' const errorMsg = err.errMsg || '请求失败'
if (showToast) { if (showToast) {
if (showLoading) {
uni.hideLoading()
}
uni.showToast({ uni.showToast({
title: errorMsg, title: errorMsg,
icon: 'none' icon: 'none'
@ -105,11 +121,7 @@ export default function request ( {
data: err data: err
}) })
}, },
complete: () => {
if (showLoading) {
uni.hideLoading()
}
}
}) })
}) })
} }

+ 1
- 1
config/index.js View File

@ -19,7 +19,7 @@ const config = {
// 网络全局配置 // 网络全局配置
netConfig: { netConfig: {
development: { development: {
baseURL: 'http://augcl.natapp1.cc/exhibit-admin/exhibit',
baseURL: 'http://h5.xzaiyp.top/englishread-admin/doc.html',
}, },
testing: { testing: {
baseURL: 'https://www.multipleculture.com/englishread-admin/appletApi', baseURL: 'https://www.multipleculture.com/englishread-admin/appletApi',


+ 2
- 2
manifest.json View File

@ -1,7 +1,7 @@
{ {
"name" : "展品维保",
"name" : "四零语境",
"appid" : "__UNI__B264FE1", "appid" : "__UNI__B264FE1",
"description" : "展品维保",
"description" : "四零语境",
"versionName" : "1.0.0", "versionName" : "1.0.0",
"versionCode" : "100", "versionCode" : "100",
"transformPx" : false, "transformPx" : false,


+ 8
- 11
mixins/config.js View File

@ -21,23 +21,20 @@ export default {
}, },
computed: { computed: {
// 获取全局配置的文本 // 获取全局配置的文本
configParamText() {
return key => this.$store.state.configList[key]?.paramText || '默认文本'
configParamInfo() {
return key => this.$store.state.configList[key]?.info || '默认资料'
}, },
// 获取全局配置的图片 // 获取全局配置的图片
configParamImage() {
return key => this.$store.state.configList[key]?.paramImage || '/static/默认图片.png'
},
// 获取全局配置的富文本
configParamTextarea() {
return key => this.$store.state.configList[key]?.paramTextarea || '默认富文本'
configParamContent() {
return key => this.$store.state.configList[key]?.content || '默认内容'
}, },
// 默认的全局分享参数 // 默认的全局分享参数
GShare() { GShare() {
return { return {
title: this.configParamText('app_name'),
desc: this.configParamText('share_desc'),
imageUrl: this.configParamImage('app_logo'),
title: this.configParamContent('app_name'),
desc: this.configParamContent('share_desc'),
imageUrl: this.configParamContent('app_logo'),
path: '/pages/index/index' path: '/pages/index/index'
} }
} }


+ 19
- 18
pages/index/home.vue View File

@ -152,12 +152,12 @@
<view class="section"> <view class="section">
<view class="recommend-list"> <view class="recommend-list">
<view <view
@click="goPlan()"
@click="goPlan(item.id, item.type)"
v-for="(item, index) in recommendList" v-for="(item, index) in recommendList"
:key="index" :key="index"
class="recommend-item" class="recommend-item"
> >
<image :src="item.image" mode="aspectFill" class="recommend-image"></image>
<image :src="item.img" mode="aspectFill" class="recommend-image"></image>
</view> </view>
</view> </view>
</view> </view>
@ -174,8 +174,10 @@ export default {
// //
bannerList: [ bannerList: [
], ],
// //
todayUpdates: [ todayUpdates: [
@ -269,18 +271,7 @@ export default {
// //
recommendList: [ recommendList: [
{
image: '/static/默认图片.png'
},
{
image: '/static/默认图片.png'
},
{
image: '/static/默认图片.png'
},
{
image: '/static/默认图片.png'
}
] ]
} }
}, },
@ -297,9 +288,9 @@ export default {
// //
}, },
// //
goPlan() {
goPlan(id, type) {
uni.navigateTo({ uni.navigateTo({
url: '/subPages/home/plan'
url: '/subPages/home/plan?id=' + id + '&type=' + type
}) })
}, },
goSearch() { goSearch() {
@ -321,10 +312,20 @@ export default {
})) }))
} }
}, },
async getSignup() {
const signupRes = await this.$api.home.getLink()
if (signupRes.code === 200){
this.recommendList = signupRes.result.map(item => ({
img: item.img,
id: item.id,
type: item.type
}))
}
}
}, },
async onShow() { async onShow() {
await this.getBanner()
Promise.all([this.getBanner(), this.getSignup()])
} }
} }
</script> </script>


+ 3
- 1
pages/index/member.vue View File

@ -238,8 +238,10 @@ export default{
uni.navigateTo({ uni.navigateTo({
url: '/subPages/member/recharge' url: '/subPages/member/recharge'
}) })
}
},
}, },
} }
</script> </script>


+ 24
- 10
pages/index/user.vue View File

@ -6,11 +6,11 @@
<view class="page-title">我的</view> <view class="page-title">我的</view>
<view class="user-info"> <view class="user-info">
<view class="user-avatar" @click="goLogin"> <view class="user-avatar" @click="goLogin">
<image :src="isLogin ? userInfo.headImage : displayInfo.avatar" mode="aspectFill"></image>
<image :src="isLogin ? userInfo.avatar === 'undefined' ? displayInfo.avatar : userInfo.avatar : displayInfo.avatar" mode="aspectFill"></image>
</view> </view>
<view class="user-details">
<view class="user-details" @click="clickInfo">
<view class="user-name">{{ isLogin ? userInfo.nickName : displayInfo.name }}</view>
<view class="user-name">{{ isLogin ? userInfo.name : displayInfo.name }}</view>
<view class="user-phone">手机号{{ isLogin ? userInfo.phone || displayInfo.phone : displayInfo.phone }}</view> <view class="user-phone">手机号{{ isLogin ? userInfo.phone || displayInfo.phone : displayInfo.phone }}</view>
<view class="user-desc">{{ displayInfo.description }}</view> <view class="user-desc">{{ displayInfo.description }}</view>
</view> </view>
@ -142,15 +142,15 @@ export default {
data() { data() {
return { return {
userInfo: { userInfo: {
headImage: '/static/默认头像.png',
nickName: '请先登录',
avatar: '/static/默认头像.png',
name: '请先登录',
id: 'XXXXX' id: 'XXXXX'
}, },
isLogin: uni.getStorageSync('token'), isLogin: uni.getStorageSync('token'),
// //
displayInfo: { displayInfo: {
name: '战斗世界',
phone: '19989674531',
name: '点击登录',
phone: 'xxxxxxxxx',
avatar: '/static/默认头像.png', avatar: '/static/默认头像.png',
description: '世界这么美,我想去看看~' description: '世界这么美,我想去看看~'
} }
@ -197,7 +197,7 @@ export default {
// //
async getUserInfo() { async getUserInfo() {
const res = await this.$api.user.queryUser();
const res = await this.$api.login.getUserInfo();
if (res.code === 200) { if (res.code === 200) {
this.userInfo = res.result; this.userInfo = res.result;
} }
@ -246,6 +246,20 @@ export default {
}) })
}, },
//
clickInfo() {
if (!this.isLogin){
uni.navigateTo({
url: '/subPages/login/login'
})
}else {
uni.navigateTo({
url: '/subPages/user/profile'
})
}
},
// 退 // 退
logout() { logout() {
uni.showModal({ uni.showModal({
@ -259,8 +273,8 @@ export default {
// //
this.userInfo = { this.userInfo = {
headImage: '/static/默认头像.png',
nickName: '请先登录',
avatar: '/static/默认头像.png',
name: '请先登录',
id: 'XXXXX' id: 'XXXXX'
} }


+ 7
- 7
stores/index.js View File

@ -63,12 +63,12 @@ const store = new Vuex.Store({
async getConfig({ commit }) { async getConfig({ commit }) {
const res = await api.config.queryConfigList() const res = await api.config.queryConfigList()
// 要求变成键值对的样子 // 要求变成键值对的样子
const config = res.result.records.reduce((acc, item) => {
if (!item.paramCode) {
console.log('paramCode为空', item);
const config = res.result.reduce((acc, item) => {
if (!item.code) {
console.log('code为空', item);
return acc return acc
} }
acc[item.paramCode] = item
acc[item.code] = item
return acc return acc
}, {}) }, {})
commit('setConfigList', config) commit('setConfigList', config)
@ -86,7 +86,7 @@ const store = new Vuex.Store({
// 初始化数据 // 初始化数据
async initData({ dispatch, state }) { async initData({ dispatch, state }) {
// 检查是否已初始化 // 检查是否已初始化
if (state.configList.length > 0 && state.departmentList.length > 0 && state.categoryList.length > 0) {
if (state.configList.length > 0) {
console.log('配置数据已初始化,无需重复初始化') console.log('配置数据已初始化,无需重复初始化')
return return
@ -95,8 +95,8 @@ const store = new Vuex.Store({
try { try {
await Promise.all([ await Promise.all([
dispatch('getConfig'), dispatch('getConfig'),
dispatch('getDepartment'),
dispatch('getCategory'),
// dispatch('getDepartment'),
// dispatch('getCategory'),
]) ])
console.log('所有配置数据初始化完成') console.log('所有配置数据初始化完成')
} catch (error) { } catch (error) {


+ 23
- 4
subPages/home/plan.vue View File

@ -15,7 +15,7 @@
</view> </view>
<!-- 底部固定报名栏 --> <!-- 底部固定报名栏 -->
<view class="bottom-bar">
<view class="bottom-bar" v-if="type === 1 || '-1'">
<uv-button <uv-button
type="primary" type="primary"
text="报名" text="报名"
@ -61,7 +61,9 @@ export default {
`, `,
style: { style: {
img: 'borderRadius: 24rpx' img: 'borderRadius: 24rpx'
}
},
id: '',
type: ''
} }
}, },
methods: { methods: {
@ -69,10 +71,27 @@ export default {
console.log('点击报名') console.log('点击报名')
// //
uni.navigateTo({ uni.navigateTo({
url: '/subPages/home/submit'
url: '/subPages/home/submit?id=' + this.id
})
},
},
async onShow() {
try{
const askRes = await this.$api.home.getLinkDetails({
id: this.id
}) })
if (askRes.code === 200){
this.richTextContent = askRes.result.content
}
} catch (error) {
console.log('error', error)
} }
}
},
onLoad(options) {
this.id = options.id
this.type = options.type
},
} }
</script> </script>


+ 36
- 7
subPages/home/submit.vue View File

@ -44,7 +44,7 @@
<view class="form-item"> <view class="form-item">
<text class="form-label">个人期待</text> <text class="form-label">个人期待</text>
<uv-textarea <uv-textarea
v-model="formData.expectation"
v-model="formData.looking"
placeholder="请输入" placeholder="请输入"
border="bottom" border="bottom"
:auto-height="true" :auto-height="true"
@ -102,13 +102,13 @@ export default {
formData: { formData: {
name: '', name: '',
phone: '', phone: '',
expectation: '',
looking: '',
background: '' background: ''
} }
} }
}, },
methods: { methods: {
handleSubmit() {
async handleSubmit() {
console.log('提交表单', this.formData) console.log('提交表单', this.formData)
// //
if (!this.formData.name) { if (!this.formData.name) {
@ -126,10 +126,39 @@ export default {
return return
} }
uni.showToast({
title: '提交成功',
icon: 'success'
})
try{
const subRes = await this.$api.home.getSignup({
...this.formData,
id: this.id
})
if (subRes.code === 200) {
uni.showToast({
title: '提交成功',
icon: 'success'
})
setTimeout(() => {
uni.navigateBack({
delta: 2
})
}, 1000)
} else {
uni.showToast({
title: subRes.msg,
icon: 'none'
})
}
} catch (error) {
uni.showToast({
title: error.msg,
icon: 'none'
})
}
// uni.showToast({
// title: '',
// icon: 'success'
// })
} }
} }
} }


+ 3
- 3
subPages/login/login.vue View File

@ -71,8 +71,8 @@ export default {
// //
handleLogin() { handleLogin() {
uni.redirectTo({ url: '/subPages/login/userInfo' })
return
// uni.redirectTo({ url: '/subPages/login/userInfo' })
// return
if (!this.isAgreed) { if (!this.isAgreed) {
this.$refs.serviceModal.open(); this.$refs.serviceModal.open();
@ -89,7 +89,7 @@ export default {
uni.setStorageSync('token', loginRes.token) uni.setStorageSync('token', loginRes.token)
const userInfo = loginRes.userInfo const userInfo = loginRes.userInfo
if ( !userInfo.department || !userInfo.headImage || !userInfo.nickName || !userInfo.phone ){
if ( !userInfo.avatar || !userInfo.name || !userInfo.phone ){
uni.navigateTo({ uni.navigateTo({
url: '/subPages/login/userInfo' url: '/subPages/login/userInfo'
}) })


+ 29
- 35
subPages/login/userInfo.vue View File

@ -19,7 +19,7 @@
<button class="avatar-button" open-type="chooseAvatar" @chooseavatar="onChooseAvatar"> <button class="avatar-button" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<image <image
class="avatar-image" class="avatar-image"
:src="userInfo.headImage || '/static/默认图片.png'"
:src="userInfo.avatar || '/static/默认头像.png'"
mode="aspectFill" mode="aspectFill"
></image> ></image>
</button> </button>
@ -30,15 +30,15 @@
<text class="form-label">昵称</text> <text class="form-label">昵称</text>
<input <input
class="form-input" class="form-input"
type="nickname"
v-model="userInfo.nickName"
type="name"
v-model="userInfo.name"
placeholder="请输入昵称" placeholder="请输入昵称"
@blur="onNicknameBlur"
@blur="nameBlur"
/> />
</view> </view>
<!-- 手机号 --> <!-- 手机号 -->
<!-- <view class="form-item">
<view class="form-item">
<text class="form-label">手机号</text> <text class="form-label">手机号</text>
<view class="phone-container" v-if="!userInfo.phone"> <view class="phone-container" v-if="!userInfo.phone">
<button <button
@ -51,7 +51,7 @@
</view> </view>
<text class="form-label" v-else>{{ userInfo.phone }}</text> <text class="form-label" v-else>{{ userInfo.phone }}</text>
</view> </view>
-->
<!-- 所在部门 --> <!-- 所在部门 -->
<!-- <view class="form-item"> <!-- <view class="form-item">
<text class="form-label">所在部门</text> <text class="form-label">所在部门</text>
@ -98,8 +98,8 @@ export default {
data() { data() {
return { return {
userInfo: { userInfo: {
headImage: '',
nickName: '',
avatar: '',
name: '',
phone: '', phone: '',
department: { department: {
title: '', title: '',
@ -113,7 +113,8 @@ export default {
}, },
async onLoad() { async onLoad() {
this.calculateContainerHeight(); this.calculateContainerHeight();
// await this.getUserInfo();
await this.getUserInfo();
}, },
computed: { computed: {
// //
@ -135,16 +136,16 @@ export default {
// //
async getWechatUserInfo() { async getWechatUserInfo() {
const { result } = await this.$api.user.queryUser() const { result } = await this.$api.user.queryUser()
this.userInfo.nickName = result.nickName
this.userInfo.headImage = result.headImage
this.userInfo.name = result.name
this.userInfo.avatar = result.avatar
this.userInfo.phone = result.phone this.userInfo.phone = result.phone
}, },
// //
async getUserInfo(){ async getUserInfo(){
const { result:info } = await this.$api.user.queryUser()
this.userInfo.nickName = info.nickName
this.userInfo.headImage = info.headImage
const { result:info } = await this.$api.login.getUserInfo()
this.userInfo.name = info.name
this.userInfo.avatar = info.headImage
this.userInfo.phone = info.phone this.userInfo.phone = info.phone
}, },
@ -169,7 +170,7 @@ export default {
if (uploadResult.success) { if (uploadResult.success) {
// URL // URL
this.userInfo.headImage = uploadResult.url;
this.userInfo.avatar = uploadResult.url;
console.log('头像上传成功', uploadResult.url); console.log('头像上传成功', uploadResult.url);
uni.showToast({ uni.showToast({
title: '头像上传成功', title: '头像上传成功',
@ -182,7 +183,7 @@ export default {
uni.hideLoading(); uni.hideLoading();
console.error('头像上传异常:', error); console.error('头像上传异常:', error);
// 使 // 使
this.userInfo.headImage = e.detail.avatarUrl;
this.userInfo.avatar = e.detail.avatarUrl;
uni.showToast({ uni.showToast({
title: '头像处理异常,使用本地头像', title: '头像处理异常,使用本地头像',
icon: 'none' icon: 'none'
@ -198,8 +199,8 @@ export default {
// //
onNicknameBlur() {
if (!this.userInfo.nickName.trim()) {
nameBlur() {
if (!this.userInfo.name.trim()) {
uni.showToast({ uni.showToast({
title: '请输入昵称', title: '请输入昵称',
icon: 'none' icon: 'none'
@ -234,11 +235,11 @@ export default {
if (e.detail.errMsg === 'getPhoneNumber:ok') { if (e.detail.errMsg === 'getPhoneNumber:ok') {
// e.detail.code // e.detail.code
console.log('获取手机号成功', e.detail); console.log('获取手机号成功', e.detail);
const res = await this.$api.login.bindPhone({
phoneCode: e.detail.code
const { result:phoneRes } = await this.$api.login.bindPhone({
code: e.detail.code
}) })
const str = JSON.parse(res.result);
this.userInfo.phone = str.phone_info.phoneNumber
this.userInfo.phone = phoneRes
uni.showToast({ uni.showToast({
title: '手机号获取成功', title: '手机号获取成功',
icon: 'success' icon: 'success'
@ -254,7 +255,7 @@ export default {
// //
async submitUserInfo() { async submitUserInfo() {
if (!this.userInfo.nickName.trim()) {
if (!this.userInfo.name.trim()) {
uni.showToast({ uni.showToast({
title: '请输入昵称', title: '请输入昵称',
icon: 'none' icon: 'none'
@ -270,24 +271,17 @@ export default {
return; return;
} }
if (!this.userInfo.department.title.trim()) {
uni.showToast({
title: '请选择所在部门',
icon: 'none'
});
return;
}
console.log('提交用户信息', this.userInfo); console.log('提交用户信息', this.userInfo);
try { try {
// //
await this.$api.user.updateUser({
nickName: this.userInfo.nickName,
await this.$api.login.updateUserInfo({
name: this.userInfo.name,
phone: this.userInfo.phone, phone: this.userInfo.phone,
headImage: this.userInfo.headImage,
department: this.userInfo.department.id,
remark: this.userInfo.remark
avatar: this.userInfo.avatar,
}); });
uni.showToast({ uni.showToast({


+ 59
- 31
subPages/member/recharge.vue View File

@ -9,7 +9,7 @@
/> />
<text class="header-title">会员开通</text> <text class="header-title">会员开通</text>
<!-- 加一个推出箭头 --> <!-- 加一个推出箭头 -->
<view class="header-icon" >
<view class="header-icon" @click="goBack">
<uv-icon name="arrow-left" color="#000" size="20" /> <uv-icon name="arrow-left" color="#000" size="20" />
</view> </view>
<!-- 轮播容器 --> <!-- 轮播容器 -->
@ -17,6 +17,9 @@
<uv-swiper <uv-swiper
bgColor="transparent" bgColor="transparent"
:list="list" :list="list"
:loading="!list.length"
@change="changeSwiper"
keyName="img"
previousMargin="70" previousMargin="70"
nextMargin="70" nextMargin="70"
acceleration acceleration
@ -51,17 +54,17 @@
> >
<view class="info"> <view class="info">
<!-- 赠送标识 --> <!-- 赠送标识 -->
<view class="gift-tag" v-if="item.gift">
赠送{{ item.gift }}
<view class="gift-tag" v-if="item.content">
{{ item.content }}
</view> </view>
<view class="package-title">{{ item.title }}</view> <view class="package-title">{{ item.title }}</view>
<view class="package-price">¥{{ getInt(item.price) }}.<text class="package-decimal">{{ getDecimal(item.price) }}</text></view>
<view class="package-original">¥{{ item.originalPrice }}</view>
<view class="package-price">¥{{ getInt(item.discountedprice) }}.<text class="package-decimal">{{ getDecimal(item.discountedprice) }}</text></view>
<view class="package-original">¥{{ item.originalprice }}</view>
</view> </view>
<view class="package-btn" :class="{ 'active': selectedPackage === index }">
<view class="package-btn" :class="{ 'active': selectedPackage === index }">
{{ selectedPackage === index ? '已选择' : '点击选择' }} {{ selectedPackage === index ? '已选择' : '点击选择' }}
</view> </view>
</view> </view>
@ -126,36 +129,47 @@
data() { data() {
return { return {
list: [ list: [
'/static/会员1.png',
'/static/会员2.png',
'/static/会员3.png'
], ],
selectedPackage: 0, // selectedPackage: 0, //
packageList: [
selectedMember: 0, //
defaultPackageList: [
{ {
title: '30天会员',
price: '36.00',
originalPrice: '128',
gift: null
title: '当前会员没有返回套餐',
discountedprice: '36.00',
originalprice: '128',
gift: null,
content: '赠送66天'
}, },
{ {
title: '90天会员',
price: '88.00',
originalPrice: '384',
gift: '180'
title: '当前会员没有返回套餐',
discountedprice: '88.00',
originalprice: '384',
gift: '180',
content: '赠送666天'
}, },
{ {
title: '180天会员',
price: '128.00',
originalPrice: '384',
gift: null
title: '当前会员没有返回套餐',
discountedprice: '128.00',
originalprice: '384',
gift: null,
content: '赠送9999天'
} }
] ]
} }
}, },
computed:{
packageList(){
return this.list[this.selectedMember].setmeals.length ? this.list[this.selectedMember].setmeals : this.defaultPackageList
}
},
methods: { methods: {
goBack(){
uni.navigateBack()
},
// //
getInt(price){
getInt(pri){
const price = String(pri)
if (price.indexOf('.') === -1) { if (price.indexOf('.') === -1) {
return price return price
} }
@ -164,10 +178,11 @@
} }
return String(price).split('.')[0] return String(price).split('.')[0]
}, },
getDecimal(price){
getDecimal(pri){
const price = String(pri)
if (price === null) return '00' if (price === null) return '00'
const parts = String(price).split('.')
return parts[1] ? parts[1].padEnd(2, '0') : '00'
const parts = price.split('.')
return parts[1] ? parts[1].padEnd(2, '0') : '00'
}, },
selectPackage(index) { selectPackage(index) {
this.selectedPackage = index this.selectedPackage = index
@ -177,8 +192,21 @@
title: '功能开发中', title: '功能开发中',
icon: 'none' icon: 'none'
}) })
}
}
},
async getMemberList(){
const memberRes = await this.$api.member.getMemberList()
if (memberRes.code === 200){
this.list = memberRes.result
}
},
changeSwiper(e){
this.selectedMember = e.current
this.selectedPackage = 0
}
},
onShow(){
this.getMemberList()
}
} }
</script> </script>
@ -271,13 +299,13 @@
.gift-tag { .gift-tag {
position: absolute; position: absolute;
top: -10rpx; top: -10rpx;
left: 50%;
transform: translateX(-50%);
left: 0%;
// transform: translateX(-50%);
background: #FF6B6B; background: #FF6B6B;
color: #fff; color: #fff;
font-size: 20rpx; font-size: 20rpx;
padding: 8rpx 16rpx; padding: 8rpx 16rpx;
border-radius: 20rpx;
border-radius: 20rpx 20rpx 20rpx 0;
white-space: nowrap; white-space: nowrap;
} }


+ 3
- 0
subPages/user/discount.vue View File

@ -80,9 +80,12 @@
</template> </template>
<script> <script>
import ListMixins from '@/mixins/list'
export default { export default {
mixins: [ListMixins],
data() { data() {
return { return {
mixinListApi: 'member.getCouponList',
currentTab: 0, currentTab: 0,
tabList: [ tabList: [
{ name: '待使用' }, { name: '待使用' },


+ 22
- 11
subPages/user/profile.vue View File

@ -11,7 +11,7 @@
<text>昵称</text> <text>昵称</text>
</view> </view>
<uv-input <uv-input
v-model="userInfo.nickName"
v-model="userInfo.name"
placeholder="请输入昵称" placeholder="请输入昵称"
:customStyle="inputStyle" :customStyle="inputStyle"
border="bottom" border="bottom"
@ -40,8 +40,15 @@
<text>头像</text> <text>头像</text>
</view> </view>
<view class="avatar-container" @click="uploadAvatar"> <view class="avatar-container" @click="uploadAvatar">
<view
v-if="userInfo.avatar === 'undefined'"
class="avatar-image"
>
<uv-icon name="camera" size="40" color="white"></uv-icon>
</view>
<image <image
:src="userInfo.headImage || '/static/默认头像.png'"
v-else
:src="userInfo.avatar || '/static/默认头像.png'"
class="avatar-image" class="avatar-image"
mode="aspectFill" mode="aspectFill"
></image> ></image>
@ -71,8 +78,8 @@ export default {
data() { data() {
return { return {
userInfo: { userInfo: {
headImage: '',
nickName: '',
avatar: 'undefined',
name: '',
phone: '' phone: ''
}, },
showMask: true, showMask: true,
@ -104,7 +111,7 @@ export default {
if (result && result.success) { if (result && result.success) {
console.log(result); console.log(result);
this.userInfo.headImage = result.url
this.userInfo.avatar = result.url
} }
} catch (error) { } catch (error) {
console.error('头像上传失败:', error) console.error('头像上传失败:', error)
@ -118,7 +125,7 @@ export default {
// //
async saveProfile() { async saveProfile() {
if (!this.userInfo.nickName.trim()) {
if (!this.userInfo.name.trim()) {
uni.showToast({ uni.showToast({
title: '请输入昵称', title: '请输入昵称',
icon: 'none' icon: 'none'
@ -145,9 +152,9 @@ export default {
} }
// TODO: API // TODO: API
const res = await this.$api.user.updateUser({
headImage: this.userInfo.headImage,
nickName: this.userInfo.nickName,
const res = await this.$api.login.updateUserInfo({
avatar: this.userInfo.avatar,
name: this.userInfo.name,
phone: this.userInfo.phone phone: this.userInfo.phone
}) })
if (res.code === 200) { if (res.code === 200) {
@ -165,14 +172,14 @@ export default {
// //
async getProfile() { async getProfile() {
const res = await this.$api.user.queryUser()
const res = await this.$api.login.getUserInfo()
if (res.code === 200) { if (res.code === 200) {
this.userInfo = res.result this.userInfo = res.result
} }
} }
}, },
onLoad() { onLoad() {
// this.getProfile()
this.getProfile()
// 3 // 3
setTimeout(() => { setTimeout(() => {
this.showMask = false this.showMask = false
@ -230,6 +237,10 @@ export default {
.avatar-image { .avatar-image {
width: 100%; width: 100%;
height: 100%; height: 100%;
background: #00000080;
display: flex;
align-items: center;
justify-content: center;
} }
.avatar-mask { .avatar-mask {


Loading…
Cancel
Save