shish 3 anni fa
parent
commit
fa1cfdec2e

+ 1 - 1
ghsApp/src/admin/home/mall.vue

@@ -45,7 +45,7 @@ export default {
             uni.saveImageToPhotosAlbum({
               filePath: res.tempFilePath,
               success: function (data) {
-                uni.showToast({title:'下载成功!'})
+                uni.showToast({title:'保存成功'})
               }
             });
           }

+ 48 - 9
ghsApp/src/admin/item/list.vue

@@ -93,17 +93,20 @@
 				<view style="width:100vw;margin-top:8upx;"><button @click="copyCreate()">复制新建</button></view>
 				<view style="width:100vw;margin-top:8upx;"><button @click="breakMore()">拆散</button></view>
 				<view style="width:100vw;margin-top:8upx;"><button @click="shareItem()">分享</button></view>
-				<view style="width:100vw;margin-top:8upx;"><button @click="getPoster(0)">分享海报(花店)</button></view>
-				<view style="width:100vw;margin-top:8upx;"><button @click="getPoster(1)">分享海报(散客)</button></view>
+				<view style="width:100vw;margin-top:8upx;"><button @click="getHdPosterFn()">分享海报(花店)</button></view>
+				<view style="width:100vw;margin-top:8upx;"><button @click="getSkPosterFn()">分享海报(散客)</button></view>
 				<view style="width:100vw;margin-top:30upx;"><button @click="closeRightShow()">取消</button></view>
 			</view>
 		</uni-popup>
 
 		<uni-popup ref="posterShow" background-color="#fff" type="center" :animation="true" class="class-popup-style">
 			<view style="display:flex;width:100vw;padding:20upx 20upx 40upx 20upx;height:auto;justify-content: space-between;align-items:center;flex-wrap:wrap;max-height:100vh;overflow:auto;">
-				<image class="image" :src="posterUrl" mode="widthFix"></image>
-				<view style="width:100%;margin-top:20upx;text-align:center;">
-					<button class="admin-button-com big blue" style="width:300upx;" @click="downloadImg">保存到手机</button>
+				<text style="position:absolute;right:50upx;top:15upx;font-size:70upx;" @click="closePoster()">×</text>
+				<view style="width:100%;text-align:center;margin-top:30upx;">
+					<image style="width:60%;margin:0 auto;" :src="posterUrl" mode="widthFix"></image>
+				</view>
+				<view style="width:100%;margin-top:30upx;text-align:center;">
+					<button class="admin-button-com big blue" style="width:300upx;" @click="downloadImg">保存图片</button>
 				</view>
 			</view>
 		</uni-popup>
@@ -118,7 +121,7 @@ import productMins from "@/mixins/product";
 import { mapGetters } from "vuex";
 import { getWeixinId } from "@/api/invite/index";
 import { print } from '@/api/product';
-import { breakItem } from '@/api/item'
+import { breakItem,getHdPoster,getSkPoster } from '@/api/item'
 import uniPopup from '@/uni_modules/uni-popup/components/uni-popup/uni-popup.vue';
 import ModalModule from "@/components/plugin/modal"
 export default {
@@ -176,12 +179,48 @@ export default {
 				that.breakAction()
 			})
 		},
-		getPoster(type){
+		closePoster(){
+			this.$refs.posterShow.close()
+		},
+		getHdPosterFn(){
+			this.closeRightShow()
+			let that = this
+			uni.showLoading({mask:true})
+			getHdPoster({id:this.currentInfo.id}).then(res=>{
+				uni.hideLoading()
+				if(res.code == 1){
+					that.posterUrl = res.data.imgUrl
+					this.$refs.posterShow.open('top')
+				}
+			})
+		},
+		getSkPosterFn(){
 			this.closeRightShow()
-			this.$refs.posterShow.open('top')
+			let that = this
+			uni.showLoading({mask:true})
+			getSkPoster({id:this.currentInfo.id}).then(res=>{
+				uni.hideLoading()
+				if(res.code == 1){
+					that.posterUrl = res.data.imgUrl
+					this.$refs.posterShow.open('top')
+				}
+			})
 		},
 		downloadImg(){
-
+			uni.downloadFile({
+				url: this.posterUrl,
+				success: (res) => {
+				if (res.statusCode === 200) {
+					console.log(res)
+					uni.saveImageToPhotosAlbum({
+					filePath: res.tempFilePath,
+					success: function (data) {
+						uni.showToast({title:'保存成功'})
+					}
+					});
+				}
+				}
+			});
 		},
 		breakMore(){
 			this.closeRightShow()

+ 8 - 0
ghsApp/src/api/item/index.js

@@ -1,5 +1,13 @@
 import https from '@/plugins/luch-request_0.0.7/request'
 
+export const getSkPoster = data => {
+	return https.get('/item/get-sk-poster', data)
+}
+
+export const getHdPoster = data => {
+	return https.get('/item/get-hd-poster', data)
+}
+
 export const breakItem = data => {
 	return https.post("/item/break-item", data);
 };