Browse Source

'静态demo快写完了'

mian
hflllll 1 week ago
parent
commit
b6ad0761f7
7 changed files with 24 additions and 72 deletions
  1. +1
    -1
      App.vue
  2. +1
    -4
      api/modules/config.js
  3. +2
    -2
      api/request.js
  4. +8
    -5
      config/index.js
  5. +6
    -5
      pages/index/user.vue
  6. +5
    -54
      stores/index.js
  7. +1
    -1
      subPages/login/login.vue

+ 1
- 1
App.vue View File

@ -8,7 +8,7 @@
}, },
async onShow() { async onShow() {
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() {


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

@ -2,13 +2,10 @@
import http from "@/api/http"; import http from "@/api/http";
export default { export default {
async queryConfigList() { async queryConfigList() {
return http({ return http({
url: '/config/queryConfigList', url: '/config/queryConfigList',
method: 'GET',
noToken: true
method: 'GET'
}) })
}, },


+ 2
- 2
api/request.js View File

@ -6,12 +6,12 @@ export default function request ( {
data = {}, data = {},
showLoading = false, showLoading = false,
header = {} , header = {} ,
noToken = false, // 需要token的接口
needToken = false, // 需要token
showToast = true // 默认显示失败的提示 showToast = true // 默认显示失败的提示
} ) { } ) {
if (showLoading) uni.showLoading({title: '加载中'}) if (showLoading) uni.showLoading({title: '加载中'})
if(!noToken) {
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


+ 8
- 5
config/index.js View File

@ -6,8 +6,13 @@
* aliOSSConfig 阿里云配置 * aliOSSConfig 阿里云配置
* debounceConfig 防抖相关配置 * debounceConfig 防抖相关配置
*/ */
const env = 'development'
const envParam = {
dev: 'development',
test: 'testing',
prod: 'production',
}
const env = 'testing'
// 全局配置 // 全局配置
const config = { const config = {
@ -16,13 +21,11 @@ const config = {
development: { development: {
baseURL: 'http://augcl.natapp1.cc/exhibit-admin/exhibit', baseURL: 'http://augcl.natapp1.cc/exhibit-admin/exhibit',
}, },
testing: { testing: {
baseURL: 'https://exhibit.augcl.com/exhibit-admin/exhibi',
baseURL: 'https://exhibit.augcl.com/exhibit-admin/exhibit',
}, },
production: { production: {
baseURL: '',
baseURL: 'https://exhibit.augcl.com/exhibit-admin/exhibit',
} }
}, },


+ 6
- 5
pages/index/user.vue View File

@ -17,7 +17,7 @@
<!-- 常用功能模块 --> <!-- 常用功能模块 -->
<view class="function-card"> <view class="function-card">
<view class="card-title"> <view class="card-title">
<text class="title-text">常用功能</text>
<text class="title-text" >常用功能</text>
</view> </view>
<view class="function-list"> <view class="function-list">
@ -42,11 +42,11 @@
</view> </view>
<!-- 用户协议和隐私政策弹窗 --> <!-- 用户协议和隐私政策弹窗 -->
<uv-modal ref="privacyModal" title="用户协议和隐私政策" :show-cancel-button="false" confirm-text="我知道了" confirm-color="#C70019">
<uv-modal ref="privacyModal" title="用户协议和隐私政策" :show-cancel-button="false" confirm-text="我知道了" confirm-color="#C70019">
<view class="privacy-content"> <view class="privacy-content">
<view>
待补充
</view>
<!-- 如果是富文本 -->
<rich-text :nodes="configParamTextarea('app_agreement')">
</rich-text>
</view> </view>
</uv-modal> </uv-modal>
</view> </view>
@ -70,6 +70,7 @@ export default {
url: '/subPages/login/login' url: '/subPages/login/login'
}) })
}, },
// //
goToBasicInfo() { goToBasicInfo() {
uni.navigateTo({ uni.navigateTo({


+ 5
- 54
stores/index.js View File

@ -8,28 +8,14 @@ const store = new Vuex.Store({
state: { state: {
// 存放状态 // 存放状态
configList: [], configList: [],
careerList: [],
qualificationList: [],
categoryGoodsList: [],
categoryActivityList: []
}, },
mutations: { mutations: {
setConfigList(state, data) { setConfigList(state, data) {
state.configList = data state.configList = data
}, },
setCareerList(state, data) {
state.careerList = data
},
setQualificationList(state, data) {
state.qualificationList = data
},
setCategoryGoodsList(state, data) {
state.categoryGoodsList = data
},
setCategoryActivityList(state, data) {
state.categoryActivityList = data
}
}, },
actions: { actions: {
// 查询配置列表 // 查询配置列表
@ -48,43 +34,11 @@ const store = new Vuex.Store({
}, },
// 查询职业列表
async getCareer({ commit }) {
const res = await api.config.queryCareerList()
// if (res.code === 0) {
commit('setCareerList', res.result.records)
// } else {
// uni.showToast({ title: res.msg, icon: 'error' })
// }
},
// 查询学历列表
async getQualification({ commit }) {
const res = await api.config.queryQualificationList()
// if (res.code === 0) {
commit('setQualificationList', res.result.records)
// } else {
// uni.showToast({ title: res.msg, icon: 'error' })
// }
},
// 查询商品分类列表
async getCategoryGoodsList({ commit }) {
const res = await api.config.queryCategoryGoodsList()
commit('setCategoryGoodsList', res.result.records)
},
// 查询活动分类列表
async getCategoryActivityList({ commit }) {
const res = await api.config.queryCategoryActivityList()
commit('setCategoryActivityList', res.result.records)
},
// 初始化数据 // 初始化数据
async initData({ dispatch, state }) { async initData({ dispatch, state }) {
// 检查是否已初始化 // 检查是否已初始化
if (state.configList.length > 0 && state.careerList.length > 0 && state.qualificationList.length > 0 && state.categoryGoodsList.length > 0 && state.categoryActivityList.length > 0) {
if (state.configList.length > 0) {
console.log('配置数据已初始化,无需重复初始化') console.log('配置数据已初始化,无需重复初始化')
return return
@ -93,10 +47,7 @@ const store = new Vuex.Store({
try { try {
await Promise.all([ await Promise.all([
dispatch('getConfig'), dispatch('getConfig'),
dispatch('getCareer'),
dispatch('getQualification'),
dispatch('getCategoryGoodsList'),
dispatch('getCategoryActivityList')
]) ])
console.log('所有配置数据初始化完成') console.log('所有配置数据初始化完成')
} catch (error) { } catch (error) {


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

@ -7,7 +7,7 @@
<view class="content"> <view class="content">
<!-- Logo和标题区域 --> <!-- Logo和标题区域 -->
<view class="logo-section"> <view class="logo-section">
<image class="logo" src="@/static/logo.png" mode="aspectFit"></image>
<image class="logo" :src="configParamImage('app_logo')" mode="aspectFit"></image>
<text class="title-text">展品维保报修小程序</text> <text class="title-text">展品维保报修小程序</text>
</view> </view>


Loading…
Cancel
Save