123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- <template>
- <view class="rf-category activityIntroduction" style="margin:20upx 20upx;">
- <view style="height:50upx; display: flex;">
- <u-image src="@/static/img/cooperationExchange/20200608_03.gif" alt=""
- style="height: 100%;vertical-align: middle; width: 10upx;">
- </u-image>
- <text
- style="margin-left: 10px;font-weight: 700;color: #000;font-size: 42upx;">{{i18n("ActivityResults")}}</text>
- </view>
- <view class="content" v-for="(item,index) in countryList">
- <!-- <u-image v-if="state==1" :src="'./api/file/pub/${item.attachmentSavePath}'" alt="" style="width: 20%;height: 20%;"></u-image>
- <u-image v-if="state==2" src="@/static/img/cooperationExchange/txt.png" alt="" class="Messicon"></u-image>
- <u-image v-if="state==3" src="@/static/img/cooperationExchange/excel.png" alt="" class="Messicon"></u-image>
- <u-image v-if="state==6" src="@/static/img/cooperationExchange/powerpoint.png" alt="" class="Messicon"></u-image>
- <u-image v-if="state==5" src="@/static/img/cooperationExchange/pdf.png" alt="" class="Messicon"></u-image>
- <u-image v-if="state==4" src="@/static/img/cooperationExchange/word.png" alt="" class="Messicon"></u-image> -->
- <text class="func_name">{{item.attachmentName}}</text>
- <view class="func_dp">
- <!-- <text class="func-preview" @click="preview(item.attachmentSavePath)">{{i18n('preview')}}</text> -->
- <text class="func-download "
- @click="download(item.attachmentSavePath,item.attachmentName)">{{i18n('download')}}</text>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: "cooperationActiveResults",
- props: ["id", "countryList"],
- data() {
- return {
- i: 0,
- }
- },
- methods: {
- download(path, fileName) {
- uni.downloadFile({
- url: websiteUrl + path, //下载地址接口返回
- success: (data) => {
- if (data.statusCode === 200) {
- //文件保存到本地
- uni.saveFile({
- tempFilePath: data.tempFilePath, //临时路径
- success: function(res) {
- uni.showToast({
- icon: 'none',
- mask: true,
- title: '文件已保存:' + res.savedFilePath, //保存路径
- duration: 3000,
- });
- setTimeout(() => {
- //打开文档查看
- uni.openDocument({
- filePath: res.savedFilePath,
- success: function(res) {
- // console.log('打开文档成功');
- }
- });
- }, 3000)
- }
- });
- }
- },
- fail: (err) => {
- console.log(err);
- uni.showToast({
- icon: 'none',
- mask: true,
- title: '失败请重新下载',
- });
- },
- });
- console.log('下载成功', 'https://localhost:8080/api/file/pub/' + path);
- },
- preview(url) {
- uni.navigateTo({
- url: '/pages/public/pdf?links=' + 'api/file/pub/' + url
- })
- },
- i18n(data) {
- return this.$t('common.' + data);
- },
- }
- }
- </script>
- <style scoped lang="scss">
- .rf-category {
- background-color: $color-white;
- /* #ifdef APP-PLUS */
- margin-top: calc(20upx + var(--status-bar-height));
- /* #endif */
- }
- .activityIntroduction /deep/ img {
- max-width: 700upx !important;
- }
- .result {
- height: 100%;
- width: 100%;
- margin-top: 30upx;
- }
- .content {
- // height: 100%;
- vertical-align: center;
- margin: 30upx 2upx;
- width: 100%;
- position: relative;
- display: inline-block;
- }
- .func_dp {
- position: absolute;
- top: 50%;
- right: 10upx;
- transform: translateY(-50%);
- display: inline-block;
- }
- .func-download {
- color: rgb(10, 15, 255);
- margin: 0upx 36upx;
- float: right;
- /* line-height: 10upx; */
- }
- .func-preview {
- color: rgb(10, 15, 255);
- margin: 0upx 12upx;
- cursor: pointer;
- // float: right;
- }
- .func_name {
- display: inline-block;
- width: 60%;
- // overflow: hidden;
- white-space: pre-wrap;
- }
- /* .Messicon {
- height: 60upx;
- margin-top: 24upx;
- float: left;
- margin-right: 20upx;
- } */
- </style>
|