From e3d658ae7bfb2194fb73bb00c29e39193daee092 Mon Sep 17 00:00:00 2001
From: panliang <1163816051@qq.com>
Date: Mon, 11 Dec 2023 14:34:15 +0800
Subject: [PATCH] score/form
---
src/pages/index/index.vue | 1 -
src/pages/score/detail.vue | 16 ++++++++++++++-
src/pages/score/form.vue | 14 ++++++++++++-
src/pages/score/list.vue | 4 +++-
src/pages/user/profile.vue | 41 +++++++++-----------------------------
src/utils/index.js | 3 ++-
6 files changed, 42 insertions(+), 37 deletions(-)
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index f7e12fa..596bb51 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -149,7 +149,6 @@
text-align: center;
font-weight: bold;
position: relative;
- padding: 15rpx 0;
}
.rank .title {
font-size: 36rpx;
diff --git a/src/pages/score/detail.vue b/src/pages/score/detail.vue
index 67f72e3..2bb93f9 100644
--- a/src/pages/score/detail.vue
+++ b/src/pages/score/detail.vue
@@ -7,7 +7,7 @@
-
+
@@ -37,6 +37,20 @@ export default {
this.info = res.data
}
})
+ },
+ copy(text) {
+ if (text) {
+ uni.setClipboardData({
+ data: text,
+ showToast: false,
+ success: () => {
+ uni.showToast({
+ icon: 'success',
+ title: '下载地址已复制',
+ })
+ }
+ })
+ }
}
}
}
diff --git a/src/pages/score/form.vue b/src/pages/score/form.vue
index 4a94248..66dbcf5 100644
--- a/src/pages/score/form.vue
+++ b/src/pages/score/form.vue
@@ -68,6 +68,13 @@
onLoad(e) {
if (e.type) {
this.type = e.type
+ this.$ajax.get(`/api/keyword/${this.type}`).then(res => {
+ if (res.status == 0) {
+ uni.setNavigationBarTitle({
+ title: res.data.name
+ })
+ }
+ })
}
if (e.id) {
this.id = e.id
@@ -148,7 +155,12 @@
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 => {
+ this.$ajax.request({
+ url: this.id ? `/api/user/score/${this.id}` : '/api/user/score',
+ method: this.id ? 'PUT' : 'POST',
+ data: params,
+ custom: { loading: true }
+ }).then(res => {
if (res.status == 0) {
uni.showToast({
title: '提交成功',
diff --git a/src/pages/score/list.vue b/src/pages/score/list.vue
index 8799629..7ba95d1 100644
--- a/src/pages/score/list.vue
+++ b/src/pages/score/list.vue
@@ -55,8 +55,10 @@ export default {
listHeight: 0,
}
},
- onLoad() {
+ onShow() {
this.loadData(true)
+ },
+ onLoad() {
uni.getSystemInfo({
success: (res) => {
this.listHeight = res.safeArea.height - 54
diff --git a/src/pages/user/profile.vue b/src/pages/user/profile.vue
index 4d092a0..25d8a78 100644
--- a/src/pages/user/profile.vue
+++ b/src/pages/user/profile.vue
@@ -68,7 +68,7 @@
}
}
},
- onLoad() {
+ onShow() {
this.init()
},
methods: {
@@ -90,40 +90,17 @@
this.user.rank = res.data.current.rank
}
}
- res = await this.$ajax.get('/api/keyword', { params: { key: 'score_cate_' } })
- let radarIndicator = [
- { name: '政治忠诚' },
- { name: '政治定力' },
- { name: '政治担当' },
- { name: '政治能力' },
- { name: '政治自律' },
- ]
- let radarValues = []
+ res = await this.$ajax.get('/api/user/chart-option')
+ var option = null
if (res.status == 0) {
- radarIndicator = res.data.map(item => {
- radarValues.push(radarValue[item.key])
- return {key: item.key, name: item.name}
- })
+ option = res.data
}
uni.hideLoading()
- var option = {
- radar: {
- indicator: radarIndicator
- },
- series: [
- {
- type: 'radar',
- data: [
- {
- value: radarValues,
- }
- ]
- }
- ]
- };
- this.$nextTick(() => {
- this.chart(option)
- })
+ if (option) {
+ this.$nextTick(() => {
+ this.chart(option)
+ })
+ }
},
chart(option) {
if (document.getElementById('echart')) {
diff --git a/src/utils/index.js b/src/utils/index.js
index 73bf7a7..1da5b4c 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -11,7 +11,6 @@ export function getToken() {
}
export function navigateTarget(option) {
- console.log(option)
if (!option || !option.target_url) {
return;
}
@@ -19,5 +18,7 @@ export function navigateTarget(option) {
uni.navigateTo({
url: option.target_url
})
+ } else if (option.target_type == 'web') {
+ window.open(option.target_url)
}
}