1.API接口代码:tp\app\api\controller\Api.php

  1. <?php
  2. namespace app\api\controller;
  3. use think\facade\Db;
  4. use think\facade\Request;
  5. class Api{
  6. // Access to XMLHttpRequest at 'http://www.tp.com/index.php/api/Api/index'
  7. // from origin 'http://localhost:8080' has been blocked by CORS policy: No
  8. // 'Access-Control-Allow-Origin' header is present on the requested resource.
  9. // 错误信息:是因为前后端分离导致的。前后端 前端和后端的域名不是一个。不是一个,就会出现这种错误。
  10. // 跨域名访问的安全错误提示
  11. public function __construct(){
  12. // 使用php的header函数,设置为*,全部能访问
  13. header("Access-Control-Allow-Origin:*");
  14. }
  15. public function index(){
  16. // 如何写一个 前端数据接口呢?app、小程序、vue
  17. // 接口:让2个以上的项目进行数据联通,数据交互
  18. // 多个语言 必须有统一的格式, 最后返回值,必须多种语言都能使用
  19. // 接口的统一数据格式是 json
  20. // php有json的函数
  21. // json_encode 把php的数据加密成json格式
  22. // json_decode 把json格式转为 php数据格式
  23. // $arr = [
  24. // "ouyangke" => "欧阳克",
  25. // "miejue" => "灭绝师太",
  26. // "php" => [
  27. // "ouyangke",
  28. // "miejue"
  29. // ],
  30. // "tianpeng" => "朱天蓬"
  31. // ];
  32. // json格式,是文本,我们就可以echo
  33. // {"ouyangke":"\u6b27\u9633\u514b","miejue":"\u706d\u7edd\u5e08\u592a","tianpeng":"\u6731\u5929\u84ec"}
  34. // echo json_encode($arr);
  35. // 1、接口 必须用json返回数据
  36. // 2、用数组 转为json数据
  37. $ad = Db::table('oyk_adver')->where('status',1)->order('sort DESC')->select()->toArray();
  38. $lists = Db::table('oyk_shop_lists')->where('status',1)->order('add_time DESC')->limit(6)->select()->toArray();
  39. // & 取之前的地址
  40. foreach($lists as &$v){
  41. $img = explode(';',$v['img']);
  42. $v['img_s'] = $img[0];
  43. }
  44. // 3、接口只能一次性返回数据,不能多次
  45. // echo json_encode($ad);
  46. // echo json_encode($lists);
  47. $arr = [
  48. 'ad' => $ad,
  49. 'lists' => $lists
  50. ];
  51. echo json_encode($arr);
  52. }
  53. public function goods_index(){
  54. //1.第一种:父子层级获取数据 (更快更好)
  55. // echo '第一种方法开始时间:' . time() . '<br />';
  56. $cat = Db::table('oyk_shop_cat')->where('status',1)->order('pid,sort DESC')->select()->toArray();
  57. // print_r($cat);
  58. $tmp =[];
  59. foreach($cat as $v){
  60. // pid == 0 表示是一级菜单
  61. if($v['pid'] == 0){
  62. //把一级的id,作为下标
  63. $tmp[$v['cid']] = $v;
  64. }else {
  65. //把多个二级放入一级菜单下面
  66. $tmp[$v['pid']]['son'][] = $v;
  67. }
  68. }
  69. // print_r($tmp);
  70. // echo json_encode($tmp);
  71. $arr = [
  72. 'code'=>0,
  73. 'msg'=>'成功',
  74. // 'data'=>$tmp,
  75. // 第二种显示方式
  76. 'data'=>array_merge($tmp),
  77. ];
  78. echo json_encode($arr);
  79. //把二级菜单放到一级菜单下面
  80. // foreach($cat as $v){
  81. // if($v['pid'] != 0){
  82. // //把一个二级放入一级菜单下面
  83. // // $tmp[$v['pid']]['son'] = $v;
  84. // //把多个二级放入一级菜单下面
  85. // $tmp[$v['pid']]['son'][] = $v;
  86. // }
  87. // }
  88. // print_r($tmp);
  89. // echo '第一种方法结束时间:' . time() . '<br />';
  90. // 2.第二种方法
  91. // echo '第二种方法开始时间:' . time() . '<br />';
  92. // $cat = Db::table('oyk_shop_cat')->where('status',1)->where('pid',0)->select()->toArray();
  93. // // print_r($cat);
  94. // foreach($cat as &$v){
  95. // $v['son'] = Db::table('oyk_shop_cat')->where('status',1)->where('pid',$v['cid'])->select()->toArray();
  96. // }
  97. // print_r($cat);
  98. // echo '第二种方法结束时间:' . time() . '<br />';
  99. }
  100. // 列表页
  101. public function goods_lists(){
  102. // $id = input('post.id');
  103. $id = input('post.id');
  104. if(empty($id)){
  105. echo json_encode([
  106. 'code' => 1,
  107. 'msg' => '未找到列表',
  108. ]);
  109. exit;
  110. }
  111. $page = input('post.p',1);
  112. $count = Db::table('oyk_shop_lists')->where('status',1)->where('cid',$id)->count();
  113. // print_r((int)($count/5)+1);
  114. // ceil 向上取整
  115. // print_r(ceil($count/5));
  116. $lists = Db::table('oyk_shop_lists')->where('status',1)->page(1,5)->where('cid',$id)->select()->toArray();
  117. // 图集处理获取第一张
  118. foreach($lists as &$v){
  119. $img = explode(';',$v['img']);
  120. $v['img_s'] = $img[0];
  121. }
  122. $arr = [
  123. 'code' => 0,
  124. 'msg' =>'成功',
  125. 'data' => [
  126. 'lists' => $lists,
  127. 'num' => ceil($count/5),
  128. ],
  129. ];
  130. echo json_encode($arr);
  131. }
  132. //详情页
  133. public function goods_details(){
  134. $id = input('post.id');
  135. if(empty($id)){
  136. echo json_encode([
  137. 'code' =>1,
  138. 'msg' =>'未找到商品',
  139. ]);
  140. exit;
  141. }
  142. $find = Db::table('oyk_shop_lists')->where('id',$id)->find();
  143. // print_r($find);
  144. if(!empty($find)){
  145. $find['img_s'] = explode(';',$find['img']);
  146. $find['info_s'] = explode(';',$find['info']);
  147. }
  148. echo json_encode([
  149. 'code' => 0,
  150. 'msg' => '成功',
  151. 'data' => $find,
  152. ]);
  153. }
  154. }

2.Js获取数据代码:vue\src\network\index.js

  1. import { request } from "./request.js";
  2. export function Index() {
  3. return request({
  4. method: "POST",
  5. url: "Api/index",
  6. });
  7. }
  8. export function GoodsIndex() {
  9. return request({
  10. method: "POST",
  11. url: "Api/goods_index",
  12. });
  13. }
  14. export function GoodsLists(data = {}) {
  15. return request({
  16. method: "POST",
  17. url: "Api/goods_lists",
  18. // 通过data 向Api接口传值
  19. data,
  20. });
  21. }
  22. export function GoodsDetails(data = {}) {
  23. return request({
  24. method: "POST",
  25. url: "Api/goods_details",
  26. // 通过data 向Api接口传值
  27. data,
  28. });
  29. }

3.Index.vue品牌列表渲染代码:vue\src\views\Goods\Index.vue

  1. <template>
  2. <div class="fui-fullHigh-group">
  3. <div class="fui-fullHigh-item menu">
  4. <div
  5. class="nav"
  6. :class="on == index ? 'on' : ''"
  7. @click="edit_cat(index)"
  8. v-for="(item, index, key) in cat"
  9. :key="key"
  10. >
  11. {{ item.name }}
  12. </div>
  13. </div>
  14. <div class="fui-fullHigh-item container">
  15. <!-- 第一种遍历方式 :两次循环
  16. <div
  17. class="fui-icon-group"
  18. v-for="(item, index, key) in cat"
  19. :key="key"
  20. >
  21. <div v-if="on == index">
  22. <router-link to="/goods_lists" v-for="(items, indexs, keys) in item.son" :key="keys">
  23. <div class="fui-icon-col">
  24. <div class="icon">
  25. <img class="img" :src="items.pic" />
  26. </div>
  27. <div class="text">{{ items.name }}</div>
  28. </div>
  29. </router-link>
  30. </div>
  31. </div> -->
  32. <!-- 第二种遍历方式 -->
  33. <div class="fui-icon-group">
  34. <router-link
  35. :to="'/goods_lists?id=' + items.cid"
  36. v-for="(items, indexs, keys) in cat_son"
  37. :key="keys"
  38. >
  39. <div class="fui-icon-col">
  40. <div class="icon">
  41. <img class="img" :src="items.pic" />
  42. </div>
  43. <div class="text">{{ items.name }}</div>
  44. </div>
  45. </router-link>
  46. </div>
  47. </div>
  48. </div>
  49. </template>
  50. <script>
  51. import { reactive, toRefs } from "vue";
  52. import { GoodsIndex } from "../../network/index.js";
  53. export default {
  54. setup() {
  55. const data = reactive({
  56. // on: 1,
  57. // 第二种方式
  58. on: 0,
  59. cat: [],
  60. cat_son: [],
  61. });
  62. //切换左侧一级分类
  63. const edit_cat = (e) => {
  64. data.on = e;
  65. console.log(e);
  66. data.cat_son = data.cat[e].son;
  67. };
  68. // 获取接口数据
  69. GoodsIndex().then((e) => {
  70. console.log(e);
  71. if (e.code != 0) {
  72. }
  73. data.cat = e.data;
  74. // 第二种方式
  75. console.log(e.data[0]);
  76. data.cat_son = e.data[0].son;
  77. });
  78. return {
  79. title: "分类",
  80. ...toRefs(data),
  81. edit_cat,
  82. };
  83. },
  84. };
  85. </script>
  86. <style scoped>
  87. .fui-fullHigh-group {
  88. position: absolute;
  89. top: 0;
  90. bottom: 0;
  91. width: 100%;
  92. display: flex;
  93. }
  94. /* 左侧 */
  95. .fui-fullHigh-item {
  96. height: inherit;
  97. width: 100%;
  98. background: #fff;
  99. overflow-y: auto;
  100. }
  101. .fui-fullHigh-item.menu {
  102. width: 5.25rem;
  103. background: #f8f8f8;
  104. }
  105. .fui-fullHigh-item.menu .nav {
  106. font-size: 28rpx;
  107. text-align: center;
  108. color: #000;
  109. padding: 0.2rem 0;
  110. height: 2.5rem;
  111. text-overflow: ellipsis;
  112. white-space: nowrap;
  113. overflow: hidden;
  114. position: relative;
  115. display: flex;
  116. justify-content: center;
  117. align-items: Center;
  118. }
  119. .fui-fullHigh-item.menu .on {
  120. background: #fff;
  121. position: relative;
  122. color: #ff5555;
  123. }
  124. /* 右侧 */
  125. .fui-fullHigh-item.container {
  126. position: relative;
  127. padding: 0.8rem;
  128. flex: 1;
  129. }
  130. .fui-icon-group {
  131. position: relative;
  132. overflow: hidden;
  133. background: #fff;
  134. display: flex;
  135. flex-wrap: wrap;
  136. }
  137. .fui-icon-group .fui-icon-col {
  138. height: auto;
  139. position: relative;
  140. padding: 0.5rem 0;
  141. text-align: center;
  142. transition: background-color 300ms;
  143. -webkit-transition: background-color 300ms;
  144. float: left;
  145. border: none !important;
  146. }
  147. .fui-icon-group .fui-icon-col {
  148. float: left;
  149. margin-right: 17px;
  150. padding-top: 10px;
  151. }
  152. .fui-icon-group .fui-icon-col .icon {
  153. height: 115px;
  154. width: 100%;
  155. margin: auto;
  156. text-align: center;
  157. line-height: 2.2rem;
  158. }
  159. .icon {
  160. font-family: "icon" !important;
  161. font-size: 16px;
  162. font-style: normal;
  163. -webkit-font-smoothing: antialiased;
  164. -moz-osx-font-smoothing: grayscale;
  165. }
  166. .img {
  167. width: 115px;
  168. height: 100%;
  169. }
  170. .fui-icon-group .fui-icon-col .text {
  171. font-size: 24px;
  172. text-align: center;
  173. overflow: hidden;
  174. text-overflow: ellipsis;
  175. white-space: nowrap;
  176. padding: 0.2rem;
  177. color: #000;
  178. }
  179. .fui-icon-group .fui-icon-col .text {
  180. font-size: 0.55rem;
  181. line-height: 1.05rem;
  182. padding-top: 0.5rem;
  183. }
  184. </style>

4.Lists.vue产品列表渲染代码:vue\src\views\Goods\Lists.vue

  1. <template>
  2. <Header :title="title"></Header>
  3. <div style="background: #f3f3f3">
  4. <!-- 商品列表 -->
  5. <div class="fui-content">
  6. <div class="fui-content-inner">
  7. <div class="fui-goods-group block">
  8. <!-- 单个商品 -->
  9. <div
  10. class="fui-goods-item"
  11. @click="go_url(item.id)"
  12. v-for="(item, index, key) in lists"
  13. :key="key"
  14. >
  15. <img class="image" :src="item.img_s" />
  16. <div class="detail">
  17. <div class="name">{{ item.title }}</div>
  18. <div
  19. style="
  20. line-height: 0.7rem;
  21. height: 0.7rem;
  22. color: #b2b2b2;
  23. font-size: 0.6rem;
  24. margin-top: 0.2rem;
  25. text-decoration: line-through;
  26. "
  27. ></div>
  28. <div class="price">
  29. <span class="text">¥{{ item.price }}</span>
  30. <span class="buy">销量:{{ item.num }}</span>
  31. </div>
  32. </div>
  33. </div>
  34. <!-- 单个商品 -->
  35. </div>
  36. </div>
  37. <button v-if="is_b" class="ant-btn ant-btn-primary" style="width: 100%" @click="xiala()">
  38. 加载更多
  39. </button>
  40. </div>
  41. </div>
  42. </template>
  43. <script>
  44. import Header from "../../components/Header.vue";
  45. import { reactive, toRefs } from "vue";
  46. import { useRoute, useRouter } from "vue-router";
  47. import { GoodsLists } from "../../network/index.js";
  48. export default {
  49. components: {
  50. Header,
  51. },
  52. setup() {
  53. const route = useRoute();
  54. const router = useRouter();
  55. const go_url = (id) => {
  56. router.push("/goods_details?id=" + id);
  57. };
  58. // 获取数据
  59. // console.log(route.query.id);
  60. const data = reactive({
  61. lists: [],
  62. page: 1,
  63. num: 1,
  64. is_b: true,
  65. });
  66. GoodsLists({ id: route.query.id, p: data.page }).then((e) => {
  67. // console.log(e);
  68. data.lists = e.data.lists;
  69. data.num = e.data.num;
  70. // 取掉加载更多
  71. if (data.page >= data.num) {
  72. data.is_b = false;
  73. }
  74. });
  75. // 加载更多
  76. const xiala = () => {
  77. data.page = data.page + 1;
  78. if (data.page <= data.num) {
  79. GoodsLists({ id: route.query.id }).then((e) => {
  80. // console.log(e);
  81. // data.lists = e.data;
  82. //合并显示页
  83. data.lists = data.lists.concat(e.data.lists);
  84. // 取掉加载更多
  85. if (data.page >= data.num) {
  86. data.is_b = false;
  87. }
  88. });
  89. }
  90. };
  91. return {
  92. go_url,
  93. title: "列表",
  94. ...toRefs(data),
  95. xiala,
  96. };
  97. },
  98. };
  99. </script>
  100. <style scoped>
  101. /* 顶部筛选 */
  102. .sort {
  103. position: relative;
  104. width: 100%;
  105. padding: 0.4rem 0;
  106. background: #fff;
  107. -webkit-box-align: center;
  108. border-bottom: 1px solid #e7e7e7;
  109. }
  110. .sort .item {
  111. position: relative;
  112. width: 1%;
  113. display: table-cell;
  114. text-align: center;
  115. font-size: 0.7rem;
  116. border-left: 1px solid #e7e7e7;
  117. color: #666;
  118. }
  119. .sort .item:first-child {
  120. border: 0;
  121. }
  122. .on .text {
  123. color: #fd5454;
  124. }
  125. /* 商品 */
  126. .fui-content {
  127. position: absolute;
  128. right: 0;
  129. left: 0;
  130. overflow: auto;
  131. -webkit-overflow-scrolling: touch;
  132. }
  133. .fui-content-inner {
  134. box-sizing: border-box;
  135. border-top: 1px solid transparent;
  136. margin-top: -1px;
  137. }
  138. .fui-goods-group {
  139. height: auto;
  140. overflow: hidden;
  141. background: #f9f9f9;
  142. }
  143. .fui-goods-group.block {
  144. padding: 0.2rem;
  145. }
  146. /* 单个商品 */
  147. .fui-goods-group .fui-goods-item {
  148. width: 50%;
  149. float: left;
  150. border-bottom: 0;
  151. background: none;
  152. padding: 0.25rem;
  153. display: block;
  154. }
  155. .fui-goods-item {
  156. position: relative;
  157. height: auto;
  158. padding: 0.8rem;
  159. border-bottom: 1px solid #e7e7e7;
  160. background: #fff;
  161. overflow: hidden;
  162. display: flex;
  163. }
  164. .image {
  165. width: 100%;
  166. overflow: hidden;
  167. margin: 0;
  168. background-position: center;
  169. background-repeat: no-repeat;
  170. background-size: cover;
  171. position: relative;
  172. float: none;
  173. }
  174. /* 商品名 */
  175. .detail {
  176. -webkit-box-flex: 1;
  177. -webkit-flex: 1;
  178. -ms-flex: 1;
  179. flex: 1;
  180. background: #fff;
  181. padding-left: 0.5rem;
  182. padding: 0.5rem;
  183. }
  184. .name {
  185. height: 1.7rem;
  186. overflow: hidden;
  187. text-overflow: ellipsis;
  188. display: -webkit-box;
  189. -webkit-line-clamp: 2;
  190. -webkit-box-orient: vertical;
  191. font-size: 0.65rem;
  192. line-height: 0.9rem;
  193. margin-top: 0;
  194. color: #262626;
  195. }
  196. .price {
  197. position: relative;
  198. display: flex;
  199. align-items: center;
  200. font-size: 0.7rem;
  201. margin-top: 0;
  202. }
  203. .price .text {
  204. flex: 1;
  205. color: #ff5555;
  206. font-size: 0.8rem;
  207. }
  208. .buy {
  209. text-align: center;
  210. color: #666;
  211. font-size: 0.6rem;
  212. }
  213. .ant-btn {
  214. line-height: 1.5715;
  215. position: relative;
  216. display: inline-block;
  217. font-weight: 400;
  218. white-space: nowrap;
  219. text-align: center;
  220. background-image: none;
  221. border: 1px solid transparent;
  222. box-shadow: 0 2px 0 rgb(0 0 0 / 2%);
  223. cursor: pointer;
  224. transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
  225. -webkit-user-select: none;
  226. -moz-user-select: none;
  227. -ms-user-select: none;
  228. user-select: none;
  229. touch-action: manipulation;
  230. height: 32px;
  231. padding: 4px 15px;
  232. font-size: 14px;
  233. border-radius: 2px;
  234. color: rgba(0, 0, 0, 0.85);
  235. background: #fff;
  236. border-color: #d9d9d9;
  237. }
  238. .ant-btn-primary {
  239. color: #fff;
  240. background: #1890ff;
  241. border-color: #1890ff;
  242. text-shadow: 0 -1px 0 rgb(0 0 0 / 12%);
  243. box-shadow: 0 2px 0 rgb(0 0 0 / 5%);
  244. }
  245. </style>

4.Details.vue详情页渲染代码:vue\src\views\Goods\Details.vue

  1. <template>
  2. <Header :title="title" :is_img="1"></Header>
  3. <div class="rele-wrap">
  4. <div class="has-bottom">
  5. <swiper
  6. :modules="modules"
  7. :loop="true"
  8. :pagination="swiper_options.pagination"
  9. :autoplay="swiper_options.autoplay"
  10. class="swiper"
  11. >
  12. <swiper-slide v-for="(item, index, key) in shop.img_s" :key="key">
  13. <img :src="item" alt="" class="active" />
  14. </swiper-slide>
  15. </swiper>
  16. <div class="idle-panel">
  17. <div class="p1">
  18. {{ shop.title }}
  19. </div>
  20. <div class="p2">
  21. <text class="span">{{ shop.price }}元</text>
  22. </div>
  23. </div>
  24. <div class="sale-panel">
  25. <div class="tit">商品详情</div>
  26. <div class="all open">
  27. <img :src="item" v-for="(item, index, key) in shop.info_s" :key="key" />
  28. </div>
  29. </div>
  30. </div>
  31. <div class="fui-navbar bottom-buttons">
  32. <button class="btn btn_left">加入购物车</button>
  33. <button class="btn btn_right" @click="go_url()">立即购买</button>
  34. </div>
  35. </div>
  36. </template>
  37. <script>
  38. import { reactive, toRefs } from "vue";
  39. import { useRoute, useRouter } from "vue-router";
  40. import Header from "../../components/Header.vue";
  41. import { GoodsDetails } from "../../network/index.js";
  42. import SwiperCore, { Pagination, Autoplay } from "swiper";
  43. import { Swiper, SwiperSlide } from "swiper/vue/swiper-vue.js";
  44. import "swiper/swiper.min.css";
  45. import "swiper/modules/pagination/pagination.min.css";
  46. SwiperCore.use([Autoplay, Pagination]);
  47. export default {
  48. components: {
  49. Swiper,
  50. SwiperSlide,
  51. Header,
  52. },
  53. setup() {
  54. const swiper_options = new reactive({
  55. pagination: {
  56. clickable: true,
  57. },
  58. autoplay: {
  59. disableOnInteraction: false, // 鼠标滑动后继续自动播放
  60. delay: 2000, //2秒切换一次
  61. pauseOnMouseEnter: true,
  62. },
  63. speed: 500, //切换过渡速度
  64. });
  65. //获取数据
  66. const route = useRoute();
  67. const router = useRouter();
  68. const go_url = () => {
  69. router.push("/cart_index");
  70. };
  71. const data = reactive({
  72. shop: [],
  73. });
  74. GoodsDetails({ id: route.query.id }).then((e) => {
  75. // console.log(e);
  76. data.shop = e.data;
  77. });
  78. return {
  79. swiper_options,
  80. go_url,
  81. title: "详情",
  82. ...toRefs(data),
  83. };
  84. },
  85. };
  86. </script>
  87. <style scoped>
  88. .swiper {
  89. margin: 0 0.1rem;
  90. }
  91. .swiper .swiper-wrapper {
  92. /* 图片容器必须要有高度,否则下面图片不能正常显示 */
  93. height: 1.5rem;
  94. border-radius: 0.1rem;
  95. }
  96. .swiper .swiper-wrapper img {
  97. height: 100%;
  98. width: 100%;
  99. border-radius: 0.1rem;
  100. }
  101. .swiper {
  102. --swiper-pagination-color: #fff;
  103. --swiper-navigation-color: black;
  104. }
  105. .rele-wrap {
  106. background: #f5f5f5;
  107. }
  108. .has-bottom {
  109. padding-bottom: 55px !important;
  110. }
  111. .banner {
  112. position: relative;
  113. background: #fff;
  114. overflow: hidden;
  115. margin: 0;
  116. visibility: visible;
  117. height: 315px;
  118. }
  119. .banner .swipe-wrap {
  120. overflow: hidden;
  121. position: relative;
  122. }
  123. .vi_img {
  124. float: left;
  125. width: 100%;
  126. height: 100%;
  127. position: relative;
  128. }
  129. .idle-panel {
  130. padding: 1px 12px 12px 12px;
  131. background: #fff;
  132. padding-left: 12px;
  133. margin-top: 0;
  134. }
  135. .p1 {
  136. font-weight: normal;
  137. line-height: 22px;
  138. padding-bottom: 0;
  139. color: #222;
  140. padding: 15px 10px 8px 0;
  141. font-size: 100%;
  142. position: relative;
  143. }
  144. .p2 {
  145. height: 20px;
  146. padding-top: 2px;
  147. padding-right: 10px;
  148. color: #222;
  149. }
  150. .p2 .span {
  151. font-size: 16px;
  152. line-height: 20px;
  153. color: #ff3600;
  154. float: right;
  155. }
  156. .sale-panel {
  157. margin-top: 10px;
  158. background: #fff;
  159. padding: 1px 12px 12px 12px;
  160. }
  161. .tit {
  162. letter-spacing: 1px;
  163. color: #666;
  164. height: 14px;
  165. line-height: 14px;
  166. font-size: 14px;
  167. padding-left: 12px;
  168. position: relative;
  169. margin: 15px 0 0;
  170. }
  171. .tit::after {
  172. position: absolute;
  173. content: "";
  174. width: 2px;
  175. height: 100%;
  176. background: #56b244;
  177. left: 5px;
  178. top: 0;
  179. }
  180. .open {
  181. height: auto;
  182. text-overflow: inherit;
  183. -webkit-line-clamp: 100000;
  184. display: -webkit-box;
  185. -webkit-box-orient: vertical;
  186. overflow: hidden;
  187. line-height: 22px;
  188. margin-top: 13px;
  189. font-size: 14px;
  190. color: #333;
  191. position: relative;
  192. }
  193. .open img {
  194. width: 100%;
  195. }
  196. /* 底部按钮 */
  197. .fui-navbar {
  198. position: fixed;
  199. width: 100%;
  200. bottom: 0;
  201. z-index: 2;
  202. }
  203. .btn {
  204. border: none;
  205. font-size: 0.7rem;
  206. color: #fff;
  207. border-radius: 0;
  208. width: 50%;
  209. height: 49px;
  210. }
  211. .btn_left {
  212. background: #fe9402;
  213. float: left;
  214. }
  215. .btn_right {
  216. float: right;
  217. background: #fd5555;
  218. }
  219. </style>

参数传递需要注意中间件配置:tp\app\middleware.php

  1. <?php
  2. // 全局中间件定义文件
  3. return [
  4. // 全局请求缓存
  5. // \think\middleware\CheckRequestCache::class,
  6. // 多语言加载
  7. // \think\middleware\LoadLangPack::class,
  8. // Session初始化
  9. // \think\middleware\SessionInit::class
  10. //允许跨域传值
  11. \think\middleware\AllowCrossDomain::class,
  12. ];

更多相关文章

  1. android使用notifyDataSetChanged()方法,adapter的数据更新了,但是
  2. Android中intent如何传递自定义数据类型
  3. 使用Android中的Parcelable序列化对象
  4. Android(安卓)之 adapter.notifyDataSetChanged() 无响应
  5. Android(安卓)技巧:命令行运行 sqlite3
  6. Android-常用UI控件(Spinner/AutoCompleteTextView)
  7. android 大文件分割上传(分块上传)
  8. Android系统源码数据库(mmssms.db)
  9. Android的几种数据存储方式

随机推荐

  1. XMLTextReader和XmlDocument读取XML文件
  2. XML和XSLT结合使网站设计浑然一体
  3. 对于任意的XML的遍历
  4. 如何使用XML实现多渠道接入网站的构架
  5. 灵活调用xsl来解析xml文档(js异步)
  6. FireFox对XML的处理兼容IE的节点处理方法
  7. 读写xml所有节点个人小结 和 读取xml节点
  8. 基于关系型数据库引擎的"XML"索引技术
  9. XML 增、删、改和查示例
  10. 效率最高的xml解析方式