detail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <template>
  2. <My_listbox ref="List" @getlist="getDetail">
  3. <swiper class="swiper" v-if="slides.length" :indicator-dots="slides.length > 1" indicator-color="#DC808B"
  4. indicator-active-color="#C30D23">
  5. <swiper-item class="swiper-item" v-for="item in slides" :key="item.url">
  6. <image class="image" :src="item.cover" mode="aspectFill" lazy-load="true" />
  7. <view class="qrcode" @click="saveQrcode">
  8. <text class="iconfont icon-xiazai" />
  9. 二维码
  10. </view>
  11. </swiper-item>
  12. </swiper>
  13. <view class="head">
  14. <view class="line1">
  15. <view class="left">
  16. <text class="iconfont icon-biaoqian" />
  17. {{ detail.renderingstype }}
  18. </view>
  19. <view class="right" hover-class="navigator-hover"
  20. @click="collectLoading ? '' : handleCollect(detail.iscollect)">
  21. <u-loading-icon v-if="collectLoading" size="20" />
  22. <block v-else>
  23. <text v-if="detail.iscollect == 0" class="iconfont icon-weishoucang" />
  24. <text v-else class="iconfont icon-yishoucang" style="color: #FFC300;" />
  25. 收藏
  26. </block>
  27. </view>
  28. </view>
  29. <view class="title">{{ detail.title }}</view>
  30. <view class="subtitle" v-if="detail.subtitle">{{ detail.subtitle }}</view>
  31. </view>
  32. <view class="introduce" v-if="detail.notes">
  33. <view class="introduce-title">
  34. 产品介绍
  35. </view>
  36. <view class="introduce-text">
  37. {{ detail.notes }}
  38. </view>
  39. </view>
  40. <storeInfo />
  41. <bottom1 />
  42. <view style="position: absolute;z-index: -999;top: 0;">
  43. <l-painter ref="painter" hidden css="padding:10px;background:#fff;width: 148px;">
  44. <l-painter-view>
  45. <l-painter-view css="margin: 0 auto;width: 128px;">
  46. <l-painter-qrcode :text="detail.appleturl" css="width: 128px; height: 128px;color:#000;" />
  47. </l-painter-view>
  48. <l-painter-view css="width: 108px;text-align: center;margin: 10px auto 0;">
  49. <l-painter-text :text="detail.title" />
  50. </l-painter-view>
  51. </l-painter-view>
  52. </l-painter>
  53. </view>
  54. </My_listbox>
  55. </template>
  56. <script>
  57. import bottom1 from "../../components/bottomModules/bottom1.vue"
  58. import lPainter from "../../uni_modules/lime-painter/components/l-painter/l-painter.vue"
  59. import lPainterText from "../../uni_modules/lime-painter/components/l-painter-text/l-painter-text.vue"
  60. import lPainterView from "../../uni_modules/lime-painter/components/l-painter-view/l-painter-view.vue"
  61. import lPainterQrcode from "../../uni_modules/lime-painter/components/l-painter-qrcode/l-painter-qrcode.vue"
  62. export default {
  63. components: { bottom1, lPainter, lPainterQrcode, lPainterText, lPainterView },
  64. data() {
  65. return {
  66. sat_sharematerialid: null,
  67. detail: {},
  68. slides: [],
  69. collectLoading: false
  70. }
  71. },
  72. onLoad(options) {
  73. this.sat_sharematerialid = options.id;
  74. this.getDetail(true);
  75. },
  76. methods: {
  77. getDetail(init = false) {
  78. if (!init) return;
  79. this.$Http.basic({
  80. "id": 20240415164302,
  81. "content": {
  82. "sat_sharematerialid": this.sat_sharematerialid
  83. },
  84. }).then(res => {
  85. this.$refs.List.RefreshToComplete()
  86. console.log("获取效果图详情", res)
  87. if (this.cutoff(res.msg)) return;
  88. this.detail = res.data;
  89. this.slides = res.data.attinfos_pic.map(v => {
  90. return {
  91. cover: this.getSpecifiedImage(v.attinfos[0], 'compressed'),
  92. url: v.attinfos[0].url
  93. }
  94. })
  95. uni.setNavigationBarTitle({
  96. title: res.data.title
  97. });
  98. })
  99. },
  100. handleCollect(iscollect) {
  101. this.collectLoading = true;
  102. this.$Http.basic({
  103. "id": 20240416133702,
  104. "content": {
  105. "ownertable": "sat_sharematerial",
  106. "ownerid": this.detail.sat_sharematerialid,
  107. "type": 1
  108. },
  109. }).then(res => {
  110. console.log("收藏", res)
  111. this.collectLoading = false;
  112. if (this.cutoff(res.msg)) return;
  113. this.detail.iscollect = iscollect ? 0 : 1
  114. })
  115. },
  116. saveQrcode() {
  117. let that = this;
  118. that.$refs.painter.canvasToTempFilePathSync({
  119. fileType: "jpg",
  120. // 如果返回的是base64是无法使用 saveImageToPhotosAlbum,需要设置 pathType为url
  121. pathType: 'url',
  122. quality: 1,
  123. success: (res) => {
  124. console.log(res.tempFilePath);
  125. // 非H5 保存到相册
  126. // H5 提示用户长按图另存
  127. uni.saveImageToPhotosAlbum({
  128. filePath: res.tempFilePath,
  129. success: function (e) {
  130. uni.showModal({
  131. title: '提示',
  132. content: '图片已保存到系统相册',
  133. showCancel: false
  134. })
  135. that.loading = false;
  136. },
  137. fail: ({ errMsg }) => {
  138. if (errMsg == 'saveImageToPhotosAlbum:fail auth deny') {
  139. uni.showModal({
  140. title: '提示',
  141. content: '请授权添加到相册权限后再试!',
  142. showCancel: false,
  143. complete: (complete) => {
  144. uni.openSetting({
  145. success: res => {
  146. that.loading = false;
  147. if (res.authSetting['scope.writePhotosAlbum']) {
  148. this.saveTheImage()
  149. } else {
  150. uni.showModal({
  151. title: '提示',
  152. content: '未获取授权!已取消保存',
  153. showCancel: false,
  154. })
  155. }
  156. }
  157. })
  158. },
  159. })
  160. } else {
  161. that.loading = false;
  162. uni.showModal({
  163. title: '提示',
  164. content: '已取消保存',
  165. showCancel: false,
  166. })
  167. }
  168. },
  169. });
  170. },
  171. });
  172. }, getSheraDate() {
  173. let detail = this.detail
  174. return {
  175. title: detail.title, // 标题
  176. path: "/packageCase/imgs/detail?id=" + detail.sat_sharematerialid, // 分享路径
  177. imageUrl: this.detail.attinfos.find(v => v.usetype == "sat_sharematerial").url || ""// 分享图
  178. };
  179. }
  180. },
  181. onShareAppMessage(res) {
  182. return this.getSheraDate()
  183. },
  184. onShareTimeline() {
  185. return this.getSheraDate()
  186. }
  187. }
  188. </script>
  189. <style lang="scss">
  190. .swiper {
  191. width: 375px;
  192. height: 231px;
  193. background: #F5F5F5;
  194. border-radius: 5px;
  195. box-sizing: border-box;
  196. .swiper-item {
  197. position: relative;
  198. width: 100%;
  199. height: 100%;
  200. .image {
  201. width: 100%;
  202. height: 100%;
  203. }
  204. .qrcode {
  205. position: absolute;
  206. display: flex;
  207. align-items: center;
  208. justify-content: center;
  209. top: 10px;
  210. right: 10px;
  211. width: 70px;
  212. height: 25px;
  213. background: rgba($color: #333333, $alpha: 0.5);
  214. font-size: 12px;
  215. color: #FFFFFF;
  216. .iconfont {
  217. margin-right: 4px;
  218. }
  219. }
  220. }
  221. }
  222. .head {
  223. background: #fff;
  224. padding: 8px 10px 15px;
  225. .line1 {
  226. display: flex;
  227. justify-content: space-between;
  228. align-items: flex-end;
  229. .left {
  230. .iconfont {
  231. margin-right: 4px;
  232. font-size: 12px;
  233. }
  234. line-height: 17px;
  235. font-size: 12px;
  236. color: #999999;
  237. }
  238. .right {
  239. display: flex;
  240. align-items: center;
  241. justify-content: center;
  242. width: 80px;
  243. height: 24px;
  244. border-radius: 12px;
  245. border: 1px solid #CCCCCC;
  246. font-family: PingFang SC, PingFang SC;
  247. font-size: 12px;
  248. color: #333333;
  249. .iconfont {
  250. margin-right: 5px;
  251. }
  252. }
  253. }
  254. .title {
  255. line-height: 20px;
  256. font-family: PingFang SC, PingFang SC;
  257. font-weight: bold;
  258. font-size: 14px;
  259. color: #333333;
  260. margin: 10px 0;
  261. }
  262. .subtitle {
  263. line-height: 17px;
  264. font-family: PingFang SC, PingFang SC;
  265. font-size: 12px;
  266. color: #666666;
  267. }
  268. }
  269. .introduce {
  270. background: #fff;
  271. margin-top: 10px;
  272. padding: 0 10px;
  273. &-title {
  274. line-height: 45px;
  275. background: #FFFFFF;
  276. font-family: PingFang SC, PingFang SC;
  277. font-weight: bold;
  278. font-size: 16px;
  279. color: #333333;
  280. }
  281. &-text {
  282. line-height: 20px;
  283. font-family: PingFang SC, PingFang SC;
  284. font-size: 14px;
  285. color: #333333;
  286. padding-bottom: 10px;
  287. }
  288. }
  289. </style>