information.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <template>
  2. <view>
  3. <view class="alter_info">请选择您药店/诊所所在城市,选择后不可更改,请谨慎选择</view>
  4. <view class="form" >
  5. <!-- 地区代表表单 -->
  6. <!-- 新增列表 -->
  7. <view class="list-container">
  8. <view class="list-item" v-for="(item, index) in articleList" :key="index">
  9. <image :src="item.thumbnail" class="list-thumbnail" mode="aspectFit"></image>
  10. <view class="list-content">
  11. <view class="list-title">{{ item.title }}</view>
  12. <view class="list-meta">
  13. <text>阅读数: {{ item.readCount }}</text>
  14. <text>点赞数: {{ item.likeCount }}</text>
  15. <text>时间: {{ item.time }}</text>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. import {getProvinces,getMyCity} from "../../utils/city";
  25. export default {
  26. data() {
  27. return {
  28. requestParam:{
  29. province:"",
  30. city:"",
  31. },
  32. cityArray: [[],[]],
  33. cityValue: [0,0],
  34. // 新增文章列表数据
  35. articleList: [
  36. {
  37. thumbnail: 'https://example.com/thumbnail1.jpg',
  38. title: '文章标题1',
  39. readCount: 100,
  40. likeCount: 20,
  41. time: '2025-02-21'
  42. },
  43. {
  44. thumbnail: 'https://example.com/thumbnail2.jpg',
  45. title: '文章标题2',
  46. readCount: 200,
  47. likeCount: 30,
  48. time: '2025-02-20'
  49. }
  50. ]
  51. }
  52. },
  53. onLoad(){
  54. // 替换对应的数据
  55. this.cityArray.splice(0,1,getProvinces());
  56. this.cityArray.splice(1,1,getMyCity(this.cityValue[0]));
  57. // 默认地址
  58. // this.requestParam.province = this.cityArray[0][this.cityValue[0]]
  59. // this.requestParam.city = this.cityArray[1][this.cityValue[1]];
  60. },
  61. onShow(){
  62. // 登录信息
  63. if( !this.$checkAccess.alterLogin() ) return ;
  64. // 授权成功以后,调用绑定
  65. this.$http.request('api/custom/get_city',{},'get').then((re)=>{
  66. // 成功的话
  67. if( re.code != 'success' ){
  68. // 跳转
  69. uni.showToast({title: re.msg,icon:"none"});
  70. return;
  71. }
  72. this.requestParam.province = re.data.province;
  73. this.requestParam.city = re.data.city;
  74. });
  75. },
  76. methods: {
  77. toApply(){
  78. // 登录信息
  79. if( !this.$checkAccess.alterLogin() ) return ;
  80. // 提示信息
  81. if( !this.requestParam.province ){
  82. uni.showToast({
  83. title:"请选择所在城市",
  84. icon:"none"
  85. })
  86. return ;
  87. }
  88. // 提示信息
  89. if( !this.requestParam.city ){
  90. uni.showToast({
  91. title:"请选择所在城市",
  92. icon:"none"
  93. })
  94. return ;
  95. }
  96. // 请求状态
  97. uni.showLoading({mask:true});
  98. // 授权成功以后,调用绑定
  99. this.$http.request('api/custom/set_city',this.requestParam,'post').then((re)=>{
  100. // 关闭
  101. uni.hideLoading();
  102. // 成功的话
  103. if( re.code != 'success' ){
  104. // 跳转
  105. uni.showToast({title: re.msg,icon:"none"});
  106. return;
  107. }
  108. uni.switchTab({url: '/pages/user/index'});
  109. });
  110. },
  111. cityChange(e){
  112. // 替换三个选项
  113. this.cityValue.splice(e.detail.column,1,e.detail.value);
  114. // 下一级设置为0
  115. if( e.detail.column == 0 ){
  116. this.cityValue.splice(1,1,0);
  117. this.cityValue.splice(2,1,0);
  118. }
  119. if( e.detail.column == 1 ){
  120. this.cityValue.splice(2,1,0);
  121. }
  122. // 替换对应的数据
  123. this.cityArray.splice(0,1,getProvinces());
  124. this.cityArray.splice(1,1,getMyCity(this.cityValue[0]));
  125. },
  126. cityFinish(e){
  127. this.requestParam.province = this.cityArray[0][this.cityValue[0]];
  128. this.requestParam.city = this.cityArray[1][this.cityValue[1]];
  129. },
  130. }
  131. }
  132. </script>
  133. <style lang="less">
  134. .alter_info{
  135. display: block;
  136. color: #E03519;
  137. font-size: 20rpx;
  138. overflow: hidden;
  139. margin: 20rpx auto;
  140. background: #FFFFFF;
  141. line-height: 40rpx;
  142. padding: 35rpx 35rpx;
  143. text-align: center;
  144. }
  145. .info_form{
  146. display: block;
  147. overflow: hidden;
  148. padding: 20rpx 0rpx;
  149. background: #FFFFFF;
  150. .form_group{
  151. display: block;
  152. overflow: hidden;
  153. line-height: 60rpx;
  154. padding: 20rpx 35rpx;
  155. .group_title{
  156. float: left;
  157. width: 160rpx;
  158. display: block;
  159. overflow: hidden;
  160. font-size: 30rpx;
  161. margin-right: 20rpx;
  162. }
  163. .group_box{
  164. width: 480rpx;
  165. float: left;
  166. display: block;
  167. .form_ctrl{
  168. height: 56rpx;
  169. font-size: 24rpx;
  170. padding: 0rpx 20rpx;
  171. line-height: 56rpx;;
  172. border: 2rpx solid #DDDDDD;
  173. .area_text{
  174. width: 446rpx;
  175. height: 56rpx;
  176. font-size: 20rpx;
  177. overflow: hidden;
  178. white-space: nowrap;
  179. line-height: 56rpx;
  180. text-overflow: ellipsis;
  181. }
  182. }
  183. .group_image{
  184. width: 200rpx;
  185. height: 200rpx;
  186. }
  187. .choose_image{
  188. display: block;
  189. width: 200rpx;
  190. height: 200rpx;
  191. font-size: 38rpx;
  192. text-align: center;
  193. line-height: 200rpx;
  194. border: 2rpx solid #DDDDDD;
  195. }
  196. }
  197. }
  198. .submit_btn{
  199. color: #FFFFFF;
  200. width: 220rpx;
  201. height: 80rpx;
  202. display: block;
  203. font-size: 30rpx;
  204. padding: 0rpx 0rpx;
  205. line-height: 80rpx;
  206. margin: 50rpx auto;
  207. background-color: forestgreen;
  208. }
  209. }
  210. </style>