
```
<template>
<view class="ts-column">
<view class="banner">
<image class="banner-img" :mode="imageMode" :src="cover"></image>
<view class="banner-title">{{pageData.title}}</view>
</view>
<view class="ts-section">
<view class="ts-section-title">
<view class="ts-row">
<view class="ts-flex-item" style="align-items: flex-end;">
<text class="ts-h2 ts-text-bold">{{pageData.linkman}}</text>
<text class="ts-h6 ts-padding-left">{{pageData.mobile}}</text>
</view>
<view style="justify-content: center; align-items: center;">
<ts-badge :text="pageData.type" type="error"></ts-badge>
</view>
</view>
</view>
<view class="ts-section-body">
<view class="ts-row ts-h2 ts-text-bold ts-ellipsis">
{{pageData.title}}
</view>
<view class="ts-row" style="flex-wrap: wrap;">
{{pageData.description}}
</view>
<ts-line></ts-line>
<view class="ts-row">
<view>地址:</view>
<view>{{pageData.address}}</view>
</view>
<view class="ts-row">
<view>時間:</view>
<view>{{pageData.create_time}}</view>
</view>
<view class="ts-column ts-padding-top ts-center" v-for="(img,idx) in pageData.images" :key="idx">
<image :src="img" style="width: 100%;" :mode="imageMode"></image>
</view>
</view>
</view>
</view>
</template>
<script>
import * as api from "@/common/api"
function _handleShareChannels(provider) {
let channels = [];
for (let i = 0, len = provider.length; i < len; i++) {
switch (provider[i]) {
case 'weixin':
channels.push({
text: '分享到微信好友',
id: 'weixin',
sort: 0
});
channels.push({
text: '分享到微信朋友圈',
id: 'weixin',
sort: 1
});
break;
default:
break;
}
}
channels.sort(function(x, y) {
return x.sort - y.sort;
});
return channels;
}
export default {
data() {
return {
title: 'list-triplex-row',
id: 0, //項目ID
isLoading: false,
providerList: [],
pageData: {
title: '詳情',
},
imageMode: 'widthFix',
}
},
computed: {
cover() {
if (this.pageData.images && this.pageData.images.length > 0) {
return this.pageData.images[0];
} else {
return 'http://via.placeholder.com/750x250'
}
}
},
onLoad(e) {
this.id = parseInt(e.id)
this.getDetail();
setTimeout(() => {
uni.setNavigationBarTitle({
title: this.pageData.title
});
}, 500)
},
onShareAppMessage() {
return {
title: this.banner.title,
path: DETAIL_PAGE_PATH + '?detailDate=' + JSON.stringify(this.banner)
}
},
onNavigationBarButtonTap(event) {
const buttonIndex = event.index;
if (buttonIndex === 0) {
// 分享 H5 的頁面
const shareProviders = [];
uni.getProvider({
service: 'share',
success: (result) => {
// 目前僅考慮分享到微信
if (result.provider && result.provider.length && ~result.provider.indexOf('weixin')) {
const channels = _handleShareChannels(result.provider);
uni.showActionSheet({
itemList: channels.map(channel => {
return channel.text;
}),
success: (result) => {
const tapIndex = result.tapIndex;
uni.share({
provider: 'weixin',
type: 0,
title: this.banner.title,
scene: tapIndex === 0 ? 'WXSceneSession' : 'WXSenceTimeline',
href: 'https://uniapp.dcloud.io/h5' + DETAIL_PAGE_PATH + '?detailDate=' + JSON.stringify(this.banner),
imageUrl: 'https://img-cdn-qiniu.dcloud.net.cn/uniapp/app/share-logo@3.png'
});
}
});
} else {
uni.showToast({
title: '未檢測到可用的微信分享服務'
});
}
},
fail: (error) => {
uni.showToast({
title: '獲取分享服務失敗'
});
}
});
}
},
methods: {
getDetail() {
//阻止重復加載網絡請求
if (this.isLoading) {
// uni.stopPullDownRefresh();
return;
}
this.isLoading = true;
api.event.getInfo(this.id, {}).then(res => {
if (res.errno === 0) {
this.pageData = res.data;
this.isLoading = false;
} else {
console.log(res.errmsg);
}
});
}
}
}
</script>
<style>
.banner {
/* height: 360upx; */
/* overflow: hidden; */
position: relative;
background-color: #ccc;
display: flex;
flex: 1;
flex-direction: row;
}
.banner-img {
/* width: 100%; */
display: flex;
flex: 1;
}
.banner-title-wraper {
background-color: #ccc;
height: 100upx;
flex: 1;
display: flex;
flex-direction: row;
padding: 20upx;
}
.banner-title {
max-height: 84upx;
overflow: hidden;
position: absolute;
/* left: 30upx; */
bottom: 30upx;
width: 100%;
font-size: 32upx;
font-weight: 400;
line-height: 42upx;
color: white;
z-index: 11;
font-weight: bold;
background-color: rgba(0, 0, 0, 0.6);
padding: 20upx;
}
.article-meta {
padding: 20upx 40upx;
display: flex;
flex-direction: row;
justify-content: flex-start;
color: gray;
}
.article-text {
font-size: 26upx;
line-height: 50upx;
margin: 0 20upx;
}
.article-author,
.article-time {
font-size: 30upx;
}
.article-content {
padding: 0 30upx;
overflow: hidden;
font-size: 30upx;
margin-bottom: 30upx;
}
</style>
```
- 內容介紹
- EcmaScript基礎
- 快速入門
- 常量與變量
- 字符串
- 函數的基本概念
- 條件判斷
- 數組
- 循環
- while循環
- for循環
- 函數基礎
- 對象
- 對象的方法
- 函數
- 變量作用域
- 箭頭函數
- 閉包
- 高階函數
- map/reduce
- filter
- sort
- Promise
- 基本對象
- Arguments 對象
- 剩余參數
- Map和Set
- Json基礎
- RegExp
- Date
- async
- callback
- promise基礎
- promise-api
- promise鏈
- async-await
- 項目實踐
- 標簽系統
- 遠程API請求
- 面向對象編程
- 創建對象
- 原型繼承
- 項目實踐
- Classes
- 構造函數
- extends
- static
- 項目實踐
- 模塊
- import
- export
- 項目實踐
- 第三方擴展庫
- immutable
- Vue快速入門
- 理解MVVM
- Vue中的MVVM模型
- Webpack+Vue快速入門
- 模板語法
- 計算屬性和偵聽器
- Class 與 Style 綁定
- 條件渲染
- 列表渲染
- 事件處理
- 表單輸入綁定
- 組件基礎
- 組件注冊
- Prop
- 自定義事件
- 插槽
- 混入
- 過濾器
- 項目實踐
- 標簽編輯
- 移動客戶端開發
- uni-app基礎
- 快速入門程序
- 單頁程序
- 底部Tab導航
- Vue語法基礎
- 模版語法
- 計算屬性與偵聽器
- Class與Style綁定
- 樣式與布局
- Box模型
- Flex布局
- 內置指令
- 基本指令
- v-model與表單
- 條件渲染指令
- 列表渲染指令v-for
- 事件與自定義屬性
- 生命周期
- 項目實踐
- 學生實驗
- 貝店商品列表
- 加載更多數據
- 詳情頁面
- 自定義組件
- 內置組件
- 表單組件
- 技術專題
- 狀態管理vuex
- Flyio
- Mockjs
- SCSS
- 條件編譯
- 常用功能實現
- 上拉加載更多數據
- 數據加載綜合案例
- Teaset UI組件庫
- Teaset設計
- Teaset使用基礎
- ts-tag
- ts-badge
- ts-button
- ta-banner
- ts-list
- ts-icon
- ts-load-more
- ts-segmented-control
- 代碼模版
- 項目實踐
- 標簽組件
- 失物招領客戶端原型
- 發布頁面
- 檢索頁面
- 詳情頁面
- 服務端開發技術
- 服務端開發環境配置
- Koajs快速入門
- 快速入門
- 常用Koa中間件介紹
- 文件上傳
- RestfulApi
- 一個復雜的RESTful例子
- 使用Mockjs生成模擬數據
- Thinkjs快速入門
- MVC模式
- Thinkjs介紹
- 快速入門
- RESTful服務
- RBAC案例
- 關聯模型
- 應用開發框架
- 服務端開發
- PC端管理界面開發
- 移動端開發
- 項目實踐
- 失物招領項目
- 移動客戶端UI設計
- 服務端設計
- 數據庫設計
- Event(事件)
- 客戶端設計
- 事件列表頁面
- 發布頁面
- 事件詳情頁面
- API設計
- image
- event
- 微信公眾號開發
- ui設計規范