增加我的页面的功能
This commit is contained in:
parent
61fa35fce6
commit
54fa000f35
@ -27,4 +27,20 @@ export const checkWord = (params: any) => {
|
||||
})
|
||||
}
|
||||
|
||||
export const getArticle = (aid: string) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.request({
|
||||
url: `https://ghost.kingsome.cn/api/emulated/article`,
|
||||
method: 'POST',
|
||||
data: {id: aid},
|
||||
success: (res) => {
|
||||
resolve && resolve(res.data);
|
||||
},
|
||||
fail: (err) => {
|
||||
reject && reject(err)
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
@ -3,11 +3,13 @@ const host_base = 'https://dirty.kingsome.cn'
|
||||
uni.addInterceptor('request', {
|
||||
invoke(args) {
|
||||
// request 触发前拼接 url
|
||||
args.url = host_base + args.url
|
||||
if (false) {
|
||||
args.header = {
|
||||
...args.header,
|
||||
token: 'xxx'
|
||||
if (args.url.indexOf('http') < 0) {
|
||||
args.url = host_base + args.url
|
||||
if (false) {
|
||||
args.header = {
|
||||
...args.header,
|
||||
token: 'xxx'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -30,7 +30,7 @@
|
||||
</view>
|
||||
<view slot="actions" class="card-actions">
|
||||
<view class="card-actions-item" @click="actionsClick('分享')">
|
||||
<uni-icons type="pengyouquan" size="18" color="#999"></uni-icons>
|
||||
<uni-icons type="pyq" size="18" color="#999"></uni-icons>
|
||||
<text class="card-actions-item-text">分享</text>
|
||||
</view>
|
||||
<view class="card-actions-item" @click="actionsClick('点赞')">
|
||||
|
92
src/components/TextArrowCell/index.vue
Normal file
92
src/components/TextArrowCell/index.vue
Normal file
@ -0,0 +1,92 @@
|
||||
<template>
|
||||
<view class="cell-container">
|
||||
<view class="ta-cell" @click="onClick">
|
||||
<view class="left-part">
|
||||
<uni-icons :type="icon" size="24" color="gray"></uni-icons>
|
||||
</view>
|
||||
<view class="center-part">
|
||||
<text >{{title}}</text>
|
||||
</view>
|
||||
<view class="right-part">
|
||||
<uni-icons type="right" size="30" color="gray"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
<button v-if="!!openType" class="function-btn" open-type="contact"></button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from 'vue-property-decorator'
|
||||
|
||||
declare module 'vue/types/vue' {
|
||||
interface Vue {
|
||||
title?: string
|
||||
openType?: string
|
||||
icon?: string
|
||||
}
|
||||
}
|
||||
@Component({
|
||||
name: 'TextArrowCell',
|
||||
props: ['title', 'openType', 'icon'],
|
||||
})
|
||||
export default class extends Vue{
|
||||
onClick(s: string) {
|
||||
console.log('on click: ', s)
|
||||
if (!this.openType) {
|
||||
this.$emit("cellClicked", s)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.cell-container {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
}
|
||||
.ta-cell{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin: 5px 0;
|
||||
color: gray;
|
||||
position: relative;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
.function-btn {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
box-sizing: unset;
|
||||
text-align: left;
|
||||
border-radius: 0;
|
||||
background-color: white!important;
|
||||
opacity:0!important;
|
||||
}
|
||||
|
||||
.left-part {
|
||||
width: 10%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin: auto;
|
||||
}
|
||||
.center-part {
|
||||
width: 80%;
|
||||
font-size: 16px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin: auto;
|
||||
padding-left: 5px;
|
||||
}
|
||||
.right-part {
|
||||
width: 10%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin: auto;
|
||||
padding: 5px 0;
|
||||
}
|
||||
|
||||
</style>
|
@ -44,6 +44,13 @@
|
||||
"style": {
|
||||
"navigationBarTitleText": "价格列表"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
"path": "pages/article/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "免责申明"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tabBar": {
|
||||
|
68
src/pages/article/index.vue
Normal file
68
src/pages/article/index.vue
Normal file
@ -0,0 +1,68 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<view class="article-title">
|
||||
<text>{{aTitle}}</text>
|
||||
</view>
|
||||
<view class="article-content">
|
||||
<text>{{aContent}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from 'vue-property-decorator'
|
||||
import PriceCell from '@/components/PriceCell/index.vue'
|
||||
import { getArticle } from '@/api/game'
|
||||
|
||||
@Component({
|
||||
name: 'Article',
|
||||
components: {
|
||||
PriceCell,
|
||||
}
|
||||
})
|
||||
export default class extends Vue{
|
||||
private aid = ''
|
||||
private aTitle = ''
|
||||
private aContent = ''
|
||||
|
||||
onLoad(options: any) {
|
||||
if (options.id) {
|
||||
this.aid = options.id
|
||||
this.getRecord(this.aid)
|
||||
}
|
||||
}
|
||||
|
||||
async getRecord(aid: string) {
|
||||
try {
|
||||
let res: any = await getArticle(aid)
|
||||
if (!res.errcode && res.record) {
|
||||
this.aTitle = res.record.title;
|
||||
this.aContent = res.record.content;
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.aTitle
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('error get article');
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.article-title {
|
||||
font-size: 30px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
width: 690rpx;
|
||||
margin: 10px;
|
||||
}
|
||||
.article-content {
|
||||
font-size: 14px;
|
||||
text-align: left;
|
||||
width: 690rpx;
|
||||
padding: 10px 15px;
|
||||
color: #666;
|
||||
margin-bottom:40px;
|
||||
}
|
||||
</style>
|
@ -1,23 +1,51 @@
|
||||
<template>
|
||||
<view class="container">
|
||||
<uni-list>
|
||||
<uni-list-item>
|
||||
<text-arrow-cell class="cell-item" title="联系客服" icon="chatbubble" open-type="contact"></text-arrow-cell>
|
||||
</uni-list-item>
|
||||
<uni-list-item>
|
||||
<text-arrow-cell class="cell-item" title="意见反馈" icon="email" open-type="feedback"></text-arrow-cell>
|
||||
</uni-list-item>
|
||||
<uni-list-item>
|
||||
<text-arrow-cell class="cell-item" title="免责申明" icon="notification" @cellClicked="onClickSm"></text-arrow-cell>
|
||||
</uni-list-item>
|
||||
</uni-list>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Vue } from 'vue-property-decorator'
|
||||
import TextArrowCell from '@/components/TextArrowCell/index.vue'
|
||||
|
||||
@Component({
|
||||
name: 'Member',
|
||||
components: {}
|
||||
components: {
|
||||
TextArrowCell
|
||||
}
|
||||
})
|
||||
export default class extends Vue{
|
||||
private chatIcon = {color: '#999',size: '32',type: 'chatbubble'}
|
||||
private yjIcon = {color: '#999',size: '32',type: 'email'}
|
||||
private smIcon = {color: '#999',size: '32',type: 'notification'}
|
||||
onLoad() {
|
||||
|
||||
}
|
||||
onClick() {
|
||||
|
||||
}
|
||||
onClickSm() {
|
||||
uni.navigateTo({
|
||||
url: `/pages/article/index?id=5ce2989bacb8f911e293843c`,
|
||||
animationType: 'pop-in',
|
||||
animationDuration: 200})
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
.cell-item{
|
||||
width: 100%
|
||||
}
|
||||
</style>
|
||||
|
Loading…
x
Reference in New Issue
Block a user