diff --git a/.env.production b/.env.production
index 8b0b51b..5fc1cfd 100644
--- a/.env.production
+++ b/.env.production
@@ -1,3 +1,3 @@
ENV = 'production'
-VUE_APP_BASE_API = 'http://www.xbzt.cc'
\ No newline at end of file
+VUE_APP_BASE_API = 'http://local.party-rank.host'
\ No newline at end of file
diff --git a/public/.htaccess b/public/.htaccess
new file mode 100644
index 0000000..06c7d29
--- /dev/null
+++ b/public/.htaccess
@@ -0,0 +1,8 @@
+
+ RewriteEngine On
+ RewriteBase /h5/
+ RewriteRule ^index\.html$ - [L]
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteCond %{REQUEST_FILENAME} !-d
+ RewriteRule . /h5/index.html [L]
+
\ No newline at end of file
diff --git a/public/nginx.conf b/public/nginx.conf
new file mode 100644
index 0000000..5dd0c44
--- /dev/null
+++ b/public/nginx.conf
@@ -0,0 +1,3 @@
+location /h5 {
+ try_files $uri $uri/h5 /h5/index.html?$query_string;
+}
\ No newline at end of file
diff --git a/src/pages.json b/src/pages.json
index 884bcd9..bd7700e 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -1,5 +1,11 @@
{
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
+ {
+ "path": "pages/index/welcome",
+ "style": {
+ "navigationBarTitleText": "五星党建"
+ }
+ },
{
"path": "pages/index/index",
"style": {
@@ -26,6 +32,21 @@
"navigationBarTitleText" : "填报"
}
},
+ {
+ "path" : "pages/score/list",
+ "style" :
+ {
+ "navigationBarTitleText" : "我的填报",
+ "enablePullDownRefresh": true
+ }
+ },
+ {
+ "path" : "pages/score/detail",
+ "style" :
+ {
+ "navigationBarTitleText" : "详细"
+ }
+ },
{
"path" : "pages/score/user-rank",
"style" :
@@ -42,6 +63,13 @@
"navigationBarTextStyle": "black"
}
},
+ {
+ "path" : "pages/user/setting",
+ "style" :
+ {
+ "navigationBarTitleText" : "设置"
+ }
+ },
{
"path" : "pages/article/detail",
"style" :
diff --git a/src/pages/article/detail.vue b/src/pages/article/detail.vue
index 973cabe..d30e116 100644
--- a/src/pages/article/detail.vue
+++ b/src/pages/article/detail.vue
@@ -5,7 +5,7 @@
{{ title }}
-
+
diff --git a/src/pages/auth/login.vue b/src/pages/auth/login.vue
index 8569a89..4f4bd9e 100644
--- a/src/pages/auth/login.vue
+++ b/src/pages/auth/login.vue
@@ -22,18 +22,23 @@
\ No newline at end of file
diff --git a/src/pages/score/category.vue b/src/pages/score/category.vue
index e64d2df..e75d55b 100644
--- a/src/pages/score/category.vue
+++ b/src/pages/score/category.vue
@@ -2,56 +2,84 @@
-
+
-
-
-
+
+
+
+
+
+ {{ item.name }}
- {{ item.name }}
-
+
-
-
-
+
+
+
+
+
+ {{ item.name }}
- {{ item.name }}
-
+
-
+
+
+
\ No newline at end of file
diff --git a/src/pages/score/form.vue b/src/pages/score/form.vue
index c1e7328..4a94248 100644
--- a/src/pages/score/form.vue
+++ b/src/pages/score/form.vue
@@ -41,6 +41,9 @@
/>
+
+
+
@@ -53,10 +56,41 @@
export default {
data() {
return {
+ id: '',
+ type: '',
title: '',
content: '',
images: [],
- files: []
+ files: [],
+ reason: ''
+ }
+ },
+ onLoad(e) {
+ if (e.type) {
+ this.type = e.type
+ }
+ if (e.id) {
+ this.id = e.id
+ uni.setNavigationBarTitle({
+ title: '修改'
+ })
+ this.$ajax.get(`/api/user/score/${this.id}`).then(res => {
+ if (res.status == 0) {
+ this.title = res.data.title
+ this.content = res.data.content
+ if (res.data.images) {
+ this.images = res.data.images.map((value) => {
+ return {url: value}
+ })
+ }
+ if (res.data.file) {
+ this.files = [{ url: res.data.file }]
+ }
+ if (res.data.check_status == 2) {
+ this.reason = res.data.check_remarks
+ }
+ }
+ })
}
},
methods: {
@@ -74,29 +108,32 @@
})
})
for (let i = 0; i < lists.length; i++) {
- const result = await this.uploadFilePromise(lists[i].url)
+ const result = await this.$ajax.upload('/api/web/upload', {filePath: lists[i].url, name: 'file'})
let item = this.images[fileListLen]
this.images.splice(fileListLen, 1, Object.assign(item, {
status: 'success',
message: '',
- url: result
+ url: result.data.file
}))
fileListLen++
}
},
uploadFile(event) {
- this.files.push(event.file)
+ const file = event.file
+ file.status = 'uploading'
+ file.message = '上传中'
+ this.$ajax.upload('/api/web/upload', {filePath: file.url, name: 'file'}).then(res => {
+ if (res.status == 0) {
+ file.status = 'success'
+ file.message = ''
+ file.url = res.data.file
+ this.files.push(file)
+ }
+ })
},
deleteFile(event) {
this.files.splice(event.index, 1)
},
- uploadFilePromise() {
- return new Promise((resolve, reject) => {
- setTimeout(() => {
- resolve('https://via.placeholder.com/100x100.png')
- }, 1000)
- })
- },
submit() {
if (!this.title) {
return uni.showToast({
@@ -104,6 +141,24 @@
icon: 'error'
})
}
+ const params = {
+ type_id: this.type,
+ title: this.title,
+ content: this.content,
+ images: this.images.length > 0 ? this.images.map(item => { return item.url }) : null,
+ file: this.files.length > 0 ? this.files[0].url : null
+ }
+ this.$ajax.post('/api/user/score', params, { custom: {loading: true} }).then(res => {
+ if (res.status == 0) {
+ uni.showToast({
+ title: '提交成功',
+ icon: 'success'
+ })
+ setTimeout(() => {
+ uni.navigateBack()
+ }, 800)
+ }
+ })
}
}
}
diff --git a/src/pages/score/list.vue b/src/pages/score/list.vue
new file mode 100644
index 0000000..2316df8
--- /dev/null
+++ b/src/pages/score/list.vue
@@ -0,0 +1,189 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.title }}
+ {{ item.check_status_text }}
+
+
+
+ 提交时间: {{ item.created_at }}
+ 审核时间: {{ item.check_at }}
+ 得分: +{{ item.score }}
+ 未通过原因:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/pages/user/profile.vue b/src/pages/user/profile.vue
index 77486bc..f74d0d6 100644
--- a/src/pages/user/profile.vue
+++ b/src/pages/user/profile.vue
@@ -6,14 +6,14 @@
-
+
-
+
- 党员1
- 党支部1
+ {{ user.name }}
+ {{ user.cate_name }}
@@ -22,17 +22,17 @@
- 10
+ {{ user.current_score }}
当前得星
- 10
+ {{ user.rank }}
总排名
- 10
+ {{ user.score }}
累计得星
@@ -42,62 +42,120 @@
-
-
-
-
-
- 我的填报
-
-
-
-
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/static/css/base.css b/src/static/css/base.css
index b8d433c..598f9de 100644
--- a/src/static/css/base.css
+++ b/src/static/css/base.css
@@ -3,10 +3,6 @@
}
.page {
background-color: #efefef;
- /* position: absolute;
- width: 100%;
- height: 100%;
- box-sizing: border-box; */
}
.flex {
@@ -18,4 +14,14 @@
.btn-danger {
color: white;
background-color: #C20000;
-}
\ No newline at end of file
+}
+
+.rich-text {
+ word-break: break-all;
+ overflow-wrap: break-word;
+ line-height: 1.6;
+}
+.rich-text img {
+ width: 100%;
+ height: 100%;
+}
diff --git a/src/static/images/bit2.png b/src/static/images/bit2.png
new file mode 100644
index 0000000..e80e98c
Binary files /dev/null and b/src/static/images/bit2.png differ
diff --git a/src/static/images/default-avatar.png b/src/static/images/default-avatar.png
new file mode 100644
index 0000000..2c0baf1
Binary files /dev/null and b/src/static/images/default-avatar.png differ
diff --git a/src/utils/index.js b/src/utils/index.js
index 8241ff2..7ddb988 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -1,3 +1,11 @@
export function isLogin() {
return !!uni.getStorageSync('party_rank_auth_token')
-}
\ No newline at end of file
+}
+
+export function setToken(value) {
+ uni.setStorageSync('party_rank_auth_token', value)
+}
+
+export function getToken() {
+ return uni.getStorageSync('party_rank_auth_token')
+}
diff --git a/src/utils/request.js b/src/utils/request.js
index 3c916e1..95f49ed 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -1,4 +1,6 @@
// http 网络请求
+// import { getToken } from './index'
+const { getToken } = require('./')
module.exports = () => {
// 全局配置
@@ -14,7 +16,7 @@ module.exports = () => {
// 请求拦截
uni.$u.http.interceptors.request.use(
(config) => {
- const token = uni.getStorageSync('party_rank_auth_token')
+ const token = getToken()
if (token) {
config.header['Authorization'] = `Bearer ${token}`
}
@@ -32,25 +34,30 @@ module.exports = () => {
// 响应拦截
uni.$u.http.interceptors.response.use(
(response) => {
- uni.hideLoading()
+ if (response.config.custom.loading) {
+ uni.hideLoading()
+ }
const res = response.data
+ if (res.status == 401) {
+ return uni.reLaunch({
+ url: '/pages/auth/login'
+ })
+ }
if (response.config.custom.toast && res.status != 0 && res.doNotDisplayToast != 1) {
uni.showModal({
title: res.msg,
showCancel: false
})
}
- if (res.code == 401) {
- uni.reLaunch({
- url: '/pages/auth/login'
- })
- }
return res
},
(response) => {
- uni.hideLoading()
+ console.log(response)
+ if (response.config?.custom.loading) {
+ uni.hideLoading()
+ }
return Promise.reject(response)
}
)