uploadimg.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <template>
  2. <view class="container">
  3. <view style="">
  4. <textarea placeholder="说点什么吧..." class="tui-modal-input" v-model="textarea" />
  5. <tui-list-view>
  6. <tui-list-cell :arrow="true">
  7. <view class="tui-goods-title">
  8. <view>上传到</view>
  9. <view style="margin-right: 30rpx;">家族合影相册</image></view>
  10. </view>
  11. </tui-list-cell>
  12. </tui-list-view>
  13. <tui-upload style="margin-top: 30rpx;" :value="value" :serverUrl="serverUrl" @complete="result" @remove="remove"></tui-upload>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. import tuiUpload from "@/components/thorui/tui-upload/tui-upload"
  19. import tuiButton from "@/components/thorui/tui-button/tui-button"
  20. import tuiDropdownList from "@/components/thorui/tui-dropdown-list/tui-dropdown-list"
  21. import tNewsItem from '@/components/views/t-news-item/t-news-item.nvue';
  22. import tuiIcon from "@/components/thorui/tui-icon/tui-icon"
  23. import tuiTabs from "@/components/thorui/tui-tabs/tui-tabs"
  24. import tuiTimeAxis from "@/components/thorui/tui-time-axis/tui-time-axis"
  25. import tuiTimeaxisItem from "@/components/thorui/tui-timeaxis-item/tui-timeaxis-item"
  26. import tuiCard from "@/components/thorui/tui-card/tui-card"
  27. import tuiModal from "@/components/thorui/tui-modal/tui-modal"
  28. import tuiGrid from "@/components/thorui/tui-grid/tui-grid"
  29. import tuiGridItem from "@/components/thorui/tui-grid-item/tui-grid-item"
  30. import tuiSticky from "@/components/thorui/tui-sticky/tui-sticky"
  31. import tuiListCell from "@/components/thorui/tui-list-cell/tui-list-cell"
  32. import tuiListView from "@/components/thorui/tui-list-view/tui-list-view"
  33. //实际使用需要传入上传地址,以及上传接口返回数据进行调整组件
  34. export default {
  35. components: {
  36. tuiUpload,
  37. tuiButton,
  38. tuiDropdownList,
  39. tNewsItem,
  40. tuiIcon,
  41. tuiTabs,
  42. tuiTimeAxis,
  43. tuiTimeaxisItem,
  44. tuiCard,
  45. tuiModal,
  46. tuiGrid,
  47. tuiGridItem,
  48. tuiSticky,
  49. tuiListCell,
  50. tuiListView
  51. },
  52. data() {
  53. return {
  54. imageData: [],
  55. //上传地址
  56. serverUrl: "https://api.thorui.cn/",
  57. value:[] ,//初始化图片
  58. textarea:'',
  59. dropdownlistData: [{
  60. name: "微信支付",
  61. icon: "wechat",
  62. color: "#80D640",
  63. size: 30
  64. }, {
  65. name: "支付宝支付",
  66. icon: "alipay",
  67. color: "#00AAEE",
  68. size: 30
  69. }, {
  70. name: "银行卡支付",
  71. icon: "bankcard-fill",
  72. color: "#ff7900",
  73. size: 28
  74. }, {
  75. name: "微信支付",
  76. icon: "wechat",
  77. color: "#80D640",
  78. size: 30
  79. }, {
  80. name: "支付宝支付",
  81. icon: "alipay",
  82. color: "#00AAEE",
  83. size: 30
  84. }, {
  85. name: "银行卡支付",
  86. icon: "bankcard-fill",
  87. color: "#ff7900",
  88. size: 28
  89. }],
  90. dropdownShow: false,
  91. }
  92. },
  93. onNavigationBarButtonTap(e) {
  94. console.log('成功')
  95. },
  96. onLoad() {
  97. //实际应为请求返回数据,此处故意延时,实际中可去除
  98. setTimeout(()=>{
  99. //实际开发中图片地址应为网络地址
  100. this.value=['../../../../static/img/shop/1.jpg']
  101. },200)
  102. },
  103. methods: {
  104. btnDropChange(index) {
  105. this.proDropData = [...this.proDropList[index].list];
  106. this.proDropIndex = index;
  107. this.dropShow = true;
  108. this.dropdownShow=false
  109. },
  110. dropDownList(index) {
  111. if (index !== -1) {
  112. this.tui.toast("index:" + index)
  113. }
  114. this.dropdownShow = !this.dropdownShow
  115. },
  116. result: function(e) {
  117. console.log(e)
  118. this.imageData = e.imgArr;
  119. },
  120. remove: function(e) {
  121. //移除图片
  122. console.log(e)
  123. let index = e.index
  124. }
  125. }
  126. }
  127. </script>
  128. <style>
  129. page {
  130. background-color: #fff;
  131. }
  132. .container {
  133. padding: 20rpx;
  134. width: 100%;
  135. box-sizing: border-box;
  136. }
  137. .header {
  138. padding: 80rpx 90rpx 60rpx 90rpx;
  139. box-sizing: border-box;
  140. }
  141. .title {
  142. font-size: 34rpx;
  143. color: #333;
  144. font-weight: 500;
  145. }
  146. .tui-goods-title {
  147. width: 100%;
  148. font-size: 28rpx;
  149. display: flex;
  150. align-items: center;
  151. justify-content: space-between;
  152. }
  153. .tui-item-box {
  154. width: 100%;
  155. display: flex;
  156. align-items: center;
  157. }
  158. .tui-list-cell_name {
  159. padding-left: 20rpx;
  160. display: flex;
  161. align-items: center;
  162. justify-content: center;
  163. }
  164. .tui-ml-auto {
  165. margin-left: auto;
  166. }
  167. .tui-right {
  168. margin-left: auto;
  169. margin-right: 34rpx;
  170. font-size: 26rpx;
  171. color: #999;
  172. }
  173. .tui-logo {
  174. height: 52rpx;
  175. width: 52rpx;
  176. flex-shrink: 0;
  177. }
  178. .tui-flex {
  179. display: flex;
  180. align-items: center;
  181. }
  182. .tui-msg-box {
  183. display: flex;
  184. align-items: center;
  185. }
  186. .tui-msg-pic {
  187. width: 100rpx;
  188. height: 100rpx;
  189. border-radius: 50%;
  190. display: block;
  191. margin-right: 24rpx;
  192. flex-shrink: 0;
  193. }
  194. .tui-msg-item {
  195. max-width: 500rpx;
  196. min-height: 80rpx;
  197. overflow: hidden;
  198. display: flex;
  199. flex-direction: column;
  200. justify-content: space-between;
  201. }
  202. .tui-msg-name {
  203. overflow: hidden;
  204. white-space: nowrap;
  205. text-overflow: ellipsis;
  206. font-size: 34rpx;
  207. line-height: 1;
  208. color: #262b3a;
  209. }
  210. .tui-msg-content {
  211. overflow: hidden;
  212. white-space: nowrap;
  213. text-overflow: ellipsis;
  214. font-size: 26rpx;
  215. line-height: 1;
  216. color: #9397a4;
  217. }
  218. .tui-msg-right {
  219. max-width: 120rpx;
  220. height: 88rpx;
  221. margin-left: auto;
  222. text-align: right;
  223. display: flex;
  224. flex-direction: column;
  225. justify-content: space-between;
  226. align-items: flex-end;
  227. }
  228. .tui-right-dot {
  229. height: 76rpx !important;
  230. padding-bottom: 10rpx !important;
  231. }
  232. .tui-msg-time {
  233. width: 100%;
  234. font-size: 24rpx;
  235. line-height: 24rpx;
  236. color: #9397a4;
  237. }
  238. .sub-title {
  239. font-size: 24rpx;
  240. color: #7a7a7a;
  241. padding-top: 18rpx;
  242. }
  243. .tui-selected-list {
  244. background-color: #fff;
  245. border-radius: 20rpx;
  246. overflow: hidden;
  247. transform: translateZ(0);
  248. }
  249. .tui-dropdown-scroll {
  250. height: 400rpx;
  251. }
  252. .tui-cell-class {
  253. display: flex;
  254. align-items: center;
  255. padding: 26rpx 30rpx !important;
  256. }
  257. .tui-ml-20 {
  258. margin-left: 20rpx;
  259. }
  260. .tui-share {
  261. background: #e8e8e8;
  262. position: relative;
  263. padding-bottom: env(safe-area-inset-bottom);
  264. }
  265. .tui-share-title {
  266. font-size: 26rpx;
  267. color: #7E7E7E;
  268. text-align: center;
  269. line-height: 26rpx;
  270. padding: 20rpx 0 50rpx 0;
  271. }
  272. .tui-share-top,
  273. .tui-share-bottom {
  274. min-width: 101%;
  275. padding: 0 20rpx 0 30rpx;
  276. white-space: nowrap;
  277. }
  278. .tui-mt {
  279. margin-top: 30rpx;
  280. padding-bottom: 150rpx;
  281. }
  282. .tui-share-item {
  283. width: 126rpx;
  284. display: inline-block;
  285. margin-right: 24rpx;
  286. text-align: center;
  287. }
  288. .tui-item-last {
  289. margin: 0;
  290. }
  291. .tui-empty {
  292. display: inline-block;
  293. width: 30rpx;
  294. visibility: hidden;
  295. }
  296. .tui-share-icon {
  297. display: flex;
  298. align-items: center;
  299. justify-content: center;
  300. background: #fafafa;
  301. height: 126rpx;
  302. width: 126rpx;
  303. border-radius: 32rpx;
  304. }
  305. .tui-share-text {
  306. font-size: 24rpx;
  307. color: #7E7E7E;
  308. line-height: 24rpx;
  309. padding: 20rpx 0;
  310. white-space: nowrap;
  311. }
  312. .tui-btn-cancle {
  313. width: 100%;
  314. height: 100rpx;
  315. position: absolute;
  316. left: 0;
  317. bottom: 0;
  318. background: #f6f6f6;
  319. font-size: 36rpx;
  320. color: #3e3e3e;
  321. display: flex;
  322. align-items: center;
  323. justify-content: center;
  324. padding-bottom: env(safe-area-inset-bottom);
  325. }
  326. .tui-hover {
  327. background: rgba(0, 0, 0, 0.2)
  328. }
  329. .tui-box-upload {
  330. box-sizing: border-box;
  331. }
  332. .tui-modal-input {
  333. width: 100%;
  334. border-bottom: 1rpx solid #e6e6e6;
  335. padding-bottom: 20rpx;
  336. font-size: 32rpx;
  337. }
  338. </style>