diff --git a/App.vue b/App.vue
index 7b0f2b7..d7b76a3 100644
--- a/App.vue
+++ b/App.vue
@@ -15,7 +15,7 @@
console.log(uni.getStorageSync('token'));
console.log('App Show')
- // await this.$store.dispatch('initData')
+ await this.$store.dispatch('initData')
// console.log('配置数据初始化完成')
},
onHide: function() {
diff --git a/api/index.js b/api/index.js
index 9916107..42ce6d6 100644
--- a/api/index.js
+++ b/api/index.js
@@ -1,13 +1,18 @@
import user from '@/api/modules/user'
import config from '@/api/modules/config'
-import exhibit from '@/api/modules/exhibit'
import login from '@/api/modules/login'
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 {
user,
config,
- exhibit,
login,
- home
+ home,
+ member,
+ book,
+ promotion
}
diff --git a/api/modules/book.js b/api/modules/book.js
new file mode 100644
index 0000000..9dd301e
--- /dev/null
+++ b/api/modules/book.js
@@ -0,0 +1,5 @@
+import request from "@/api/request";
+
+export default {
+
+}
\ No newline at end of file
diff --git a/api/modules/config.js b/api/modules/config.js
index 0ad0aa7..a9ea2c9 100644
--- a/api/modules/config.js
+++ b/api/modules/config.js
@@ -4,7 +4,7 @@ import http from "@/api/http";
export default {
async queryConfigList() {
return http({
- url: '/config/queryConfigList',
+ url: '/config/list',
method: 'GET'
})
},
diff --git a/api/modules/exhibit.js b/api/modules/exhibit.js
deleted file mode 100644
index 6797280..0000000
--- a/api/modules/exhibit.js
+++ /dev/null
@@ -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
- })
- },
-
-
-}
diff --git a/api/modules/home.js b/api/modules/home.js
index bc1cc2b..0ceec34 100644
--- a/api/modules/home.js
+++ b/api/modules/home.js
@@ -2,11 +2,13 @@ import http from "@/api/http";
export default{
- async getSignup() {
+ async getSignup(data) {
// 首页底部内容添加报名
return http({
url: '/index/linkSignup',
- method: 'GET',
+ method: 'POST',
+ data,
+ needToken: true
})
},
@@ -19,10 +21,11 @@ export default{
},
// 首页底部内容链接详情
- async getLinkDetails() {
+ async getLinkDetails(data) {
return http({
url: '/index/linkDetails',
method: 'GET',
+ data
})
},
diff --git a/api/modules/login.js b/api/modules/login.js
index f2f63bb..dd8f53d 100644
--- a/api/modules/login.js
+++ b/api/modules/login.js
@@ -1,24 +1,45 @@
// import request from "@/api/request";
import http from "@/api/http";
export default {
- // 程序-绑定手机号码
+ // 绑定手机号码
async bindPhone(data) {
return http({
- url: '/login/bindPhone',
- method: 'GET',
- data
+ url: '/login/getPhoneNumber',
+ method: 'POST',
+ data,
+ needToken: true
})
},
+ // 登录
async login(data) {
return http({
- url: '/login/login',
- method: 'GET',
+ url: '/login/wxLogin',
+ method: 'POST',
data,
// header: {
// 'Content-Type': 'application/x-www-form-urlencoded'
// },
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
+ })
}
}
\ No newline at end of file
diff --git a/api/modules/member.js b/api/modules/member.js
new file mode 100644
index 0000000..c78e1af
--- /dev/null
+++ b/api/modules/member.js
@@ -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
+ })
+ }
+}
\ No newline at end of file
diff --git a/api/modules/promotion.js b/api/modules/promotion.js
new file mode 100644
index 0000000..84c5c3e
--- /dev/null
+++ b/api/modules/promotion.js
@@ -0,0 +1,5 @@
+import request from "@/api/request";
+
+export default {
+
+}
\ No newline at end of file
diff --git a/api/request.js b/api/request.js
index 9255aa3..314ae79 100644
--- a/api/request.js
+++ b/api/request.js
@@ -1,21 +1,24 @@
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
showToast = true // 默认显示失败的提示
-} ) {
- if (showLoading) uni.showLoading({title: '加载中'})
- if(needToken) {
+}) {
+ if (showLoading) uni.showLoading({ title: '加载中' })
+ if (needToken) {
const token = uni.getStorageSync('token')
if (token) {
header['X-Access-Token'] = token
- }else {
+ } else {
+ if (showLoading) {
+ uni.hideLoading()
+ }
uni.showToast({
title: '请先登录',
icon: 'none'
@@ -39,18 +42,25 @@ export default function request ( {
// 优先处理业务逻辑响应
if (res.statusCode === 200 && res.data) {
// 业务成功
- if (res.data.code === 200 ) {
+ if (res.data.code === 200) {
+ if (showLoading) {
+ uni.hideLoading()
+ }
resolve(res.data)
return
}
-
+
// 业务失败但有具体错误信息
const errorMsg = res.data.message || '请求失败'
-
+
if (showToast) {
+ if (showLoading) {
+ uni.hideLoading()
+ }
uni.showToast({
title: errorMsg,
- icon: 'none'
+ icon: 'none',
+ duration: 3000
})
}
reject({
@@ -77,11 +87,14 @@ export default function request ( {
case 404:
error.message = '资源不存在'
break;
- case 500:
+ case 500:
error.message = '服务器错误'
break;
}
if (showToast) {
+ if (showLoading) {
+ uni.hideLoading()
+ }
uni.showToast({
title: error.message,
icon: 'none'
@@ -93,6 +106,9 @@ export default function request ( {
console.log(`Fail ${method} ${url}`, err);
const errorMsg = err.errMsg || '请求失败'
if (showToast) {
+ if (showLoading) {
+ uni.hideLoading()
+ }
uni.showToast({
title: errorMsg,
icon: 'none'
@@ -105,11 +121,7 @@ export default function request ( {
data: err
})
},
- complete: () => {
- if (showLoading) {
- uni.hideLoading()
- }
- }
+
})
})
}
\ No newline at end of file
diff --git a/config/index.js b/config/index.js
index 8702446..c8ac0d1 100644
--- a/config/index.js
+++ b/config/index.js
@@ -19,7 +19,7 @@ const config = {
// 网络全局配置
netConfig: {
development: {
- baseURL: 'http://augcl.natapp1.cc/exhibit-admin/exhibit',
+ baseURL: 'http://h5.xzaiyp.top/englishread-admin/doc.html',
},
testing: {
baseURL: 'https://www.multipleculture.com/englishread-admin/appletApi',
diff --git a/manifest.json b/manifest.json
index 09dbf4c..09c4a72 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,7 +1,7 @@
{
- "name" : "展品维保",
+ "name" : "四零语境",
"appid" : "__UNI__B264FE1",
- "description" : "展品维保",
+ "description" : "四零语境",
"versionName" : "1.0.0",
"versionCode" : "100",
"transformPx" : false,
diff --git a/mixins/config.js b/mixins/config.js
index 225a913..6446be6 100644
--- a/mixins/config.js
+++ b/mixins/config.js
@@ -21,23 +21,20 @@ export default {
},
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() {
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'
}
}
diff --git a/pages/index/home.vue b/pages/index/home.vue
index 7d72119..0c45bde 100644
--- a/pages/index/home.vue
+++ b/pages/index/home.vue
@@ -152,12 +152,12 @@
-
+
@@ -174,8 +174,10 @@ export default {
// 轮播图数据
bannerList: [
-
+
],
+
+
// 今日更新数据
todayUpdates: [
@@ -269,18 +271,7 @@ export default {
// 推荐列表数据
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({
- url: '/subPages/home/plan'
+ url: '/subPages/home/plan?id=' + id + '&type=' + type
})
},
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() {
- await this.getBanner()
+ Promise.all([this.getBanner(), this.getSignup()])
}
}
diff --git a/pages/index/member.vue b/pages/index/member.vue
index 8597e82..c21d67b 100644
--- a/pages/index/member.vue
+++ b/pages/index/member.vue
@@ -238,8 +238,10 @@ export default{
uni.navigateTo({
url: '/subPages/member/recharge'
})
- }
+ },
+
},
+
}
diff --git a/pages/index/user.vue b/pages/index/user.vue
index c9ccebd..d3177db 100644
--- a/pages/index/user.vue
+++ b/pages/index/user.vue
@@ -6,11 +6,11 @@
我的
-
+
-
+
- {{ isLogin ? userInfo.nickName : displayInfo.name }}
+ {{ isLogin ? userInfo.name : displayInfo.name }}
手机号:{{ isLogin ? userInfo.phone || displayInfo.phone : displayInfo.phone }}
{{ displayInfo.description }}
@@ -142,15 +142,15 @@ export default {
data() {
return {
userInfo: {
- headImage: '/static/默认头像.png',
- nickName: '请先登录',
+ avatar: '/static/默认头像.png',
+ name: '请先登录',
id: 'XXXXX'
},
isLogin: uni.getStorageSync('token'),
// 用户展示信息
displayInfo: {
- name: '战斗世界',
- phone: '19989674531',
+ name: '点击登录',
+ phone: 'xxxxxxxxx',
avatar: '/static/默认头像.png',
description: '世界这么美,我想去看看~'
}
@@ -197,7 +197,7 @@ export default {
// 获取用户信息
async getUserInfo() {
- const res = await this.$api.user.queryUser();
+ const res = await this.$api.login.getUserInfo();
if (res.code === 200) {
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() {
uni.showModal({
@@ -259,8 +273,8 @@ export default {
// 重置用户信息
this.userInfo = {
- headImage: '/static/默认头像.png',
- nickName: '请先登录',
+ avatar: '/static/默认头像.png',
+ name: '请先登录',
id: 'XXXXX'
}
diff --git a/stores/index.js b/stores/index.js
index 52a0e12..1177b22 100644
--- a/stores/index.js
+++ b/stores/index.js
@@ -63,12 +63,12 @@ const store = new Vuex.Store({
async getConfig({ commit }) {
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
}
- acc[item.paramCode] = item
+ acc[item.code] = item
return acc
}, {})
commit('setConfigList', config)
@@ -86,7 +86,7 @@ const store = new Vuex.Store({
// 初始化数据
async initData({ dispatch, state }) {
// 检查是否已初始化
- if (state.configList.length > 0 && state.departmentList.length > 0 && state.categoryList.length > 0) {
+ if (state.configList.length > 0) {
console.log('配置数据已初始化,无需重复初始化')
return
@@ -95,8 +95,8 @@ const store = new Vuex.Store({
try {
await Promise.all([
dispatch('getConfig'),
- dispatch('getDepartment'),
- dispatch('getCategory'),
+ // dispatch('getDepartment'),
+ // dispatch('getCategory'),
])
console.log('所有配置数据初始化完成')
} catch (error) {
diff --git a/subPages/home/plan.vue b/subPages/home/plan.vue
index 339b25d..20eff13 100644
--- a/subPages/home/plan.vue
+++ b/subPages/home/plan.vue
@@ -15,7 +15,7 @@
-
+
diff --git a/subPages/home/submit.vue b/subPages/home/submit.vue
index f74ec1e..845f71a 100644
--- a/subPages/home/submit.vue
+++ b/subPages/home/submit.vue
@@ -44,7 +44,7 @@
个人期待
{
+ 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'
+ // })
}
}
}
diff --git a/subPages/login/login.vue b/subPages/login/login.vue
index ca2f551..d4b18cf 100644
--- a/subPages/login/login.vue
+++ b/subPages/login/login.vue
@@ -71,8 +71,8 @@ export default {
// 授权登录
handleLogin() {
- uni.redirectTo({ url: '/subPages/login/userInfo' })
- return
+ // uni.redirectTo({ url: '/subPages/login/userInfo' })
+ // return
if (!this.isAgreed) {
this.$refs.serviceModal.open();
@@ -89,7 +89,7 @@ export default {
uni.setStorageSync('token', loginRes.token)
const userInfo = loginRes.userInfo
- if ( !userInfo.department || !userInfo.headImage || !userInfo.nickName || !userInfo.phone ){
+ if ( !userInfo.avatar || !userInfo.name || !userInfo.phone ){
uni.navigateTo({
url: '/subPages/login/userInfo'
})
diff --git a/subPages/login/userInfo.vue b/subPages/login/userInfo.vue
index 704d298..33d3c6f 100644
--- a/subPages/login/userInfo.vue
+++ b/subPages/login/userInfo.vue
@@ -19,7 +19,7 @@
@@ -30,15 +30,15 @@
昵称
-
+
-